summaryrefslogtreecommitdiffstats
path: root/fs/init.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-07-22 11:41:02 +0200
committerChristoph Hellwig <hch@lst.de>2020-07-31 08:17:53 +0200
commit1097742efc643ffc667c5c6684635b2663145a7d (patch)
tree8cfd84b2df0b78392661466d6a18ce09f3e5f9f7 /fs/init.c
parentb873498f99c77e7b5be3aa5ffe9ca67437232fe0 (diff)
downloadlinux-1097742efc643ffc667c5c6684635b2663145a7d.tar.gz
linux-1097742efc643ffc667c5c6684635b2663145a7d.tar.xz
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>
Diffstat (limited to 'fs/init.c')
-rw-r--r--fs/init.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/fs/init.c b/fs/init.c
index edd024465595..a66032d128b6 100644
--- a/fs/init.c
+++ b/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));