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>

authored by Eric W. Biederman and committed by Greg Kroah-Hartman fac2622b 2354dcc7

+6 -5
+1 -1
fs/sysfs/dir.c
··· 645 } 646 647 /* attach dentry and inode */ 648 - inode = sysfs_get_inode(sd); 649 if (!inode) { 650 ret = ERR_PTR(-ENOMEM); 651 goto out_unlock;
··· 645 } 646 647 /* attach dentry and inode */ 648 + inode = sysfs_get_inode(dir->i_sb, sd); 649 if (!inode) { 650 ret = ERR_PTR(-ENOMEM); 651 goto out_unlock;
+3 -2
fs/sysfs/inode.c
··· 283 284 /** 285 * sysfs_get_inode - get inode for sysfs_dirent 286 * @sd: sysfs_dirent to allocate inode for 287 * 288 * Get inode for @sd. If such inode doesn't exist, a new inode ··· 296 * RETURNS: 297 * Pointer to allocated inode on success, NULL on failure. 298 */ 299 - struct inode * sysfs_get_inode(struct sysfs_dirent *sd) 300 { 301 struct inode *inode; 302 303 - inode = iget_locked(sysfs_sb, sd->s_ino); 304 if (inode && (inode->i_state & I_NEW)) 305 sysfs_init_inode(sd, inode); 306
··· 283 284 /** 285 * sysfs_get_inode - get inode for sysfs_dirent 286 + * @sb: super block 287 * @sd: sysfs_dirent to allocate inode for 288 * 289 * Get inode for @sd. If such inode doesn't exist, a new inode ··· 295 * RETURNS: 296 * Pointer to allocated inode on success, NULL on failure. 297 */ 298 + struct inode * sysfs_get_inode(struct super_block *sb, struct sysfs_dirent *sd) 299 { 300 struct inode *inode; 301 302 + inode = iget_locked(sb, sd->s_ino); 303 if (inode && (inode->i_state & I_NEW)) 304 sysfs_init_inode(sd, inode); 305
+1 -1
fs/sysfs/mount.c
··· 54 55 /* get root inode, initialize and unlock it */ 56 mutex_lock(&sysfs_mutex); 57 - inode = sysfs_get_inode(&sysfs_root); 58 mutex_unlock(&sysfs_mutex); 59 if (!inode) { 60 pr_debug("sysfs: could not get root inode\n");
··· 54 55 /* get root inode, initialize and unlock it */ 56 mutex_lock(&sysfs_mutex); 57 + inode = sysfs_get_inode(sb, &sysfs_root); 58 mutex_unlock(&sysfs_mutex); 59 if (!inode) { 60 pr_debug("sysfs: could not get root inode\n");
+1 -1
fs/sysfs/sysfs.h
··· 172 /* 173 * inode.c 174 */ 175 - struct inode *sysfs_get_inode(struct sysfs_dirent *sd); 176 void sysfs_delete_inode(struct inode *inode); 177 int sysfs_sd_setattr(struct sysfs_dirent *sd, struct iattr *iattr); 178 int sysfs_permission(struct inode *inode, int mask);
··· 172 /* 173 * inode.c 174 */ 175 + struct inode *sysfs_get_inode(struct super_block *sb, struct sysfs_dirent *sd); 176 void sysfs_delete_inode(struct inode *inode); 177 int sysfs_sd_setattr(struct sysfs_dirent *sd, struct iattr *iattr); 178 int sysfs_permission(struct inode *inode, int mask);