CAPI: Eliminate capifs_root variable
capifs_mnt->mnt_sb->s_root already contains what we need. Signed-off-by: Jan Kiszka <jan.kiszka@web.de> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
90926f0e58
commit
07ad603ab8
@@ -32,7 +32,6 @@ static char *revision = "$Revision: 1.1.2.3 $";
|
|||||||
#define CAPIFS_SUPER_MAGIC (('C'<<8)|'N')
|
#define CAPIFS_SUPER_MAGIC (('C'<<8)|'N')
|
||||||
|
|
||||||
static struct vfsmount *capifs_mnt;
|
static struct vfsmount *capifs_mnt;
|
||||||
static struct dentry *capifs_root;
|
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
int setuid;
|
int setuid;
|
||||||
@@ -118,7 +117,7 @@ capifs_fill_super(struct super_block *s, void *data, int silent)
|
|||||||
inode->i_fop = &simple_dir_operations;
|
inode->i_fop = &simple_dir_operations;
|
||||||
inode->i_nlink = 2;
|
inode->i_nlink = 2;
|
||||||
|
|
||||||
capifs_root = s->s_root = d_alloc_root(inode);
|
s->s_root = d_alloc_root(inode);
|
||||||
if (s->s_root)
|
if (s->s_root)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@@ -143,15 +142,17 @@ static struct file_system_type capifs_fs_type = {
|
|||||||
|
|
||||||
struct dentry *capifs_new_ncci(unsigned int number, dev_t device)
|
struct dentry *capifs_new_ncci(unsigned int number, dev_t device)
|
||||||
{
|
{
|
||||||
|
struct super_block *s = capifs_mnt->mnt_sb;
|
||||||
|
struct dentry *root = s->s_root;
|
||||||
struct dentry *dentry;
|
struct dentry *dentry;
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
char name[10];
|
char name[10];
|
||||||
int namelen;
|
int namelen;
|
||||||
|
|
||||||
mutex_lock(&capifs_root->d_inode->i_mutex);
|
mutex_lock(&root->d_inode->i_mutex);
|
||||||
|
|
||||||
namelen = sprintf(name, "%d", number);
|
namelen = sprintf(name, "%d", number);
|
||||||
dentry = lookup_one_len(name, capifs_root, namelen);
|
dentry = lookup_one_len(name, root, namelen);
|
||||||
if (IS_ERR(dentry)) {
|
if (IS_ERR(dentry)) {
|
||||||
dentry = NULL;
|
dentry = NULL;
|
||||||
goto unlock_out;
|
goto unlock_out;
|
||||||
@@ -163,7 +164,7 @@ struct dentry *capifs_new_ncci(unsigned int number, dev_t device)
|
|||||||
goto unlock_out;
|
goto unlock_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
inode = new_inode(capifs_mnt->mnt_sb);
|
inode = new_inode(s);
|
||||||
if (!inode) {
|
if (!inode) {
|
||||||
dput(dentry);
|
dput(dentry);
|
||||||
dentry = NULL;
|
dentry = NULL;
|
||||||
@@ -181,19 +182,20 @@ struct dentry *capifs_new_ncci(unsigned int number, dev_t device)
|
|||||||
dget(dentry);
|
dget(dentry);
|
||||||
|
|
||||||
unlock_out:
|
unlock_out:
|
||||||
mutex_unlock(&capifs_root->d_inode->i_mutex);
|
mutex_unlock(&root->d_inode->i_mutex);
|
||||||
|
|
||||||
return dentry;
|
return dentry;
|
||||||
}
|
}
|
||||||
|
|
||||||
void capifs_free_ncci(struct dentry *dentry)
|
void capifs_free_ncci(struct dentry *dentry)
|
||||||
{
|
{
|
||||||
|
struct dentry *root = capifs_mnt->mnt_sb->s_root;
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
|
|
||||||
if (!dentry)
|
if (!dentry)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mutex_lock(&capifs_root->d_inode->i_mutex);
|
mutex_lock(&root->d_inode->i_mutex);
|
||||||
|
|
||||||
inode = dentry->d_inode;
|
inode = dentry->d_inode;
|
||||||
if (inode) {
|
if (inode) {
|
||||||
@@ -203,7 +205,7 @@ void capifs_free_ncci(struct dentry *dentry)
|
|||||||
}
|
}
|
||||||
dput(dentry);
|
dput(dentry);
|
||||||
|
|
||||||
mutex_unlock(&capifs_root->d_inode->i_mutex);
|
mutex_unlock(&root->d_inode->i_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __init capifs_init(void)
|
static int __init capifs_init(void)
|
||||||
|
Reference in New Issue
Block a user