init: add an init_chmod helper
Add a simple helper to chmod 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:
13
fs/init.c
13
fs/init.c
@@ -96,6 +96,19 @@ int __init init_chown(const char *filename, uid_t user, gid_t group, int flags)
|
||||
return error;
|
||||
}
|
||||
|
||||
int __init init_chmod(const char *filename, umode_t mode)
|
||||
{
|
||||
struct path path;
|
||||
int error;
|
||||
|
||||
error = kern_path(filename, LOOKUP_FOLLOW, &path);
|
||||
if (error)
|
||||
return error;
|
||||
error = chmod_common(&path, mode);
|
||||
path_put(&path);
|
||||
return error;
|
||||
}
|
||||
|
||||
int __init init_unlink(const char *pathname)
|
||||
{
|
||||
return do_unlinkat(AT_FDCWD, getname_kernel(pathname));
|
||||
|
Reference in New Issue
Block a user