xiaoxiang781216 commented on code in PR #19900:
URL: https://github.com/apache/nuttx/pull/19900#discussion_r3944846544
##########
fs/partition/fs_partition.c:
##########
@@ -29,6 +29,8 @@
#include <assert.h>
#include <stdio.h>
+#include <nuttx/lib/lib.h>
Review Comment:
revert the change
##########
fs/vfs/fs_rename.c:
##########
@@ -188,24 +193,40 @@ static int pseudorename(FAR const char *oldpath, FAR
struct inode *oldinode,
* of zero.
*/
+ inode_release(newinode);
+ newinode = NULL;
+
ret = inode_reserve(newpath, 0777, &newinode);
if (ret < 0)
{
- goto errout_with_lock;
+ goto errout_with_newsearch;
}
/* Re-resolve the source under the same lock before unlinking it. */
- SETUP_SEARCH(&olddesc, oldpath, true);
- ret = inode_search(&olddesc);
- RELEASE_SEARCH(&olddesc);
- if (ret < 0 || olddesc.node != oldinode)
+ ret = inode_search_setup(&olddesc, oldpath, true);
+ if (ret < 0)
{
+ goto errout_with_newsearch;
+ }
+
+ ret = inode_search(&olddesc, &oldfound);
+ inode_search_release(&olddesc);
+ if (ret >= 0)
+ {
+ inode_addref(oldfound);
Review Comment:
why add ref
##########
fs/vfs/Make.defs:
##########
@@ -29,6 +29,10 @@ CSRCS += fs_rename.c fs_rmdir.c fs_select.c fs_sendfile.c
fs_stat.c
CSRCS += fs_statfs.c fs_uio.c fs_unlink.c fs_write.c fs_dir.c fs_fsync.c
CSRCS += fs_syncfs.c fs_truncate.c fs_link.c
+ifeq ($(CONFIG_FS_CHROOT),y)
+CSRCS += fs_chroot.c
Review Comment:
move to chroot patch
##########
fs/vfs/fs_close.c:
##########
@@ -34,6 +34,7 @@
#include <nuttx/cancelpt.h>
#include <nuttx/fs/fs.h>
+#include <nuttx/lib/lib.h>
Review Comment:
revert
##########
fs/vfs/fs_rename.c:
##########
@@ -188,24 +193,40 @@ static int pseudorename(FAR const char *oldpath, FAR
struct inode *oldinode,
* of zero.
*/
+ inode_release(newinode);
+ newinode = NULL;
Review Comment:
why need zero
##########
fs/vfs/CMakeLists.txt:
##########
@@ -54,6 +54,10 @@ set(SRCS
fs_truncate.c
fs_link.c)
+if(CONFIG_FS_CHROOT)
+ list(APPEND SRCS fs_chroot.c)
Review Comment:
move to chroot patch
##########
fs/littlefs/lfs_vfs.c:
##########
@@ -37,6 +37,7 @@
#include <nuttx/fs/fs.h>
#include <nuttx/fs/ioctl.h>
#include <nuttx/kmalloc.h>
+#include <nuttx/lib/lib.h>
Review Comment:
revert change in this file
##########
fs/vfs/fs_rename.c:
##########
@@ -188,24 +193,40 @@ static int pseudorename(FAR const char *oldpath, FAR
struct inode *oldinode,
* of zero.
*/
+ inode_release(newinode);
+ newinode = NULL;
+
ret = inode_reserve(newpath, 0777, &newinode);
if (ret < 0)
{
- goto errout_with_lock;
+ goto errout_with_newsearch;
}
/* Re-resolve the source under the same lock before unlinking it. */
- SETUP_SEARCH(&olddesc, oldpath, true);
Review Comment:
why need re-resolve? let's remove it
##########
fs/vfs/fs_rename.c:
##########
@@ -96,20 +101,20 @@ static int pseudorename(FAR const char *oldpath, FAR
struct inode *oldinode,
ret = inode_checkperm(oldparent, W_OK);
if (ret < 0)
{
- goto errout_with_lock;
+ goto errout_with_newsearch;
}
/* According to POSIX, any new inode at this path should be removed
* first, provided that it is not a directory.
*/
- ret = inode_search(&newdesc);
+ ret = inode_search(&newdesc, &newinode);
if (ret >= 0)
{
/* We found it. Get the search results */
- newinode = newdesc.node;
DEBUGASSERT(newinode != NULL);
+ inode_addref(newinode);
Review Comment:
why add ref
##########
fs/mount/fs_automount.c:
##########
@@ -420,27 +426,33 @@ static int automount_findinode(FAR const char *path)
/* No.. Not found */
ret = OK_NOENT;
+ inode = NULL;
}
+ else
+ {
+ inode_addref(inode);
Review Comment:
why add ref
##########
fs/mount/fs_automount.c:
##########
@@ -470,56 +482,56 @@ static void automount_mount(FAR struct
automounter_state_s *priv)
ret = automount_findinode(lower->mountpoint);
switch (ret)
{
- case OK_EXIST:
+ case OK_EXIST:
Review Comment:
move the format to new patch
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]