nuttx/fs/inode
yukangzhi 67cd42677b fs/inode: canonicalize path before inode search to fix .. resolution
Add _inode_canonicalize() to remove '.' and '..' segments from the
absolute path before the inode tree traversal begins. This fixes the
case where paths containing '..' that resolve back to a mountpoint
root (e.g., /tmp/subdir/..) were not being handed to the filesystem.

Previously, _compute_path_depth() returned 0 for such paths, causing
the VFS to skip the mountpoint and attempt to find 'subdir' in the
pseudo filesystem -- which fails with ENOTDIR.

With canonicalization, /tmp/subdir/.. becomes /tmp before the search,
so the mountpoint is correctly matched. This fixes chdir('..'),
stat('../..'), opendir('../..'), and similar operations from within
mountpoint subdirectories.

The implementation uses an in-place two-pointer algorithm with no
additional stack allocation, safe for NuttX's small kernel stacks.

Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
2026-08-28 23:07:24 +08:00
..
CMakeLists.txt fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_files.c nuttx/atomic: replace atomic_fetch_xxx with atomic_xxx just like zephyr 2026-08-24 13:20:45 +08:00
fs_foreachinode.c fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_inode.c sched: add supplementary group IDs (setgroups/getgroups/initgroups) 2026-08-12 16:06:03 -03:00
fs_inodeaddref.c nuttx/atomic: replace atomic_fetch_xxx with atomic_xxx just like zephyr 2026-08-24 13:20:45 +08:00
fs_inodebasename.c fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_inodefind.c nuttx/atomic: replace atomic_fetch_xxx with atomic_xxx just like zephyr 2026-08-24 13:20:45 +08:00
fs_inodefree.c fs: rename PSEUDOFS_SOFTLINKS to FS_LINKS 2026-08-27 01:12:33 +08:00
fs_inodegetpath.c fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_inoderelease.c nuttx/atomic: replace atomic_fetch_xxx with atomic_xxx just like zephyr 2026-08-24 13:20:45 +08:00
fs_inoderemove.c fs: rename PSEUDOFS_SOFTLINKS to FS_LINKS 2026-08-27 01:12:33 +08:00
fs_inodereserve.c fs: enforce path search and unify inode permission helpers 2026-08-02 18:48:40 -03:00
fs_inodesearch.c fs/inode: canonicalize path before inode search to fix .. resolution 2026-08-28 23:07:24 +08:00
inode.h fs/inode: change fs_heap to lib_get_tempbuffer/lib_put_tempbuffer 2026-08-28 12:09:46 +08:00
Make.defs fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00