diff options
Diffstat (limited to 'fs/debugfs')
-rw-r--r-- | fs/debugfs/inode.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index 05f2960ed7c3..adaaa04448b3 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c | |||
@@ -89,8 +89,9 @@ static int debugfs_mknod(struct inode *dir, struct dentry *dentry, | |||
89 | return error; | 89 | return error; |
90 | } | 90 | } |
91 | 91 | ||
92 | static int debugfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) | 92 | static int debugfs_mkdir(struct dentry *dentry, umode_t mode) |
93 | { | 93 | { |
94 | struct inode *dir = dentry->d_parent->d_inode; | ||
94 | int res; | 95 | int res; |
95 | 96 | ||
96 | mode = (mode & (S_IRWXUGO | S_ISVTX)) | S_IFDIR; | 97 | mode = (mode & (S_IRWXUGO | S_ISVTX)) | S_IFDIR; |
@@ -102,16 +103,18 @@ static int debugfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) | |||
102 | return res; | 103 | return res; |
103 | } | 104 | } |
104 | 105 | ||
105 | static int debugfs_link(struct inode *dir, struct dentry *dentry, umode_t mode, | 106 | static int debugfs_link(struct dentry *dentry, umode_t mode, |
106 | void *data) | 107 | void *data) |
107 | { | 108 | { |
109 | struct inode *dir = dentry->d_parent->d_inode; | ||
108 | mode = (mode & S_IALLUGO) | S_IFLNK; | 110 | mode = (mode & S_IALLUGO) | S_IFLNK; |
109 | return debugfs_mknod(dir, dentry, mode, 0, data, NULL); | 111 | return debugfs_mknod(dir, dentry, mode, 0, data, NULL); |
110 | } | 112 | } |
111 | 113 | ||
112 | static int debugfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, | 114 | static int debugfs_create(struct dentry *dentry, umode_t mode, |
113 | void *data, const struct file_operations *fops) | 115 | void *data, const struct file_operations *fops) |
114 | { | 116 | { |
117 | struct inode *dir = dentry->d_parent->d_inode; | ||
115 | int res; | 118 | int res; |
116 | 119 | ||
117 | mode = (mode & S_IALLUGO) | S_IFREG; | 120 | mode = (mode & S_IALLUGO) | S_IFREG; |
@@ -329,16 +332,14 @@ static struct dentry *__create_file(const char *name, umode_t mode, | |||
329 | if (!IS_ERR(dentry)) { | 332 | if (!IS_ERR(dentry)) { |
330 | switch (mode & S_IFMT) { | 333 | switch (mode & S_IFMT) { |
331 | case S_IFDIR: | 334 | case S_IFDIR: |
332 | error = debugfs_mkdir(parent->d_inode, dentry, mode); | 335 | error = debugfs_mkdir(dentry, mode); |
333 | 336 | ||
334 | break; | 337 | break; |
335 | case S_IFLNK: | 338 | case S_IFLNK: |
336 | error = debugfs_link(parent->d_inode, dentry, mode, | 339 | error = debugfs_link(dentry, mode, data); |
337 | data); | ||
338 | break; | 340 | break; |
339 | default: | 341 | default: |
340 | error = debugfs_create(parent->d_inode, dentry, mode, | 342 | error = debugfs_create(dentry, mode, data, fops); |
341 | data, fops); | ||
342 | break; | 343 | break; |
343 | } | 344 | } |
344 | dput(dentry); | 345 | dput(dentry); |