mirror of https://github.com/torvalds/linux.git
convert ibmasmfs
static contents for each "service processor", whatever the fuck it is. Congruent subdirectories of root, created at mount time, taken out by kill_litter_super(). All dentries created with d_alloc_name() and are left pinned. The odd part is that the list of service providers is assumed to be unchanging - no locking, nothing to handle removals or extra elements added later on. ... and it's a PCI device. If you ever tell it to remove an instance, you are fucked - it doesn't bother with removing its directory from filesystem, it has a strange check that presumably wanted to be a check for removed devices, but it had never been fleshed out. Anyway, d_add() -> d_make_persistent()+dput() in ibmasmfs_create_dir() and ibmasmfs_create_file(), and make the latter return int - no need to even borrow that dentry, callers completely ignore it. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
ea800a515f
commit
e6ef35deec
|
|
@ -103,7 +103,7 @@ static struct file_system_type ibmasmfs_type = {
|
|||
.owner = THIS_MODULE,
|
||||
.name = "ibmasmfs",
|
||||
.init_fs_context = ibmasmfs_init_fs_context,
|
||||
.kill_sb = kill_litter_super,
|
||||
.kill_sb = kill_anon_super,
|
||||
};
|
||||
MODULE_ALIAS_FS("ibmasmfs");
|
||||
|
||||
|
|
@ -144,7 +144,7 @@ static struct inode *ibmasmfs_make_inode(struct super_block *sb, int mode)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static struct dentry *ibmasmfs_create_file(struct dentry *parent,
|
||||
static int ibmasmfs_create_file(struct dentry *parent,
|
||||
const char *name,
|
||||
const struct file_operations *fops,
|
||||
void *data,
|
||||
|
|
@ -155,19 +155,20 @@ static struct dentry *ibmasmfs_create_file(struct dentry *parent,
|
|||
|
||||
dentry = d_alloc_name(parent, name);
|
||||
if (!dentry)
|
||||
return NULL;
|
||||
return -ENOMEM;
|
||||
|
||||
inode = ibmasmfs_make_inode(parent->d_sb, S_IFREG | mode);
|
||||
if (!inode) {
|
||||
dput(dentry);
|
||||
return NULL;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
inode->i_fop = fops;
|
||||
inode->i_private = data;
|
||||
|
||||
d_add(dentry, inode);
|
||||
return dentry;
|
||||
d_make_persistent(dentry, inode);
|
||||
dput(dentry);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct dentry *ibmasmfs_create_dir(struct dentry *parent,
|
||||
|
|
@ -189,8 +190,9 @@ static struct dentry *ibmasmfs_create_dir(struct dentry *parent,
|
|||
inode->i_op = &simple_dir_inode_operations;
|
||||
inode->i_fop = ibmasmfs_dir_ops;
|
||||
|
||||
d_add(dentry, inode);
|
||||
return dentry;
|
||||
d_make_persistent(dentry, inode);
|
||||
dput(dentry);
|
||||
return dentry; // borrowed
|
||||
}
|
||||
|
||||
int ibmasmfs_register(void)
|
||||
|
|
|
|||
Loading…
Reference in New Issue