lkml.org 
[lkml]   [2020]   [Mar]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC][PATCH v3 26/55] namei: invert the meaning of WALK_FOLLOW
Date
From: Al Viro <viro@zeniv.linux.org.uk>

old flags & WALK_FOLLOW <=> new !(flags & WALK_TRAILING)
That's what that flag had really been used for.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
fs/namei.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index 56d4adbf4da1..f994ed10ef39 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1819,7 +1819,7 @@ static const char *pick_link(struct nameidata *nd, struct path *link,
return NULL;
}

-enum {WALK_FOLLOW = 1, WALK_MORE = 2, WALK_NOFOLLOW = 4};
+enum {WALK_TRAILING = 1, WALK_MORE = 2, WALK_NOFOLLOW = 4};

/*
* Do we need to follow links? We _really_ want to be able
@@ -1838,8 +1838,8 @@ static const char *step_into(struct nameidata *nd, int flags,
if (!(flags & WALK_MORE) && nd->depth)
put_link(nd);
if (likely(!d_is_symlink(path.dentry)) ||
- !(flags & WALK_FOLLOW || nd->flags & LOOKUP_FOLLOW) ||
- flags & WALK_NOFOLLOW) {
+ ((flags & WALK_TRAILING) && !(nd->flags & LOOKUP_FOLLOW)) ||
+ (flags & WALK_NOFOLLOW)) {
/* not a symlink or should not follow */
path_to_nameidata(&path, nd);
nd->inode = inode;
@@ -2190,10 +2190,10 @@ static int link_path_walk(const char *name, struct nameidata *nd)
if (!name)
return 0;
/* last component of nested symlink */
- link = walk_component(nd, WALK_FOLLOW);
+ link = walk_component(nd, 0);
} else {
/* not the last component */
- link = walk_component(nd, WALK_FOLLOW | WALK_MORE);
+ link = walk_component(nd, WALK_MORE);
}
if (unlikely(link)) {
if (IS_ERR(link))
@@ -2321,7 +2321,7 @@ static inline const char *lookup_last(struct nameidata *nd)
nd->flags |= LOOKUP_FOLLOW | LOOKUP_DIRECTORY;

nd->flags &= ~LOOKUP_PARENT;
- link = walk_component(nd, 0);
+ link = walk_component(nd, WALK_TRAILING);
if (link) {
nd->flags |= LOOKUP_PARENT;
nd->stack[0].name = NULL;
@@ -3274,7 +3274,7 @@ static const char *do_last(struct nameidata *nd,
}

finish_lookup:
- link = step_into(nd, 0, dentry, inode, seq);
+ link = step_into(nd, WALK_TRAILING, dentry, inode, seq);
if (unlikely(link)) {
nd->flags |= LOOKUP_PARENT;
nd->flags &= ~(LOOKUP_OPEN|LOOKUP_CREATE|LOOKUP_EXCL);
--
2.11.0
\
 
 \ /
  Last update: 2020-03-01 22:55    [W:0.318 / U:13.944 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site