summaryrefslogtreecommitdiffstats
path: root/fs/sysfs/mount.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-11-28 20:54:39 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-11-30 03:09:27 +0100
commit061447a496b915f1dc8f8c645c6825f856d2bbac (patch)
treece67f6c0ed84ab95594ae3b50fe409e80ca336cf /fs/sysfs/mount.c
parentsysfs, kernfs: no need to kern_mount() sysfs from sysfs_init() (diff)
downloadlinux-061447a496b915f1dc8f8c645c6825f856d2bbac.tar.xz
linux-061447a496b915f1dc8f8c645c6825f856d2bbac.zip
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>
Diffstat (limited to 'fs/sysfs/mount.c')
-rw-r--r--fs/sysfs/mount.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c
index 0c80f0379016..7cbd1fce2826 100644
--- a/fs/sysfs/mount.c
+++ b/fs/sysfs/mount.c
@@ -32,7 +32,7 @@ static const struct super_operations sysfs_ops = {
.evict_inode = sysfs_evict_inode,
};
-struct sysfs_dirent sysfs_root = {
+static struct sysfs_dirent sysfs_root = {
.s_name = "",
.s_count = ATOMIC_INIT(1),
.s_flags = SYSFS_DIR,
@@ -40,6 +40,8 @@ struct sysfs_dirent sysfs_root = {
.s_ino = 1,
};
+struct sysfs_dirent *sysfs_root_sd = &sysfs_root;
+
static int sysfs_fill_super(struct super_block *sb)
{
struct inode *inode;
@@ -53,7 +55,7 @@ static int sysfs_fill_super(struct super_block *sb)
/* get root inode, initialize and unlock it */
mutex_lock(&sysfs_mutex);
- inode = sysfs_get_inode(sb, &sysfs_root);
+ inode = sysfs_get_inode(sb, sysfs_root_sd);
mutex_unlock(&sysfs_mutex);
if (!inode) {
pr_debug("sysfs: could not get root inode\n");
@@ -66,7 +68,7 @@ static int sysfs_fill_super(struct super_block *sb)
pr_debug("%s: could not get root dentry!\n", __func__);
return -ENOMEM;
}
- root->d_fsdata = &sysfs_root;
+ root->d_fsdata = sysfs_root_sd;
sb->s_root = root;
sb->s_d_op = &sysfs_dentry_ops;
return 0;