aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2010-02-12 22:22:27 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2010-03-07 20:04:52 -0500
commitfac2622bbad4d7e3a32c53e631e018b80ec631dc (patch)
tree42e4ad2b38c6d40c86eabaff5efff2b0adeb0b40
parent2354dcc7218853a6537ec722be40fde9a11c413b (diff)
sysfs: Pass super_block to sysfs_get_inode
Currently sysfs_get_inode magically returns an inode on sysfs_sb. Make the super_block parameter explicit and the code becomes clearer. Acked-by: Tejun Heo <tj@kernel.org> Acked-by: Serge Hallyn <serue@us.ibm.com> Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--fs/sysfs/dir.c2
-rw-r--r--fs/sysfs/inode.c5
-rw-r--r--fs/sysfs/mount.c2
-rw-r--r--fs/sysfs/sysfs.h2
4 files changed, 6 insertions, 5 deletions
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index 481fdec09f4e..590717861c7a 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -645,7 +645,7 @@ static struct dentry * sysfs_lookup(struct inode *dir, struct dentry *dentry,
645 } 645 }
646 646
647 /* attach dentry and inode */ 647 /* attach dentry and inode */
648 inode = sysfs_get_inode(sd); 648 inode = sysfs_get_inode(dir->i_sb, sd);
649 if (!inode) { 649 if (!inode) {
650 ret = ERR_PTR(-ENOMEM); 650 ret = ERR_PTR(-ENOMEM);
651 goto out_unlock; 651 goto out_unlock;
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c
index 0d09f6c6efab..082daaecac1b 100644
--- a/fs/sysfs/inode.c
+++ b/fs/sysfs/inode.c
@@ -283,6 +283,7 @@ static void sysfs_init_inode(struct sysfs_dirent *sd, struct inode *inode)
283 283
284/** 284/**
285 * sysfs_get_inode - get inode for sysfs_dirent 285 * sysfs_get_inode - get inode for sysfs_dirent
286 * @sb: super block
286 * @sd: sysfs_dirent to allocate inode for 287 * @sd: sysfs_dirent to allocate inode for
287 * 288 *
288 * Get inode for @sd. If such inode doesn't exist, a new inode 289 * Get inode for @sd. If such inode doesn't exist, a new inode
@@ -295,11 +296,11 @@ static void sysfs_init_inode(struct sysfs_dirent *sd, struct inode *inode)
295 * RETURNS: 296 * RETURNS:
296 * Pointer to allocated inode on success, NULL on failure. 297 * Pointer to allocated inode on success, NULL on failure.
297 */ 298 */
298struct inode * sysfs_get_inode(struct sysfs_dirent *sd) 299struct inode * sysfs_get_inode(struct super_block *sb, struct sysfs_dirent *sd)
299{ 300{
300 struct inode *inode; 301 struct inode *inode;
301 302
302 inode = iget_locked(sysfs_sb, sd->s_ino); 303 inode = iget_locked(sb, sd->s_ino);
303 if (inode && (inode->i_state & I_NEW)) 304 if (inode && (inode->i_state & I_NEW))
304 sysfs_init_inode(sd, inode); 305 sysfs_init_inode(sd, inode);
305 306
diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c
index 49749955ccaf..89db07e489b0 100644
--- a/fs/sysfs/mount.c
+++ b/fs/sysfs/mount.c
@@ -54,7 +54,7 @@ static int sysfs_fill_super(struct super_block *sb, void *data, int silent)
54 54
55 /* get root inode, initialize and unlock it */ 55 /* get root inode, initialize and unlock it */
56 mutex_lock(&sysfs_mutex); 56 mutex_lock(&sysfs_mutex);
57 inode = sysfs_get_inode(&sysfs_root); 57 inode = sysfs_get_inode(sb, &sysfs_root);
58 mutex_unlock(&sysfs_mutex); 58 mutex_unlock(&sysfs_mutex);
59 if (!inode) { 59 if (!inode) {
60 pr_debug("sysfs: could not get root inode\n"); 60 pr_debug("sysfs: could not get root inode\n");
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h
index 5a3192a08442..7593d71d92f8 100644
--- a/fs/sysfs/sysfs.h
+++ b/fs/sysfs/sysfs.h
@@ -172,7 +172,7 @@ static inline void __sysfs_put(struct sysfs_dirent *sd)
172/* 172/*
173 * inode.c 173 * inode.c
174 */ 174 */
175struct inode *sysfs_get_inode(struct sysfs_dirent *sd); 175struct inode *sysfs_get_inode(struct super_block *sb, struct sysfs_dirent *sd);
176void sysfs_delete_inode(struct inode *inode); 176void sysfs_delete_inode(struct inode *inode);
177int sysfs_sd_setattr(struct sysfs_dirent *sd, struct iattr *iattr); 177int sysfs_sd_setattr(struct sysfs_dirent *sd, struct iattr *iattr);
178int sysfs_permission(struct inode *inode, int mask); 178int sysfs_permission(struct inode *inode, int mask);