In the upcoming new sysfs interface, sysfs_root will be exported. To
ease usage and make dummy declaration easier, make sysfs_root a
pointer.
Signed-off-by: Tejun Heo <[email protected]>
---
fs/sysfs/dir.c | 4 ++--
fs/sysfs/mount.c | 8 +++++---
fs/sysfs/symlink.c | 2 +-
fs/sysfs/sysfs.h | 2 +-
4 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index fe8270c..ba631eb 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -651,7 +651,7 @@ int sysfs_create_dir(struct kobject * kobj)
if (kobj->parent)
parent_sd = kobj->parent->sd;
else
- parent_sd = &sysfs_root;
+ parent_sd = sysfs_root;
error = create_dir(kobj, parent_sd, kobject_name(kobj), &sd);
if (!error)
@@ -832,7 +832,7 @@ int sysfs_move_dir(struct kobject *kobj, struct kobject *new_parent_kobj)
mutex_lock(&sysfs_rename_mutex);
BUG_ON(!sd->s_parent);
- new_parent_sd = new_parent_kobj->sd ? new_parent_kobj->sd : &sysfs_root;
+ new_parent_sd = new_parent_kobj->sd ? new_parent_kobj->sd : sysfs_root;
error = 0;
if (sd->s_parent == new_parent_sd)
diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c
index 465902c..d00d4b9 100644
--- a/fs/sysfs/mount.c
+++ b/fs/sysfs/mount.c
@@ -23,7 +23,7 @@ static const struct super_operations sysfs_ops = {
.drop_inode = generic_delete_inode,
};
-struct sysfs_dirent sysfs_root = {
+static struct sysfs_dirent sysfs_root_storage = {
.s_name = "",
.s_count = ATOMIC_INIT(1),
.s_flags = SYSFS_DIR,
@@ -31,6 +31,8 @@ struct sysfs_dirent sysfs_root = {
.s_ino = 1,
};
+struct sysfs_dirent * const sysfs_root = &sysfs_root_storage;
+
static int sysfs_fill_super(struct super_block *sb, void *data, int silent)
{
struct inode *inode;
@@ -44,7 +46,7 @@ static int sysfs_fill_super(struct super_block *sb, void *data, int silent)
sysfs_sb = sb;
/* get root inode, initialize and unlock it */
- inode = sysfs_get_inode(&sysfs_root);
+ inode = sysfs_get_inode(sysfs_root);
if (!inode) {
pr_debug("sysfs: could not get root inode\n");
return -ENOMEM;
@@ -57,7 +59,7 @@ static int sysfs_fill_super(struct super_block *sb, void *data, int silent)
iput(inode);
return -ENOMEM;
}
- root->d_fsdata = &sysfs_root;
+ root->d_fsdata = sysfs_root;
sb->s_root = root;
return 0;
}
diff --git a/fs/sysfs/symlink.c b/fs/sysfs/symlink.c
index ffa82e9..6b3358e 100644
--- a/fs/sysfs/symlink.c
+++ b/fs/sysfs/symlink.c
@@ -61,7 +61,7 @@ int sysfs_create_link(struct kobject * kobj, struct kobject * target, const char
BUG_ON(!name);
if (!kobj)
- parent_sd = &sysfs_root;
+ parent_sd = sysfs_root;
else
parent_sd = kobj->sd;
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h
index 58f517b..9180e2c 100644
--- a/fs/sysfs/sysfs.h
+++ b/fs/sysfs/sysfs.h
@@ -78,7 +78,7 @@ struct sysfs_addrm_cxt {
/*
* mount.c
*/
-extern struct sysfs_dirent sysfs_root;
+extern struct sysfs_dirent * const sysfs_root;
extern struct super_block *sysfs_sb;
extern struct kmem_cache *sysfs_dir_cachep;
--
1.5.0.3
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]