Commit 160f7592 authored by Al Viro's avatar Al Viro

debugfs_mknod(): get rid useless arguments

dev is always zero, dir was only used to get its ->i_sb, which is
equal to ->d_sb of dentry...
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 9b73fab0
...@@ -70,23 +70,18 @@ static struct inode *debugfs_get_inode(struct super_block *sb, umode_t mode, dev ...@@ -70,23 +70,18 @@ static struct inode *debugfs_get_inode(struct super_block *sb, umode_t mode, dev
} }
/* SMP-safe */ /* SMP-safe */
static int debugfs_mknod(struct inode *dir, struct dentry *dentry, static int debugfs_mknod(struct dentry *dentry,
umode_t mode, dev_t dev, void *data, umode_t mode, void *data,
const struct file_operations *fops) const struct file_operations *fops)
{ {
struct inode *inode; struct inode *inode;
int error = -EPERM;
if (dentry->d_inode) inode = debugfs_get_inode(dentry->d_sb, mode, 0, data, fops);
return -EEXIST; if (unlikely(!inode))
return -EPERM;
inode = debugfs_get_inode(dir->i_sb, mode, dev, data, fops);
if (inode) {
d_instantiate(dentry, inode); d_instantiate(dentry, inode);
dget(dentry); dget(dentry);
error = 0; return 0;
}
return error;
} }
static int debugfs_mkdir(struct dentry *dentry, umode_t mode) static int debugfs_mkdir(struct dentry *dentry, umode_t mode)
...@@ -95,7 +90,7 @@ static int debugfs_mkdir(struct dentry *dentry, umode_t mode) ...@@ -95,7 +90,7 @@ static int debugfs_mkdir(struct dentry *dentry, umode_t mode)
int res; int res;
mode = (mode & (S_IRWXUGO | S_ISVTX)) | S_IFDIR; mode = (mode & (S_IRWXUGO | S_ISVTX)) | S_IFDIR;
res = debugfs_mknod(dir, dentry, mode, 0, NULL, NULL); res = debugfs_mknod(dentry, mode, NULL, NULL);
if (!res) { if (!res) {
inc_nlink(dir); inc_nlink(dir);
fsnotify_mkdir(dir, dentry); fsnotify_mkdir(dir, dentry);
...@@ -110,7 +105,7 @@ static int debugfs_create(struct dentry *dentry, umode_t mode, ...@@ -110,7 +105,7 @@ static int debugfs_create(struct dentry *dentry, umode_t mode,
int res; int res;
mode = (mode & S_IALLUGO) | S_IFREG; mode = (mode & S_IALLUGO) | S_IFREG;
res = debugfs_mknod(dir, dentry, mode, 0, data, fops); res = debugfs_mknod(dentry, mode, data, fops);
if (!res) if (!res)
fsnotify_create(dir, dentry); fsnotify_create(dir, dentry);
return res; return res;
...@@ -458,8 +453,7 @@ struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent, ...@@ -458,8 +453,7 @@ struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent,
return NULL; return NULL;
} }
error = debugfs_mknod(dentry->d_parent->d_inode, dentry, error = debugfs_mknod(dentry, S_IFLNK | S_IRWXUGO, link, NULL);
S_IFLNK | S_IRWXUGO, 0, link, NULL);
if (error) if (error)
kfree(link); kfree(link);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment