summaryrefslogtreecommitdiffstats
path: root/fs/init.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-07-22 11:14:59 +0200
committerChristoph Hellwig <hch@lst.de>2020-07-31 08:17:53 +0200
commit83ff98c3e9cd2b82b4289e185f2ce7d635a9cbd3 (patch)
treec45bf0dfc39594f8787be068175f50a9d124cc9e /fs/init.c
parentinit: add an init_symlink helper (diff)
downloadlinux-83ff98c3e9cd2b82b4289e185f2ce7d635a9cbd3.tar.xz
linux-83ff98c3e9cd2b82b4289e185f2ce7d635a9cbd3.zip
init: add an init_mkdir helper
Add a simple helper to mkdir with a kernel space file name and switch the early init code over to it. Remove the now unused ksys_mkdir. Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/init.c')
-rw-r--r--fs/init.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/init.c b/fs/init.c
index 09ef2b58d48c..127033d08426 100644
--- a/fs/init.c
+++ b/fs/init.c
@@ -176,6 +176,24 @@ int __init init_unlink(const char *pathname)
return do_unlinkat(AT_FDCWD, getname_kernel(pathname));
}
+int __init init_mkdir(const char *pathname, umode_t mode)
+{
+ struct dentry *dentry;
+ struct path path;
+ int error;
+
+ dentry = kern_path_create(AT_FDCWD, pathname, &path, LOOKUP_DIRECTORY);
+ if (IS_ERR(dentry))
+ return PTR_ERR(dentry);
+ if (!IS_POSIXACL(path.dentry->d_inode))
+ mode &= ~current_umask();
+ error = security_path_mkdir(&path, dentry, mode);
+ if (!error)
+ error = vfs_mkdir(path.dentry->d_inode, dentry, mode);
+ done_path_create(&path, dentry);
+ return error;
+}
+
int __init init_rmdir(const char *pathname)
{
return do_rmdir(AT_FDCWD, getname_kernel(pathname));