summaryrefslogtreecommitdiffstats
path: root/fs/init.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-07-22 11:14:36 +0200
committerChristoph Hellwig <hch@lst.de>2020-07-31 08:17:53 +0200
commitcd3acb6a79349f346714ab3d26d203a0c6ca5ab0 (patch)
treeef54d5dfaceca217273e3f4a323c95573b2b681a /fs/init.c
parent812931d693da58cc24d2bb8dec01c2b4a7f4668f (diff)
downloadlinux-cd3acb6a79349f346714ab3d26d203a0c6ca5ab0.tar.bz2
init: add an init_symlink helper
Add a simple helper to symlink with a kernel space file name and switch the early init code over to it. Remove the now unused ksys_symlink. Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/init.c')
-rw-r--r--fs/init.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/init.c b/fs/init.c
index 5db9d9f74868..09ef2b58d48c 100644
--- a/fs/init.c
+++ b/fs/init.c
@@ -155,6 +155,22 @@ out:
return error;
}
+int __init init_symlink(const char *oldname, const char *newname)
+{
+ struct dentry *dentry;
+ struct path path;
+ int error;
+
+ dentry = kern_path_create(AT_FDCWD, newname, &path, 0);
+ if (IS_ERR(dentry))
+ return PTR_ERR(dentry);
+ error = security_path_symlink(&path, dentry, oldname);
+ if (!error)
+ error = vfs_symlink(path.dentry->d_inode, dentry, oldname);
+ done_path_create(&path, dentry);
+ return error;
+}
+
int __init init_unlink(const char *pathname)
{
return do_unlinkat(AT_FDCWD, getname_kernel(pathname));