jingfei195887 commented on PR #20820: URL: https://github.com/apache/nuttx/pull/20820#issuecomment-6311741600
Thanks @Swatantra-66 for adding `CONFIG_DISABLE_DIRECTORY_OPERATIONS` here, and @xiaoxiang781216 for the suggestion. In parallel we opened #20868, which adds the same option with a narrower scope. The differences, for comparison: | | this PR (#20820) | #20868 | |---|---|---| | Default | `n` | `DEFAULT_SMALL` (same as `DISABLE_PSEUDOFS_OPERATIONS`) | | Kernel side | `fs_dir.c` not built, `#ifdef`s in `fs_open.c` / `fs_fstat.c` | `fs_dir.c` not built; `dir_allocate()` / `dir_fstat()` become inline stubs in `fs/inode/inode.h` returning `-ENOSYS` / `-ENOTTY`, callers unchanged | | libc / headers | `libs/libc/dirent`, `lib_glob.c` and the `dirent.h` / `ftw.h` / `glob.h` prototypes are removed | unchanged: `opendir()` etc. still exist and fail at run time with `ENOSYS` | | Size | not measured here | `stm32f103-minimum:nsh` flash -996 bytes | | Files | 27, +576 -47 (together with `FS_DIRENT_LITE`) | 4, +34 -2 | One thing I noticed while comparing: with `CONFIG_DISABLE_DIRECTORY_OPERATIONS=y` on this PR (e402d7012f), `stm32f103-minimum:nsh` no longer links, because NSH still calls `opendir()`: ``` nsh_fscmds.c:(.text.cp_recursive+0xe): undefined reference to `opendir' nsh_fscmds.c:(.text.unlink_recursive+0x2a): undefined reference to `opendir' nsh_fsutils.c:(.text.nsh_foreach_direntry+0xe): undefined reference to `opendir' ``` That is why #20868 keeps the libc layer and only drops the kernel directory layer: existing applications keep building, and e.g. NSH `ls` reports `opendir failed: 38` instead of failing to link (checked on `qemu-armv7a:nsh`). `FS_DIRENT_LITE` is independent of this and does not overlap with #20868. Happy to coordinate on the option so the two PRs don't conflict, whichever way reviewers prefer. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
