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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
2354dcc721
commit
fac2622bba
@@ -645,7 +645,7 @@ static struct dentry * sysfs_lookup(struct inode *dir, struct dentry *dentry,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* attach dentry and inode */
|
/* attach dentry and inode */
|
||||||
inode = sysfs_get_inode(sd);
|
inode = sysfs_get_inode(dir->i_sb, sd);
|
||||||
if (!inode) {
|
if (!inode) {
|
||||||
ret = ERR_PTR(-ENOMEM);
|
ret = ERR_PTR(-ENOMEM);
|
||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
|
@@ -283,6 +283,7 @@ static void sysfs_init_inode(struct sysfs_dirent *sd, struct inode *inode)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* sysfs_get_inode - get inode for sysfs_dirent
|
* sysfs_get_inode - get inode for sysfs_dirent
|
||||||
|
* @sb: super block
|
||||||
* @sd: sysfs_dirent to allocate inode for
|
* @sd: sysfs_dirent to allocate inode for
|
||||||
*
|
*
|
||||||
* Get inode for @sd. If such inode doesn't exist, a new inode
|
* 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)
|
|||||||
* RETURNS:
|
* RETURNS:
|
||||||
* Pointer to allocated inode on success, NULL on failure.
|
* Pointer to allocated inode on success, NULL on failure.
|
||||||
*/
|
*/
|
||||||
struct inode * sysfs_get_inode(struct sysfs_dirent *sd)
|
struct inode * sysfs_get_inode(struct super_block *sb, struct sysfs_dirent *sd)
|
||||||
{
|
{
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
|
|
||||||
inode = iget_locked(sysfs_sb, sd->s_ino);
|
inode = iget_locked(sb, sd->s_ino);
|
||||||
if (inode && (inode->i_state & I_NEW))
|
if (inode && (inode->i_state & I_NEW))
|
||||||
sysfs_init_inode(sd, inode);
|
sysfs_init_inode(sd, inode);
|
||||||
|
|
||||||
|
@@ -54,7 +54,7 @@ static int sysfs_fill_super(struct super_block *sb, void *data, int silent)
|
|||||||
|
|
||||||
/* get root inode, initialize and unlock it */
|
/* get root inode, initialize and unlock it */
|
||||||
mutex_lock(&sysfs_mutex);
|
mutex_lock(&sysfs_mutex);
|
||||||
inode = sysfs_get_inode(&sysfs_root);
|
inode = sysfs_get_inode(sb, &sysfs_root);
|
||||||
mutex_unlock(&sysfs_mutex);
|
mutex_unlock(&sysfs_mutex);
|
||||||
if (!inode) {
|
if (!inode) {
|
||||||
pr_debug("sysfs: could not get root inode\n");
|
pr_debug("sysfs: could not get root inode\n");
|
||||||
|
@@ -172,7 +172,7 @@ static inline void __sysfs_put(struct sysfs_dirent *sd)
|
|||||||
/*
|
/*
|
||||||
* inode.c
|
* inode.c
|
||||||
*/
|
*/
|
||||||
struct inode *sysfs_get_inode(struct sysfs_dirent *sd);
|
struct inode *sysfs_get_inode(struct super_block *sb, struct sysfs_dirent *sd);
|
||||||
void sysfs_delete_inode(struct inode *inode);
|
void sysfs_delete_inode(struct inode *inode);
|
||||||
int sysfs_sd_setattr(struct sysfs_dirent *sd, struct iattr *iattr);
|
int sysfs_sd_setattr(struct sysfs_dirent *sd, struct iattr *iattr);
|
||||||
int sysfs_permission(struct inode *inode, int mask);
|
int sysfs_permission(struct inode *inode, int mask);
|
||||||
|
Reference in New Issue
Block a user