aboutsummaryrefslogtreecommitdiffstats
path: root/fs/debugfs/inode.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /fs/debugfs/inode.c
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'fs/debugfs/inode.c')
-rw-r--r--fs/debugfs/inode.c35
1 files changed, 12 insertions, 23 deletions
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index 30a87b3dbcac..e7a7a2f07324 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -13,9 +13,6 @@
13 * 13 *
14 */ 14 */
15 15
16/* uncomment to get debug messages from the debug filesystem, ah the irony. */
17/* #define DEBUG */
18
19#include <linux/module.h> 16#include <linux/module.h>
20#include <linux/fs.h> 17#include <linux/fs.h>
21#include <linux/mount.h> 18#include <linux/mount.h>
@@ -40,6 +37,7 @@ static struct inode *debugfs_get_inode(struct super_block *sb, int mode, dev_t d
40 struct inode *inode = new_inode(sb); 37 struct inode *inode = new_inode(sb);
41 38
42 if (inode) { 39 if (inode) {
40 inode->i_ino = get_next_ino();
43 inode->i_mode = mode; 41 inode->i_mode = mode;
44 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 42 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
45 switch (mode & S_IFMT) { 43 switch (mode & S_IFMT) {
@@ -134,17 +132,17 @@ static int debug_fill_super(struct super_block *sb, void *data, int silent)
134 return simple_fill_super(sb, DEBUGFS_MAGIC, debug_files); 132 return simple_fill_super(sb, DEBUGFS_MAGIC, debug_files);
135} 133}
136 134
137static int debug_get_sb(struct file_system_type *fs_type, 135static struct dentry *debug_mount(struct file_system_type *fs_type,
138 int flags, const char *dev_name, 136 int flags, const char *dev_name,
139 void *data, struct vfsmount *mnt) 137 void *data)
140{ 138{
141 return get_sb_single(fs_type, flags, data, debug_fill_super, mnt); 139 return mount_single(fs_type, flags, data, debug_fill_super);
142} 140}
143 141
144static struct file_system_type debug_fs_type = { 142static struct file_system_type debug_fs_type = {
145 .owner = THIS_MODULE, 143 .owner = THIS_MODULE,
146 .name = "debugfs", 144 .name = "debugfs",
147 .get_sb = debug_get_sb, 145 .mount = debug_mount,
148 .kill_sb = kill_litter_super, 146 .kill_sb = kill_litter_super,
149}; 147};
150 148
@@ -309,7 +307,7 @@ struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent,
309} 307}
310EXPORT_SYMBOL_GPL(debugfs_create_symlink); 308EXPORT_SYMBOL_GPL(debugfs_create_symlink);
311 309
312static void __debugfs_remove(struct dentry *dentry, struct dentry *parent) 310static int __debugfs_remove(struct dentry *dentry, struct dentry *parent)
313{ 311{
314 int ret = 0; 312 int ret = 0;
315 313
@@ -332,6 +330,7 @@ static void __debugfs_remove(struct dentry *dentry, struct dentry *parent)
332 dput(dentry); 330 dput(dentry);
333 } 331 }
334 } 332 }
333 return ret;
335} 334}
336 335
337/** 336/**
@@ -350,7 +349,8 @@ static void __debugfs_remove(struct dentry *dentry, struct dentry *parent)
350void debugfs_remove(struct dentry *dentry) 349void debugfs_remove(struct dentry *dentry)
351{ 350{
352 struct dentry *parent; 351 struct dentry *parent;
353 352 int ret;
353
354 if (!dentry) 354 if (!dentry)
355 return; 355 return;
356 356
@@ -359,9 +359,10 @@ void debugfs_remove(struct dentry *dentry)
359 return; 359 return;
360 360
361 mutex_lock(&parent->d_inode->i_mutex); 361 mutex_lock(&parent->d_inode->i_mutex);
362 __debugfs_remove(dentry, parent); 362 ret = __debugfs_remove(dentry, parent);
363 mutex_unlock(&parent->d_inode->i_mutex); 363 mutex_unlock(&parent->d_inode->i_mutex);
364 simple_release_fs(&debugfs_mount, &debugfs_mount_count); 364 if (!ret)
365 simple_release_fs(&debugfs_mount, &debugfs_mount_count);
365} 366}
366EXPORT_SYMBOL_GPL(debugfs_remove); 367EXPORT_SYMBOL_GPL(debugfs_remove);
367 368
@@ -539,17 +540,5 @@ static int __init debugfs_init(void)
539 540
540 return retval; 541 return retval;
541} 542}
542
543static void __exit debugfs_exit(void)
544{
545 debugfs_registered = false;
546
547 simple_release_fs(&debugfs_mount, &debugfs_mount_count);
548 unregister_filesystem(&debug_fs_type);
549 kobject_put(debug_kobj);
550}
551
552core_initcall(debugfs_init); 543core_initcall(debugfs_init);
553module_exit(debugfs_exit);
554MODULE_LICENSE("GPL");
555 544