summaryrefslogtreecommitdiff
path: root/fs/debugfs/inode.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2015-01-25 22:36:18 +0300
committerAl Viro <viro@zeniv.linux.org.uk>2015-01-26 00:52:53 +0300
commitedac65eaf8d5c00b1d6004a44e76b9de6b038dc6 (patch)
tree61b3dc2fe048b296a57fa5a60177c0d223a86c1c /fs/debugfs/inode.c
parent680b302409cdc87c2000a31f2ceb2951bd642260 (diff)
downloadlinux-edac65eaf8d5c00b1d6004a44e76b9de6b038dc6.tar.xz
debugfs: take mode-dependent parts of debugfs_get_inode() into callers
... and trim the arguments list Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/debugfs/inode.c')
-rw-r--r--fs/debugfs/inode.c48
1 files changed, 16 insertions, 32 deletions
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index b765c04eba20..61e9a6815a19 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -34,37 +34,12 @@ static struct vfsmount *debugfs_mount;
static int debugfs_mount_count;
static bool debugfs_registered;
-static struct inode *debugfs_get_inode(struct super_block *sb, umode_t mode, dev_t dev,
- void *data, const struct file_operations *fops)
-
+static struct inode *debugfs_get_inode(struct super_block *sb)
{
struct inode *inode = new_inode(sb);
-
if (inode) {
inode->i_ino = get_next_ino();
- inode->i_mode = mode;
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
- switch (mode & S_IFMT) {
- default:
- init_special_inode(inode, mode, dev);
- break;
- case S_IFREG:
- inode->i_fop = fops ? fops : &debugfs_file_operations;
- inode->i_private = data;
- break;
- case S_IFLNK:
- inode->i_op = &debugfs_link_operations;
- inode->i_private = data;
- break;
- case S_IFDIR:
- inode->i_op = &simple_dir_inode_operations;
- inode->i_fop = &simple_dir_operations;
-
- /* directory inodes start off with i_nlink == 2
- * (for "." entry) */
- inc_nlink(inode);
- break;
- }
}
return inode;
}
@@ -334,10 +309,13 @@ struct dentry *debugfs_create_file(const char *name, umode_t mode,
if (IS_ERR(dentry))
return NULL;
- inode = debugfs_get_inode(dentry->d_sb, mode, 0, data, fops);
+ inode = debugfs_get_inode(dentry->d_sb);
if (unlikely(!inode))
return end_creating(dentry, -ENOMEM);
+ inode->i_mode = mode;
+ inode->i_fop = fops ? fops : &debugfs_file_operations;
+ inode->i_private = data;
d_instantiate(dentry, inode);
dget(dentry);
fsnotify_create(dentry->d_parent->d_inode, dentry);
@@ -371,12 +349,16 @@ struct dentry *debugfs_create_dir(const char *name, struct dentry *parent)
if (IS_ERR(dentry))
return NULL;
- inode = debugfs_get_inode(dentry->d_sb,
- S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO,
- 0, NULL, NULL);
+ inode = debugfs_get_inode(dentry->d_sb);
if (unlikely(!inode))
return end_creating(dentry, -ENOMEM);
+ inode->i_mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO;
+ inode->i_op = &simple_dir_inode_operations;
+ inode->i_fop = &simple_dir_operations;
+
+ /* directory inodes start off with i_nlink == 2 (for "." entry) */
+ inc_nlink(inode);
d_instantiate(dentry, inode);
dget(dentry);
inc_nlink(dentry->d_parent->d_inode);
@@ -423,12 +405,14 @@ struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent,
return NULL;
}
- inode = debugfs_get_inode(dentry->d_sb, S_IFLNK | S_IRWXUGO, 0,
- link, NULL);
+ inode = debugfs_get_inode(dentry->d_sb);
if (unlikely(!inode)) {
kfree(link);
return end_creating(dentry, -ENOMEM);
}
+ inode->i_mode = S_IFLNK | S_IRWXUGO;
+ inode->i_op = &debugfs_link_operations;
+ inode->i_private = link;
d_instantiate(dentry, inode);
dget(dentry);
return end_creating(dentry, 0);