From 3f4f89b918a7db0c354f10bf85641c2872f8e1f9 Mon Sep 17 00:00:00 2001 From: zhengyu16 Date: Thu, 18 Sep 2025 16:56:44 +0800 Subject: [PATCH 1/5] fs/vfs: add hardlink function of pseudofs 1. add the hardlink function 2. _POSIX_LINK_MAX judgement Signed-off-by: zhengyu16 --- fs/inode/fs_inoderemove.c | 14 +++ fs/inode/fs_inodesearch.c | 9 ++ fs/inode/inode.h | 6 ++ fs/vfs/fs_chstat.c | 10 ++ fs/vfs/fs_dir.c | 44 ++++++--- fs/vfs/fs_link.c | 188 ++++++++++++++++++++++++++++++++++++-- fs/vfs/fs_open.c | 12 +++ fs/vfs/fs_rename.c | 6 +- fs/vfs/fs_stat.c | 11 +++ fs/vfs/fs_unlink.c | 6 +- include/nuttx/fs/fs.h | 3 + 11 files changed, 281 insertions(+), 28 deletions(-) diff --git a/fs/inode/fs_inoderemove.c b/fs/inode/fs_inoderemove.c index 87c8693747931..aad079325e511 100644 --- a/fs/inode/fs_inoderemove.c +++ b/fs/inode/fs_inoderemove.c @@ -120,6 +120,20 @@ static FAR struct inode *inode_unlink(FAR const char *path) inode->i_peer = NULL; inode->i_parent = NULL; atomic_sub(&inode->i_crefs, 1); +#ifdef CONFIG_PSEUDOFS_SOFTLINKS + if (INODE_IS_HARDLINK(inode)) + { + FAR struct inode *target; + + DEBUGASSERT(inode->i_private != NULL); + target = inode->i_private; + atomic_sub(&target->i_crefs, INODE_NLINK_INC); + if (atomic_read(&target->i_crefs) == 0) + { + inode_free(target); + } + } +#endif } errout: diff --git a/fs/inode/fs_inodesearch.c b/fs/inode/fs_inodesearch.c index 67a14cf474eef..1b2f69eb643a9 100644 --- a/fs/inode/fs_inodesearch.c +++ b/fs/inode/fs_inodesearch.c @@ -523,6 +523,15 @@ int inode_search(FAR struct inode_search_s *desc) return ret; } } + else if (!desc->nofollow && INODE_IS_HARDLINK(inode)) + { + /* The terminating inode is a valid hard link */ + + inode = inode->i_private; + DEBUGASSERT(inode != NULL); + + desc->node = inode; + } } #endif diff --git a/fs/inode/inode.h b/fs/inode/inode.h index 2f938ac81a3a7..08fc76325100e 100644 --- a/fs/inode/inode.h +++ b/fs/inode/inode.h @@ -98,6 +98,12 @@ # define FS_ADD_BACKTRACE(fd) #endif +#define INODE_NLINK_INC (1u << 16) /* Increment link count */ +#define INODE_CREF_INC (1u << 0) /* Increment reference count */ +#define INODE_NLINK_SHIFT 16 /* Shift to get link count */ +#define INODE_GET_NLINK(i) \ + ((atomic_read(&(i)->i_crefs) >> INODE_NLINK_SHIFT) + 1) + /**************************************************************************** * Public Types ****************************************************************************/ diff --git a/fs/vfs/fs_chstat.c b/fs/vfs/fs_chstat.c index 16b61b257e9ba..d5da5b9179897 100644 --- a/fs/vfs/fs_chstat.c +++ b/fs/vfs/fs_chstat.c @@ -454,6 +454,16 @@ int inode_chstat(FAR struct inode *inode, return chstat_recursive(inode->u.i_link, buf, flags, ++resolve); } } + + else if (INODE_IS_HARDLINK(inode)) + { + /* The inode is a hard link. The actual inode is referenced + * by the i_private field. + */ + + DEBUGASSERT(inode->i_private != NULL); + inode = inode->i_private; + } #endif #ifdef CONFIG_SCHED_USER_IDENTITY diff --git a/fs/vfs/fs_dir.c b/fs/vfs/fs_dir.c index 40abdc40b1494..dfa074b1e441e 100644 --- a/fs/vfs/fs_dir.c +++ b/fs/vfs/fs_dir.c @@ -299,11 +299,12 @@ static int read_pseudodir(FAR struct fs_dirent_s *dir, FAR struct dirent *entry) { FAR struct fs_pseudodir_s *pdir = (FAR struct fs_pseudodir_s *)dir; + FAR struct inode *next = pdir->next; FAR struct inode *prev; /* Check if we are at the end of the list */ - if (pdir->next == NULL) + if (next == NULL) { /* End of file and error conditions are not distinguishable with * readdir. Here we return -ENOENT to signal the end of the directory. @@ -312,54 +313,67 @@ static int read_pseudodir(FAR struct fs_dirent_s *dir, return -ENOENT; } - /* Copy the inode name into the dirent structure */ + /* Copy the inode name into the dirent structure. + * If it's a hardlink, we should get the name of hardlink itself, + * not the target file name. + * But other information like type should be based on the target file. + * So we put this line before the INODE_IS_HARDLINK() check. + */ + + strlcpy(entry->d_name, next->i_name, sizeof(entry->d_name)); - strlcpy(entry->d_name, pdir->next->i_name, sizeof(entry->d_name)); +#ifdef CONFIG_PSEUDOFS_SOFTLINKS + if (INODE_IS_HARDLINK(next)) + { + DEBUGASSERT(next->i_private != NULL); + next = next->i_private; + } +#endif /* If the node has file operations, we will say that it is a file. */ entry->d_type = DTYPE_UNKNOWN; - if (pdir->next->u.i_ops != NULL) + if (next->u.i_ops != NULL) { #ifndef CONFIG_DISABLE_MOUNTPOINT - if (INODE_IS_BLOCK(pdir->next)) + if (INODE_IS_BLOCK(next)) { entry->d_type = DTYPE_BLK; } - else if (INODE_IS_MTD(pdir->next)) + else if (INODE_IS_MTD(next)) { entry->d_type = DTYPE_MTD; } - else if (INODE_IS_MOUNTPT(pdir->next)) + else if (INODE_IS_MOUNTPT(next)) { entry->d_type = DTYPE_DIRECTORY; } else #endif #ifdef CONFIG_PSEUDOFS_SOFTLINKS - if (INODE_IS_SOFTLINK(pdir->next)) + if (INODE_IS_SOFTLINK(next)) { entry->d_type = DTYPE_LINK; } else #endif - if (INODE_IS_DRIVER(pdir->next)) + if (INODE_IS_DRIVER(next)) { entry->d_type = DTYPE_CHR; } - else if (INODE_IS_NAMEDSEM(pdir->next)) + else if (INODE_IS_NAMEDSEM(next)) { entry->d_type = DTYPE_SEM; } - else if (INODE_IS_MQUEUE(pdir->next)) + else if (INODE_IS_MQUEUE(next)) { entry->d_type = DTYPE_MQ; } - else if (INODE_IS_SHM(pdir->next)) + else if (INODE_IS_SHM(next)) { entry->d_type = DTYPE_SHM; } - else if (INODE_IS_PIPE(pdir->next)) + else if (INODE_IS_PIPE(next)) { entry->d_type = DTYPE_FIFO; } @@ -370,8 +384,8 @@ static int read_pseudodir(FAR struct fs_dirent_s *dir, * be both! */ - if (pdir->next->i_child != NULL || - pdir->next->u.i_ops == NULL) + if (next->i_child != NULL || + next->u.i_ops == NULL) { entry->d_type = DTYPE_DIRECTORY; } diff --git a/fs/vfs/fs_link.c b/fs/vfs/fs_link.c index e47ac41fffec0..b580a9aae82e5 100644 --- a/fs/vfs/fs_link.c +++ b/fs/vfs/fs_link.c @@ -26,8 +26,25 @@ #include -#include +#include +#include +#include #include +#include +#include + +#include +#include +#include + +#include "inode/inode.h" +#include "vfs.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#ifdef CONFIG_PSEUDOFS_SOFTLINKS /**************************************************************************** * Public Functions @@ -37,8 +54,14 @@ * Name: link * * Description: - * The link function provides a wrapper to symlink when pseudo filesystem - * softlinks are enabled. Otherwise, hard links are unsupported. + * The link() function creates a new hard link for the existing file + * specified by 'path1'. The new link is created at the location specified + * by 'path2'. + * + * This implementation currently only supports creating hard links within + * the NuttX pseudo-filesystem (pseudofs). Hard links for files within + * mounted filesystems are not yet supported. In the future, support for + * hard links in mounted filesystems may be added. * * Input Parameters: * path1 - Points to a pathname naming an existing file. @@ -53,13 +76,160 @@ int link(FAR const char *path1, FAR const char *path2) { -#ifdef CONFIG_PSEUDOFS_SOFTLINKS - return symlink(path1, path2); -#else - (void)path1; - (void)path2; + struct inode_search_s desc_path1; + struct inode_search_s desc_path2; + FAR struct inode *target = NULL; + FAR struct inode *newinode = NULL; + int errcode; + int ret; + + if (path1 == NULL || path2 == NULL) + { + errcode = EINVAL; + goto errout; + } + + if (*path1 == '\0' || *path2 == '\0') + { + errcode = ENOENT; + goto errout; + } + + SETUP_SEARCH(&desc_path1, path1, false); + ret = inode_find(&desc_path1); + if (ret < 0) + { + errcode = -ret; + goto errout_with_search_path1; + } + + target = desc_path1.node; + + /* Check if target inode is a mountpoint. */ + + if (INODE_IS_MOUNTPT(target)) + { + /* Hard links within the mounted volume are not supported */ + + errcode = ENOSYS; + goto errout_with_target; + } + + if (INODE_GET_NLINK(target) >= _POSIX_LINK_MAX) + { + /* Too many links to the target inode */ + + errcode = EMLINK; + goto errout_with_target; + } + + /* Check that no inode exists at the 'path2' and that the path up to + * 'path2' does not lie on a mounted volume. + */ + + SETUP_SEARCH(&desc_path2, path2, true); + + ret = inode_find(&desc_path2); + if (ret >= 0) + { + newinode = desc_path2.node; + + /* Something exists at the path2 where we are trying to create the + * link. + */ + +#ifndef CONFIG_DISABLE_MOUNTPOINT + /* Check if the inode is a mountpoint. */ + + DEBUGASSERT(newinode != NULL); + if (INODE_IS_MOUNTPT(newinode)) + { + /* Hard links within the mounted volume are not supported */ + + errcode = ENOSYS; + } + else +#endif + { + /* A node already exists in the pseudofs at 'path2' */ + + errcode = EEXIST; + } + + goto errout_with_newinode; + } + + /* No inode exists that contains this path. Create a new inode in the + * pseudo-filesystem at this location. + */ + + else + { + /* Create an inode in the pseudo-filesystem at this path. */ + + inode_lock(); + ret = inode_reserve(path2, 0777, &newinode); + + if (ret >= 0) + { + /* Initialize the inode */ + + INODE_SET_HARDLINK(newinode); + newinode->i_private = target; + atomic_add(&target->i_crefs, INODE_NLINK_INC); + } + + inode_unlock(); + if (ret < 0) + { + errcode = -ret; + goto errout_with_newinode; + } + } + + /* Hard link successfully created */ + + RELEASE_SEARCH(&desc_path1); + RELEASE_SEARCH(&desc_path2); + inode_release(target); + +#ifdef CONFIG_FS_NOTIFY + notify_create(path2); +#endif + return OK; + +errout_with_newinode: + inode_release(newinode); + RELEASE_SEARCH(&desc_path2); +errout_with_target: + inode_release(target); +errout_with_search_path1: + RELEASE_SEARCH(&desc_path1); + +errout: + set_errno(errcode); + return ERROR; +} + +#else /* CONFIG_PSEUDOFS_SOFTLINKS */ + +/**************************************************************************** + * Name: link + * + * Description: + * When CONFIG_PSEUDOFS_SOFTLINKS is disabled, link() is not supported. + * The symbol is still provided so that applications referencing link() + * continue to link, but the call always fails with ENOSYS. + * + ****************************************************************************/ + +int link(FAR const char *path1, FAR const char *path2) +{ + UNUSED(path1); + UNUSED(path2); set_errno(ENOSYS); return ERROR; -#endif } + +#endif /* CONFIG_PSEUDOFS_SOFTLINKS */ diff --git a/fs/vfs/fs_open.c b/fs/vfs/fs_open.c index 82b13dec5548d..a6c10c9802373 100644 --- a/fs/vfs/fs_open.c +++ b/fs/vfs/fs_open.c @@ -128,10 +128,22 @@ static int file_vopen(FAR struct file *filep, FAR const char *path, inode = desc.node; DEBUGASSERT(inode != NULL); +#ifdef CONFIG_PSEUDOFS_SOFTLINKS + if (INODE_IS_HARDLINK(inode)) + { + /* The inode is a hard link. The actual inode is referenced + * by the i_private field. + */ + + DEBUGASSERT(inode->i_private != NULL); + inode = inode->i_private; + } + if (desc.nofollow && INODE_IS_SOFTLINK(inode)) { return -ELOOP; } +#endif #if defined(CONFIG_BCH) && \ !defined(CONFIG_DISABLE_MOUNTPOINT) && \ diff --git a/fs/vfs/fs_rename.c b/fs/vfs/fs_rename.c index 28afc7000897b..4428354929ae1 100644 --- a/fs/vfs/fs_rename.c +++ b/fs/vfs/fs_rename.c @@ -135,7 +135,11 @@ static int pseudorename(FAR const char *oldpath, FAR struct inode *oldinode, * directory (i.e, an operation-less inode or an inode with children)? */ - if (newinode->u.i_ops == NULL || newinode->i_child != NULL) + if ((newinode->u.i_ops == NULL || newinode->i_child != NULL) +#ifdef CONFIG_PSEUDOFS_SOFTLINKS + && !INODE_IS_HARDLINK(newinode) +#endif + ) { FAR char *subdirname; diff --git a/fs/vfs/fs_stat.c b/fs/vfs/fs_stat.c index 27f1b040f08c6..bceba8e70d4fb 100644 --- a/fs/vfs/fs_stat.c +++ b/fs/vfs/fs_stat.c @@ -267,6 +267,14 @@ int inode_stat(FAR struct inode *inode, FAR struct stat *buf, int resolve) RESET_BUF(buf); +#ifdef CONFIG_PSEUDOFS_SOFTLINKS + if (INODE_IS_HARDLINK(inode)) + { + DEBUGASSERT(inode->i_private != NULL); + inode = inode->i_private; + } +#endif + /* Handle "special" nodes */ #if defined(CONFIG_FS_NAMED_SEMAPHORES) @@ -469,6 +477,9 @@ int inode_stat(FAR struct inode *inode, FAR struct stat *buf, int resolve) buf->st_ctim = inode->i_ctime; #endif buf->st_ino = inode->i_ino; +#ifdef CONFIG_PSEUDOFS_SOFTLINKS + buf->st_nlink = INODE_GET_NLINK(inode); +#endif return OK; } diff --git a/fs/vfs/fs_unlink.c b/fs/vfs/fs_unlink.c index e92a9ec99ec06..b3c54d204147b 100644 --- a/fs/vfs/fs_unlink.c +++ b/fs/vfs/fs_unlink.c @@ -155,11 +155,11 @@ int nx_unlink(FAR const char *pathname) } } #endif + else if ( #ifdef CONFIG_PSEUDOFS_SOFTLINKS - else if (INODE_IS_PSEUDODIR(inode) || INODE_IS_SOFTLINK(inode)) -#else - else if (INODE_IS_PSEUDODIR(inode)) + INODE_IS_SOFTLINK(inode) || INODE_IS_HARDLINK(inode) || #endif + INODE_IS_PSEUDODIR(inode)) { /* If this is a "dangling" pseudo-file node * (i.e., it has no operations) or a soft link, diff --git a/include/nuttx/fs/fs.h b/include/nuttx/fs/fs.h index a13e56b04ab73..5b9eb33a94589 100644 --- a/include/nuttx/fs/fs.h +++ b/include/nuttx/fs/fs.h @@ -128,6 +128,7 @@ #define FSNODEFLAG_TYPE_SOCKET 0x00000009 /* Socket */ #define FSNODEFLAG_TYPE_PIPE 0x0000000a /* Pipe */ #define FSNODEFLAG_TYPE_NAMEDEVENT 0x0000000b /* Named event group */ +#define FSNODEFLAG_TYPE_HARDLINK 0x0000000c /* Hard link */ #define INODE_IS_TYPE(i,t) \ (((i)->i_flags & FSNODEFLAG_TYPE_MASK) == (t)) @@ -144,6 +145,7 @@ #define INODE_IS_SOCKET(i) INODE_IS_TYPE(i,FSNODEFLAG_TYPE_SOCKET) #define INODE_IS_PIPE(i) INODE_IS_TYPE(i,FSNODEFLAG_TYPE_PIPE) #define INODE_IS_NAMEDEVENT(i) INODE_IS_TYPE(i,FSNODEFLAG_TYPE_NAMEDEVENT) +#define INODE_IS_HARDLINK(i) INODE_IS_TYPE(i,FSNODEFLAG_TYPE_HARDLINK) #define INODE_GET_TYPE(i) ((i)->i_flags & FSNODEFLAG_TYPE_MASK) #define INODE_SET_TYPE(i,t) \ @@ -164,6 +166,7 @@ #define INODE_SET_SOCKET(i) INODE_SET_TYPE(i,FSNODEFLAG_TYPE_SOCKET) #define INODE_SET_PIPE(i) INODE_SET_TYPE(i,FSNODEFLAG_TYPE_PIPE) #define INODE_SET_NAMEDEVENT(i) INODE_SET_TYPE(i,FSNODEFLAG_TYPE_NAMEDEVENT) +#define INODE_SET_HARDLINK(i) INODE_SET_TYPE(i,FSNODEFLAG_TYPE_HARDLINK) /* The status change flags. * These should be or-ed together to figure out what want to change. From 05dca2df1ca182812d1076f2f58e13d95b98493a Mon Sep 17 00:00:00 2001 From: zhengyu16 Date: Thu, 6 Nov 2025 17:11:24 +0800 Subject: [PATCH 2/5] fs: rename PSEUDOFS_SOFTLINKS to FS_LINKS The link support is no longer limited to the pseudo file system and now covers both soft (symbolic) links and hard links across the VFS. Rename the configuration option PSEUDOFS_SOFTLINKS to the more accurate FS_LINKS and update all references in the source, headers, Kconfig, documentation and board defconfigs accordingly. This is a configuration rename; any out-of-tree defconfig that still selects PSEUDOFS_SOFTLINKS must be updated to FS_LINKS. Signed-off-by: zhengyu16 --- Documentation/applications/nsh/config.rst | 4 ++-- Documentation/reference/user/10_filesystem.rst | 2 +- Documentation/standards/posix.rst | 2 +- boards/arm/am67/t3-gem-o1/configs/nsh/defconfig | 2 +- boards/arm/imx6/sabre-6quad/configs/citest/defconfig | 2 +- .../arm/imx6/sabre-6quad/configs/netknsh/defconfig | 2 +- .../imx6/sabre-6quad/configs/netknsh_smp/defconfig | 2 +- .../configs/pico-restouch-lcd-2.8/defconfig | 2 +- .../stm32f4discovery/configs/toybox/defconfig | 2 +- .../stm32h7/portenta-h7/configs/jumbo_cm7/defconfig | 2 +- boards/arm64/imx9/imx93-evk/configs/knsh/defconfig | 2 +- boards/arm64/imx9/imx93-evk/configs/koptee/defconfig | 2 +- .../configs/python/defconfig | 2 +- .../configs/webpanel/defconfig | 2 +- .../esp32p4/esp32p4-tab5/configs/python/defconfig | 2 +- boards/risc-v/mpfs/icicle/configs/knsh/defconfig | 2 +- .../risc-v/qemu-rv/rv-virt/configs/citest/defconfig | 2 +- .../qemu-rv/rv-virt/configs/citest64/defconfig | 2 +- .../risc-v/qemu-rv/rv-virt/configs/python/defconfig | 2 +- boards/sim/sim/sim/configs/adb/defconfig | 2 +- boards/sim/sim/sim/configs/baromonitor/defconfig | 2 +- boards/sim/sim/sim/configs/citest/defconfig | 2 +- boards/sim/sim/sim/configs/crypto/defconfig | 2 +- boards/sim/sim/sim/configs/dropbear/defconfig | 2 +- boards/sim/sim/sim/configs/login/defconfig | 2 +- boards/sim/sim/sim/configs/lua/defconfig | 2 +- boards/sim/sim/sim/configs/matter/defconfig | 2 +- boards/sim/sim/sim/configs/minmea/defconfig | 2 +- boards/sim/sim/sim/configs/mnemofs/defconfig | 2 +- boards/sim/sim/sim/configs/nand/defconfig | 2 +- boards/sim/sim/sim/configs/nsh/defconfig | 2 +- boards/sim/sim/sim/configs/nsh2/defconfig | 2 +- boards/sim/sim/sim/configs/nxcamera/defconfig | 2 +- boards/sim/sim/sim/configs/nxdoom/defconfig | 2 +- boards/sim/sim/sim/configs/nxmbrtu/defconfig | 2 +- boards/sim/sim/sim/configs/posix_test/defconfig | 2 +- boards/sim/sim/sim/configs/quickjs/defconfig | 2 +- boards/sim/sim/sim/configs/rtptools/defconfig | 2 +- boards/sim/sim/sim/configs/rust/defconfig | 2 +- boards/sim/sim/sim/configs/segger/defconfig | 2 +- boards/sim/sim/sim/configs/smartfs/defconfig | 2 +- boards/sim/sim/sim/configs/sqlite/defconfig | 2 +- boards/sim/sim/sim/configs/tcpblaster/defconfig | 2 +- boards/sim/sim/sim/configs/toybox/defconfig | 2 +- boards/sim/sim/sim/configs/txmorse/defconfig | 2 +- boards/sim/sim/sim/configs/usbdev/defconfig | 2 +- boards/sim/sim/sim/configs/usbhost/defconfig | 2 +- .../sim/sim/sim/configs/watchdog-notifier/defconfig | 2 +- boards/sim/sim/sim/configs/zipfs/defconfig | 2 +- .../qemu/qemu-intel64/configs/nxterm/defconfig | 2 +- .../qemu/qemu-intel64/configs/python/defconfig | 2 +- .../esp32s3/esp32s3-devkit/configs/mbedtls/defconfig | 2 +- .../esp32s3/esp32s3-devkit/configs/python/defconfig | 2 +- .../esp32s3-devkit/configs/qemu_debug/defconfig | 2 +- .../esp32s3-devkit/configs/qemu_toywasm/defconfig | 2 +- .../esp32s3/esp32s3-devkit/configs/toywasm/defconfig | 2 +- fs/Kconfig | 2 +- fs/inode/fs_inodefree.c | 4 ++-- fs/inode/fs_inoderemove.c | 2 +- fs/inode/fs_inodesearch.c | 8 ++++---- fs/vfs/CMakeLists.txt | 2 +- fs/vfs/Make.defs | 2 +- fs/vfs/fs_chstat.c | 2 +- fs/vfs/fs_dir.c | 4 ++-- fs/vfs/fs_link.c | 12 ++++++------ fs/vfs/fs_open.c | 2 +- fs/vfs/fs_readlink.c | 4 ++-- fs/vfs/fs_rename.c | 4 ++-- fs/vfs/fs_stat.c | 6 +++--- fs/vfs/fs_symlink.c | 4 ++-- fs/vfs/fs_unlink.c | 2 +- include/nuttx/fs/fs.h | 2 +- include/sys/syscall_lookup.h | 2 +- libs/libc/stdlib/lib_realpath.c | 8 ++++---- libs/libc/unistd/lib_linkat.c | 4 ++-- libs/libc/unistd/lib_readlinkat.c | 4 ++-- libs/libc/unistd/lib_symlinkat.c | 4 ++-- syscall/syscall.csv | 6 +++--- 78 files changed, 102 insertions(+), 102 deletions(-) diff --git a/Documentation/applications/nsh/config.rst b/Documentation/applications/nsh/config.rst index d40227f35afe0..19b92ebfe033b 100644 --- a/Documentation/applications/nsh/config.rst +++ b/Documentation/applications/nsh/config.rst @@ -73,7 +73,7 @@ Command Depends on Configuration Can Be Disabl :ref:`cmdkill` ``CONFIG_NSH_DISABLE_KILL`` . :ref:`cmdlosetup` ! ``CONFIG_DISABLE_MOUNTPOINT`` && ``CONFIG_NSH_DISABLE_LOSETUP`` ``CONFIG_DEV_LOOP`` -:ref:`cmdln` ``CONFIG_PSEUDOFS_SOFTLINKS`` ``CONFIG_NSH_DISABLE_LN`` +:ref:`cmdln` ``CONFIG_FS_LINKS`` ``CONFIG_NSH_DISABLE_LN`` :ref:`cmdls` ``CONFIG_NSH_DISABLE_LS`` . :ref:`cmdlsmod` ``CONFIG_MODULE`` && ``CONFIG_FS_PROCFS`` ``CONFIG_NSH_DISABLE_MODCMDS`` && |br| @@ -106,7 +106,7 @@ Command Depends on Configuration Can Be Disabl :ref:`cmdput` ``CONFIG_NET`` && ``CONFIG_NET_UDP`` && ``CONFIG_NSH_DISABLE_PUT`` ``MTU >= 558`` [#1]_, [#2]_ :ref:`cmdpwd` ! ``CONFIG_DISABLE_ENVIRON`` ``CONFIG_NSH_DISABLE_PWD`` -:ref:`cmdreadlink` ``CONFIG_PSEUDOFS_SOFTLINKS`` ``CONFIG_NSH_DISABLE_READLINK`` +:ref:`cmdreadlink` ``CONFIG_FS_LINKS`` ``CONFIG_NSH_DISABLE_READLINK`` :ref:`cmdreboot` ``CONFIG_BOARD_RESET`` ``CONFIG_NSH_DISABLE_REBOOT`` :ref:`cmdrm` ! ``CONFIG_DISABLE_MOUNTPOINT`` \|\| ``CONFIG_NSH_DISABLE_RM`` ! ``CONFIG_DISABLE_PSEUDOFS_OPERATIONS`` diff --git a/Documentation/reference/user/10_filesystem.rst b/Documentation/reference/user/10_filesystem.rst index 4ad5cb43039a7..695c1e0db3001 100644 --- a/Documentation/reference/user/10_filesystem.rst +++ b/Documentation/reference/user/10_filesystem.rst @@ -227,7 +227,7 @@ UNIX Standard Operations (``unistd.h``) int rmdir(FAR const char *pathname); int unlink(FAR const char *pathname); - #ifdef CONFIG_PSEUDOFS_SOFTLINKS + #ifdef CONFIG_FS_LINKS int link(FAR const char *path1, FAR const char *path2); ssize_t readlink(FAR const char *path, FAR char *buf, size_t bufsize); #endif diff --git a/Documentation/standards/posix.rst b/Documentation/standards/posix.rst index 47622ec7921c2..5333f6f11e737 100644 --- a/Documentation/standards/posix.rst +++ b/Documentation/standards/posix.rst @@ -225,7 +225,7 @@ Units of Functionality Requirements: +------------------------------+---------+--------------------------------+ | `POSIX_STRING_MATCHING`_ | Yes | | +------------------------------+---------+--------------------------------+ -| `POSIX_SYMBOLIC_LINKS`_ | Yes | ``CONFIG_PSEUDOFS_SOFTLINKS`` | +| `POSIX_SYMBOLIC_LINKS`_ | Yes | ``CONFIG_FS_LINKS`` | +------------------------------+---------+--------------------------------+ | `POSIX_SYSTEM_DATABASE`_ | Yes | | +------------------------------+---------+--------------------------------+ diff --git a/boards/arm/am67/t3-gem-o1/configs/nsh/defconfig b/boards/arm/am67/t3-gem-o1/configs/nsh/defconfig index 3bf01e873140d..fb7b0717470c3 100644 --- a/boards/arm/am67/t3-gem-o1/configs/nsh/defconfig +++ b/boards/arm/am67/t3-gem-o1/configs/nsh/defconfig @@ -26,6 +26,7 @@ CONFIG_ARM_MPU=y CONFIG_BOARD_LOOPSPERMSEC=2813 CONFIG_BOOT_RUNFROMISRAM=y CONFIG_BUILTIN=y +CONFIG_FS_LINKS=y CONFIG_FS_PROCFS=y CONFIG_HAVE_CXX=y CONFIG_HAVE_CXXINITIALIZE=y @@ -35,7 +36,6 @@ CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_READLINE=y CONFIG_PSEUDOFS_ATTRIBUTES=y CONFIG_PSEUDOFS_FILE=y -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_RAM_SIZE=14680064 CONFIG_RAM_START=0xA2200000 CONFIG_READLINE_CMD_HISTORY=y diff --git a/boards/arm/imx6/sabre-6quad/configs/citest/defconfig b/boards/arm/imx6/sabre-6quad/configs/citest/defconfig index 05b5b8b0e00ea..daceae1df4bed 100644 --- a/boards/arm/imx6/sabre-6quad/configs/citest/defconfig +++ b/boards/arm/imx6/sabre-6quad/configs/citest/defconfig @@ -32,6 +32,7 @@ CONFIG_EXAMPLES_PIPE=y CONFIG_EXAMPLES_POPEN=y CONFIG_EXAMPLES_USRSOCKTEST=y CONFIG_EXPERIMENTAL=y +CONFIG_FS_LINKS=y CONFIG_FS_PROCFS=y CONFIG_FS_TMPFS=y CONFIG_HAVE_CXX=y @@ -48,7 +49,6 @@ CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_READLINE=y CONFIG_PREALLOC_TIMERS=4 -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_RAM_SIZE=1073741824 CONFIG_RAM_START=0x10000000 CONFIG_RAM_VSTART=0x10000000 diff --git a/boards/arm/imx6/sabre-6quad/configs/netknsh/defconfig b/boards/arm/imx6/sabre-6quad/configs/netknsh/defconfig index 5cad237fb1f03..a856df862df07 100644 --- a/boards/arm/imx6/sabre-6quad/configs/netknsh/defconfig +++ b/boards/arm/imx6/sabre-6quad/configs/netknsh/defconfig @@ -42,6 +42,7 @@ CONFIG_ELF_STACKSIZE=3072 CONFIG_ETH0_PHY_KSZ8081=y CONFIG_EXAMPLES_HELLO=m CONFIG_FS_HOSTFS=y +CONFIG_FS_LINKS=y CONFIG_FS_PROCFS=y CONFIG_HAVE_CXX=y CONFIG_HAVE_CXXINITIALIZE=y @@ -92,7 +93,6 @@ CONFIG_NSH_FILE_APPS=y CONFIG_NSH_READLINE=y CONFIG_PATH_INITIAL="/system/bin" CONFIG_PREALLOC_TIMERS=4 -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_RAM_SIZE=1073741824 CONFIG_RAM_START=0x10000000 CONFIG_RAM_VSTART=0x10000000 diff --git a/boards/arm/imx6/sabre-6quad/configs/netknsh_smp/defconfig b/boards/arm/imx6/sabre-6quad/configs/netknsh_smp/defconfig index 2e2b708b21cd1..1812e9210d070 100644 --- a/boards/arm/imx6/sabre-6quad/configs/netknsh_smp/defconfig +++ b/boards/arm/imx6/sabre-6quad/configs/netknsh_smp/defconfig @@ -42,6 +42,7 @@ CONFIG_ELF_STACKSIZE=3072 CONFIG_ETH0_PHY_KSZ8081=y CONFIG_EXAMPLES_HELLO=m CONFIG_FS_HOSTFS=y +CONFIG_FS_LINKS=y CONFIG_FS_PROCFS=y CONFIG_HAVE_CXX=y CONFIG_HAVE_CXXINITIALIZE=y @@ -92,7 +93,6 @@ CONFIG_NSH_FILE_APPS=y CONFIG_NSH_READLINE=y CONFIG_PATH_INITIAL="/system/bin" CONFIG_PREALLOC_TIMERS=4 -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_RAM_SIZE=1073741824 CONFIG_RAM_START=0x10000000 CONFIG_RAM_VSTART=0x10000000 diff --git a/boards/arm/rp2040/raspberrypi-pico/configs/pico-restouch-lcd-2.8/defconfig b/boards/arm/rp2040/raspberrypi-pico/configs/pico-restouch-lcd-2.8/defconfig index 77d12f43ccf49..611d532cc60e2 100644 --- a/boards/arm/rp2040/raspberrypi-pico/configs/pico-restouch-lcd-2.8/defconfig +++ b/boards/arm/rp2040/raspberrypi-pico/configs/pico-restouch-lcd-2.8/defconfig @@ -50,6 +50,7 @@ CONFIG_EXAMPLES_NXLINES_BPP=16 CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR=0xf7bb CONFIG_EXAMPLES_NXLINES_LINECOLOR=0xffe0 CONFIG_EXAMPLES_NX_BPP=16 +CONFIG_FS_LINKS=y CONFIG_FS_PROCFS=y CONFIG_FS_PROCFS_REGISTER=y CONFIG_FS_ROMFS=y @@ -75,7 +76,6 @@ CONFIG_NXFONT_SANS40X49B=y CONFIG_NX_BLOCKING=y CONFIG_PSEUDOFS_ATTRIBUTES=y CONFIG_PSEUDOFS_FILE=y -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_RAMLOG=y CONFIG_RAMLOG_SYSLOG=y CONFIG_RAM_SIZE=270336 diff --git a/boards/arm/stm32f4/stm32f4discovery/configs/toybox/defconfig b/boards/arm/stm32f4/stm32f4discovery/configs/toybox/defconfig index d8fad21601d21..f40428bde5d89 100644 --- a/boards/arm/stm32f4/stm32f4discovery/configs/toybox/defconfig +++ b/boards/arm/stm32f4/stm32f4discovery/configs/toybox/defconfig @@ -19,6 +19,7 @@ CONFIG_ARCH_SETJMP_H=y CONFIG_ARCH_STACKDUMP=y CONFIG_BOARD_LOOPSPERMSEC=16717 CONFIG_EXAMPLES_HELLO=y +CONFIG_FS_LINKS=y CONFIG_FS_NOTIFY=y CONFIG_FS_PROCFS=y CONFIG_HAVE_CXX=y @@ -33,7 +34,6 @@ CONFIG_LINE_MAX=64 CONFIG_MM_REGIONS=2 CONFIG_PIPES=y CONFIG_PREALLOC_TIMERS=4 -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_RAM_SIZE=114688 CONFIG_RAM_START=0x20000000 CONFIG_RAW_BINARY=y diff --git a/boards/arm/stm32h7/portenta-h7/configs/jumbo_cm7/defconfig b/boards/arm/stm32h7/portenta-h7/configs/jumbo_cm7/defconfig index f324baba7d729..d8ae7b7ab02a7 100644 --- a/boards/arm/stm32h7/portenta-h7/configs/jumbo_cm7/defconfig +++ b/boards/arm/stm32h7/portenta-h7/configs/jumbo_cm7/defconfig @@ -26,6 +26,7 @@ CONFIG_DEBUG_ASSERTIONS_EXPRESSION=y CONFIG_DEBUG_FEATURES=y CONFIG_DEBUG_SYMBOLS=y CONFIG_EVENT_FD=y +CONFIG_FS_LINKS=y CONFIG_FS_NOTIFY=y CONFIG_FS_PROCFS=y CONFIG_FS_PROCFS_REGISTER=y @@ -47,7 +48,6 @@ CONFIG_NSH_READLINE=y CONFIG_PREALLOC_TIMERS=4 CONFIG_PSEUDOFS_ATTRIBUTES=y CONFIG_PSEUDOFS_FILE=y -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_RAM_SIZE=245760 CONFIG_RAM_START=0x20010000 CONFIG_RAW_BINARY=y diff --git a/boards/arm64/imx9/imx93-evk/configs/knsh/defconfig b/boards/arm64/imx9/imx93-evk/configs/knsh/defconfig index eb90f69198d86..4cd8d91e97a72 100644 --- a/boards/arm64/imx9/imx93-evk/configs/knsh/defconfig +++ b/boards/arm64/imx9/imx93-evk/configs/knsh/defconfig @@ -54,6 +54,7 @@ CONFIG_EXPERIMENTAL=y CONFIG_FAT_DMAMEMORY=y CONFIG_FS_FAT=y CONFIG_FS_FATTIME=y +CONFIG_FS_LINKS=y CONFIG_FS_PROCFS=y CONFIG_FS_ROMFS=y CONFIG_GPT_PARTITION=y @@ -127,7 +128,6 @@ CONFIG_NSH_STRERROR=y CONFIG_NSH_VARS=y CONFIG_PATH_INITIAL="/bin" CONFIG_PRIORITY_INHERITANCE=y -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_PTHREAD_STACK_MIN=1024 CONFIG_PWM=y CONFIG_PWM_NCHANNELS=4 diff --git a/boards/arm64/imx9/imx93-evk/configs/koptee/defconfig b/boards/arm64/imx9/imx93-evk/configs/koptee/defconfig index 18a8e405efb94..7b056ffd1dee5 100644 --- a/boards/arm64/imx9/imx93-evk/configs/koptee/defconfig +++ b/boards/arm64/imx9/imx93-evk/configs/koptee/defconfig @@ -58,6 +58,7 @@ CONFIG_EXPERIMENTAL=y CONFIG_FAT_DMAMEMORY=y CONFIG_FS_FAT=y CONFIG_FS_FATTIME=y +CONFIG_FS_LINKS=y CONFIG_FS_PROCFS=y CONFIG_FS_ROMFS=y CONFIG_FS_SHMFS=y @@ -132,7 +133,6 @@ CONFIG_NSH_STRERROR=y CONFIG_NSH_VARS=y CONFIG_PATH_INITIAL="/bin" CONFIG_PRIORITY_INHERITANCE=y -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_PTHREAD_STACK_MIN=1024 CONFIG_PWM=y CONFIG_PWM_NCHANNELS=4 diff --git a/boards/risc-v/esp32p4/esp32p4-function-ev-board/configs/python/defconfig b/boards/risc-v/esp32p4/esp32p4-function-ev-board/configs/python/defconfig index fd91f3d5dfef7..09fe3e5ffa462 100644 --- a/boards/risc-v/esp32p4/esp32p4-function-ev-board/configs/python/defconfig +++ b/boards/risc-v/esp32p4/esp32p4-function-ev-board/configs/python/defconfig @@ -49,6 +49,7 @@ CONFIG_EXPERIMENTAL=y CONFIG_FS_HEAPBUF_SECTION=".ext_ram.bss.buf" CONFIG_FS_HEAPSIZE=2097152 CONFIG_FS_LARGEFILE=y +CONFIG_FS_LINKS=y CONFIG_FS_PROCFS=y CONFIG_FS_ROMFS=y CONFIG_FS_TMPFS=y @@ -93,7 +94,6 @@ CONFIG_NSH_STRERROR=y CONFIG_ONESHOT=y CONFIG_PIPES=y CONFIG_PREALLOC_TIMERS=0 -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_RR_INTERVAL=200 CONFIG_SCHED_BACKTRACE=y CONFIG_SMARTFS_MAXNAMLEN=48 diff --git a/boards/risc-v/esp32p4/esp32p4-function-ev-board/configs/webpanel/defconfig b/boards/risc-v/esp32p4/esp32p4-function-ev-board/configs/webpanel/defconfig index 4c90b61be34e6..4c3c1d851da6e 100644 --- a/boards/risc-v/esp32p4/esp32p4-function-ev-board/configs/webpanel/defconfig +++ b/boards/risc-v/esp32p4/esp32p4-function-ev-board/configs/webpanel/defconfig @@ -56,6 +56,7 @@ CONFIG_FS_BINFS=y CONFIG_FS_HEAPBUF_SECTION=".ext_ram.bss.buf" CONFIG_FS_HEAPSIZE=2097152 CONFIG_FS_LARGEFILE=y +CONFIG_FS_LINKS=y CONFIG_FS_PROCFS=y CONFIG_FS_ROMFS=y CONFIG_FS_TMPFS=y @@ -110,7 +111,6 @@ CONFIG_NSH_READLINE=y CONFIG_NSH_STRERROR=y CONFIG_ONESHOT=y CONFIG_PREALLOC_TIMERS=0 -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_PSEUDOTERM=y CONFIG_RR_INTERVAL=200 CONFIG_SCHED_BACKTRACE=y diff --git a/boards/risc-v/esp32p4/esp32p4-tab5/configs/python/defconfig b/boards/risc-v/esp32p4/esp32p4-tab5/configs/python/defconfig index 53ecaad31407e..601d3027191b7 100644 --- a/boards/risc-v/esp32p4/esp32p4-tab5/configs/python/defconfig +++ b/boards/risc-v/esp32p4/esp32p4-tab5/configs/python/defconfig @@ -46,6 +46,7 @@ CONFIG_EXPERIMENTAL=y CONFIG_FS_HEAPBUF_SECTION=".ext_ram.bss.buf" CONFIG_FS_HEAPSIZE=2097152 CONFIG_FS_LARGEFILE=y +CONFIG_FS_LINKS=y CONFIG_FS_PROCFS=y CONFIG_FS_ROMFS=y CONFIG_FS_TMPFS=y @@ -77,7 +78,6 @@ CONFIG_NSH_READLINE=y CONFIG_NSH_STRERROR=y CONFIG_PIPES=y CONFIG_PREALLOC_TIMERS=0 -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_RR_INTERVAL=200 CONFIG_SCHED_BACKTRACE=y CONFIG_SCHED_WORKQUEUE=y diff --git a/boards/risc-v/mpfs/icicle/configs/knsh/defconfig b/boards/risc-v/mpfs/icicle/configs/knsh/defconfig index 069db7380ac0d..a4950cf03433f 100644 --- a/boards/risc-v/mpfs/icicle/configs/knsh/defconfig +++ b/boards/risc-v/mpfs/icicle/configs/knsh/defconfig @@ -49,6 +49,7 @@ CONFIG_DEFAULT_TASK_STACKSIZE=4096 CONFIG_ELF=y CONFIG_EXAMPLES_HELLO=y CONFIG_EXPERIMENTAL=y +CONFIG_FS_LINKS=y CONFIG_FS_PROCFS=y CONFIG_FS_PROCFS_EXCLUDE_ENVIRON=y CONFIG_FS_ROMFS=y @@ -81,7 +82,6 @@ CONFIG_NUTTSBI_IPI_BASE=0x02000000 CONFIG_NUTTSBI_MTIMECMP_BASE=0x02004000 CONFIG_NUTTSBI_MTIME_BASE=0x0200bff8 CONFIG_PREALLOC_TIMERS=4 -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_RAM_SIZE=2097152 CONFIG_RAM_START=0x80200000 CONFIG_RAW_BINARY=y diff --git a/boards/risc-v/qemu-rv/rv-virt/configs/citest/defconfig b/boards/risc-v/qemu-rv/rv-virt/configs/citest/defconfig index 4c02d991ce661..d9ccaeaee4154 100644 --- a/boards/risc-v/qemu-rv/rv-virt/configs/citest/defconfig +++ b/boards/risc-v/qemu-rv/rv-virt/configs/citest/defconfig @@ -60,6 +60,7 @@ CONFIG_FAT_LFN=y CONFIG_FS_AIO=y CONFIG_FS_FAT=y CONFIG_FS_HOSTFS=y +CONFIG_FS_LINKS=y CONFIG_FS_NAMED_SEMAPHORES=y CONFIG_FS_PROCFS=y CONFIG_FS_ROMFS=y @@ -96,7 +97,6 @@ CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_READLINE=y CONFIG_PATH_INITIAL="/system/bin" CONFIG_PREALLOC_TIMERS=0 -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_PTHREAD_SPINLOCKS=y CONFIG_PTHREAD_STACK_MIN=2048 CONFIG_RAM_SIZE=33554432 diff --git a/boards/risc-v/qemu-rv/rv-virt/configs/citest64/defconfig b/boards/risc-v/qemu-rv/rv-virt/configs/citest64/defconfig index 90c9cb6b48269..4408b55cc3dd0 100644 --- a/boards/risc-v/qemu-rv/rv-virt/configs/citest64/defconfig +++ b/boards/risc-v/qemu-rv/rv-virt/configs/citest64/defconfig @@ -39,6 +39,7 @@ CONFIG_EXAMPLES_PIPE=y CONFIG_EXAMPLES_POPEN=y CONFIG_EXAMPLES_USRSOCKTEST=y CONFIG_FS_HOSTFS=y +CONFIG_FS_LINKS=y CONFIG_FS_PROCFS=y CONFIG_FS_TMPFS=y CONFIG_HAVE_CXX=y @@ -62,7 +63,6 @@ CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_READLINE=y CONFIG_PATH_INITIAL="/system/bin" CONFIG_PREALLOC_TIMERS=0 -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_RAM_SIZE=33554432 CONFIG_RAM_START=0x80000000 CONFIG_READLINE_CMD_HISTORY=y diff --git a/boards/risc-v/qemu-rv/rv-virt/configs/python/defconfig b/boards/risc-v/qemu-rv/rv-virt/configs/python/defconfig index 4a467c3eab5cf..3040231a60fab 100644 --- a/boards/risc-v/qemu-rv/rv-virt/configs/python/defconfig +++ b/boards/risc-v/qemu-rv/rv-virt/configs/python/defconfig @@ -56,6 +56,7 @@ CONFIG_FRAME_POINTER=y CONFIG_FS_FAT=y CONFIG_FS_FATTIME=y CONFIG_FS_HOSTFS=y +CONFIG_FS_LINKS=y CONFIG_FS_PROCFS=y CONFIG_FS_ROMFS=y CONFIG_FS_TMPFS=y @@ -112,7 +113,6 @@ CONFIG_NXPLAYER_HTTP_STREAMING_SUPPORT=y CONFIG_NXPLAYER_MAINTHREAD_STACKSIZE=3072 CONFIG_PATH_INITIAL="/system/bin" CONFIG_PIPES=y -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_RAM_SIZE=33554432 CONFIG_RAM_START=0x80000000 CONFIG_READLINE_CMD_HISTORY=y diff --git a/boards/sim/sim/sim/configs/adb/defconfig b/boards/sim/sim/sim/configs/adb/defconfig index e416bbdc30c68..d09f4a1e8b678 100644 --- a/boards/sim/sim/sim/configs/adb/defconfig +++ b/boards/sim/sim/sim/configs/adb/defconfig @@ -30,6 +30,7 @@ CONFIG_ETC_ROMFS=y CONFIG_ETC_ROMFSDEVNO=1 CONFIG_FSUTILS_PASSWD=y CONFIG_FSUTILS_PASSWD_READONLY=y +CONFIG_FS_LINKS=y CONFIG_FS_PROCFS=y CONFIG_FS_ROMFS=y CONFIG_FS_TMPFS=y @@ -55,7 +56,6 @@ CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_CONSOLE_LOGIN=y CONFIG_NSH_READLINE=y CONFIG_NSH_TELNET_LOGIN=y -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_PSEUDOTERM=y CONFIG_RAMLOG=y CONFIG_RAMLOG_SYSLOG=y diff --git a/boards/sim/sim/sim/configs/baromonitor/defconfig b/boards/sim/sim/sim/configs/baromonitor/defconfig index 9a662cc409cc3..b01c7b3263ebf 100644 --- a/boards/sim/sim/sim/configs/baromonitor/defconfig +++ b/boards/sim/sim/sim/configs/baromonitor/defconfig @@ -37,6 +37,7 @@ CONFIG_FAT_LFN=y CONFIG_FS_BINFS=y CONFIG_FS_FAT=y CONFIG_FS_HOSTFS=y +CONFIG_FS_LINKS=y CONFIG_FS_PROCFS=y CONFIG_FS_RAMMAP=y CONFIG_FS_ROMFS=y @@ -71,7 +72,6 @@ CONFIG_PATH_INITIAL="/bin" CONFIG_PIPES=y CONFIG_PSEUDOFS_ATTRIBUTES=y CONFIG_PSEUDOFS_FILE=y -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_READLINE_TABCOMPLETION=y CONFIG_RTC=y CONFIG_RTC_ARCH=y diff --git a/boards/sim/sim/sim/configs/citest/defconfig b/boards/sim/sim/sim/configs/citest/defconfig index 83f7008d23a9f..96f435aa99685 100644 --- a/boards/sim/sim/sim/configs/citest/defconfig +++ b/boards/sim/sim/sim/configs/citest/defconfig @@ -55,6 +55,7 @@ CONFIG_FS_BACKTRACE=8 CONFIG_FS_BINFS=y CONFIG_FS_FAT=y CONFIG_FS_HOSTFS=y +CONFIG_FS_LINKS=y CONFIG_FS_NAMED_SEMAPHORES=y CONFIG_FS_PROCFS=y CONFIG_FS_PROCFS_PROFILER=y @@ -111,7 +112,6 @@ CONFIG_PATH_INITIAL="/bin" CONFIG_PM=y CONFIG_PM_RUNTIME=y CONFIG_PSEUDOFS_ATTRIBUTES=y -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_PTHREAD_SPINLOCKS=y CONFIG_PTHREAD_STACK_MIN=2048 CONFIG_READLINE_TABCOMPLETION=y diff --git a/boards/sim/sim/sim/configs/crypto/defconfig b/boards/sim/sim/sim/configs/crypto/defconfig index f56bb4d5cfdfa..520fffa8e1ced 100644 --- a/boards/sim/sim/sim/configs/crypto/defconfig +++ b/boards/sim/sim/sim/configs/crypto/defconfig @@ -37,6 +37,7 @@ CONFIG_FSUTILS_PASSWD=y CONFIG_FSUTILS_PASSWD_READONLY=y CONFIG_FS_BINFS=y CONFIG_FS_FAT=y +CONFIG_FS_LINKS=y CONFIG_FS_PROCFS=y CONFIG_FS_RAMMAP=y CONFIG_FS_ROMFS=y @@ -60,7 +61,6 @@ CONFIG_MBEDTLS_SHA512_ALT=y CONFIG_NETUTILS_CODECS=y CONFIG_PATH_INITIAL="/bin" CONFIG_PSEUDOFS_ATTRIBUTES=y -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_READLINE_TABCOMPLETION=y CONFIG_SCHED_BACKTRACE=y CONFIG_SCHED_HAVE_PARENT=y diff --git a/boards/sim/sim/sim/configs/dropbear/defconfig b/boards/sim/sim/sim/configs/dropbear/defconfig index 0f151f46f81d4..fed9cf6f0766d 100644 --- a/boards/sim/sim/sim/configs/dropbear/defconfig +++ b/boards/sim/sim/sim/configs/dropbear/defconfig @@ -39,6 +39,7 @@ CONFIG_FSUTILS_PASSWD=y CONFIG_FSUTILS_PASSWD_PATH="/tmp/passwd" CONFIG_FS_BINFS=y CONFIG_FS_FAT=y +CONFIG_FS_LINKS=y CONFIG_FS_PROCFS=y CONFIG_FS_RAMMAP=y CONFIG_FS_ROMFS=y @@ -75,7 +76,6 @@ CONFIG_NSH_DROPBEAR=y CONFIG_NSH_FILE_APPS=y CONFIG_PATH_INITIAL="/bin" CONFIG_PSEUDOFS_ATTRIBUTES=y -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_PSEUDOTERM=y CONFIG_READLINE_TABCOMPLETION=y CONFIG_SCHED_BACKTRACE=y diff --git a/boards/sim/sim/sim/configs/login/defconfig b/boards/sim/sim/sim/configs/login/defconfig index 972b05ba1f242..94da7ca3d9e91 100644 --- a/boards/sim/sim/sim/configs/login/defconfig +++ b/boards/sim/sim/sim/configs/login/defconfig @@ -37,6 +37,7 @@ CONFIG_FSUTILS_PASSWD=y CONFIG_FSUTILS_PASSWD_READONLY=y CONFIG_FS_BINFS=y CONFIG_FS_FAT=y +CONFIG_FS_LINKS=y CONFIG_FS_PROCFS=y CONFIG_FS_RAMMAP=y CONFIG_FS_ROMFS=y @@ -61,7 +62,6 @@ CONFIG_NSH_MOTD_STRING="This is an example NuttX Message Of The Day (MOTD). Have CONFIG_NSH_READLINE=y CONFIG_PATH_INITIAL="/bin" CONFIG_PSEUDOFS_ATTRIBUTES=y -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_READLINE_TABCOMPLETION=y CONFIG_SCHED_BACKTRACE=y CONFIG_SCHED_HAVE_PARENT=y diff --git a/boards/sim/sim/sim/configs/lua/defconfig b/boards/sim/sim/sim/configs/lua/defconfig index b86a526165e95..3a74b98aec662 100644 --- a/boards/sim/sim/sim/configs/lua/defconfig +++ b/boards/sim/sim/sim/configs/lua/defconfig @@ -31,6 +31,7 @@ CONFIG_FAT_LCNAMES=y CONFIG_FAT_LFN=y CONFIG_FS_BINFS=y CONFIG_FS_FAT=y +CONFIG_FS_LINKS=y CONFIG_FS_PROCFS=y CONFIG_FS_RAMMAP=y CONFIG_FS_ROMFS=y @@ -62,7 +63,6 @@ CONFIG_NSH_READLINE=y CONFIG_PATH_INITIAL="/bin" CONFIG_PIPES=y CONFIG_PSEUDOFS_ATTRIBUTES=y -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_READLINE_CMD_HISTORY=y CONFIG_READLINE_TABCOMPLETION=y CONFIG_SCHED_HAVE_PARENT=y diff --git a/boards/sim/sim/sim/configs/matter/defconfig b/boards/sim/sim/sim/configs/matter/defconfig index 479a97c231d29..ceaadb248735c 100644 --- a/boards/sim/sim/sim/configs/matter/defconfig +++ b/boards/sim/sim/sim/configs/matter/defconfig @@ -39,6 +39,7 @@ CONFIG_FAT_LFN=y CONFIG_FS_BINFS=y CONFIG_FS_FAT=y CONFIG_FS_HOSTFS=y +CONFIG_FS_LINKS=y CONFIG_FS_PROCFS=y CONFIG_FS_RAMMAP=y CONFIG_FS_ROMFS=y @@ -102,7 +103,6 @@ CONFIG_NSH_MOTD_STRING="This is an example NuttX Message Of The Day (MOTD). Have CONFIG_NSH_READLINE=y CONFIG_PATH_INITIAL="/bin" CONFIG_PSEUDOFS_ATTRIBUTES=y -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_READLINE_TABCOMPLETION=y CONFIG_SCHED_BACKTRACE=y CONFIG_SCHED_HAVE_PARENT=y diff --git a/boards/sim/sim/sim/configs/minmea/defconfig b/boards/sim/sim/sim/configs/minmea/defconfig index 6f7136423cd25..6f005a92dee51 100644 --- a/boards/sim/sim/sim/configs/minmea/defconfig +++ b/boards/sim/sim/sim/configs/minmea/defconfig @@ -38,6 +38,7 @@ CONFIG_FSUTILS_PASSWD=y CONFIG_FSUTILS_PASSWD_READONLY=y CONFIG_FS_BINFS=y CONFIG_FS_FAT=y +CONFIG_FS_LINKS=y CONFIG_FS_PROCFS=y CONFIG_FS_RAMMAP=y CONFIG_FS_ROMFS=y @@ -63,7 +64,6 @@ CONFIG_NSH_MOTD_STRING="This is an example NuttX Message Of The Day (MOTD). Have CONFIG_NSH_READLINE=y CONFIG_PATH_INITIAL="/bin" CONFIG_PSEUDOFS_ATTRIBUTES=y -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_READLINE_TABCOMPLETION=y CONFIG_SCHED_BACKTRACE=y CONFIG_SCHED_HAVE_PARENT=y diff --git a/boards/sim/sim/sim/configs/mnemofs/defconfig b/boards/sim/sim/sim/configs/mnemofs/defconfig index 60c1f2aff81ac..8b8b085be3c79 100644 --- a/boards/sim/sim/sim/configs/mnemofs/defconfig +++ b/boards/sim/sim/sim/configs/mnemofs/defconfig @@ -38,6 +38,7 @@ CONFIG_FSUTILS_PASSWD=y CONFIG_FSUTILS_PASSWD_READONLY=y CONFIG_FS_BINFS=y CONFIG_FS_FAT=y +CONFIG_FS_LINKS=y CONFIG_FS_MNEMOFS=y CONFIG_FS_PROCFS=y CONFIG_FS_RAMMAP=y @@ -71,7 +72,6 @@ CONFIG_NSH_MOTD_STRING="This is an example NuttX Message Of The Day (MOTD). Have CONFIG_NSH_READLINE=y CONFIG_PATH_INITIAL="/bin" CONFIG_PSEUDOFS_ATTRIBUTES=y -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_READLINE_TABCOMPLETION=y CONFIG_SCHED_BACKTRACE=y CONFIG_SCHED_HAVE_PARENT=y diff --git a/boards/sim/sim/sim/configs/nand/defconfig b/boards/sim/sim/sim/configs/nand/defconfig index 0d5c92df27654..470e530843000 100644 --- a/boards/sim/sim/sim/configs/nand/defconfig +++ b/boards/sim/sim/sim/configs/nand/defconfig @@ -38,6 +38,7 @@ CONFIG_FSUTILS_PASSWD=y CONFIG_FSUTILS_PASSWD_READONLY=y CONFIG_FS_BINFS=y CONFIG_FS_FAT=y +CONFIG_FS_LINKS=y CONFIG_FS_PROCFS=y CONFIG_FS_RAMMAP=y CONFIG_FS_ROMFS=y @@ -70,7 +71,6 @@ CONFIG_NSH_MOTD_STRING="This is an example NuttX Message Of The Day (MOTD). Have CONFIG_NSH_READLINE=y CONFIG_PATH_INITIAL="/bin" CONFIG_PSEUDOFS_ATTRIBUTES=y -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_READLINE_TABCOMPLETION=y CONFIG_SCHED_BACKTRACE=y CONFIG_SCHED_HAVE_PARENT=y diff --git a/boards/sim/sim/sim/configs/nsh/defconfig b/boards/sim/sim/sim/configs/nsh/defconfig index c28c4efe7fa4f..a54528e94a965 100644 --- a/boards/sim/sim/sim/configs/nsh/defconfig +++ b/boards/sim/sim/sim/configs/nsh/defconfig @@ -34,6 +34,7 @@ CONFIG_FAT_LFN=y CONFIG_FS_BINFS=y CONFIG_FS_FAT=y CONFIG_FS_HOSTFS=y +CONFIG_FS_LINKS=y CONFIG_FS_PROCFS=y CONFIG_FS_RAMMAP=y CONFIG_FS_ROMFS=y @@ -58,7 +59,6 @@ CONFIG_PATH_INITIAL="/bin" CONFIG_PIPES=y CONFIG_PSEUDOFS_ATTRIBUTES=y CONFIG_PSEUDOFS_FILE=y -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_READLINE_CMD_HISTORY=y CONFIG_READLINE_EDIT_EMACS=y CONFIG_READLINE_TABCOMPLETION=y diff --git a/boards/sim/sim/sim/configs/nsh2/defconfig b/boards/sim/sim/sim/configs/nsh2/defconfig index c44d9f32031dd..f9a8789e783bf 100644 --- a/boards/sim/sim/sim/configs/nsh2/defconfig +++ b/boards/sim/sim/sim/configs/nsh2/defconfig @@ -34,6 +34,7 @@ CONFIG_FAT_LFN=y CONFIG_FS_BINFS=y CONFIG_FS_FAT=y CONFIG_FS_HOSTFS=y +CONFIG_FS_LINKS=y CONFIG_FS_PROCFS=y CONFIG_FS_RAMMAP=y CONFIG_FS_ROMFS=y @@ -58,7 +59,6 @@ CONFIG_PATH_INITIAL="/bin" CONFIG_PIPES=y CONFIG_PSEUDOFS_ATTRIBUTES=y CONFIG_PSEUDOFS_FILE=y -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_READLINE_TABCOMPLETION=y CONFIG_SCHED_BACKTRACE=y CONFIG_SCHED_EVENTS=y diff --git a/boards/sim/sim/sim/configs/nxcamera/defconfig b/boards/sim/sim/sim/configs/nxcamera/defconfig index f2e7ed1a7903b..4b0de453abdb2 100644 --- a/boards/sim/sim/sim/configs/nxcamera/defconfig +++ b/boards/sim/sim/sim/configs/nxcamera/defconfig @@ -30,6 +30,7 @@ CONFIG_FAT_LCNAMES=y CONFIG_FAT_LFN=y CONFIG_FS_BINFS=y CONFIG_FS_FAT=y +CONFIG_FS_LINKS=y CONFIG_FS_PROCFS=y CONFIG_FS_RAMMAP=y CONFIG_FS_ROMFS=y @@ -51,7 +52,6 @@ CONFIG_NSH_FILE_APPS=y CONFIG_NSH_READLINE=y CONFIG_PATH_INITIAL="/bin" CONFIG_PSEUDOFS_ATTRIBUTES=y -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_READLINE_TABCOMPLETION=y CONFIG_SCHED_BACKTRACE=y CONFIG_SCHED_HAVE_PARENT=y diff --git a/boards/sim/sim/sim/configs/nxdoom/defconfig b/boards/sim/sim/sim/configs/nxdoom/defconfig index f2daec575db0d..8c642b66a480d 100644 --- a/boards/sim/sim/sim/configs/nxdoom/defconfig +++ b/boards/sim/sim/sim/configs/nxdoom/defconfig @@ -35,6 +35,7 @@ CONFIG_FAT_LFN=y CONFIG_FS_BINFS=y CONFIG_FS_FAT=y CONFIG_FS_HOSTFS=y +CONFIG_FS_LINKS=y CONFIG_FS_PROCFS=y CONFIG_FS_RAMMAP=y CONFIG_FS_ROMFS=y @@ -63,7 +64,6 @@ CONFIG_PATH_INITIAL="/bin" CONFIG_PIPES=y CONFIG_PSEUDOFS_ATTRIBUTES=y CONFIG_PSEUDOFS_FILE=y -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_READLINE_TABCOMPLETION=y CONFIG_SCHED_BACKTRACE=y CONFIG_SCHED_EVENTS=y diff --git a/boards/sim/sim/sim/configs/nxmbrtu/defconfig b/boards/sim/sim/sim/configs/nxmbrtu/defconfig index d25881b23fd59..d879e9d62654b 100644 --- a/boards/sim/sim/sim/configs/nxmbrtu/defconfig +++ b/boards/sim/sim/sim/configs/nxmbrtu/defconfig @@ -22,6 +22,7 @@ CONFIG_DEBUG_SYMBOLS=y CONFIG_DEV_LOOP=y CONFIG_EXAMPLES_NXMBSERVER=y CONFIG_FS_BINFS=y +CONFIG_FS_LINKS=y CONFIG_FS_PROCFS=y CONFIG_HAVE_CXXINITIALIZE=y CONFIG_IDLETHREAD_STACKSIZE=4096 @@ -40,7 +41,6 @@ CONFIG_PATH_INITIAL="/bin" CONFIG_PIPES=y CONFIG_PSEUDOFS_ATTRIBUTES=y CONFIG_PSEUDOFS_FILE=y -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_READLINE_CMD_HISTORY=y CONFIG_READLINE_TABCOMPLETION=y CONFIG_SCHED_BACKTRACE=y diff --git a/boards/sim/sim/sim/configs/posix_test/defconfig b/boards/sim/sim/sim/configs/posix_test/defconfig index fb0836dbc63d9..29267fceb3b9a 100644 --- a/boards/sim/sim/sim/configs/posix_test/defconfig +++ b/boards/sim/sim/sim/configs/posix_test/defconfig @@ -39,6 +39,7 @@ CONFIG_FS_AIO=y CONFIG_FS_BINFS=y CONFIG_FS_FAT=y CONFIG_FS_HOSTFS=y +CONFIG_FS_LINKS=y CONFIG_FS_NAMED_SEMAPHORES=y CONFIG_FS_PROCFS=y CONFIG_FS_RAMMAP=y @@ -72,7 +73,6 @@ CONFIG_NSH_READLINE=y CONFIG_PATH_INITIAL="/bin" CONFIG_PIPES=y CONFIG_PSEUDOFS_ATTRIBUTES=y -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_PTHREAD_MUTEX_TYPES=y CONFIG_PTHREAD_SPINLOCKS=y CONFIG_READLINE_TABCOMPLETION=y diff --git a/boards/sim/sim/sim/configs/quickjs/defconfig b/boards/sim/sim/sim/configs/quickjs/defconfig index 74a012147419b..a8e07f4a592fc 100644 --- a/boards/sim/sim/sim/configs/quickjs/defconfig +++ b/boards/sim/sim/sim/configs/quickjs/defconfig @@ -28,6 +28,7 @@ CONFIG_FAT_LCNAMES=y CONFIG_FAT_LFN=y CONFIG_FS_BINFS=y CONFIG_FS_FAT=y +CONFIG_FS_LINKS=y CONFIG_FS_PROCFS=y CONFIG_FS_RAMMAP=y CONFIG_FS_ROMFS=y @@ -54,7 +55,6 @@ CONFIG_PATH_INITIAL="/bin" CONFIG_PIPES=y CONFIG_PSEUDOFS_ATTRIBUTES=y CONFIG_PSEUDOFS_FILE=y -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_READLINE_TABCOMPLETION=y CONFIG_SCHED_BACKTRACE=y CONFIG_SCHED_EVENTS=y diff --git a/boards/sim/sim/sim/configs/rtptools/defconfig b/boards/sim/sim/sim/configs/rtptools/defconfig index 4e73f76b9881c..be7bd40661430 100644 --- a/boards/sim/sim/sim/configs/rtptools/defconfig +++ b/boards/sim/sim/sim/configs/rtptools/defconfig @@ -24,6 +24,7 @@ CONFIG_EXAMPLES_TCPBLASTER=y CONFIG_EXAMPLES_TCPECHO=y CONFIG_FS_BINFS=y CONFIG_FS_HOSTFS=y +CONFIG_FS_LINKS=y CONFIG_FS_LITTLEFS=y CONFIG_FS_PROCFS=y CONFIG_FS_TMPFS=y @@ -79,7 +80,6 @@ CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_FILE_APPS=y CONFIG_NSH_READLINE=y CONFIG_PREALLOC_TIMERS=4 -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_PSEUDOTERM=y CONFIG_PTHREAD_MUTEX_TYPES=y CONFIG_RAMMTD=y diff --git a/boards/sim/sim/sim/configs/rust/defconfig b/boards/sim/sim/sim/configs/rust/defconfig index 5332d8bb60a95..cb35a9b35061e 100644 --- a/boards/sim/sim/sim/configs/rust/defconfig +++ b/boards/sim/sim/sim/configs/rust/defconfig @@ -37,6 +37,7 @@ CONFIG_FSUTILS_PASSWD=y CONFIG_FSUTILS_PASSWD_READONLY=y CONFIG_FS_BINFS=y CONFIG_FS_FAT=y +CONFIG_FS_LINKS=y CONFIG_FS_PROCFS=y CONFIG_FS_RAMMAP=y CONFIG_FS_ROMFS=y @@ -60,7 +61,6 @@ CONFIG_NSH_MOTD_STRING="This is an example NuttX Message Of The Day (MOTD). Have CONFIG_NSH_READLINE=y CONFIG_PATH_INITIAL="/bin" CONFIG_PSEUDOFS_ATTRIBUTES=y -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_READLINE_TABCOMPLETION=y CONFIG_SCHED_HAVE_PARENT=y CONFIG_SCHED_WAITPID=y diff --git a/boards/sim/sim/sim/configs/segger/defconfig b/boards/sim/sim/sim/configs/segger/defconfig index 6341241e71f4f..aec82117a8a16 100644 --- a/boards/sim/sim/sim/configs/segger/defconfig +++ b/boards/sim/sim/sim/configs/segger/defconfig @@ -35,6 +35,7 @@ CONFIG_FAT_LCNAMES=y CONFIG_FAT_LFN=y CONFIG_FS_BINFS=y CONFIG_FS_FAT=y +CONFIG_FS_LINKS=y CONFIG_FS_PROCFS=y CONFIG_FS_RAMMAP=y CONFIG_FS_ROMFS=y @@ -58,7 +59,6 @@ CONFIG_NSH_MOTD_STRING="This is an example NuttX Message Of The Day (MOTD). Have CONFIG_NSH_READLINE=y CONFIG_PATH_INITIAL="/bin" CONFIG_PSEUDOFS_ATTRIBUTES=y -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_READLINE_TABCOMPLETION=y CONFIG_SCHED_CRITMONITOR=y CONFIG_SCHED_HAVE_PARENT=y diff --git a/boards/sim/sim/sim/configs/smartfs/defconfig b/boards/sim/sim/sim/configs/smartfs/defconfig index 537c9d89577fc..d580009a75bfa 100644 --- a/boards/sim/sim/sim/configs/smartfs/defconfig +++ b/boards/sim/sim/sim/configs/smartfs/defconfig @@ -35,6 +35,7 @@ CONFIG_EXAMPLES_HELLO=y CONFIG_FSUTILS_PASSWD=y CONFIG_FSUTILS_PASSWD_READONLY=y CONFIG_FS_BINFS=y +CONFIG_FS_LINKS=y CONFIG_FS_PROCFS=y CONFIG_FS_RAMMAP=y CONFIG_FS_ROMFS=y @@ -57,7 +58,6 @@ CONFIG_NSH_MOTD=y CONFIG_NSH_MOTD_STRING="This is an example NuttX Message Of The Day (MOTD). Have fun!" CONFIG_NSH_READLINE=y CONFIG_PSEUDOFS_ATTRIBUTES=y -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_QSPI_FLASH=y CONFIG_READLINE_TABCOMPLETION=y CONFIG_SCHED_HAVE_PARENT=y diff --git a/boards/sim/sim/sim/configs/sqlite/defconfig b/boards/sim/sim/sim/configs/sqlite/defconfig index 64f86e5372caf..1752c430f140a 100644 --- a/boards/sim/sim/sim/configs/sqlite/defconfig +++ b/boards/sim/sim/sim/configs/sqlite/defconfig @@ -30,6 +30,7 @@ CONFIG_FAT_LFN=y CONFIG_FS_FAT=y CONFIG_FS_HOSTFS=y CONFIG_FS_LARGEFILE=y +CONFIG_FS_LINKS=y CONFIG_FS_LOCK_BUCKET_SIZE=4 CONFIG_FS_PROCFS=y CONFIG_FS_ROMFS=y @@ -48,7 +49,6 @@ CONFIG_NSH_FILE_APPS=y CONFIG_NSH_READLINE=y CONFIG_PATH_INITIAL="/bin" CONFIG_PIPES=y -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_PTHREAD_MUTEX_TYPES=y CONFIG_READLINE_TABCOMPLETION=y CONFIG_SCHED_HAVE_PARENT=y diff --git a/boards/sim/sim/sim/configs/tcpblaster/defconfig b/boards/sim/sim/sim/configs/tcpblaster/defconfig index b21851917af0a..57b1f38d2a9c7 100644 --- a/boards/sim/sim/sim/configs/tcpblaster/defconfig +++ b/boards/sim/sim/sim/configs/tcpblaster/defconfig @@ -24,6 +24,7 @@ CONFIG_EXAMPLES_TCPBLASTER=y CONFIG_EXAMPLES_TCPECHO=y CONFIG_FS_BINFS=y CONFIG_FS_HOSTFS=y +CONFIG_FS_LINKS=y CONFIG_FS_LITTLEFS=y CONFIG_FS_PROCFS=y CONFIG_FS_TMPFS=y @@ -78,7 +79,6 @@ CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_FILE_APPS=y CONFIG_NSH_READLINE=y CONFIG_PREALLOC_TIMERS=4 -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_PSEUDOTERM=y CONFIG_PTHREAD_MUTEX_TYPES=y CONFIG_RAMMTD=y diff --git a/boards/sim/sim/sim/configs/toybox/defconfig b/boards/sim/sim/sim/configs/toybox/defconfig index b8a6c76c23267..e14bc604e7d6e 100644 --- a/boards/sim/sim/sim/configs/toybox/defconfig +++ b/boards/sim/sim/sim/configs/toybox/defconfig @@ -34,6 +34,7 @@ CONFIG_FAT_LFN=y CONFIG_FS_BINFS=y CONFIG_FS_FAT=y CONFIG_FS_HOSTFS=y +CONFIG_FS_LINKS=y CONFIG_FS_PROCFS=y CONFIG_FS_RAMMAP=y CONFIG_FS_ROMFS=y @@ -56,7 +57,6 @@ CONFIG_PATH_INITIAL="/bin" CONFIG_PIPES=y CONFIG_PSEUDOFS_ATTRIBUTES=y CONFIG_PSEUDOFS_FILE=y -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_READLINE_CMD_HISTORY=y CONFIG_READLINE_EDIT_EMACS=y CONFIG_READLINE_TABCOMPLETION=y diff --git a/boards/sim/sim/sim/configs/txmorse/defconfig b/boards/sim/sim/sim/configs/txmorse/defconfig index 91b87107cabde..2a99389945a42 100644 --- a/boards/sim/sim/sim/configs/txmorse/defconfig +++ b/boards/sim/sim/sim/configs/txmorse/defconfig @@ -36,6 +36,7 @@ CONFIG_FAT_LFN=y CONFIG_FS_BINFS=y CONFIG_FS_FAT=y CONFIG_FS_HOSTFS=y +CONFIG_FS_LINKS=y CONFIG_FS_PROCFS=y CONFIG_FS_RAMMAP=y CONFIG_FS_ROMFS=y @@ -60,7 +61,6 @@ CONFIG_PATH_INITIAL="/bin" CONFIG_PIPES=y CONFIG_PSEUDOFS_ATTRIBUTES=y CONFIG_PSEUDOFS_FILE=y -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_READLINE_TABCOMPLETION=y CONFIG_RTC=y CONFIG_RTC_ARCH=y diff --git a/boards/sim/sim/sim/configs/usbdev/defconfig b/boards/sim/sim/sim/configs/usbdev/defconfig index 8328fdfb6bcaf..1ea813309e198 100644 --- a/boards/sim/sim/sim/configs/usbdev/defconfig +++ b/boards/sim/sim/sim/configs/usbdev/defconfig @@ -32,6 +32,7 @@ CONFIG_DEBUG_USB=y CONFIG_DEBUG_USB_ERROR=y CONFIG_DEBUG_USB_WARN=y CONFIG_EXAMPLES_DHCPD=y +CONFIG_FS_LINKS=y CONFIG_FS_PROCFS=y CONFIG_FS_TMPFS=y CONFIG_ICMPv6_AUTOCONF_RDNSS=y @@ -86,7 +87,6 @@ CONFIG_NET_UDP_NOTIFIER=y CONFIG_NET_UDP_WRITE_BUFFERS=y CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_READLINE=y -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_PSEUDOTERM=y CONFIG_READLINE_CMD_HISTORY=y CONFIG_READLINE_TABCOMPLETION=y diff --git a/boards/sim/sim/sim/configs/usbhost/defconfig b/boards/sim/sim/sim/configs/usbhost/defconfig index afdde97ade76c..991413a5672bc 100644 --- a/boards/sim/sim/sim/configs/usbhost/defconfig +++ b/boards/sim/sim/sim/configs/usbhost/defconfig @@ -22,6 +22,7 @@ CONFIG_DEBUG_USB=y CONFIG_DEBUG_USB_ERROR=y CONFIG_DEBUG_USB_INFO=y CONFIG_DEBUG_USB_WARN=y +CONFIG_FS_LINKS=y CONFIG_FS_PROCFS=y CONFIG_FS_TMPFS=y CONFIG_INIT_ENTRYPOINT="nsh_main" @@ -29,7 +30,6 @@ CONFIG_LIBC_DLFCN=y CONFIG_LIBC_EXECFUNCS=y CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_READLINE=y -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_PSEUDOTERM=y CONFIG_READLINE_CMD_HISTORY=y CONFIG_READLINE_TABCOMPLETION=y diff --git a/boards/sim/sim/sim/configs/watchdog-notifier/defconfig b/boards/sim/sim/sim/configs/watchdog-notifier/defconfig index df6350b258c11..2ba1f883faf61 100644 --- a/boards/sim/sim/sim/configs/watchdog-notifier/defconfig +++ b/boards/sim/sim/sim/configs/watchdog-notifier/defconfig @@ -31,6 +31,7 @@ CONFIG_FAT_LFN=y CONFIG_FS_BINFS=y CONFIG_FS_FAT=y CONFIG_FS_HOSTFS=y +CONFIG_FS_LINKS=y CONFIG_FS_PROCFS=y CONFIG_FS_RAMMAP=y CONFIG_FS_ROMFS=y @@ -54,7 +55,6 @@ CONFIG_PATH_INITIAL="/bin" CONFIG_PIPES=y CONFIG_PSEUDOFS_ATTRIBUTES=y CONFIG_PSEUDOFS_FILE=y -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_READLINE_TABCOMPLETION=y CONFIG_RTC=y CONFIG_RTC_ARCH=y diff --git a/boards/sim/sim/sim/configs/zipfs/defconfig b/boards/sim/sim/sim/configs/zipfs/defconfig index b169fb0bf42fb..16a5988213ca4 100644 --- a/boards/sim/sim/sim/configs/zipfs/defconfig +++ b/boards/sim/sim/sim/configs/zipfs/defconfig @@ -33,6 +33,7 @@ CONFIG_FAT_LFN=y CONFIG_FS_BINFS=y CONFIG_FS_FAT=y CONFIG_FS_HOSTFS=y +CONFIG_FS_LINKS=y CONFIG_FS_PROCFS=y CONFIG_FS_RAMMAP=y CONFIG_FS_ROMFS=y @@ -58,7 +59,6 @@ CONFIG_NSH_MOTD_STRING="This is an example NuttX Message Of The Day (MOTD). Have CONFIG_NSH_READLINE=y CONFIG_PATH_INITIAL="/bin" CONFIG_PSEUDOFS_ATTRIBUTES=y -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_READLINE_TABCOMPLETION=y CONFIG_SCHED_BACKTRACE=y CONFIG_SCHED_HAVE_PARENT=y diff --git a/boards/x86_64/qemu/qemu-intel64/configs/nxterm/defconfig b/boards/x86_64/qemu/qemu-intel64/configs/nxterm/defconfig index 36657169126b5..44e58c48ab910 100644 --- a/boards/x86_64/qemu/qemu-intel64/configs/nxterm/defconfig +++ b/boards/x86_64/qemu/qemu-intel64/configs/nxterm/defconfig @@ -71,6 +71,7 @@ CONFIG_EXAMPLES_WGET=y CONFIG_EXPERIMENTAL=y CONFIG_FS_FAT=y CONFIG_FS_LARGEFILE=y +CONFIG_FS_LINKS=y CONFIG_FS_PROCFS=y CONFIG_FS_ROMFS=y CONFIG_FS_TMPFS=y @@ -134,7 +135,6 @@ CONFIG_PCI=y CONFIG_PCI_MSIX=y CONFIG_PREALLOC_CHILDSTATUS=16 CONFIG_PRIORITY_INHERITANCE=y -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_PSEUDOTERM=y CONFIG_PTHREAD_MUTEX_TYPES=y CONFIG_PTHREAD_STACK_MIN=4194304 diff --git a/boards/x86_64/qemu/qemu-intel64/configs/python/defconfig b/boards/x86_64/qemu/qemu-intel64/configs/python/defconfig index a054dc0ff89d5..a109a6ebb6552 100644 --- a/boards/x86_64/qemu/qemu-intel64/configs/python/defconfig +++ b/boards/x86_64/qemu/qemu-intel64/configs/python/defconfig @@ -39,6 +39,7 @@ CONFIG_DEV_URANDOM=y CONFIG_EVENT_FD=y CONFIG_EXPERIMENTAL=y CONFIG_FS_LARGEFILE=y +CONFIG_FS_LINKS=y CONFIG_FS_PROCFS=y CONFIG_FS_ROMFS=y CONFIG_FS_TMPFS=y @@ -83,7 +84,6 @@ CONFIG_PCI_MSIX=y CONFIG_PIPES=y CONFIG_PREALLOC_CHILDSTATUS=16 CONFIG_PRIORITY_INHERITANCE=y -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_PTHREAD_MUTEX_TYPES=y CONFIG_PTHREAD_STACK_MIN=4194304 CONFIG_RAM_SIZE=268435456 diff --git a/boards/xtensa/esp32s3/esp32s3-devkit/configs/mbedtls/defconfig b/boards/xtensa/esp32s3/esp32s3-devkit/configs/mbedtls/defconfig index 2c816a4a98440..56ec6f50a4f19 100644 --- a/boards/xtensa/esp32s3/esp32s3-devkit/configs/mbedtls/defconfig +++ b/boards/xtensa/esp32s3/esp32s3-devkit/configs/mbedtls/defconfig @@ -39,6 +39,7 @@ CONFIG_ESP32S3_UART0=y CONFIG_ESPRESSIF_WIFI=y CONFIG_EXAMPLES_RANDOM=y CONFIG_FS_LARGEFILE=y +CONFIG_FS_LINKS=y CONFIG_FS_LITTLEFS=y CONFIG_FS_LITTLEFS_MULTI_VERSION=y CONFIG_FS_LITTLEFS_VERSION="v2.10.1" @@ -79,7 +80,6 @@ CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_READLINE=y CONFIG_POSIX_SPAWN_DEFAULT_STACKSIZE=2048 CONFIG_PREALLOC_TIMERS=4 -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_PTHREAD_MUTEX_TYPES=y CONFIG_RAM_SIZE=114688 CONFIG_RAM_START=0x20000000 diff --git a/boards/xtensa/esp32s3/esp32s3-devkit/configs/python/defconfig b/boards/xtensa/esp32s3/esp32s3-devkit/configs/python/defconfig index 85404bfaadce6..492ba0fd835d0 100644 --- a/boards/xtensa/esp32s3/esp32s3-devkit/configs/python/defconfig +++ b/boards/xtensa/esp32s3/esp32s3-devkit/configs/python/defconfig @@ -44,6 +44,7 @@ CONFIG_EVENT_FD=y CONFIG_EXAMPLES_WGET=y CONFIG_EXAMPLES_WS2812=y CONFIG_EXPERIMENTAL=y +CONFIG_FS_LINKS=y CONFIG_FS_PROCFS=y CONFIG_FS_ROMFS=y CONFIG_FS_TMPFS=y @@ -86,7 +87,6 @@ CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_READLINE=y CONFIG_PIPES=y CONFIG_PREALLOC_TIMERS=4 -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_PTHREAD_MUTEX_TYPES=y CONFIG_RAM_SIZE=114688 CONFIG_RAM_START=0x20000000 diff --git a/boards/xtensa/esp32s3/esp32s3-devkit/configs/qemu_debug/defconfig b/boards/xtensa/esp32s3/esp32s3-devkit/configs/qemu_debug/defconfig index 38ffc83b05fcd..87eb5032e9a44 100644 --- a/boards/xtensa/esp32s3/esp32s3-devkit/configs/qemu_debug/defconfig +++ b/boards/xtensa/esp32s3/esp32s3-devkit/configs/qemu_debug/defconfig @@ -38,6 +38,7 @@ CONFIG_ESP32S3_UART0=y CONFIG_EXAMPLES_RANDOM=y CONFIG_FS_HOSTFS=y CONFIG_FS_LARGEFILE=y +CONFIG_FS_LINKS=y CONFIG_FS_LITTLEFS=y CONFIG_FS_PROCFS=y CONFIG_HOST_MACOS=y @@ -72,7 +73,6 @@ CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_READLINE=y CONFIG_POSIX_SPAWN_DEFAULT_STACKSIZE=2048 CONFIG_PREALLOC_TIMERS=4 -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_PTHREAD_MUTEX_TYPES=y CONFIG_RAM_SIZE=114688 CONFIG_RAM_START=0x20000000 diff --git a/boards/xtensa/esp32s3/esp32s3-devkit/configs/qemu_toywasm/defconfig b/boards/xtensa/esp32s3/esp32s3-devkit/configs/qemu_toywasm/defconfig index 87eb706a6368b..dc293926461bd 100644 --- a/boards/xtensa/esp32s3/esp32s3-devkit/configs/qemu_toywasm/defconfig +++ b/boards/xtensa/esp32s3/esp32s3-devkit/configs/qemu_toywasm/defconfig @@ -38,6 +38,7 @@ CONFIG_ESP32S3_UART0=y CONFIG_EXAMPLES_RANDOM=y CONFIG_FS_HOSTFS=y CONFIG_FS_LARGEFILE=y +CONFIG_FS_LINKS=y CONFIG_FS_LITTLEFS=y CONFIG_FS_PROCFS=y CONFIG_HOST_MACOS=y @@ -73,7 +74,6 @@ CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_READLINE=y CONFIG_POSIX_SPAWN_DEFAULT_STACKSIZE=2048 CONFIG_PREALLOC_TIMERS=4 -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_PTHREAD_MUTEX_TYPES=y CONFIG_RAM_SIZE=114688 CONFIG_RAM_START=0x20000000 diff --git a/boards/xtensa/esp32s3/esp32s3-devkit/configs/toywasm/defconfig b/boards/xtensa/esp32s3/esp32s3-devkit/configs/toywasm/defconfig index 116a4a872413f..dede31cf6e8e6 100644 --- a/boards/xtensa/esp32s3/esp32s3-devkit/configs/toywasm/defconfig +++ b/boards/xtensa/esp32s3/esp32s3-devkit/configs/toywasm/defconfig @@ -37,6 +37,7 @@ CONFIG_ESP32S3_UART0=y CONFIG_ESPRESSIF_WIFI=y CONFIG_EXAMPLES_RANDOM=y CONFIG_FS_LARGEFILE=y +CONFIG_FS_LINKS=y CONFIG_FS_LITTLEFS=y CONFIG_FS_LITTLEFS_MULTI_VERSION=y CONFIG_FS_LITTLEFS_VERSION="v2.10.1" @@ -72,7 +73,6 @@ CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_READLINE=y CONFIG_POSIX_SPAWN_DEFAULT_STACKSIZE=2048 CONFIG_PREALLOC_TIMERS=4 -CONFIG_PSEUDOFS_SOFTLINKS=y CONFIG_PTHREAD_MUTEX_TYPES=y CONFIG_RAM_SIZE=114688 CONFIG_RAM_START=0x20000000 diff --git a/fs/Kconfig b/fs/Kconfig index db8e7ded3100c..b2aef67bb81a0 100644 --- a/fs/Kconfig +++ b/fs/Kconfig @@ -115,7 +115,7 @@ config FS_PERMISSION comment "UNIX filesystem permission support requires SCHED_USER_IDENTITY=y, PSEUDOFS_ATTRIBUTES=y and DISABLE_PSEUDOFS_OPERATIONS=n" depends on !SCHED_USER_IDENTITY || !PSEUDOFS_ATTRIBUTES || DISABLE_PSEUDOFS_OPERATIONS -config PSEUDOFS_SOFTLINKS +config FS_LINKS bool "Pseudo-filesystem soft links" default n depends on !DISABLE_PSEUDOFS_OPERATIONS diff --git a/fs/inode/fs_inodefree.c b/fs/inode/fs_inodefree.c index 7b7fc314c8597..517eb41046219 100644 --- a/fs/inode/fs_inodefree.c +++ b/fs/inode/fs_inodefree.c @@ -53,7 +53,7 @@ void inode_free(FAR struct inode *inode) if (inode != NULL) { -#ifdef CONFIG_PSEUDOFS_SOFTLINKS +#ifdef CONFIG_FS_LINKS /* Symbol links should never have peers or children */ DEBUGASSERT(!INODE_IS_SOFTLINK(inode) || @@ -65,7 +65,7 @@ void inode_free(FAR struct inode *inode) inode_free(inode->i_peer); inode_free(inode->i_child); -#ifdef CONFIG_PSEUDOFS_SOFTLINKS +#ifdef CONFIG_FS_LINKS /* If the inode is a symbolic link, the free the path to the linked * entity. */ diff --git a/fs/inode/fs_inoderemove.c b/fs/inode/fs_inoderemove.c index aad079325e511..064d4a7ccfe6e 100644 --- a/fs/inode/fs_inoderemove.c +++ b/fs/inode/fs_inoderemove.c @@ -120,7 +120,7 @@ static FAR struct inode *inode_unlink(FAR const char *path) inode->i_peer = NULL; inode->i_parent = NULL; atomic_sub(&inode->i_crefs, 1); -#ifdef CONFIG_PSEUDOFS_SOFTLINKS +#ifdef CONFIG_FS_LINKS if (INODE_IS_HARDLINK(inode)) { FAR struct inode *target; diff --git a/fs/inode/fs_inodesearch.c b/fs/inode/fs_inodesearch.c index 1b2f69eb643a9..8793a4ae0c044 100644 --- a/fs/inode/fs_inodesearch.c +++ b/fs/inode/fs_inodesearch.c @@ -43,7 +43,7 @@ ****************************************************************************/ static int _inode_compare(FAR const char *fname, FAR struct inode *inode); -#ifdef CONFIG_PSEUDOFS_SOFTLINKS +#ifdef CONFIG_FS_LINKS static int _inode_linktarget(FAR struct inode *inode, FAR struct inode_search_s *desc); #endif @@ -144,7 +144,7 @@ static int _inode_compare(FAR const char *fname, FAR struct inode *inode) * ****************************************************************************/ -#ifdef CONFIG_PSEUDOFS_SOFTLINKS +#ifdef CONFIG_FS_LINKS static int _inode_linktarget(FAR struct inode *inode, FAR struct inode_search_s *desc) { @@ -297,7 +297,7 @@ static int _inode_search(FAR struct inode_search_s *desc) { /* More nodes to be examined in the path "below" this one. */ -#ifdef CONFIG_PSEUDOFS_SOFTLINKS +#ifdef CONFIG_FS_LINKS /* Was the node a soft link? If so, then we need need to * continue below the target of the link, not the link itself. */ @@ -493,7 +493,7 @@ int inode_search(FAR struct inode_search_s *desc) ret = _inode_search(desc); -#ifdef CONFIG_PSEUDOFS_SOFTLINKS +#ifdef CONFIG_FS_LINKS if (ret >= 0) { FAR struct inode *inode; diff --git a/fs/vfs/CMakeLists.txt b/fs/vfs/CMakeLists.txt index 3880b2a3727c5..b5318de671952 100644 --- a/fs/vfs/CMakeLists.txt +++ b/fs/vfs/CMakeLists.txt @@ -66,7 +66,7 @@ if(NOT "${CONFIG_FS_LOCK_BUCKET_SIZE}" STREQUAL "0") list(APPEND SRCS fs_lock.c) endif() -if(NOT "${CONFIG_PSEUDOFS_SOFTLINKS}" STREQUAL "0") +if(NOT "${CONFIG_FS_LINKS}" STREQUAL "0") list(APPEND SRCS fs_symlink.c fs_readlink.c) endif() diff --git a/fs/vfs/Make.defs b/fs/vfs/Make.defs index ce2a7a5f5afb7..e8e588680e9aa 100644 --- a/fs/vfs/Make.defs +++ b/fs/vfs/Make.defs @@ -37,7 +37,7 @@ ifneq ($(CONFIG_FS_LOCK_BUCKET_SIZE),0) CSRCS += fs_lock.c endif -ifneq ($(CONFIG_PSEUDOFS_SOFTLINKS),0) +ifneq ($(CONFIG_FS_LINKS),0) CSRCS += fs_symlink.c fs_readlink.c endif diff --git a/fs/vfs/fs_chstat.c b/fs/vfs/fs_chstat.c index d5da5b9179897..a8adcb342a3d9 100644 --- a/fs/vfs/fs_chstat.c +++ b/fs/vfs/fs_chstat.c @@ -425,7 +425,7 @@ int inode_chstat(FAR struct inode *inode, DEBUGASSERT(inode != NULL && buf != NULL); -#ifdef CONFIG_PSEUDOFS_SOFTLINKS +#ifdef CONFIG_FS_LINKS /* Handle softlinks differently. Just call chstat() recursively on the * target of the softlink. */ diff --git a/fs/vfs/fs_dir.c b/fs/vfs/fs_dir.c index dfa074b1e441e..75f54db3632c7 100644 --- a/fs/vfs/fs_dir.c +++ b/fs/vfs/fs_dir.c @@ -322,7 +322,7 @@ static int read_pseudodir(FAR struct fs_dirent_s *dir, strlcpy(entry->d_name, next->i_name, sizeof(entry->d_name)); -#ifdef CONFIG_PSEUDOFS_SOFTLINKS +#ifdef CONFIG_FS_LINKS if (INODE_IS_HARDLINK(next)) { DEBUGASSERT(next->i_private != NULL); @@ -350,7 +350,7 @@ static int read_pseudodir(FAR struct fs_dirent_s *dir, } else #endif -#ifdef CONFIG_PSEUDOFS_SOFTLINKS +#ifdef CONFIG_FS_LINKS if (INODE_IS_SOFTLINK(next)) { entry->d_type = DTYPE_LINK; diff --git a/fs/vfs/fs_link.c b/fs/vfs/fs_link.c index b580a9aae82e5..03c49f75cd303 100644 --- a/fs/vfs/fs_link.c +++ b/fs/vfs/fs_link.c @@ -44,7 +44,7 @@ * Pre-processor Definitions ****************************************************************************/ -#ifdef CONFIG_PSEUDOFS_SOFTLINKS +#ifdef CONFIG_FS_LINKS /**************************************************************************** * Public Functions @@ -211,15 +211,15 @@ int link(FAR const char *path1, FAR const char *path2) return ERROR; } -#else /* CONFIG_PSEUDOFS_SOFTLINKS */ +#else /* CONFIG_FS_LINKS */ /**************************************************************************** * Name: link * * Description: - * When CONFIG_PSEUDOFS_SOFTLINKS is disabled, link() is not supported. - * The symbol is still provided so that applications referencing link() - * continue to link, but the call always fails with ENOSYS. + * When CONFIG_FS_LINKS is disabled, link() is not supported. The symbol + * is still provided so that applications referencing link() continue to + * link, but the call always fails with ENOSYS. * ****************************************************************************/ @@ -232,4 +232,4 @@ int link(FAR const char *path1, FAR const char *path2) return ERROR; } -#endif /* CONFIG_PSEUDOFS_SOFTLINKS */ +#endif /* CONFIG_FS_LINKS */ diff --git a/fs/vfs/fs_open.c b/fs/vfs/fs_open.c index a6c10c9802373..35518d77fbfba 100644 --- a/fs/vfs/fs_open.c +++ b/fs/vfs/fs_open.c @@ -128,7 +128,7 @@ static int file_vopen(FAR struct file *filep, FAR const char *path, inode = desc.node; DEBUGASSERT(inode != NULL); -#ifdef CONFIG_PSEUDOFS_SOFTLINKS +#ifdef CONFIG_FS_LINKS if (INODE_IS_HARDLINK(inode)) { /* The inode is a hard link. The actual inode is referenced diff --git a/fs/vfs/fs_readlink.c b/fs/vfs/fs_readlink.c index 3a057ad895d45..e75ad19188645 100644 --- a/fs/vfs/fs_readlink.c +++ b/fs/vfs/fs_readlink.c @@ -36,7 +36,7 @@ #include "inode/inode.h" -#ifdef CONFIG_PSEUDOFS_SOFTLINKS +#ifdef CONFIG_FS_LINKS /**************************************************************************** * Public Functions @@ -132,4 +132,4 @@ ssize_t readlink(FAR const char *path, FAR char *buf, size_t bufsize) return ERROR; } -#endif /* CONFIG_PSEUDOFS_SOFTLINKS */ +#endif /* CONFIG_FS_LINKS */ diff --git a/fs/vfs/fs_rename.c b/fs/vfs/fs_rename.c index 4428354929ae1..183fb6e5ae69b 100644 --- a/fs/vfs/fs_rename.c +++ b/fs/vfs/fs_rename.c @@ -136,7 +136,7 @@ static int pseudorename(FAR const char *oldpath, FAR struct inode *oldinode, */ if ((newinode->u.i_ops == NULL || newinode->i_child != NULL) -#ifdef CONFIG_PSEUDOFS_SOFTLINKS +#ifdef CONFIG_FS_LINKS && !INODE_IS_HARDLINK(newinode) #endif ) @@ -221,7 +221,7 @@ static int pseudorename(FAR const char *oldpath, FAR struct inode *oldinode, #endif newinode->i_private = oldinode->i_private; /* Per inode driver private data */ -#ifdef CONFIG_PSEUDOFS_SOFTLINKS +#ifdef CONFIG_FS_LINKS /* Prevent the link target string from being deallocated. The pointer to * the allocated link target path was copied above (under the guise of * u.i_ops). Now we must nullify the u.i_link pointer so that it is not diff --git a/fs/vfs/fs_stat.c b/fs/vfs/fs_stat.c index bceba8e70d4fb..60259cca12eaf 100644 --- a/fs/vfs/fs_stat.c +++ b/fs/vfs/fs_stat.c @@ -267,7 +267,7 @@ int inode_stat(FAR struct inode *inode, FAR struct stat *buf, int resolve) RESET_BUF(buf); -#ifdef CONFIG_PSEUDOFS_SOFTLINKS +#ifdef CONFIG_FS_LINKS if (INODE_IS_HARDLINK(inode)) { DEBUGASSERT(inode->i_private != NULL); @@ -326,7 +326,7 @@ int inode_stat(FAR struct inode *inode, FAR struct stat *buf, int resolve) } else #endif -#ifdef CONFIG_PSEUDOFS_SOFTLINKS +#ifdef CONFIG_FS_LINKS /* Handle softlinks differently. Just call stat() recursively on the * target of the softlink. * @@ -477,7 +477,7 @@ int inode_stat(FAR struct inode *inode, FAR struct stat *buf, int resolve) buf->st_ctim = inode->i_ctime; #endif buf->st_ino = inode->i_ino; -#ifdef CONFIG_PSEUDOFS_SOFTLINKS +#ifdef CONFIG_FS_LINKS buf->st_nlink = INODE_GET_NLINK(inode); #endif diff --git a/fs/vfs/fs_symlink.c b/fs/vfs/fs_symlink.c index 552b139777422..f4a828117ec5f 100644 --- a/fs/vfs/fs_symlink.c +++ b/fs/vfs/fs_symlink.c @@ -45,7 +45,7 @@ * Pre-processor Definitions ****************************************************************************/ -#ifdef CONFIG_PSEUDOFS_SOFTLINKS +#ifdef CONFIG_FS_LINKS /**************************************************************************** * Public Functions @@ -183,4 +183,4 @@ int symlink(FAR const char *path1, FAR const char *path2) return ERROR; } -#endif /* CONFIG_PSEUDOFS_SOFTLINKS */ +#endif /* CONFIG_FS_LINKS */ diff --git a/fs/vfs/fs_unlink.c b/fs/vfs/fs_unlink.c index b3c54d204147b..9d7be5dc545c6 100644 --- a/fs/vfs/fs_unlink.c +++ b/fs/vfs/fs_unlink.c @@ -156,7 +156,7 @@ int nx_unlink(FAR const char *pathname) } #endif else if ( -#ifdef CONFIG_PSEUDOFS_SOFTLINKS +#ifdef CONFIG_FS_LINKS INODE_IS_SOFTLINK(inode) || INODE_IS_HARDLINK(inode) || #endif INODE_IS_PSEUDODIR(inode)) diff --git a/include/nuttx/fs/fs.h b/include/nuttx/fs/fs.h index 5b9eb33a94589..33ef992a861d3 100644 --- a/include/nuttx/fs/fs.h +++ b/include/nuttx/fs/fs.h @@ -433,7 +433,7 @@ union inode_ops_u #ifdef CONFIG_FS_NAMED_EVENTS FAR struct nevent_inode_s *i_nevent; /* Named event */ #endif -#ifdef CONFIG_PSEUDOFS_SOFTLINKS +#ifdef CONFIG_FS_LINKS FAR char *i_link; /* Full path to link target */ #endif }; diff --git a/include/sys/syscall_lookup.h b/include/sys/syscall_lookup.h index 55a20f7f13586..9b106b5e99750 100644 --- a/include/sys/syscall_lookup.h +++ b/include/sys/syscall_lookup.h @@ -285,7 +285,7 @@ SYSCALL_LOOKUP(munmap, 2) SYSCALL_LOOKUP(munlock, 2) SYSCALL_LOOKUP(munlockall, 0) -#if defined(CONFIG_PSEUDOFS_SOFTLINKS) +#if defined(CONFIG_FS_LINKS) SYSCALL_LOOKUP(link, 2) SYSCALL_LOOKUP(symlink, 2) SYSCALL_LOOKUP(readlink, 3) diff --git a/libs/libc/stdlib/lib_realpath.c b/libs/libc/stdlib/lib_realpath.c index 3973e1ac73d6b..c381d7d044a4c 100644 --- a/libs/libc/stdlib/lib_realpath.c +++ b/libs/libc/stdlib/lib_realpath.c @@ -41,7 +41,7 @@ FAR char *lib_realpath(FAR const char *path, FAR char *resolved, bool notfollow) { -#ifdef CONFIG_PSEUDOFS_SOFTLINKS +#ifdef CONFIG_FS_LINKS FAR char *wbuf[2] = { }; @@ -124,7 +124,7 @@ FAR char *lib_realpath(FAR const char *path, FAR char *resolved, *p = '\0'; -#ifdef CONFIG_PSEUDOFS_SOFTLINKS +#ifdef CONFIG_FS_LINKS if (wbuf[0] != NULL) { lib_free(wbuf[0]); @@ -198,7 +198,7 @@ FAR char *lib_realpath(FAR const char *path, FAR char *resolved, goto out; } -#ifdef CONFIG_PSEUDOFS_SOFTLINKS +#ifdef CONFIG_FS_LINKS if (S_ISLNK(sb.st_mode)) { if (nlnk++ >= SYMLOOP_MAX) @@ -267,7 +267,7 @@ FAR char *lib_realpath(FAR const char *path, FAR char *resolved, out: lib_free(fres); -#ifdef CONFIG_PSEUDOFS_SOFTLINKS +#ifdef CONFIG_FS_LINKS if (wbuf[0] != NULL) { lib_free(wbuf[0]); diff --git a/libs/libc/unistd/lib_linkat.c b/libs/libc/unistd/lib_linkat.c index 1448f2a756f62..54f8383560618 100644 --- a/libs/libc/unistd/lib_linkat.c +++ b/libs/libc/unistd/lib_linkat.c @@ -29,7 +29,7 @@ #include "libc.h" -#ifdef CONFIG_PSEUDOFS_SOFTLINKS +#ifdef CONFIG_FS_LINKS /**************************************************************************** * Public Functions @@ -119,4 +119,4 @@ int linkat(int olddirfd, FAR const char *path1, return ret; } -#endif /* CONFIG_PSEUDOFS_SOFTLINKS */ +#endif /* CONFIG_FS_LINKS */ diff --git a/libs/libc/unistd/lib_readlinkat.c b/libs/libc/unistd/lib_readlinkat.c index 3fa2e8705ae43..d307bd0682151 100644 --- a/libs/libc/unistd/lib_readlinkat.c +++ b/libs/libc/unistd/lib_readlinkat.c @@ -29,7 +29,7 @@ #include "libc.h" -#ifdef CONFIG_PSEUDOFS_SOFTLINKS +#ifdef CONFIG_FS_LINKS /**************************************************************************** * Public Functions @@ -93,4 +93,4 @@ ssize_t readlinkat(int dirfd, FAR const char *path, FAR char *buf, return ret; } -#endif /* CONFIG_PSEUDOFS_SOFTLINKS */ +#endif /* CONFIG_FS_LINKS */ diff --git a/libs/libc/unistd/lib_symlinkat.c b/libs/libc/unistd/lib_symlinkat.c index 6063839ebc696..31a14691f833a 100644 --- a/libs/libc/unistd/lib_symlinkat.c +++ b/libs/libc/unistd/lib_symlinkat.c @@ -29,7 +29,7 @@ #include "libc.h" -#ifdef CONFIG_PSEUDOFS_SOFTLINKS +#ifdef CONFIG_FS_LINKS /**************************************************************************** * Public Functions @@ -90,4 +90,4 @@ int symlinkat(FAR const char *path1, int dirfd, FAR const char *path2) return ret; } -#endif /* CONFIG_PSEUDOFS_SOFTLINKS */ +#endif /* CONFIG_FS_LINKS */ diff --git a/syscall/syscall.csv b/syscall/syscall.csv index c488776b3c49b..439630d71305c 100644 --- a/syscall/syscall.csv +++ b/syscall/syscall.csv @@ -63,7 +63,7 @@ "kill","signal.h","","int","pid_t","int" "lchmod","sys/stat.h","","int","FAR const char *","mode_t" "lchown","unistd.h","","int","FAR const char *","uid_t","gid_t" -"link","unistd.h","defined(CONFIG_PSEUDOFS_SOFTLINKS)","int","FAR const char *","FAR const char *" +"link","unistd.h","defined(CONFIG_FS_LINKS)","int","FAR const char *","FAR const char *" "listen","sys/socket.h","defined(CONFIG_NET)","int","int","int" "lseek","unistd.h","","off_t","int","off_t","int" "lstat","sys/stat.h","","int","FAR const char *","FAR struct stat *" @@ -131,7 +131,7 @@ "pwrite","unistd.h","","ssize_t","int","FAR const void *","size_t","off_t" "read","unistd.h","","ssize_t","int","FAR void *","size_t" "readv","sys/uio.h","","ssize_t","int","FAR const struct iovec *","int" -"readlink","unistd.h","defined(CONFIG_PSEUDOFS_SOFTLINKS)","ssize_t","FAR const char *","FAR char *","size_t" +"readlink","unistd.h","defined(CONFIG_FS_LINKS)","ssize_t","FAR const char *","FAR char *","size_t" "recv","sys/socket.h","defined(CONFIG_NET)","ssize_t","int","FAR void *","size_t","int" "recvfrom","sys/socket.h","defined(CONFIG_NET)","ssize_t","int","FAR void*","size_t","int","FAR struct sockaddr*","FAR socklen_t*" "recvmsg","sys/socket.h","defined(CONFIG_NET)","ssize_t","int","FAR struct msghdr *","int" @@ -192,7 +192,7 @@ "socketpair","sys/socket.h","defined(CONFIG_NET)","int","int","int","int","int [2]|FAR int *" "stat","sys/stat.h","","int","FAR const char *","FAR struct stat *" "statfs","sys/statfs.h","","int","FAR const char *","FAR struct statfs *" -"symlink","unistd.h","defined(CONFIG_PSEUDOFS_SOFTLINKS)","int","FAR const char *","FAR const char *" +"symlink","unistd.h","defined(CONFIG_FS_LINKS)","int","FAR const char *","FAR const char *" "sync","unistd.h","","void" "sysinfo","sys/sysinfo.h","","int","FAR struct sysinfo *" "task_create","sched.h","!defined(CONFIG_BUILD_KERNEL)", "int","FAR const char *","int","int","main_t","FAR char * const []|FAR char * const *" From ad8582121196d39aa0bca052eb98629bf045b81c Mon Sep 17 00:00:00 2001 From: zhengyu16 Date: Thu, 6 Nov 2025 14:23:46 +0800 Subject: [PATCH 3/5] fs/vfs: add link, symlink and readlink support for mountpt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. add three func to mountpt_operations: link symlink readlink 2. modify fs_link、fs_symlink、fs_readlink for mountpt Signed-off-by: zhengyu16 --- fs/vfs/fs_link.c | 53 +++++++++++++++++++++++++----------- fs/vfs/fs_readlink.c | 62 ++++++++++++++++++++++++++++++------------- fs/vfs/fs_symlink.c | 24 +++++++++++++---- include/nuttx/fs/fs.h | 11 ++++++++ 4 files changed, 112 insertions(+), 38 deletions(-) diff --git a/fs/vfs/fs_link.c b/fs/vfs/fs_link.c index 03c49f75cd303..21432eb6ad3a4 100644 --- a/fs/vfs/fs_link.c +++ b/fs/vfs/fs_link.c @@ -105,16 +105,6 @@ int link(FAR const char *path1, FAR const char *path2) target = desc_path1.node; - /* Check if target inode is a mountpoint. */ - - if (INODE_IS_MOUNTPT(target)) - { - /* Hard links within the mounted volume are not supported */ - - errcode = ENOSYS; - goto errout_with_target; - } - if (INODE_GET_NLINK(target) >= _POSIX_LINK_MAX) { /* Too many links to the target inode */ @@ -144,9 +134,35 @@ int link(FAR const char *path1, FAR const char *path2) DEBUGASSERT(newinode != NULL); if (INODE_IS_MOUNTPT(newinode)) { - /* Hard links within the mounted volume are not supported */ - - errcode = ENOSYS; + /* Check if path1 and path2 are on the same mountpoint */ + + if (newinode != target) + { + errcode = EXDEV; + goto errout_with_newinode; + } + + if (target->u.i_mops && target->u.i_mops->link) + { + /* Perform the link operation using the relative path at the + * mountpoint. + */ + + ret = target->u.i_mops->link(target, desc_path1.relpath, + desc_path2.relpath); + if (ret < 0) + { + errcode = -ret; + goto errout_with_newinode; + } + } + else + { + /* Hard links within this type of fs are not supported */ + + errcode = ENOSYS; + goto errout_with_newinode; + } } else #endif @@ -154,9 +170,8 @@ int link(FAR const char *path1, FAR const char *path2) /* A node already exists in the pseudofs at 'path2' */ errcode = EEXIST; + goto errout_with_newinode; } - - goto errout_with_newinode; } /* No inode exists that contains this path. Create a new inode in the @@ -165,6 +180,14 @@ int link(FAR const char *path1, FAR const char *path2) else { + /* Cannot link between pseudofs and other mountpoints */ + + if (INODE_IS_MOUNTPT(target)) + { + errcode = EXDEV; + goto errout_with_target; + } + /* Create an inode in the pseudo-filesystem at this path. */ inode_lock(); diff --git a/fs/vfs/fs_readlink.c b/fs/vfs/fs_readlink.c index e75ad19188645..ad301ec46b394 100644 --- a/fs/vfs/fs_readlink.c +++ b/fs/vfs/fs_readlink.c @@ -94,28 +94,54 @@ ssize_t readlink(FAR const char *path, FAR char *buf, size_t bufsize) node = desc.node; DEBUGASSERT(node != NULL); - ret = inode_checkpathperm(node, 0, 0); - if (ret < 0) - { - errcode = -ret; - goto errout_with_inode; - } - - /* An inode was found that includes this path and possibly refers to a - * symbolic link. - * - * Check if the inode is a valid symbolic link. +#ifndef CONFIG_DISABLE_MOUNTPOINT + /* If the inode is a mountpoint, let the mountpoint's readlink + * method handle the request. */ - if (!INODE_IS_SOFTLINK(node)) + if (INODE_IS_MOUNTPT(node)) { - errcode = EINVAL; - goto errout_with_inode; + if (node->u.i_mops && node->u.i_mops->readlink) + { + ret = node->u.i_mops->readlink(node, desc.relpath, buf, bufsize); + if (ret < 0) + { + errcode = -ret; + goto errout_with_inode; + } + } + else + { + errcode = ENOSYS; + goto errout_with_inode; + } + } + else +#endif + { + ret = inode_checkpathperm(node, 0, 0); + if (ret < 0) + { + errcode = -ret; + goto errout_with_inode; + } + + /* An inode was found that includes this path and possibly refers to a + * symbolic link. + * + * Check if the inode is a valid symbolic link. + */ + + if (!INODE_IS_SOFTLINK(node)) + { + errcode = EINVAL; + goto errout_with_inode; + } + + /* Copy the link target path to the user-provided buffer. */ + + strlcpy(buf, node->u.i_link, bufsize); } - - /* Copy the link target pathto the user-provided buffer. */ - - strlcpy(buf, node->u.i_link, bufsize); /* Release our reference on the inode and return the length */ diff --git a/fs/vfs/fs_symlink.c b/fs/vfs/fs_symlink.c index f4a828117ec5f..76cac2bad7371 100644 --- a/fs/vfs/fs_symlink.c +++ b/fs/vfs/fs_symlink.c @@ -109,9 +109,23 @@ int symlink(FAR const char *path1, FAR const char *path2) DEBUGASSERT(desc.node != NULL); if (INODE_IS_MOUNTPT(desc.node)) { - /* Symbolic links within the mounted volume are not supported */ - - errcode = ENOSYS; + if (desc.node->u.i_mops && desc.node->u.i_mops->symlink) + { + ret = desc.node->u.i_mops->symlink(desc.node, path1, + desc.relpath); + if (ret < 0) + { + errcode = -ret; + goto errout_with_inode; + } + } + else + { + /* Symbolic links within this type of fs are not supported */ + + errcode = ENOSYS; + goto errout_with_inode; + } } else #endif @@ -119,9 +133,8 @@ int symlink(FAR const char *path1, FAR const char *path2) /* A node already exists in the pseudofs at 'path1' */ errcode = EEXIST; + goto errout_with_inode; } - - goto errout_with_inode; } /* No inode exists that contains this path. Create a new inode in the @@ -133,6 +146,7 @@ int symlink(FAR const char *path1, FAR const char *path2) /* Copy path1 */ FAR char *newpath2 = fs_heap_strdup(path1); + if (newpath2 == NULL) { errcode = ENOMEM; diff --git a/include/nuttx/fs/fs.h b/include/nuttx/fs/fs.h index 33ef992a861d3..a12cc3e2976ad 100644 --- a/include/nuttx/fs/fs.h +++ b/include/nuttx/fs/fs.h @@ -402,6 +402,17 @@ struct mountpt_operations CODE int (*permission)(FAR struct inode *mountpt, FAR const char *relpath, int amode); + +#ifdef CONFIG_FS_LINKS + CODE int (*link)(FAR struct inode *mountpt, FAR const char *relpath1, + FAR const char *relpath2); + CODE int (*symlink)(FAR struct inode *mountpt, + FAR const char *path1, + FAR const char *relpath2); + CODE ssize_t (*readlink)(FAR struct inode *mountpt, + FAR const char *relpath, + FAR char *buf, size_t bufsize); +#endif }; #endif /* CONFIG_DISABLE_MOUNTPOINT */ From c608116c2dce1a2dc08806a6c18764a3bf7605cd Mon Sep 17 00:00:00 2001 From: zhengyu16 Date: Wed, 24 Sep 2025 16:06:57 +0800 Subject: [PATCH 4/5] fs/vfs/rename: rename a directory to an empty directory resolve rename{7}: On a call to rename(old, new), when the old argument points to the pathname of a directory, if the directory named by the new argument exists and is empty it shall be removed and old renamed to new. resolve rename{23}: EEXIST or ENOTEMPTY in errno and a return value of -1 on a call to rename(old, new) when the link named by new is a directory containing entries other than dot and dot-dot. The named files are not changed. Signed-off-by: zhengyu16 --- fs/vfs/fs_rename.c | 91 ++++++++++++++++++---------------------------- 1 file changed, 36 insertions(+), 55 deletions(-) diff --git a/fs/vfs/fs_rename.c b/fs/vfs/fs_rename.c index 183fb6e5ae69b..38ed865cabde5 100644 --- a/fs/vfs/fs_rename.c +++ b/fs/vfs/fs_rename.c @@ -294,10 +294,8 @@ static int mountptrename(FAR const char *oldpath, FAR struct inode *oldinode, FAR struct inode *newinode; FAR const char *newrelpath; FAR char *subdir = NULL; -#ifdef CONFIG_FS_NOTIFY bool newisdir = false; bool oldisdir = false; -#endif int ret; DEBUGASSERT(oldinode->u.i_mops); @@ -314,7 +312,7 @@ static int mountptrename(FAR const char *oldpath, FAR struct inode *oldinode, } /* Get an inode for the new relpath -- it should lie on the same - * mountpoint. Path search on oldinode was already enforced by rename(). + * mountpoint */ SETUP_SEARCH(&newdesc, newpath, true); @@ -356,73 +354,68 @@ static int mountptrename(FAR const char *oldpath, FAR struct inode *oldinode, * If the directory entry at the newrelpath is a regular file, then that * file should be removed first. * - * If the directory entry at the target is a directory, then the source - * file should be moved "under" the directory, i.e., if newrelpath is a - * directory, then rename(b,a) should use move the oldrelpath should be - * moved as if rename(b,a/basename(b)) had been called. + * If the directory entry at the newrelpath is an empty directory, then it + * can be removed without issue. + * + * If the directory entry at the newrelpath is a non-empty directory, + * then the rename should fail with the error ENOTEMPTY. */ if (oldinode->u.i_mops->stat != NULL) { - struct stat buf; + struct stat oldbuf; + struct stat newbuf; - ret = oldinode->u.i_mops->stat(oldinode, newrelpath, &buf); - if (ret >= 0) + ret = oldinode->u.i_mops->stat(oldinode, oldrelpath, &oldbuf); + if (ret < 0) { - /* Is the directory entry a directory? */ + goto errout_with_newinode; + } -#ifdef CONFIG_FS_NOTIFY - newisdir = S_ISDIR(buf.st_mode); - if (newisdir) -#else - if (S_ISDIR(buf.st_mode)) -#endif - { - FAR char *subdirname; + oldisdir = S_ISDIR(oldbuf.st_mode); - /* Yes.. In this case, the target of the rename must be a - * subdirectory of newinode, not the newinode itself. For - * example: mv b a/ must move b to a/b. - */ + ret = oldinode->u.i_mops->stat(oldinode, newrelpath, &newbuf); + if (ret >= 0) + { + newisdir = S_ISDIR(newbuf.st_mode); - subdirname = basename((FAR char *)oldrelpath); + /* Is the new path a directory? */ - /* Special case the root directory */ + if (newisdir) + { + /* It is an error to rename a file to a directory */ - if (*newrelpath == '\0') + if (!oldisdir) { - newrelpath = subdirname; + ret = -EISDIR; + goto errout_with_newinode; } - else + + /* Remove the newrelpath which already exists. + * rmdir will handle the error cases. + */ + + if (oldinode->u.i_mops->rmdir) { - ret = fs_heap_asprintf(&subdir, "%s/%s", newrelpath, - subdirname); + ret = oldinode->u.i_mops->rmdir(oldinode, newrelpath); if (ret < 0) { - subdir = NULL; - ret = -ENOMEM; goto errout_with_newinode; } - - newrelpath = subdir; } } else { - /* No.. newrelpath must refer to a regular file. Make sure - * that the file at the oldrelpath actually exists before - * performing any further actions with newrelpath - */ + /* No.. newrelpath must refer to a regular file. */ - ret = oldinode->u.i_mops->stat(oldinode, oldrelpath, &buf); - if (ret < 0) + if (oldisdir) { + /* It is an error to rename a directory to a file */ + + ret = -ENOTDIR; goto errout_with_newinode; } -#ifdef CONFIG_FS_NOTIFY - oldisdir = S_ISDIR(buf.st_mode); -#endif if (oldinode->u.i_mops->unlink) { /* Attempt to remove the file before doing the rename. @@ -439,18 +432,6 @@ static int mountptrename(FAR const char *oldpath, FAR struct inode *oldinode, } } } -#ifdef CONFIG_FS_NOTIFY - else - { - ret = oldinode->u.i_mops->stat(oldinode, oldrelpath, &buf); - if (ret < 0) - { - goto errout_with_newinode; - } - - oldisdir = S_ISDIR(buf.st_mode); - } -#endif } /* Perform the rename operation using the relative paths at the common From eb00979b6630ae91a53869e7f117016450821385 Mon Sep 17 00:00:00 2001 From: zhengyu16 Date: Fri, 5 Dec 2025 14:37:41 +0800 Subject: [PATCH 5/5] fs/vfs: add lstat interface to mountpt_operations Add an lstat method to mountpt_operations so that mounted file systems can report link metadata without dereferencing symbolic links. In mountptrename() and stat_recursive(), prefer lstat() over stat() when it is available so that rename() and the non-following stat path operate on the link itself rather than its target, matching POSIX semantics. Signed-off-by: zhengyu16 --- fs/vfs/fs_rename.c | 42 ++++++++++++++++++++++++++++++++++-------- fs/vfs/fs_stat.c | 12 ++++++++++-- include/nuttx/fs/fs.h | 3 +++ 3 files changed, 47 insertions(+), 10 deletions(-) diff --git a/fs/vfs/fs_rename.c b/fs/vfs/fs_rename.c index 38ed865cabde5..c461124157c81 100644 --- a/fs/vfs/fs_rename.c +++ b/fs/vfs/fs_rename.c @@ -361,12 +361,28 @@ static int mountptrename(FAR const char *oldpath, FAR struct inode *oldinode, * then the rename should fail with the error ENOTEMPTY. */ +#ifdef CONFIG_FS_LINKS + if (oldinode->u.i_mops->lstat != NULL || oldinode->u.i_mops->stat != NULL) +#else if (oldinode->u.i_mops->stat != NULL) +#endif { struct stat oldbuf; struct stat newbuf; - ret = oldinode->u.i_mops->stat(oldinode, oldrelpath, &oldbuf); +#ifdef CONFIG_FS_LINKS + /* Use lstat if available to avoid dereferencing symlinks */ + + if (oldinode->u.i_mops->lstat) + { + ret = oldinode->u.i_mops->lstat(oldinode, oldrelpath, &oldbuf); + } + else +#endif + { + ret = oldinode->u.i_mops->stat(oldinode, oldrelpath, &oldbuf); + } + if (ret < 0) { goto errout_with_newinode; @@ -374,7 +390,19 @@ static int mountptrename(FAR const char *oldpath, FAR struct inode *oldinode, oldisdir = S_ISDIR(oldbuf.st_mode); - ret = oldinode->u.i_mops->stat(oldinode, newrelpath, &newbuf); +#ifdef CONFIG_FS_LINKS + /* Use lstat if available to avoid dereferencing symlinks */ + + if (oldinode->u.i_mops->lstat) + { + ret = oldinode->u.i_mops->lstat(oldinode, newrelpath, &newbuf); + } + else +#endif + { + ret = oldinode->u.i_mops->stat(oldinode, newrelpath, &newbuf); + } + if (ret >= 0) { newisdir = S_ISDIR(newbuf.st_mode); @@ -425,9 +453,9 @@ static int mountptrename(FAR const char *oldpath, FAR struct inode *oldinode, * method should check that. */ - oldinode->u.i_mops->unlink(oldinode, newrelpath); + oldinode->u.i_mops->unlink(oldinode, newrelpath); #ifdef CONFIG_FS_NOTIFY - notify_unlink(newrelpath); + notify_unlink(newrelpath); #endif } } @@ -522,15 +550,13 @@ int rename(FAR const char *oldpath, FAR const char *newpath) } else #endif /* CONFIG_DISABLE_MOUNTPOINT */ -#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS { +#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS ret = pseudorename(oldpath, oldinode, olddesc.parent, newpath); - } #else - { ret = -ENXIO; - } #endif + } inode_release(oldinode); diff --git a/fs/vfs/fs_stat.c b/fs/vfs/fs_stat.c index 60259cca12eaf..9eefb401e5edf 100644 --- a/fs/vfs/fs_stat.c +++ b/fs/vfs/fs_stat.c @@ -123,10 +123,17 @@ static int stat_recursive(FAR const char *path, * supports the stat() method */ +# ifdef CONFIG_FS_LINKS + /* use lstat() if available to avoid following symlinks */ + + if (!resolve && inode->u.i_mops && inode->u.i_mops->lstat) + { + ret = inode->u.i_mops->lstat(inode, desc.relpath, buf); + } + else +# endif if (inode->u.i_mops && inode->u.i_mops->stat) { - /* Perform the stat() operation */ - ret = inode->u.i_mops->stat(inode, desc.relpath, buf); } else @@ -428,6 +435,7 @@ int inode_stat(FAR struct inode *inode, FAR struct stat *buf, int resolve) (inode->u.i_bops->geometry != NULL)) { struct geometry geo; + if (inode->u.i_bops->geometry(inode, &geo) >= 0 && geo.geo_available) { diff --git a/include/nuttx/fs/fs.h b/include/nuttx/fs/fs.h index a12cc3e2976ad..36c039888ec16 100644 --- a/include/nuttx/fs/fs.h +++ b/include/nuttx/fs/fs.h @@ -412,6 +412,9 @@ struct mountpt_operations CODE ssize_t (*readlink)(FAR struct inode *mountpt, FAR const char *relpath, FAR char *buf, size_t bufsize); + CODE int (*lstat)(FAR struct inode *mountpt, + FAR const char *relpath, + FAR struct stat *buf); #endif }; #endif /* CONFIG_DISABLE_MOUNTPOINT */