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>
This commit is contained in:
16
fs/init.c
16
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));
|
||||
|
||||
Reference in New Issue
Block a user