diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2015-01-25 14:09:49 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2015-01-25 16:52:51 -0500 |
commit | 160f7592f2364b47c615cff96117f0877d58e427 (patch) | |
tree | 46e3980cf2795fc0896d692918e19a2de9594e2a /fs/debugfs/inode.c | |
parent | 9b73fab01bcd62530e8c9a5da44d3ed8a753b3eb (diff) |
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: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/debugfs/inode.c')
-rw-r--r-- | fs/debugfs/inode.c | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index c69e00d69ff1..bc02e2096977 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c | |||
@@ -70,23 +70,18 @@ static struct inode *debugfs_get_inode(struct super_block *sb, umode_t mode, dev | |||
70 | } | 70 | } |
71 | 71 | ||
72 | /* SMP-safe */ | 72 | /* SMP-safe */ |
73 | static int debugfs_mknod(struct inode *dir, struct dentry *dentry, | 73 | static int debugfs_mknod(struct dentry *dentry, |
74 | umode_t mode, dev_t dev, void *data, | 74 | umode_t mode, void *data, |
75 | const struct file_operations *fops) | 75 | const struct file_operations *fops) |
76 | { | 76 | { |
77 | struct inode *inode; | 77 | struct inode *inode; |
78 | int error = -EPERM; | ||
79 | 78 | ||
80 | if (dentry->d_inode) | 79 | inode = debugfs_get_inode(dentry->d_sb, mode, 0, data, fops); |
81 | return -EEXIST; | 80 | if (unlikely(!inode)) |
82 | 81 | return -EPERM; | |
83 | inode = debugfs_get_inode(dir->i_sb, mode, dev, data, fops); | 82 | d_instantiate(dentry, inode); |
84 | if (inode) { | 83 | dget(dentry); |
85 | d_instantiate(dentry, inode); | 84 | return 0; |
86 | dget(dentry); | ||
87 | error = 0; | ||
88 | } | ||
89 | return error; | ||
90 | } | 85 | } |
91 | 86 | ||
92 | static int debugfs_mkdir(struct dentry *dentry, umode_t mode) | 87 | 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 | int res; | 90 | int res; |
96 | 91 | ||
97 | mode = (mode & (S_IRWXUGO | S_ISVTX)) | S_IFDIR; | 92 | mode = (mode & (S_IRWXUGO | S_ISVTX)) | S_IFDIR; |
98 | res = debugfs_mknod(dir, dentry, mode, 0, NULL, NULL); | 93 | res = debugfs_mknod(dentry, mode, NULL, NULL); |
99 | if (!res) { | 94 | if (!res) { |
100 | inc_nlink(dir); | 95 | inc_nlink(dir); |
101 | fsnotify_mkdir(dir, dentry); | 96 | fsnotify_mkdir(dir, dentry); |
@@ -110,7 +105,7 @@ static int debugfs_create(struct dentry *dentry, umode_t mode, | |||
110 | int res; | 105 | int res; |
111 | 106 | ||
112 | mode = (mode & S_IALLUGO) | S_IFREG; | 107 | mode = (mode & S_IALLUGO) | S_IFREG; |
113 | res = debugfs_mknod(dir, dentry, mode, 0, data, fops); | 108 | res = debugfs_mknod(dentry, mode, data, fops); |
114 | if (!res) | 109 | if (!res) |
115 | fsnotify_create(dir, dentry); | 110 | fsnotify_create(dir, dentry); |
116 | return res; | 111 | return res; |
@@ -458,8 +453,7 @@ struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent, | |||
458 | return NULL; | 453 | return NULL; |
459 | } | 454 | } |
460 | 455 | ||
461 | error = debugfs_mknod(dentry->d_parent->d_inode, dentry, | 456 | error = debugfs_mknod(dentry, S_IFLNK | S_IRWXUGO, link, NULL); |
462 | S_IFLNK | S_IRWXUGO, 0, link, NULL); | ||
463 | if (error) | 457 | if (error) |
464 | kfree(link); | 458 | kfree(link); |
465 | 459 | ||