diff options
Diffstat (limited to 'fs/debugfs/file.c')
| -rw-r--r-- | fs/debugfs/file.c | 61 |
1 files changed, 27 insertions, 34 deletions
diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c index 66a505422e5c..bf3901ab1744 100644 --- a/fs/debugfs/file.c +++ b/fs/debugfs/file.c | |||
| @@ -13,7 +13,6 @@ | |||
| 13 | * | 13 | * |
| 14 | */ | 14 | */ |
| 15 | 15 | ||
| 16 | #include <linux/config.h> | ||
| 17 | #include <linux/module.h> | 16 | #include <linux/module.h> |
| 18 | #include <linux/fs.h> | 17 | #include <linux/fs.h> |
| 19 | #include <linux/pagemap.h> | 18 | #include <linux/pagemap.h> |
| @@ -33,8 +32,8 @@ static ssize_t default_write_file(struct file *file, const char __user *buf, | |||
| 33 | 32 | ||
| 34 | static int default_open(struct inode *inode, struct file *file) | 33 | static int default_open(struct inode *inode, struct file *file) |
| 35 | { | 34 | { |
| 36 | if (inode->u.generic_ip) | 35 | if (inode->i_private) |
| 37 | file->private_data = inode->u.generic_ip; | 36 | file->private_data = inode->i_private; |
| 38 | 37 | ||
| 39 | return 0; | 38 | return 0; |
| 40 | } | 39 | } |
| @@ -56,12 +55,11 @@ static u64 debugfs_u8_get(void *data) | |||
| 56 | DEFINE_SIMPLE_ATTRIBUTE(fops_u8, debugfs_u8_get, debugfs_u8_set, "%llu\n"); | 55 | DEFINE_SIMPLE_ATTRIBUTE(fops_u8, debugfs_u8_get, debugfs_u8_set, "%llu\n"); |
| 57 | 56 | ||
| 58 | /** | 57 | /** |
| 59 | * debugfs_create_u8 - create a file in the debugfs filesystem that is used to read and write an unsigned 8 bit value. | 58 | * debugfs_create_u8 - create a debugfs file that is used to read and write an unsigned 8-bit value |
| 60 | * | ||
| 61 | * @name: a pointer to a string containing the name of the file to create. | 59 | * @name: a pointer to a string containing the name of the file to create. |
| 62 | * @mode: the permission that the file should have | 60 | * @mode: the permission that the file should have |
| 63 | * @parent: a pointer to the parent dentry for this file. This should be a | 61 | * @parent: a pointer to the parent dentry for this file. This should be a |
| 64 | * directory dentry if set. If this paramater is NULL, then the | 62 | * directory dentry if set. If this parameter is %NULL, then the |
| 65 | * file will be created in the root of the debugfs filesystem. | 63 | * file will be created in the root of the debugfs filesystem. |
| 66 | * @value: a pointer to the variable that the file should read to and write | 64 | * @value: a pointer to the variable that the file should read to and write |
| 67 | * from. | 65 | * from. |
| @@ -73,11 +71,11 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_u8, debugfs_u8_get, debugfs_u8_set, "%llu\n"); | |||
| 73 | * This function will return a pointer to a dentry if it succeeds. This | 71 | * This function will return a pointer to a dentry if it succeeds. This |
| 74 | * pointer must be passed to the debugfs_remove() function when the file is | 72 | * pointer must be passed to the debugfs_remove() function when the file is |
| 75 | * to be removed (no automatic cleanup happens if your module is unloaded, | 73 | * to be removed (no automatic cleanup happens if your module is unloaded, |
| 76 | * you are responsible here.) If an error occurs, NULL will be returned. | 74 | * you are responsible here.) If an error occurs, %NULL will be returned. |
| 77 | * | 75 | * |
| 78 | * If debugfs is not enabled in the kernel, the value -ENODEV will be | 76 | * If debugfs is not enabled in the kernel, the value -%ENODEV will be |
| 79 | * returned. It is not wise to check for this value, but rather, check for | 77 | * returned. It is not wise to check for this value, but rather, check for |
| 80 | * NULL or !NULL instead as to eliminate the need for #ifdef in the calling | 78 | * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling |
| 81 | * code. | 79 | * code. |
| 82 | */ | 80 | */ |
| 83 | struct dentry *debugfs_create_u8(const char *name, mode_t mode, | 81 | struct dentry *debugfs_create_u8(const char *name, mode_t mode, |
| @@ -98,12 +96,11 @@ static u64 debugfs_u16_get(void *data) | |||
| 98 | DEFINE_SIMPLE_ATTRIBUTE(fops_u16, debugfs_u16_get, debugfs_u16_set, "%llu\n"); | 96 | DEFINE_SIMPLE_ATTRIBUTE(fops_u16, debugfs_u16_get, debugfs_u16_set, "%llu\n"); |
| 99 | 97 | ||
| 100 | /** | 98 | /** |
| 101 | * debugfs_create_u16 - create a file in the debugfs filesystem that is used to read and write an unsigned 16 bit value. | 99 | * debugfs_create_u16 - create a debugfs file that is used to read and write an unsigned 16-bit value |
| 102 | * | ||
| 103 | * @name: a pointer to a string containing the name of the file to create. | 100 | * @name: a pointer to a string containing the name of the file to create. |
| 104 | * @mode: the permission that the file should have | 101 | * @mode: the permission that the file should have |
| 105 | * @parent: a pointer to the parent dentry for this file. This should be a | 102 | * @parent: a pointer to the parent dentry for this file. This should be a |
| 106 | * directory dentry if set. If this paramater is NULL, then the | 103 | * directory dentry if set. If this parameter is %NULL, then the |
| 107 | * file will be created in the root of the debugfs filesystem. | 104 | * file will be created in the root of the debugfs filesystem. |
| 108 | * @value: a pointer to the variable that the file should read to and write | 105 | * @value: a pointer to the variable that the file should read to and write |
| 109 | * from. | 106 | * from. |
| @@ -115,11 +112,11 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_u16, debugfs_u16_get, debugfs_u16_set, "%llu\n"); | |||
| 115 | * This function will return a pointer to a dentry if it succeeds. This | 112 | * This function will return a pointer to a dentry if it succeeds. This |
| 116 | * pointer must be passed to the debugfs_remove() function when the file is | 113 | * pointer must be passed to the debugfs_remove() function when the file is |
| 117 | * to be removed (no automatic cleanup happens if your module is unloaded, | 114 | * to be removed (no automatic cleanup happens if your module is unloaded, |
| 118 | * you are responsible here.) If an error occurs, NULL will be returned. | 115 | * you are responsible here.) If an error occurs, %NULL will be returned. |
| 119 | * | 116 | * |
| 120 | * If debugfs is not enabled in the kernel, the value -ENODEV will be | 117 | * If debugfs is not enabled in the kernel, the value -%ENODEV will be |
| 121 | * returned. It is not wise to check for this value, but rather, check for | 118 | * returned. It is not wise to check for this value, but rather, check for |
| 122 | * NULL or !NULL instead as to eliminate the need for #ifdef in the calling | 119 | * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling |
| 123 | * code. | 120 | * code. |
| 124 | */ | 121 | */ |
| 125 | struct dentry *debugfs_create_u16(const char *name, mode_t mode, | 122 | struct dentry *debugfs_create_u16(const char *name, mode_t mode, |
| @@ -140,12 +137,11 @@ static u64 debugfs_u32_get(void *data) | |||
| 140 | DEFINE_SIMPLE_ATTRIBUTE(fops_u32, debugfs_u32_get, debugfs_u32_set, "%llu\n"); | 137 | DEFINE_SIMPLE_ATTRIBUTE(fops_u32, debugfs_u32_get, debugfs_u32_set, "%llu\n"); |
| 141 | 138 | ||
| 142 | /** | 139 | /** |
| 143 | * debugfs_create_u32 - create a file in the debugfs filesystem that is used to read and write an unsigned 32 bit value. | 140 | * debugfs_create_u32 - create a debugfs file that is used to read and write an unsigned 32-bit value |
| 144 | * | ||
| 145 | * @name: a pointer to a string containing the name of the file to create. | 141 | * @name: a pointer to a string containing the name of the file to create. |
| 146 | * @mode: the permission that the file should have | 142 | * @mode: the permission that the file should have |
| 147 | * @parent: a pointer to the parent dentry for this file. This should be a | 143 | * @parent: a pointer to the parent dentry for this file. This should be a |
| 148 | * directory dentry if set. If this paramater is NULL, then the | 144 | * directory dentry if set. If this parameter is %NULL, then the |
| 149 | * file will be created in the root of the debugfs filesystem. | 145 | * file will be created in the root of the debugfs filesystem. |
| 150 | * @value: a pointer to the variable that the file should read to and write | 146 | * @value: a pointer to the variable that the file should read to and write |
| 151 | * from. | 147 | * from. |
| @@ -157,11 +153,11 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_u32, debugfs_u32_get, debugfs_u32_set, "%llu\n"); | |||
| 157 | * This function will return a pointer to a dentry if it succeeds. This | 153 | * This function will return a pointer to a dentry if it succeeds. This |
| 158 | * pointer must be passed to the debugfs_remove() function when the file is | 154 | * pointer must be passed to the debugfs_remove() function when the file is |
| 159 | * to be removed (no automatic cleanup happens if your module is unloaded, | 155 | * to be removed (no automatic cleanup happens if your module is unloaded, |
| 160 | * you are responsible here.) If an error occurs, NULL will be returned. | 156 | * you are responsible here.) If an error occurs, %NULL will be returned. |
| 161 | * | 157 | * |
| 162 | * If debugfs is not enabled in the kernel, the value -ENODEV will be | 158 | * If debugfs is not enabled in the kernel, the value -%ENODEV will be |
| 163 | * returned. It is not wise to check for this value, but rather, check for | 159 | * returned. It is not wise to check for this value, but rather, check for |
| 164 | * NULL or !NULL instead as to eliminate the need for #ifdef in the calling | 160 | * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling |
| 165 | * code. | 161 | * code. |
| 166 | */ | 162 | */ |
| 167 | struct dentry *debugfs_create_u32(const char *name, mode_t mode, | 163 | struct dentry *debugfs_create_u32(const char *name, mode_t mode, |
| @@ -220,12 +216,11 @@ static const struct file_operations fops_bool = { | |||
| 220 | }; | 216 | }; |
| 221 | 217 | ||
| 222 | /** | 218 | /** |
| 223 | * debugfs_create_bool - create a file in the debugfs filesystem that is used to read and write a boolean value. | 219 | * debugfs_create_bool - create a debugfs file that is used to read and write a boolean value |
| 224 | * | ||
| 225 | * @name: a pointer to a string containing the name of the file to create. | 220 | * @name: a pointer to a string containing the name of the file to create. |
| 226 | * @mode: the permission that the file should have | 221 | * @mode: the permission that the file should have |
| 227 | * @parent: a pointer to the parent dentry for this file. This should be a | 222 | * @parent: a pointer to the parent dentry for this file. This should be a |
| 228 | * directory dentry if set. If this paramater is NULL, then the | 223 | * directory dentry if set. If this parameter is %NULL, then the |
| 229 | * file will be created in the root of the debugfs filesystem. | 224 | * file will be created in the root of the debugfs filesystem. |
| 230 | * @value: a pointer to the variable that the file should read to and write | 225 | * @value: a pointer to the variable that the file should read to and write |
| 231 | * from. | 226 | * from. |
| @@ -237,11 +232,11 @@ static const struct file_operations fops_bool = { | |||
| 237 | * This function will return a pointer to a dentry if it succeeds. This | 232 | * This function will return a pointer to a dentry if it succeeds. This |
| 238 | * pointer must be passed to the debugfs_remove() function when the file is | 233 | * pointer must be passed to the debugfs_remove() function when the file is |
| 239 | * to be removed (no automatic cleanup happens if your module is unloaded, | 234 | * to be removed (no automatic cleanup happens if your module is unloaded, |
| 240 | * you are responsible here.) If an error occurs, NULL will be returned. | 235 | * you are responsible here.) If an error occurs, %NULL will be returned. |
| 241 | * | 236 | * |
| 242 | * If debugfs is not enabled in the kernel, the value -ENODEV will be | 237 | * If debugfs is not enabled in the kernel, the value -%ENODEV will be |
| 243 | * returned. It is not wise to check for this value, but rather, check for | 238 | * returned. It is not wise to check for this value, but rather, check for |
| 244 | * NULL or !NULL instead as to eliminate the need for #ifdef in the calling | 239 | * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling |
| 245 | * code. | 240 | * code. |
| 246 | */ | 241 | */ |
| 247 | struct dentry *debugfs_create_bool(const char *name, mode_t mode, | 242 | struct dentry *debugfs_create_bool(const char *name, mode_t mode, |
| @@ -265,13 +260,11 @@ static struct file_operations fops_blob = { | |||
| 265 | }; | 260 | }; |
| 266 | 261 | ||
| 267 | /** | 262 | /** |
| 268 | * debugfs_create_blob - create a file in the debugfs filesystem that is | 263 | * debugfs_create_blob - create a debugfs file that is used to read and write a binary blob |
| 269 | * used to read and write a binary blob. | ||
| 270 | * | ||
| 271 | * @name: a pointer to a string containing the name of the file to create. | 264 | * @name: a pointer to a string containing the name of the file to create. |
| 272 | * @mode: the permission that the file should have | 265 | * @mode: the permission that the file should have |
| 273 | * @parent: a pointer to the parent dentry for this file. This should be a | 266 | * @parent: a pointer to the parent dentry for this file. This should be a |
| 274 | * directory dentry if set. If this paramater is NULL, then the | 267 | * directory dentry if set. If this parameter is %NULL, then the |
| 275 | * file will be created in the root of the debugfs filesystem. | 268 | * file will be created in the root of the debugfs filesystem. |
| 276 | * @blob: a pointer to a struct debugfs_blob_wrapper which contains a pointer | 269 | * @blob: a pointer to a struct debugfs_blob_wrapper which contains a pointer |
| 277 | * to the blob data and the size of the data. | 270 | * to the blob data and the size of the data. |
| @@ -283,11 +276,11 @@ static struct file_operations fops_blob = { | |||
| 283 | * This function will return a pointer to a dentry if it succeeds. This | 276 | * This function will return a pointer to a dentry if it succeeds. This |
| 284 | * pointer must be passed to the debugfs_remove() function when the file is | 277 | * pointer must be passed to the debugfs_remove() function when the file is |
| 285 | * to be removed (no automatic cleanup happens if your module is unloaded, | 278 | * to be removed (no automatic cleanup happens if your module is unloaded, |
| 286 | * you are responsible here.) If an error occurs, NULL will be returned. | 279 | * you are responsible here.) If an error occurs, %NULL will be returned. |
| 287 | * | 280 | * |
| 288 | * If debugfs is not enabled in the kernel, the value -ENODEV will be | 281 | * If debugfs is not enabled in the kernel, the value -%ENODEV will be |
| 289 | * returned. It is not wise to check for this value, but rather, check for | 282 | * returned. It is not wise to check for this value, but rather, check for |
| 290 | * NULL or !NULL instead as to eliminate the need for #ifdef in the calling | 283 | * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling |
| 291 | * code. | 284 | * code. |
| 292 | */ | 285 | */ |
| 293 | struct dentry *debugfs_create_blob(const char *name, mode_t mode, | 286 | struct dentry *debugfs_create_blob(const char *name, mode_t mode, |
