1 // SPDX-License-Identifier: GPL-2.0
3 * inode.c - part of debugfs, a tiny little debug file system
5 * Copyright (C) 2004,2019 Greg Kroah-Hartman <greg@kroah.com>
6 * Copyright (C) 2004 IBM Inc.
7 * Copyright (C) 2019 Linux Foundation <gregkh@linuxfoundation.org>
9 * debugfs is for people to use instead of /proc or /sys.
10 * See ./Documentation/core-api/kernel-api.rst for more details.
13 #define pr_fmt(fmt) "debugfs: " fmt
15 #include <linux/module.h>
17 #include <linux/mount.h>
18 #include <linux/pagemap.h>
19 #include <linux/init.h>
20 #include <linux/kobject.h>
21 #include <linux/namei.h>
22 #include <linux/debugfs.h>
23 #include <linux/fsnotify.h>
24 #include <linux/string.h>
25 #include <linux/seq_file.h>
26 #include <linux/parser.h>
27 #include <linux/magic.h>
28 #include <linux/slab.h>
32 #define DEBUGFS_DEFAULT_MODE 0700
34 static struct vfsmount *debugfs_mount;
35 static int debugfs_mount_count;
36 static bool debugfs_registered;
38 static struct inode *debugfs_get_inode(struct super_block *sb)
40 struct inode *inode = new_inode(sb);
42 inode->i_ino = get_next_ino();
43 inode->i_atime = inode->i_mtime =
44 inode->i_ctime = current_time(inode);
49 struct debugfs_mount_opts {
62 static const match_table_t tokens = {
65 {Opt_mode, "mode=%o"},
69 struct debugfs_fs_info {
70 struct debugfs_mount_opts mount_opts;
73 static int debugfs_parse_options(char *data, struct debugfs_mount_opts *opts)
75 substring_t args[MAX_OPT_ARGS];
82 opts->mode = DEBUGFS_DEFAULT_MODE;
84 while ((p = strsep(&data, ",")) != NULL) {
88 token = match_token(p, tokens, args);
91 if (match_int(&args[0], &option))
93 uid = make_kuid(current_user_ns(), option);
99 if (match_int(&args[0], &option))
101 gid = make_kgid(current_user_ns(), option);
107 if (match_octal(&args[0], &option))
109 opts->mode = option & S_IALLUGO;
112 * We might like to report bad mount options here;
113 * but traditionally debugfs has ignored all mount options
121 static int debugfs_apply_options(struct super_block *sb)
123 struct debugfs_fs_info *fsi = sb->s_fs_info;
124 struct inode *inode = d_inode(sb->s_root);
125 struct debugfs_mount_opts *opts = &fsi->mount_opts;
127 inode->i_mode &= ~S_IALLUGO;
128 inode->i_mode |= opts->mode;
130 inode->i_uid = opts->uid;
131 inode->i_gid = opts->gid;
136 static int debugfs_remount(struct super_block *sb, int *flags, char *data)
139 struct debugfs_fs_info *fsi = sb->s_fs_info;
142 err = debugfs_parse_options(data, &fsi->mount_opts);
146 debugfs_apply_options(sb);
152 static int debugfs_show_options(struct seq_file *m, struct dentry *root)
154 struct debugfs_fs_info *fsi = root->d_sb->s_fs_info;
155 struct debugfs_mount_opts *opts = &fsi->mount_opts;
157 if (!uid_eq(opts->uid, GLOBAL_ROOT_UID))
158 seq_printf(m, ",uid=%u",
159 from_kuid_munged(&init_user_ns, opts->uid));
160 if (!gid_eq(opts->gid, GLOBAL_ROOT_GID))
161 seq_printf(m, ",gid=%u",
162 from_kgid_munged(&init_user_ns, opts->gid));
163 if (opts->mode != DEBUGFS_DEFAULT_MODE)
164 seq_printf(m, ",mode=%o", opts->mode);
169 static void debugfs_free_inode(struct inode *inode)
171 if (S_ISLNK(inode->i_mode))
172 kfree(inode->i_link);
173 free_inode_nonrcu(inode);
176 static const struct super_operations debugfs_super_operations = {
177 .statfs = simple_statfs,
178 .remount_fs = debugfs_remount,
179 .show_options = debugfs_show_options,
180 .free_inode = debugfs_free_inode,
183 static void debugfs_release_dentry(struct dentry *dentry)
185 void *fsd = dentry->d_fsdata;
187 if (!((unsigned long)fsd & DEBUGFS_FSDATA_IS_REAL_FOPS_BIT))
188 kfree(dentry->d_fsdata);
191 static struct vfsmount *debugfs_automount(struct path *path)
193 debugfs_automount_t f;
194 f = (debugfs_automount_t)path->dentry->d_fsdata;
195 return f(path->dentry, d_inode(path->dentry)->i_private);
198 static const struct dentry_operations debugfs_dops = {
199 .d_delete = always_delete_dentry,
200 .d_release = debugfs_release_dentry,
201 .d_automount = debugfs_automount,
204 static int debug_fill_super(struct super_block *sb, void *data, int silent)
206 static const struct tree_descr debug_files[] = {{""}};
207 struct debugfs_fs_info *fsi;
210 fsi = kzalloc(sizeof(struct debugfs_fs_info), GFP_KERNEL);
217 err = debugfs_parse_options(data, &fsi->mount_opts);
221 err = simple_fill_super(sb, DEBUGFS_MAGIC, debug_files);
225 sb->s_op = &debugfs_super_operations;
226 sb->s_d_op = &debugfs_dops;
228 debugfs_apply_options(sb);
234 sb->s_fs_info = NULL;
238 static struct dentry *debug_mount(struct file_system_type *fs_type,
239 int flags, const char *dev_name,
242 return mount_single(fs_type, flags, data, debug_fill_super);
245 static struct file_system_type debug_fs_type = {
246 .owner = THIS_MODULE,
248 .mount = debug_mount,
249 .kill_sb = kill_litter_super,
251 MODULE_ALIAS_FS("debugfs");
254 * debugfs_lookup() - look up an existing debugfs file
255 * @name: a pointer to a string containing the name of the file to look up.
256 * @parent: a pointer to the parent dentry of the file.
258 * This function will return a pointer to a dentry if it succeeds. If the file
259 * doesn't exist or an error occurs, %NULL will be returned. The returned
260 * dentry must be passed to dput() when it is no longer needed.
262 * If debugfs is not enabled in the kernel, the value -%ENODEV will be
265 struct dentry *debugfs_lookup(const char *name, struct dentry *parent)
267 struct dentry *dentry;
273 parent = debugfs_mount->mnt_root;
275 dentry = lookup_one_len_unlocked(name, parent, strlen(name));
278 if (!d_really_is_positive(dentry)) {
284 EXPORT_SYMBOL_GPL(debugfs_lookup);
286 static struct dentry *start_creating(const char *name, struct dentry *parent)
288 struct dentry *dentry;
291 pr_debug("creating file '%s'\n", name);
296 error = simple_pin_fs(&debug_fs_type, &debugfs_mount,
297 &debugfs_mount_count);
299 pr_err("Unable to pin filesystem for file '%s'\n", name);
300 return ERR_PTR(error);
303 /* If the parent is not specified, we create it in the root.
304 * We need the root dentry to do this, which is in the super
305 * block. A pointer to that is in the struct vfsmount that we
309 parent = debugfs_mount->mnt_root;
311 inode_lock(d_inode(parent));
312 dentry = lookup_one_len(name, parent, strlen(name));
313 if (!IS_ERR(dentry) && d_really_is_positive(dentry)) {
314 if (d_is_dir(dentry))
315 pr_err("Directory '%s' with parent '%s' already present!\n",
316 name, parent->d_name.name);
318 pr_err("File '%s' in directory '%s' already present!\n",
319 name, parent->d_name.name);
321 dentry = ERR_PTR(-EEXIST);
324 if (IS_ERR(dentry)) {
325 inode_unlock(d_inode(parent));
326 simple_release_fs(&debugfs_mount, &debugfs_mount_count);
332 static struct dentry *failed_creating(struct dentry *dentry)
334 inode_unlock(d_inode(dentry->d_parent));
336 simple_release_fs(&debugfs_mount, &debugfs_mount_count);
337 return ERR_PTR(-ENOMEM);
340 static struct dentry *end_creating(struct dentry *dentry)
342 inode_unlock(d_inode(dentry->d_parent));
346 static struct dentry *__debugfs_create_file(const char *name, umode_t mode,
347 struct dentry *parent, void *data,
348 const struct file_operations *proxy_fops,
349 const struct file_operations *real_fops)
351 struct dentry *dentry;
354 if (!(mode & S_IFMT))
356 BUG_ON(!S_ISREG(mode));
357 dentry = start_creating(name, parent);
362 inode = debugfs_get_inode(dentry->d_sb);
363 if (unlikely(!inode)) {
364 pr_err("out of free dentries, can not create file '%s'\n",
366 return failed_creating(dentry);
369 inode->i_mode = mode;
370 inode->i_private = data;
372 inode->i_fop = proxy_fops;
373 dentry->d_fsdata = (void *)((unsigned long)real_fops |
374 DEBUGFS_FSDATA_IS_REAL_FOPS_BIT);
376 d_instantiate(dentry, inode);
377 fsnotify_create(d_inode(dentry->d_parent), dentry);
378 return end_creating(dentry);
382 * debugfs_create_file - create a file in the debugfs filesystem
383 * @name: a pointer to a string containing the name of the file to create.
384 * @mode: the permission that the file should have.
385 * @parent: a pointer to the parent dentry for this file. This should be a
386 * directory dentry if set. If this parameter is NULL, then the
387 * file will be created in the root of the debugfs filesystem.
388 * @data: a pointer to something that the caller will want to get to later
389 * on. The inode.i_private pointer will point to this value on
391 * @fops: a pointer to a struct file_operations that should be used for
394 * This is the basic "create a file" function for debugfs. It allows for a
395 * wide range of flexibility in creating a file, or a directory (if you want
396 * to create a directory, the debugfs_create_dir() function is
397 * recommended to be used instead.)
399 * This function will return a pointer to a dentry if it succeeds. This
400 * pointer must be passed to the debugfs_remove() function when the file is
401 * to be removed (no automatic cleanup happens if your module is unloaded,
402 * you are responsible here.) If an error occurs, %ERR_PTR(-ERROR) will be
405 * If debugfs is not enabled in the kernel, the value -%ENODEV will be
408 struct dentry *debugfs_create_file(const char *name, umode_t mode,
409 struct dentry *parent, void *data,
410 const struct file_operations *fops)
413 return __debugfs_create_file(name, mode, parent, data,
414 fops ? &debugfs_full_proxy_file_operations :
415 &debugfs_noop_file_operations,
418 EXPORT_SYMBOL_GPL(debugfs_create_file);
421 * debugfs_create_file_unsafe - create a file in the debugfs filesystem
422 * @name: a pointer to a string containing the name of the file to create.
423 * @mode: the permission that the file should have.
424 * @parent: a pointer to the parent dentry for this file. This should be a
425 * directory dentry if set. If this parameter is NULL, then the
426 * file will be created in the root of the debugfs filesystem.
427 * @data: a pointer to something that the caller will want to get to later
428 * on. The inode.i_private pointer will point to this value on
430 * @fops: a pointer to a struct file_operations that should be used for
433 * debugfs_create_file_unsafe() is completely analogous to
434 * debugfs_create_file(), the only difference being that the fops
435 * handed it will not get protected against file removals by the
438 * It is your responsibility to protect your struct file_operation
439 * methods against file removals by means of debugfs_file_get()
440 * and debugfs_file_put(). ->open() is still protected by
443 * Any struct file_operations defined by means of
444 * DEFINE_DEBUGFS_ATTRIBUTE() is protected against file removals and
445 * thus, may be used here.
447 struct dentry *debugfs_create_file_unsafe(const char *name, umode_t mode,
448 struct dentry *parent, void *data,
449 const struct file_operations *fops)
452 return __debugfs_create_file(name, mode, parent, data,
453 fops ? &debugfs_open_proxy_file_operations :
454 &debugfs_noop_file_operations,
457 EXPORT_SYMBOL_GPL(debugfs_create_file_unsafe);
460 * debugfs_create_file_size - create a file in the debugfs filesystem
461 * @name: a pointer to a string containing the name of the file to create.
462 * @mode: the permission that the file should have.
463 * @parent: a pointer to the parent dentry for this file. This should be a
464 * directory dentry if set. If this parameter is NULL, then the
465 * file will be created in the root of the debugfs filesystem.
466 * @data: a pointer to something that the caller will want to get to later
467 * on. The inode.i_private pointer will point to this value on
469 * @fops: a pointer to a struct file_operations that should be used for
471 * @file_size: initial file size
473 * This is the basic "create a file" function for debugfs. It allows for a
474 * wide range of flexibility in creating a file, or a directory (if you want
475 * to create a directory, the debugfs_create_dir() function is
476 * recommended to be used instead.)
478 * This function will return a pointer to a dentry if it succeeds. This
479 * pointer must be passed to the debugfs_remove() function when the file is
480 * to be removed (no automatic cleanup happens if your module is unloaded,
481 * you are responsible here.) If an error occurs, %ERR_PTR(-ERROR) will be
484 * If debugfs is not enabled in the kernel, the value -%ENODEV will be
487 struct dentry *debugfs_create_file_size(const char *name, umode_t mode,
488 struct dentry *parent, void *data,
489 const struct file_operations *fops,
492 struct dentry *de = debugfs_create_file(name, mode, parent, data, fops);
495 d_inode(de)->i_size = file_size;
498 EXPORT_SYMBOL_GPL(debugfs_create_file_size);
501 * debugfs_create_dir - create a directory in the debugfs filesystem
502 * @name: a pointer to a string containing the name of the directory to
504 * @parent: a pointer to the parent dentry for this file. This should be a
505 * directory dentry if set. If this parameter is NULL, then the
506 * directory will be created in the root of the debugfs filesystem.
508 * This function creates a directory in debugfs with the given name.
510 * This function will return a pointer to a dentry if it succeeds. This
511 * pointer must be passed to the debugfs_remove() function when the file is
512 * to be removed (no automatic cleanup happens if your module is unloaded,
513 * you are responsible here.) If an error occurs, %ERR_PTR(-ERROR) will be
516 * If debugfs is not enabled in the kernel, the value -%ENODEV will be
519 struct dentry *debugfs_create_dir(const char *name, struct dentry *parent)
521 struct dentry *dentry = start_creating(name, parent);
527 inode = debugfs_get_inode(dentry->d_sb);
528 if (unlikely(!inode)) {
529 pr_err("out of free dentries, can not create directory '%s'\n",
531 return failed_creating(dentry);
534 inode->i_mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO;
535 inode->i_op = &simple_dir_inode_operations;
536 inode->i_fop = &simple_dir_operations;
538 /* directory inodes start off with i_nlink == 2 (for "." entry) */
540 d_instantiate(dentry, inode);
541 inc_nlink(d_inode(dentry->d_parent));
542 fsnotify_mkdir(d_inode(dentry->d_parent), dentry);
543 return end_creating(dentry);
545 EXPORT_SYMBOL_GPL(debugfs_create_dir);
548 * debugfs_create_automount - create automount point in the debugfs filesystem
549 * @name: a pointer to a string containing the name of the file to create.
550 * @parent: a pointer to the parent dentry for this file. This should be a
551 * directory dentry if set. If this parameter is NULL, then the
552 * file will be created in the root of the debugfs filesystem.
553 * @f: function to be called when pathname resolution steps on that one.
554 * @data: opaque argument to pass to f().
556 * @f should return what ->d_automount() would.
558 struct dentry *debugfs_create_automount(const char *name,
559 struct dentry *parent,
560 debugfs_automount_t f,
563 struct dentry *dentry = start_creating(name, parent);
569 inode = debugfs_get_inode(dentry->d_sb);
570 if (unlikely(!inode)) {
571 pr_err("out of free dentries, can not create automount '%s'\n",
573 return failed_creating(dentry);
576 make_empty_dir_inode(inode);
577 inode->i_flags |= S_AUTOMOUNT;
578 inode->i_private = data;
579 dentry->d_fsdata = (void *)f;
580 /* directory inodes start off with i_nlink == 2 (for "." entry) */
582 d_instantiate(dentry, inode);
583 inc_nlink(d_inode(dentry->d_parent));
584 fsnotify_mkdir(d_inode(dentry->d_parent), dentry);
585 return end_creating(dentry);
587 EXPORT_SYMBOL(debugfs_create_automount);
590 * debugfs_create_symlink- create a symbolic link in the debugfs filesystem
591 * @name: a pointer to a string containing the name of the symbolic link to
593 * @parent: a pointer to the parent dentry for this symbolic link. This
594 * should be a directory dentry if set. If this parameter is NULL,
595 * then the symbolic link will be created in the root of the debugfs
597 * @target: a pointer to a string containing the path to the target of the
600 * This function creates a symbolic link with the given name in debugfs that
601 * links to the given target path.
603 * This function will return a pointer to a dentry if it succeeds. This
604 * pointer must be passed to the debugfs_remove() function when the symbolic
605 * link is to be removed (no automatic cleanup happens if your module is
606 * unloaded, you are responsible here.) If an error occurs, %ERR_PTR(-ERROR)
609 * If debugfs is not enabled in the kernel, the value -%ENODEV will be
612 struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent,
615 struct dentry *dentry;
617 char *link = kstrdup(target, GFP_KERNEL);
619 return ERR_PTR(-ENOMEM);
621 dentry = start_creating(name, parent);
622 if (IS_ERR(dentry)) {
627 inode = debugfs_get_inode(dentry->d_sb);
628 if (unlikely(!inode)) {
629 pr_err("out of free dentries, can not create symlink '%s'\n",
632 return failed_creating(dentry);
634 inode->i_mode = S_IFLNK | S_IRWXUGO;
635 inode->i_op = &simple_symlink_inode_operations;
636 inode->i_link = link;
637 d_instantiate(dentry, inode);
638 return end_creating(dentry);
640 EXPORT_SYMBOL_GPL(debugfs_create_symlink);
642 static void __debugfs_file_removed(struct dentry *dentry)
644 struct debugfs_fsdata *fsd;
647 * Paired with the closing smp_mb() implied by a successful
648 * cmpxchg() in debugfs_file_get(): either
649 * debugfs_file_get() must see a dead dentry or we must see a
650 * debugfs_fsdata instance at ->d_fsdata here (or both).
653 fsd = READ_ONCE(dentry->d_fsdata);
654 if ((unsigned long)fsd & DEBUGFS_FSDATA_IS_REAL_FOPS_BIT)
656 if (!refcount_dec_and_test(&fsd->active_users))
657 wait_for_completion(&fsd->active_users_drained);
660 static int __debugfs_remove(struct dentry *dentry, struct dentry *parent)
664 if (simple_positive(dentry)) {
666 if (d_is_dir(dentry)) {
667 ret = simple_rmdir(d_inode(parent), dentry);
669 fsnotify_rmdir(d_inode(parent), dentry);
671 simple_unlink(d_inode(parent), dentry);
672 fsnotify_unlink(d_inode(parent), dentry);
676 if (d_is_reg(dentry))
677 __debugfs_file_removed(dentry);
684 * debugfs_remove - removes a file or directory from the debugfs filesystem
685 * @dentry: a pointer to a the dentry of the file or directory to be
686 * removed. If this parameter is NULL or an error value, nothing
689 * This function removes a file or directory in debugfs that was previously
690 * created with a call to another debugfs function (like
691 * debugfs_create_file() or variants thereof.)
693 * This function is required to be called in order for the file to be
694 * removed, no automatic cleanup of files will happen when a module is
695 * removed, you are responsible here.
697 void debugfs_remove(struct dentry *dentry)
699 struct dentry *parent;
702 if (IS_ERR_OR_NULL(dentry))
705 parent = dentry->d_parent;
706 inode_lock(d_inode(parent));
707 ret = __debugfs_remove(dentry, parent);
708 inode_unlock(d_inode(parent));
710 simple_release_fs(&debugfs_mount, &debugfs_mount_count);
712 EXPORT_SYMBOL_GPL(debugfs_remove);
715 * debugfs_remove_recursive - recursively removes a directory
716 * @dentry: a pointer to a the dentry of the directory to be removed. If this
717 * parameter is NULL or an error value, nothing will be done.
719 * This function recursively removes a directory tree in debugfs that
720 * was previously created with a call to another debugfs function
721 * (like debugfs_create_file() or variants thereof.)
723 * This function is required to be called in order for the file to be
724 * removed, no automatic cleanup of files will happen when a module is
725 * removed, you are responsible here.
727 void debugfs_remove_recursive(struct dentry *dentry)
729 struct dentry *child, *parent;
731 if (IS_ERR_OR_NULL(dentry))
736 inode_lock(d_inode(parent));
739 * The parent->d_subdirs is protected by the d_lock. Outside that
740 * lock, the child can be unlinked and set to be freed which can
741 * use the d_u.d_child as the rcu head and corrupt this list.
743 spin_lock(&parent->d_lock);
744 list_for_each_entry(child, &parent->d_subdirs, d_child) {
745 if (!simple_positive(child))
748 /* perhaps simple_empty(child) makes more sense */
749 if (!list_empty(&child->d_subdirs)) {
750 spin_unlock(&parent->d_lock);
751 inode_unlock(d_inode(parent));
756 spin_unlock(&parent->d_lock);
758 if (!__debugfs_remove(child, parent))
759 simple_release_fs(&debugfs_mount, &debugfs_mount_count);
762 * The parent->d_lock protects agaist child from unlinking
763 * from d_subdirs. When releasing the parent->d_lock we can
764 * no longer trust that the next pointer is valid.
765 * Restart the loop. We'll skip this one with the
766 * simple_positive() check.
770 spin_unlock(&parent->d_lock);
772 inode_unlock(d_inode(parent));
774 parent = parent->d_parent;
775 inode_lock(d_inode(parent));
781 if (!__debugfs_remove(child, parent))
782 simple_release_fs(&debugfs_mount, &debugfs_mount_count);
783 inode_unlock(d_inode(parent));
785 EXPORT_SYMBOL_GPL(debugfs_remove_recursive);
788 * debugfs_rename - rename a file/directory in the debugfs filesystem
789 * @old_dir: a pointer to the parent dentry for the renamed object. This
790 * should be a directory dentry.
791 * @old_dentry: dentry of an object to be renamed.
792 * @new_dir: a pointer to the parent dentry where the object should be
793 * moved. This should be a directory dentry.
794 * @new_name: a pointer to a string containing the target name.
796 * This function renames a file/directory in debugfs. The target must not
797 * exist for rename to succeed.
799 * This function will return a pointer to old_dentry (which is updated to
800 * reflect renaming) if it succeeds. If an error occurs, %NULL will be
803 * If debugfs is not enabled in the kernel, the value -%ENODEV will be
806 struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry,
807 struct dentry *new_dir, const char *new_name)
810 struct dentry *dentry = NULL, *trap;
811 struct name_snapshot old_name;
817 if (IS_ERR_OR_NULL(old_dentry))
820 trap = lock_rename(new_dir, old_dir);
821 /* Source or destination directories don't exist? */
822 if (d_really_is_negative(old_dir) || d_really_is_negative(new_dir))
824 /* Source does not exist, cyclic rename, or mountpoint? */
825 if (d_really_is_negative(old_dentry) || old_dentry == trap ||
826 d_mountpoint(old_dentry))
828 dentry = lookup_one_len(new_name, new_dir, strlen(new_name));
829 /* Lookup failed, cyclic rename or target exists? */
830 if (IS_ERR(dentry) || dentry == trap || d_really_is_positive(dentry))
833 take_dentry_name_snapshot(&old_name, old_dentry);
835 error = simple_rename(d_inode(old_dir), old_dentry, d_inode(new_dir),
838 release_dentry_name_snapshot(&old_name);
841 d_move(old_dentry, dentry);
842 fsnotify_move(d_inode(old_dir), d_inode(new_dir), &old_name.name,
843 d_is_dir(old_dentry),
845 release_dentry_name_snapshot(&old_name);
846 unlock_rename(new_dir, old_dir);
850 if (dentry && !IS_ERR(dentry))
852 unlock_rename(new_dir, old_dir);
855 return ERR_PTR(-EINVAL);
857 EXPORT_SYMBOL_GPL(debugfs_rename);
860 * debugfs_initialized - Tells whether debugfs has been registered
862 bool debugfs_initialized(void)
864 return debugfs_registered;
866 EXPORT_SYMBOL_GPL(debugfs_initialized);
868 static int __init debugfs_init(void)
872 retval = sysfs_create_mount_point(kernel_kobj, "debug");
876 retval = register_filesystem(&debug_fs_type);
878 sysfs_remove_mount_point(kernel_kobj, "debug");
880 debugfs_registered = true;
884 core_initcall(debugfs_init);