Repository navigation
fs/vfs: make FIOC_FILEPATH and F_GETPATH optional for DEFAULT_SMALL - #21862
Merged
michallenc merged 1 commit intoNov 17, 2026
Merged
Conversation
Swatantra-66
requested review from
Donny9,
jerpelea,
pkarashchenko,
pussuw and
xiaoxiang781216
as code owners
November 14, 2026 19:46
|
1 task done
Swatantra-66
force-pushed
the
feature/vfs-optional-ioctl-filepath
branch
from
November 15, 2026 11:53
5b2c808 to
39ef6d7
Compare
4 of 5 tasks
The FIOC_FILEPATH ioctl and F_GETPATH fcntl command resolve the path of an open file descriptor from its inode tree. In small memory-constrained configurations (DEFAULT_SMALL=y), unconditionally handling this command forces the inclusion of inode_getpath() and path reconstruction logic, adding unnecessary Flash overhead on targets that do not require path resolution from file descriptors. This patch introduces CONFIG_FS_IOCTL_FILEPATH (default !DEFAULT_SMALL): 1. In fs/Kconfig, defines CONFIG_FS_IOCTL_FILEPATH. 2. In fs/vfs/Kconfig, selects FS_IOCTL_FILEPATH under CONFIG_FS_NOTIFY. 3. In fs/vfs/fs_ioctl.c, rejects FIOC_FILEPATH with -ENOTTY prior to driver dispatch when disabled, and gates inode_getpath() fallback. 4. In fs/vfs/fs_fcntl.c, keeps F_GETPATH case and returns -ENOTTY when disabled, matching FIOC_FILEPATH behavior. 5. In libs/libc/misc/lib_getfullpath.c, properly propagates F_GETPATH failure (-get_errno()) so caller *at functions safely abort when path resolution is unsupported or fails, rather than operating on an uninitialized buffer. Saves 240 bytes of Flash on stm32f103-minimum:nsh (text 53596 -> 53356 bytes). Assisted-by: Google DeepMind:antigravity Signed-off-by: Swatantra Yadav <[email protected]>
Swatantra-66
force-pushed
the
feature/vfs-optional-ioctl-filepath
branch
from
November 16, 2026 07:04
39ef6d7 to
594e322
Compare
GUIDINGLI
approved these changes
Nov 17, 2026
xiaoxiang781216
approved these changes
Nov 17, 2026
This file contains hidden or 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
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.
Summary
Addresses #20414 by making the FIOC_FILEPATH ioctl and F_GETPATH fcntl command optional on small configurations (DEFAULT_SMALL=y).
In small memory-constrained configurations, unconditionally handling
FIOC_FILEPATHandF_GETPATHforces the inclusion ofinode_getpath()and recursive path reconstruction logic even when no application or filesystem requires path resolution from open file descriptors.This PR introduces
CONFIG_FS_IOCTL_FILEPATH(defaultyif!DEFAULT_SMALL,default n):fs/Kconfig: DefinesCONFIG_FS_IOCTL_FILEPATH.fs/vfs/Kconfig: SelectsFS_IOCTL_FILEPATHunderCONFIG_FS_NOTIFYto preserve path resolution for filesystem notifications.fs/vfs/fs_ioctl.c: RejectsFIOC_FILEPATHwith-ENOTTYprior to driver dispatch when disabled, and gatesinode_getpath()fallback.fs/vfs/fs_fcntl.c: KeepsF_GETPATHcase and returns-ENOTTYwhen disabled, matchingFIOC_FILEPATH.libs/libc/misc/lib_getfullpath.c: Fixeslib_getfullpath()to properly propagatefcntl(F_GETPATH)error status (-get_errno()) instead of returning 0 with an uninitialized buffer, ensuring caller*at()functions abort safely with-ENOTTY/-ENOSYS.Impact
CONFIG_FS_IOCTL_FILEPATH)CONFIG_FS_IOCTL_FILEPATH=y(default for standard builds). ForDEFAULT_SMALL=ybuilds, saves 240 bytes of Flash by excludinginode_getpath().Size Difference (Before vs After)
Target:
stm32f103-minimum:nsh(DEFAULT_SMALL=y)Compiler:
arm-none-eabi-gcc 10.3.1Before (master baseline):
After (with CONFIG_FS_IOCTL_FILEPATH=n):
Difference:
inode_getpath()is eliminated from the final binary image.Object file breakdown:
fs/fs_ioctl.o: 560 -> 464 bytes (-96 bytes)fs/fs_fcntl.o: 392 -> 384 bytes (-8 bytes)Testing
nuttx-builderarm-none-eabi-gcc (15:10.3-2021.07-4) 10.3.1stm32f103-minimum:nsh(DEFAULT_SMALL=y)Build Log:
Style Verification:
$ ./tools/checkpatch.sh -c -u -m -g HEAD~1..HEAD # 0 errors, 0 warnings