[PATCH vfs-2.6 6/6] vfs: add LOOKUP_RENAME_TARGET intent
authorOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Wed, 15 Oct 2008 22:50:29 +0000 (07:50 +0900)
committerAl Viro <viro@zeniv.linux.org.uk>
Thu, 23 Oct 2008 09:13:20 +0000 (05:13 -0400)
This adds LOOKUP_RENAME_TARGET intent for lookup of rename destination.

LOOKUP_RENAME_TARGET is going to be used like LOOKUP_CREATE. But since
the destination of rename() can be existing directory entry, so it has a
difference. Although that difference doesn't matter in my usage, this
tells it to user of this intent.

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
fs/namei.c
include/linux/namei.h

index 18894fdf048a11f178df94b38ae2dd42cbab1154..9e2a534383d9f3c26780e4ae937d3b52df16cfc9 100644 (file)
@@ -2654,6 +2654,7 @@ asmlinkage long sys_renameat(int olddfd, const char __user *oldname,
 
        oldnd.flags &= ~LOOKUP_PARENT;
        newnd.flags &= ~LOOKUP_PARENT;
+       newnd.flags |= LOOKUP_RENAME_TARGET;
 
        trap = lock_rename(new_dir, old_dir);
 
index 6b5627afd2eb6cce8cb237b54129002963011088..99eb80306dc5bba4fab74b9a1693222209d619ea 100644 (file)
@@ -54,6 +54,7 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
 #define LOOKUP_OPEN            0x0100
 #define LOOKUP_CREATE          0x0200
 #define LOOKUP_EXCL            0x0400
+#define LOOKUP_RENAME_TARGET   0x0800
 
 extern int user_path_at(int, const char __user *, unsigned, struct path *);