diff options
author | Christoph Hellwig <hch@lst.de> | 2020-07-22 12:15:40 +0300 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2020-07-31 09:17:54 +0300 |
commit | 716308a5331bf907b819f9db8dc942b19568f925 (patch) | |
tree | 9138128e16cab1d49d2006f8340425532c6f9e5d /fs | |
parent | 5fee64fcde0770c41e926ff981022eaa512d8980 (diff) | |
download | linux-716308a5331bf907b819f9db8dc942b19568f925.tar.xz |
init: add an init_stat helper
Add a simple helper to stat with a kernel space file name and switch
the early init code over to it.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/init.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/init.c b/fs/init.c index 145fb31b7a5f..51646ba38099 100644 --- a/fs/init.c +++ b/fs/init.c @@ -122,6 +122,21 @@ int __init init_eaccess(const char *filename) return error; } +int __init init_stat(const char *filename, struct kstat *stat, int flags) +{ + int lookup_flags = (flags & AT_SYMLINK_NOFOLLOW) ? 0 : LOOKUP_FOLLOW; + struct path path; + int error; + + error = kern_path(filename, lookup_flags, &path); + if (error) + return error; + error = vfs_getattr(&path, stat, STATX_BASIC_STATS, + flags | AT_NO_AUTOMOUNT); + path_put(&path); + return error; +} + int __init init_mknod(const char *filename, umode_t mode, unsigned int dev) { struct dentry *dentry; |