mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 16:20:55 +07:00
SYSFS: allow sysfs_create_link to create symlinks in the root of sysfs
This is needed to make the compatible link for /sys/block in the future. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
6468b3afa7
commit
ceeee1fb28
@ -3,6 +3,7 @@
|
||||
*/
|
||||
|
||||
#include <linux/fs.h>
|
||||
#include <linux/mount.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/kobject.h>
|
||||
#include <linux/namei.h>
|
||||
@ -82,10 +83,19 @@ static int sysfs_add_link(struct dentry * parent, const char * name, struct kobj
|
||||
*/
|
||||
int sysfs_create_link(struct kobject * kobj, struct kobject * target, const char * name)
|
||||
{
|
||||
struct dentry * dentry = kobj->dentry;
|
||||
struct dentry *dentry = NULL;
|
||||
int error = -EEXIST;
|
||||
|
||||
BUG_ON(!kobj || !kobj->dentry || !name);
|
||||
BUG_ON(!name);
|
||||
|
||||
if (!kobj) {
|
||||
if (sysfs_mount && sysfs_mount->mnt_sb)
|
||||
dentry = sysfs_mount->mnt_sb->s_root;
|
||||
} else
|
||||
dentry = kobj->dentry;
|
||||
|
||||
if (!dentry)
|
||||
return -EFAULT;
|
||||
|
||||
mutex_lock(&dentry->d_inode->i_mutex);
|
||||
if (!sysfs_dirent_exist(dentry->d_fsdata, name))
|
||||
|
Loading…
Reference in New Issue
Block a user