diff options
author | Christoph Hellwig <hch@lst.de> | 2020-07-22 12:14:36 +0300 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2020-07-31 09:17:53 +0300 |
commit | cd3acb6a79349f346714ab3d26d203a0c6ca5ab0 (patch) | |
tree | ef54d5dfaceca217273e3f4a323c95573b2b681a /fs/init.c | |
parent | 812931d693da58cc24d2bb8dec01c2b4a7f4668f (diff) | |
download | linux-cd3acb6a79349f346714ab3d26d203a0c6ca5ab0.tar.xz |
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.c | 16 |
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)); |