提交 8c4efe22 编写于 作者: A Al Viro

namei: invert the meaning of WALK_FOLLOW

old flags & WALK_FOLLOW <=> new !(flags & WALK_TRAILING)
That's what that flag had really been used for.
Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 b4c03536
...@@ -1819,7 +1819,7 @@ static const char *pick_link(struct nameidata *nd, struct path *link, ...@@ -1819,7 +1819,7 @@ static const char *pick_link(struct nameidata *nd, struct path *link,
return NULL; 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 * Do we need to follow links? We _really_ want to be able
...@@ -1836,7 +1836,7 @@ static const char *step_into(struct nameidata *nd, int flags, ...@@ -1836,7 +1836,7 @@ static const char *step_into(struct nameidata *nd, int flags,
if (err < 0) if (err < 0)
return ERR_PTR(err); return ERR_PTR(err);
if (likely(!d_is_symlink(path.dentry)) || if (likely(!d_is_symlink(path.dentry)) ||
!((flags & WALK_FOLLOW) || (nd->flags & LOOKUP_FOLLOW)) || ((flags & WALK_TRAILING) && !(nd->flags & LOOKUP_FOLLOW)) ||
(flags & WALK_NOFOLLOW)) { (flags & WALK_NOFOLLOW)) {
/* not a symlink or should not follow */ /* not a symlink or should not follow */
path_to_nameidata(&path, nd); path_to_nameidata(&path, nd);
...@@ -2190,10 +2190,10 @@ static int link_path_walk(const char *name, struct nameidata *nd) ...@@ -2190,10 +2190,10 @@ static int link_path_walk(const char *name, struct nameidata *nd)
if (!name) if (!name)
return 0; return 0;
/* last component of nested symlink */ /* last component of nested symlink */
link = walk_component(nd, WALK_FOLLOW); link = walk_component(nd, 0);
} else { } else {
/* not the last component */ /* not the last component */
link = walk_component(nd, WALK_FOLLOW | WALK_MORE); link = walk_component(nd, WALK_MORE);
} }
if (unlikely(link)) { if (unlikely(link)) {
if (IS_ERR(link)) if (IS_ERR(link))
...@@ -2321,7 +2321,7 @@ static inline const char *lookup_last(struct nameidata *nd) ...@@ -2321,7 +2321,7 @@ static inline const char *lookup_last(struct nameidata *nd)
nd->flags |= LOOKUP_FOLLOW | LOOKUP_DIRECTORY; nd->flags |= LOOKUP_FOLLOW | LOOKUP_DIRECTORY;
nd->flags &= ~LOOKUP_PARENT; nd->flags &= ~LOOKUP_PARENT;
link = walk_component(nd, 0); link = walk_component(nd, WALK_TRAILING);
if (link) { if (link) {
nd->flags |= LOOKUP_PARENT; nd->flags |= LOOKUP_PARENT;
nd->stack[0].name = NULL; nd->stack[0].name = NULL;
...@@ -3276,7 +3276,7 @@ static const char *do_last(struct nameidata *nd, ...@@ -3276,7 +3276,7 @@ static const char *do_last(struct nameidata *nd,
finish_lookup: finish_lookup:
if (nd->depth) if (nd->depth)
put_link(nd); put_link(nd);
res = step_into(nd, 0, dentry, inode, seq); res = step_into(nd, WALK_TRAILING, dentry, inode, seq);
if (unlikely(res)) { if (unlikely(res)) {
nd->flags |= LOOKUP_PARENT; nd->flags |= LOOKUP_PARENT;
nd->flags &= ~(LOOKUP_OPEN|LOOKUP_CREATE|LOOKUP_EXCL); nd->flags &= ~(LOOKUP_OPEN|LOOKUP_CREATE|LOOKUP_EXCL);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册