aboutsummaryrefslogtreecommitdiffstats
path: root/fs/debugfs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/debugfs/inode.c')
-rw-r--r--fs/debugfs/inode.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index 440128ebef3b..269e649e6dc6 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -16,7 +16,6 @@
16/* uncomment to get debug messages from the debug filesystem, ah the irony. */ 16/* uncomment to get debug messages from the debug filesystem, ah the irony. */
17/* #define DEBUG */ 17/* #define DEBUG */
18 18
19#include <linux/config.h>
20#include <linux/module.h> 19#include <linux/module.h>
21#include <linux/fs.h> 20#include <linux/fs.h>
22#include <linux/mount.h> 21#include <linux/mount.h>
@@ -41,7 +40,6 @@ static struct inode *debugfs_get_inode(struct super_block *sb, int mode, dev_t d
41 inode->i_mode = mode; 40 inode->i_mode = mode;
42 inode->i_uid = 0; 41 inode->i_uid = 0;
43 inode->i_gid = 0; 42 inode->i_gid = 0;
44 inode->i_blksize = PAGE_CACHE_SIZE;
45 inode->i_blocks = 0; 43 inode->i_blocks = 0;
46 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 44 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
47 switch (mode & S_IFMT) { 45 switch (mode & S_IFMT) {
@@ -163,14 +161,13 @@ static int debugfs_create_by_name(const char *name, mode_t mode,
163 161
164/** 162/**
165 * debugfs_create_file - create a file in the debugfs filesystem 163 * debugfs_create_file - create a file in the debugfs filesystem
166 *
167 * @name: a pointer to a string containing the name of the file to create. 164 * @name: a pointer to a string containing the name of the file to create.
168 * @mode: the permission that the file should have 165 * @mode: the permission that the file should have
169 * @parent: a pointer to the parent dentry for this file. This should be a 166 * @parent: a pointer to the parent dentry for this file. This should be a
170 * directory dentry if set. If this paramater is NULL, then the 167 * directory dentry if set. If this paramater is NULL, then the
171 * file will be created in the root of the debugfs filesystem. 168 * file will be created in the root of the debugfs filesystem.
172 * @data: a pointer to something that the caller will want to get to later 169 * @data: a pointer to something that the caller will want to get to later
173 * on. The inode.u.generic_ip pointer will point to this value on 170 * on. The inode.i_private pointer will point to this value on
174 * the open() call. 171 * the open() call.
175 * @fops: a pointer to a struct file_operations that should be used for 172 * @fops: a pointer to a struct file_operations that should be used for
176 * this file. 173 * this file.
@@ -183,11 +180,11 @@ static int debugfs_create_by_name(const char *name, mode_t mode,
183 * This function will return a pointer to a dentry if it succeeds. This 180 * This function will return a pointer to a dentry if it succeeds. This
184 * pointer must be passed to the debugfs_remove() function when the file is 181 * pointer must be passed to the debugfs_remove() function when the file is
185 * to be removed (no automatic cleanup happens if your module is unloaded, 182 * to be removed (no automatic cleanup happens if your module is unloaded,
186 * you are responsible here.) If an error occurs, NULL will be returned. 183 * you are responsible here.) If an error occurs, %NULL will be returned.
187 * 184 *
188 * If debugfs is not enabled in the kernel, the value -ENODEV will be 185 * If debugfs is not enabled in the kernel, the value -%ENODEV will be
189 * returned. It is not wise to check for this value, but rather, check for 186 * returned. It is not wise to check for this value, but rather, check for
190 * NULL or !NULL instead as to eliminate the need for #ifdef in the calling 187 * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling
191 * code. 188 * code.
192 */ 189 */
193struct dentry *debugfs_create_file(const char *name, mode_t mode, 190struct dentry *debugfs_create_file(const char *name, mode_t mode,
@@ -199,7 +196,7 @@ struct dentry *debugfs_create_file(const char *name, mode_t mode,
199 196
200 pr_debug("debugfs: creating file '%s'\n",name); 197 pr_debug("debugfs: creating file '%s'\n",name);
201 198
202 error = simple_pin_fs("debugfs", &debugfs_mount, &debugfs_mount_count); 199 error = simple_pin_fs(&debug_fs_type, &debugfs_mount, &debugfs_mount_count);
203 if (error) 200 if (error)
204 goto exit; 201 goto exit;
205 202
@@ -211,7 +208,7 @@ struct dentry *debugfs_create_file(const char *name, mode_t mode,
211 208
212 if (dentry->d_inode) { 209 if (dentry->d_inode) {
213 if (data) 210 if (data)
214 dentry->d_inode->u.generic_ip = data; 211 dentry->d_inode->i_private = data;
215 if (fops) 212 if (fops)
216 dentry->d_inode->i_fop = fops; 213 dentry->d_inode->i_fop = fops;
217 } 214 }
@@ -222,7 +219,6 @@ EXPORT_SYMBOL_GPL(debugfs_create_file);
222 219
223/** 220/**
224 * debugfs_create_dir - create a directory in the debugfs filesystem 221 * debugfs_create_dir - create a directory in the debugfs filesystem
225 *
226 * @name: a pointer to a string containing the name of the directory to 222 * @name: a pointer to a string containing the name of the directory to
227 * create. 223 * create.
228 * @parent: a pointer to the parent dentry for this file. This should be a 224 * @parent: a pointer to the parent dentry for this file. This should be a
@@ -234,11 +230,11 @@ EXPORT_SYMBOL_GPL(debugfs_create_file);
234 * This function will return a pointer to a dentry if it succeeds. This 230 * This function will return a pointer to a dentry if it succeeds. This
235 * pointer must be passed to the debugfs_remove() function when the file is 231 * pointer must be passed to the debugfs_remove() function when the file is
236 * to be removed (no automatic cleanup happens if your module is unloaded, 232 * to be removed (no automatic cleanup happens if your module is unloaded,
237 * you are responsible here.) If an error occurs, NULL will be returned. 233 * you are responsible here.) If an error occurs, %NULL will be returned.
238 * 234 *
239 * If debugfs is not enabled in the kernel, the value -ENODEV will be 235 * If debugfs is not enabled in the kernel, the value -%ENODEV will be
240 * returned. It is not wise to check for this value, but rather, check for 236 * returned. It is not wise to check for this value, but rather, check for
241 * NULL or !NULL instead as to eliminate the need for #ifdef in the calling 237 * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling
242 * code. 238 * code.
243 */ 239 */
244struct dentry *debugfs_create_dir(const char *name, struct dentry *parent) 240struct dentry *debugfs_create_dir(const char *name, struct dentry *parent)
@@ -251,7 +247,6 @@ EXPORT_SYMBOL_GPL(debugfs_create_dir);
251 247
252/** 248/**
253 * debugfs_remove - removes a file or directory from the debugfs filesystem 249 * debugfs_remove - removes a file or directory from the debugfs filesystem
254 *
255 * @dentry: a pointer to a the dentry of the file or directory to be 250 * @dentry: a pointer to a the dentry of the file or directory to be
256 * removed. 251 * removed.
257 * 252 *