sysfs, kernfs: introduce sysfs_root_sd
Currently, it's assumed that there's a single kernfs hierarchy in the system anchored at sysfs_root which is defined as a global struct. To allow other users of kernfs, this will be made dynamic. Introduce a new global variable sysfs_root_sd which points to &sysfs_root and convert all &sysfs_root users. This patch doesn't introduce any behavior difference. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
9e30cc9595
commit
061447a496
@@ -68,7 +68,7 @@ int sysfs_create_dir_ns(struct kobject *kobj, const void *ns)
|
||||
if (kobj->parent)
|
||||
parent_sd = kobj->parent->sd;
|
||||
else
|
||||
parent_sd = &sysfs_root;
|
||||
parent_sd = sysfs_root_sd;
|
||||
|
||||
if (!parent_sd)
|
||||
return -ENOENT;
|
||||
@@ -134,7 +134,7 @@ int sysfs_move_dir_ns(struct kobject *kobj, struct kobject *new_parent_kobj,
|
||||
|
||||
BUG_ON(!sd->s_parent);
|
||||
new_parent_sd = new_parent_kobj && new_parent_kobj->sd ?
|
||||
new_parent_kobj->sd : &sysfs_root;
|
||||
new_parent_kobj->sd : sysfs_root_sd;
|
||||
|
||||
return kernfs_rename_ns(sd, new_parent_sd, sd->s_name, new_ns);
|
||||
}
|
||||
|
Reference in New Issue
Block a user