[PATCH v2 028/113] fs: drop unused LOOKUP_ flags
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon Mar 4 10:59:13 PST 2024
Most flags used during VFS lookup are apparently unused, so let's delete
them to make the code easier to reason about.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
fs/fs.c | 11 +----------
include/linux/namei.h | 13 -------------
2 files changed, 1 insertion(+), 23 deletions(-)
diff --git a/fs/fs.c b/fs/fs.c
index 7c4e2f250ea8..7d9bee539db5 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -1696,9 +1696,7 @@ static int follow_automount(struct path *path, struct nameidata *nd,
* as being automount points. These will need the attentions
* of the daemon to instantiate them before they can be used.
*/
- if (!(nd->flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY |
- LOOKUP_OPEN | LOOKUP_CREATE | LOOKUP_AUTOMOUNT)) &&
- path->dentry->d_inode)
+ if (!(nd->flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY)) && path->dentry->d_inode)
return -EISDIR;
return automount_mount(path->dentry);
@@ -2278,12 +2276,6 @@ static struct dentry *filename_create(struct filename *name,
int error;
bool is_dir = (lookup_flags & LOOKUP_DIRECTORY);
- /*
- * Note that only LOOKUP_REVAL and LOOKUP_DIRECTORY matter here. Any
- * other flags passed in are ignored!
- */
- lookup_flags &= LOOKUP_REVAL;
-
name = filename_parentat(name, 0, path, &last, &type);
if (IS_ERR(name))
return ERR_CAST(name);
@@ -2298,7 +2290,6 @@ static struct dentry *filename_create(struct filename *name,
/*
* Do the final lookup.
*/
- lookup_flags |= LOOKUP_CREATE | LOOKUP_EXCL;
dentry = __lookup_hash(&last, path->dentry, lookup_flags);
if (IS_ERR(dentry))
goto unlock;
diff --git a/include/linux/namei.h b/include/linux/namei.h
index 9f6e568591af..29c3460ace2a 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -19,30 +19,17 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
* - follow links at the end
* - require a directory
* - ending slashes ok even for nonexistent files
- * - internal "there are more path components" flag
- * - dentry cache is untrusted; force a real lookup
- * - suppress terminal automount
*/
#define LOOKUP_FOLLOW 0x0001
#define LOOKUP_DIRECTORY 0x0002
#define LOOKUP_AUTOMOUNT 0x0004
#define LOOKUP_PARENT 0x0010
-#define LOOKUP_REVAL 0x0020
-#define LOOKUP_RCU 0x0040
-#define LOOKUP_NO_REVAL 0x0080
/*
* Intent data
*/
-#define LOOKUP_OPEN 0x0100
-#define LOOKUP_CREATE 0x0200
-#define LOOKUP_EXCL 0x0400
-#define LOOKUP_RENAME_TARGET 0x0800
#define LOOKUP_JUMPED 0x1000
-#define LOOKUP_ROOT 0x2000
-#define LOOKUP_EMPTY 0x4000
-#define LOOKUP_DOWN 0x8000
#endif /* _LINUX_NAMEI_H */
--
2.39.2
More information about the barebox
mailing list