Swatantra-66 commented on code in PR #20820:
URL: https://github.com/apache/nuttx/pull/20820#discussion_r4328960297


##########
include/nuttx/fs/fs.h:
##########
@@ -1934,7 +1930,16 @@ int nx_mkfifo(FAR const char *pathname, mode_t mode, 
size_t bufsize);
 int map_anonymous(FAR struct mm_map_entry_s *entry, bool kernel);
 #else
 #  define map_anonymous(entry, kernel) (-ENOSYS)
-#endif /* CONFIG_FS_ANONMAP */
+#endif
+
+#ifdef CONFIG_FS_DIRENT_LITE

Review Comment:
   Hi @xiaoxiang781216,
   
   The reason for introducing `CONFIG_FS_DIRENT_LITE` came from the discussion 
in #20414 regarding flash growth on constrained boards like 
`stm32f103-minimum:nsh`. On these boards, users still want an interactive shell 
(NSH) with basic `ls` working, but routing directories through the full file 
descriptor apparatus adds ~2.1 KB of overhead. `FS_DIRENT_LITE` was intended to 
keep directory listing functional for NSH without that descriptor overhead.
   
   However, your point is very well taken—for headless, deeply embedded, or 
minimal targets that only access device nodes directly by path, they don't need 
`opendir()` or `readdir()` at all.
   
   I will add `CONFIG_DISABLE_DIRECTORY_OPERATIONS` to this PR as well 
(following `CONFIG_DISABLE_MOUNTPOINT` and 
`CONFIG_DISABLE_PSEUDOFS_OPERATIONS`) so users can:
   1. Completely disable directory operations 
(`CONFIG_DISABLE_DIRECTORY_OPERATIONS=y`), stripping `fs_dir.c` and 
`libc/dirent/` entirely to save ~4–5 KB of flash, or
   2. Use `CONFIG_FS_DIRENT_LITE` when basic directory listing like NSH `ls` is 
still needed with a minimal footprint.
   



-- 
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]

Reply via email to