mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
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>
This commit is contained in:
15
fs/init.c
15
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;
|
||||
|
Reference in New Issue
Block a user