-
Notifications
You must be signed in to change notification settings - Fork 572
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
code refactoring #1298
Merged
Merged
code refactoring #1298
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
sunghan-chang
commented
Feb 26, 2018
- Some module which uses file operation APIs like open, read, write and so on make a dependancy with NFILE_DESCRIPTORS to prevent compilation and linking errors.
- TASH adds new config, TASH_SCRIPT to disable script functionality.
The cle is "EMACS-like Command Line Editor", not VI work-alike. This commit is come from Nuttx commit 6e46290.
The cle uses FILE type of argument but that type is valid when NFILE_STREAMS is bigger than 0. This commit makes a dependancy with NFILE_STREAMS to CLE. CC: cle.c cle.c: In function 'cle': cle.c:861:22: error: dereferencing pointer to incomplete type priv.infd = instream->fs_fd; ^ cle.c:862:24: error: dereferencing pointer to incomplete type priv.outfd = outstream->fs_fd; ^ make[2]: *** [cle.o] Error 1
The standard I/Os, stdin, stdout and stderr, use the sched_getstreams function but it is in "#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0" conditional. Some combination of config does not enable them so that it causes compilation errors as shown below: CC: vi.c In file included from vi.c:66:0: vi.c: In function 'vi_write': vi.c:513:13: error: invalid type argument of '->' (have 'int') fprintf(stderr, "ERROR: write to stdout failed: %d\n", errcode); ^ ... vi.c:3432:11: error: invalid type argument of '->' (have 'int') fprintf(stderr, "ERROR: Too many arguments\n"); ^ make[2]: *** [vi.o] Error 1 Because there is no way to use standard I/Os without those configs, this commit makes I/Os NULL under undefined those configs.
1. The ioctl has last argument with unsigned long type. But dm gives it as void *. This commit fixs below: CC: src/dm/arch/sidk_s5jt200/s5j_dm_connectivity.c src/dm/arch/sidk_s5jt200/s5j_dm_connectivity.c: In function 'dm_conn_get_address': src/dm/arch/sidk_s5jt200/s5j_dm_connectivity.c:203:29: error: passing argument 3 of 'ioctl' makes integer from pointer without a cast [-Werror] if (ioctl(fd, SIOCGIFCONF, (void *)&ifcfg) < 0) { ^ In file included from src/dm/arch/sidk_s5jt200/s5j_dm_connectivity.c:33:0: /home/sunghan/Work/TinyAra/TizenRT_forked/os/include/sys/ioctl.h:140:5: note: expected 'long unsigned int' but argument is of type 'void *' int ioctl(int fd, int req, unsigned long arg); ^ src/dm/arch/sidk_s5jt200/s5j_dm_connectivity.c: In function 'dm_conn_get_interface': src/dm/arch/sidk_s5jt200/s5j_dm_connectivity.c:246:29: error: passing argument 3 of 'ioctl' makes integer from pointer without a cast [-Werror] if (ioctl(fd, SIOCGIFCONF, (void *)&ifcfg) < 0) { ^ In file included from src/dm/arch/sidk_s5jt200/s5j_dm_connectivity.c:33:0: /home/sunghan/Work/TinyAra/TizenRT_forked/os/include/sys/ioctl.h:140:5: note: expected 'long unsigned int' but argument is of type 'void *' int ioctl(int fd, int req, unsigned long arg); ^ cc1: all warnings being treated as errors make[1]: *** [s5j_dm_connectivity.o] Error 1 2. That file uses slsi wifi APIs and there is no dependancy with s5j arch so that a conditional in Make.defs should be changed. This commit fixs below linking error on some config combination as well: /os/../build/output/libraries/libframework.a(s5j_dm_connectivity.o): In function `dm_cb_register_init': /framework/src/dm/arch/sidk_s5jt200/s5j_dm_connectivity.c:104: undefined reference to `WiFiRegisterLinkCallback'
…automount functionalities 1. ARTIK05X_AUTOMOUNT and SIDK_S5JT200_AUTOMOUNT use mtd functionality and mtd is in FILE_DESCRIPTORS conditional. So, they should have a dependancy with NFILE_DESCRIPTORS. This commit fixs below: /os/arch/arm/src/board/libboard.a(artik05x_tash.o): In function `artik05x_configure_partitions': /os/arch/arm/src/artik05x/src/artik05x_tash.c:132: undefined reference to `progmem_initialize' /os/arch/arm/src/artik05x/src/artik05x_tash.c:171: undefined reference to `ftl_initialize' /os/arch/arm/src/artik05x/src/artik05x_tash.c:200: undefined reference to `mtd_setpartitionname' /os/arch/arm/src/artik05x/src/artik05x_tash.c:162: undefined reference to `mtd_partition' /os/arch/arm/src/artik05x/src/artik05x_tash.c:178: undefined reference to `mtdconfig_register' /os/arch/arm/src/artik05x/src/artik05x_tash.c:186: undefined reference to `smart_initialize' 2. Some automount functionality is in board_app_initialize without any conditional. But that uses mount function and mount is controled by configuration. When mount is not enabled, automount functionality should not work. This commit covers them with AUTOMOUNT config and fixs below: /os/arch/arm/src/board/libboard.a(artik05x_tash.o): In function `board_app_initialize': /os/arch/arm/src/artik05x/src/artik05x_tash.c:331: undefined reference to `mount' 3. RTC driver uses file operation so that NFILE_DESCRIPTORS should be enabled. This commit makes a dependancy RTC with that and fix below: /os/arch/arm/src/artik05x/src/artik05x_tash.c:378: undefined reference to `rtc_initialize'
…TORS Vi uses file operation APIs like fopen, fread, stat and so on so that it should have dependancies with them. This commit fixs below linking errors: /os/../build/output/libraries/libapps.a(vi.o): In function `vi_insertfile': /apps/system/vi/vi.c:1113: undefined reference to `stat' /apps/system/vi/vi.c:1128: undefined reference to `fopen' /apps/system/vi/vi.c:1144: undefined reference to `fread' /apps/system/vi/vi.c:1155: undefined reference to `fclose' /os/../build/output/libraries/libapps.a(vi.o): In function `vi_main': /apps/system/vi/vi.c:3385: undefined reference to `fprintf' ... /os/../build/output/libraries/libapps.a(vi.o): In function `vi_main': /apps/system/vi/vi.c:3356: undefined reference to `fprintf'
Shell use file operation APIs like open, fopen and so on. This commit fixs below: /os/../build/output/libraries/libapps.a(tash_script.o): In function `tash_script': /apps/shell/tash_script.c:55: undefined reference to `fopen' /apps/shell/tash_script.c:62: undefined reference to `fgets' /apps/shell/tash_script.c:78: undefined reference to `fclose' /os/../build/output/libraries/libapps.a(tash_main.o): In function `tash_open_console': /apps/shell/tash_main.c:161: undefined reference to `open'
FS_CMDS use file operation APIs so that let's make a dependancy. This commit fixs below: /os/../build/output/libraries/libapps.a(fscmd.o): In function `tash_rmdir': /apps/system/utils/fscmd.c:1058: undefined reference to `rmdir' /os/../build/output/libraries/libapps.a(fscmd.o): In function `tash_rm': /apps/system/utils/fscmd.c:1031: undefined reference to `unlink' /os/../build/output/libraries/libapps.a(fscmd.o): In function `tash_umount': /apps/system/utils/fscmd.c:985: undefined reference to `umount' /os/../build/output/libraries/libapps.a(fscmd.o): In function `tash_mksmartfs': /apps/system/utils/fscmd.c:827: undefined reference to `mksmartfs' ...
Script functionality on TASH is rarely used so that supporting disable script functionality is better on footprint.
Code Rule Check OK. |
Poweroff application can be enabled when board supports poweroff functionality. This commit fixs below: /os/../build/output/libraries/libapps.a(poweroff.o): In function `poweroff_main': /apps/system/poweroff/poweroff.c:68: undefined reference to `board_power_off'
Code Rule Check OK. |
Taejun-Kwon
approved these changes
Feb 27, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.