inode.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688
  1. /*
  2. * inode.c - part of debugfs, a tiny little debug file system
  3. *
  4. * Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com>
  5. * Copyright (C) 2004 IBM Inc.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License version
  9. * 2 as published by the Free Software Foundation.
  10. *
  11. * debugfs is for people to use instead of /proc or /sys.
  12. * See Documentation/DocBook/kernel-api for more details.
  13. *
  14. */
  15. #include <linux/module.h>
  16. #include <linux/fs.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>
  29. #define DEBUGFS_DEFAULT_MODE 0755
  30. static struct vfsmount *debugfs_mount;
  31. static int debugfs_mount_count;
  32. static bool debugfs_registered;
  33. static struct inode *debugfs_get_inode(struct super_block *sb, umode_t mode, dev_t dev,
  34. void *data, const struct file_operations *fops)
  35. {
  36. struct inode *inode = new_inode(sb);
  37. if (inode) {
  38. inode->i_ino = get_next_ino();
  39. inode->i_mode = mode;
  40. inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
  41. switch (mode & S_IFMT) {
  42. default:
  43. init_special_inode(inode, mode, dev);
  44. break;
  45. case S_IFREG:
  46. inode->i_fop = fops ? fops : &debugfs_file_operations;
  47. inode->i_private = data;
  48. break;
  49. case S_IFLNK:
  50. inode->i_op = &debugfs_link_operations;
  51. inode->i_private = data;
  52. break;
  53. case S_IFDIR:
  54. inode->i_op = &simple_dir_inode_operations;
  55. inode->i_fop = &simple_dir_operations;
  56. inode->i_private = NULL;
  57. /* directory inodes start off with i_nlink == 2
  58. * (for "." entry) */
  59. inc_nlink(inode);
  60. break;
  61. }
  62. }
  63. return inode;
  64. }
  65. /* SMP-safe */
  66. static int debugfs_mknod(struct inode *dir, struct dentry *dentry,
  67. umode_t mode, dev_t dev, void *data,
  68. const struct file_operations *fops)
  69. {
  70. struct inode *inode;
  71. int error = -EPERM;
  72. if (dentry->d_inode)
  73. return -EEXIST;
  74. inode = debugfs_get_inode(dir->i_sb, mode, dev, data, fops);
  75. if (inode) {
  76. d_instantiate(dentry, inode);
  77. dget(dentry);
  78. error = 0;
  79. }
  80. return error;
  81. }
  82. static int debugfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
  83. {
  84. int res;
  85. mode = (mode & (S_IRWXUGO | S_ISVTX)) | S_IFDIR;
  86. res = debugfs_mknod(dir, dentry, mode, 0, NULL, NULL);
  87. if (!res) {
  88. inc_nlink(dir);
  89. fsnotify_mkdir(dir, dentry);
  90. }
  91. return res;
  92. }
  93. static int debugfs_link(struct inode *dir, struct dentry *dentry, umode_t mode,
  94. void *data)
  95. {
  96. mode = (mode & S_IALLUGO) | S_IFLNK;
  97. return debugfs_mknod(dir, dentry, mode, 0, data, NULL);
  98. }
  99. static int debugfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
  100. void *data, const struct file_operations *fops)
  101. {
  102. int res;
  103. mode = (mode & S_IALLUGO) | S_IFREG;
  104. res = debugfs_mknod(dir, dentry, mode, 0, data, fops);
  105. if (!res)
  106. fsnotify_create(dir, dentry);
  107. return res;
  108. }
  109. static inline int debugfs_positive(struct dentry *dentry)
  110. {
  111. return dentry->d_inode && !d_unhashed(dentry);
  112. }
  113. struct debugfs_mount_opts {
  114. uid_t uid;
  115. gid_t gid;
  116. umode_t mode;
  117. };
  118. enum {
  119. Opt_uid,
  120. Opt_gid,
  121. Opt_mode,
  122. Opt_err
  123. };
  124. static const match_table_t tokens = {
  125. {Opt_uid, "uid=%u"},
  126. {Opt_gid, "gid=%u"},
  127. {Opt_mode, "mode=%o"},
  128. {Opt_err, NULL}
  129. };
  130. struct debugfs_fs_info {
  131. struct debugfs_mount_opts mount_opts;
  132. };
  133. static int debugfs_parse_options(char *data, struct debugfs_mount_opts *opts)
  134. {
  135. substring_t args[MAX_OPT_ARGS];
  136. int option;
  137. int token;
  138. char *p;
  139. opts->mode = DEBUGFS_DEFAULT_MODE;
  140. while ((p = strsep(&data, ",")) != NULL) {
  141. if (!*p)
  142. continue;
  143. token = match_token(p, tokens, args);
  144. switch (token) {
  145. case Opt_uid:
  146. if (match_int(&args[0], &option))
  147. return -EINVAL;
  148. opts->uid = option;
  149. break;
  150. case Opt_gid:
  151. if (match_octal(&args[0], &option))
  152. return -EINVAL;
  153. opts->gid = option;
  154. break;
  155. case Opt_mode:
  156. if (match_octal(&args[0], &option))
  157. return -EINVAL;
  158. opts->mode = option & S_IALLUGO;
  159. break;
  160. /*
  161. * We might like to report bad mount options here;
  162. * but traditionally debugfs has ignored all mount options
  163. */
  164. }
  165. }
  166. return 0;
  167. }
  168. static int debugfs_apply_options(struct super_block *sb)
  169. {
  170. struct debugfs_fs_info *fsi = sb->s_fs_info;
  171. struct inode *inode = sb->s_root->d_inode;
  172. struct debugfs_mount_opts *opts = &fsi->mount_opts;
  173. inode->i_mode &= ~S_IALLUGO;
  174. inode->i_mode |= opts->mode;
  175. inode->i_uid = opts->uid;
  176. inode->i_gid = opts->gid;
  177. return 0;
  178. }
  179. static int debugfs_remount(struct super_block *sb, int *flags, char *data)
  180. {
  181. int err;
  182. struct debugfs_fs_info *fsi = sb->s_fs_info;
  183. err = debugfs_parse_options(data, &fsi->mount_opts);
  184. if (err)
  185. goto fail;
  186. debugfs_apply_options(sb);
  187. fail:
  188. return err;
  189. }
  190. static int debugfs_show_options(struct seq_file *m, struct dentry *root)
  191. {
  192. struct debugfs_fs_info *fsi = root->d_sb->s_fs_info;
  193. struct debugfs_mount_opts *opts = &fsi->mount_opts;
  194. if (opts->uid != 0)
  195. seq_printf(m, ",uid=%u", opts->uid);
  196. if (opts->gid != 0)
  197. seq_printf(m, ",gid=%u", opts->gid);
  198. if (opts->mode != DEBUGFS_DEFAULT_MODE)
  199. seq_printf(m, ",mode=%o", opts->mode);
  200. return 0;
  201. }
  202. static const struct super_operations debugfs_super_operations = {
  203. .statfs = simple_statfs,
  204. .remount_fs = debugfs_remount,
  205. .show_options = debugfs_show_options,
  206. };
  207. static int debug_fill_super(struct super_block *sb, void *data, int silent)
  208. {
  209. static struct tree_descr debug_files[] = {{""}};
  210. struct debugfs_fs_info *fsi;
  211. int err;
  212. save_mount_options(sb, data);
  213. fsi = kzalloc(sizeof(struct debugfs_fs_info), GFP_KERNEL);
  214. sb->s_fs_info = fsi;
  215. if (!fsi) {
  216. err = -ENOMEM;
  217. goto fail;
  218. }
  219. err = debugfs_parse_options(data, &fsi->mount_opts);
  220. if (err)
  221. goto fail;
  222. err = simple_fill_super(sb, DEBUGFS_MAGIC, debug_files);
  223. if (err)
  224. goto fail;
  225. sb->s_op = &debugfs_super_operations;
  226. debugfs_apply_options(sb);
  227. return 0;
  228. fail:
  229. kfree(fsi);
  230. sb->s_fs_info = NULL;
  231. return err;
  232. }
  233. static struct dentry *debug_mount(struct file_system_type *fs_type,
  234. int flags, const char *dev_name,
  235. void *data)
  236. {
  237. return mount_single(fs_type, flags, data, debug_fill_super);
  238. }
  239. static struct file_system_type debug_fs_type = {
  240. .owner = THIS_MODULE,
  241. .name = "debugfs",
  242. .mount = debug_mount,
  243. .kill_sb = kill_litter_super,
  244. };
  245. struct dentry *__create_file(const char *name, umode_t mode,
  246. struct dentry *parent, void *data,
  247. const struct file_operations *fops)
  248. {
  249. struct dentry *dentry = NULL;
  250. int error;
  251. pr_debug("debugfs: creating file '%s'\n",name);
  252. error = simple_pin_fs(&debug_fs_type, &debugfs_mount,
  253. &debugfs_mount_count);
  254. if (error)
  255. goto exit;
  256. /* If the parent is not specified, we create it in the root.
  257. * We need the root dentry to do this, which is in the super
  258. * block. A pointer to that is in the struct vfsmount that we
  259. * have around.
  260. */
  261. if (!parent)
  262. parent = debugfs_mount->mnt_root;
  263. dentry = NULL;
  264. mutex_lock(&parent->d_inode->i_mutex);
  265. dentry = lookup_one_len(name, parent, strlen(name));
  266. if (!IS_ERR(dentry)) {
  267. switch (mode & S_IFMT) {
  268. case S_IFDIR:
  269. error = debugfs_mkdir(parent->d_inode, dentry, mode);
  270. break;
  271. case S_IFLNK:
  272. error = debugfs_link(parent->d_inode, dentry, mode,
  273. data);
  274. break;
  275. default:
  276. error = debugfs_create(parent->d_inode, dentry, mode,
  277. data, fops);
  278. break;
  279. }
  280. dput(dentry);
  281. } else
  282. error = PTR_ERR(dentry);
  283. mutex_unlock(&parent->d_inode->i_mutex);
  284. if (error) {
  285. dentry = NULL;
  286. simple_release_fs(&debugfs_mount, &debugfs_mount_count);
  287. }
  288. exit:
  289. return dentry;
  290. }
  291. /**
  292. * debugfs_create_file - create a file in the debugfs filesystem
  293. * @name: a pointer to a string containing the name of the file to create.
  294. * @mode: the permission that the file should have.
  295. * @parent: a pointer to the parent dentry for this file. This should be a
  296. * directory dentry if set. If this paramater is NULL, then the
  297. * file will be created in the root of the debugfs filesystem.
  298. * @data: a pointer to something that the caller will want to get to later
  299. * on. The inode.i_private pointer will point to this value on
  300. * the open() call.
  301. * @fops: a pointer to a struct file_operations that should be used for
  302. * this file.
  303. *
  304. * This is the basic "create a file" function for debugfs. It allows for a
  305. * wide range of flexibility in creating a file, or a directory (if you want
  306. * to create a directory, the debugfs_create_dir() function is
  307. * recommended to be used instead.)
  308. *
  309. * This function will return a pointer to a dentry if it succeeds. This
  310. * pointer must be passed to the debugfs_remove() function when the file is
  311. * to be removed (no automatic cleanup happens if your module is unloaded,
  312. * you are responsible here.) If an error occurs, %NULL will be returned.
  313. *
  314. * If debugfs is not enabled in the kernel, the value -%ENODEV will be
  315. * returned.
  316. */
  317. struct dentry *debugfs_create_file(const char *name, umode_t mode,
  318. struct dentry *parent, void *data,
  319. const struct file_operations *fops)
  320. {
  321. switch (mode & S_IFMT) {
  322. case S_IFREG:
  323. case 0:
  324. break;
  325. default:
  326. BUG();
  327. }
  328. return __create_file(name, mode, parent, data, fops);
  329. }
  330. EXPORT_SYMBOL_GPL(debugfs_create_file);
  331. /**
  332. * debugfs_create_dir - create a directory in the debugfs filesystem
  333. * @name: a pointer to a string containing the name of the directory to
  334. * create.
  335. * @parent: a pointer to the parent dentry for this file. This should be a
  336. * directory dentry if set. If this paramater is NULL, then the
  337. * directory will be created in the root of the debugfs filesystem.
  338. *
  339. * This function creates a directory in debugfs with the given name.
  340. *
  341. * This function will return a pointer to a dentry if it succeeds. This
  342. * pointer must be passed to the debugfs_remove() function when the file is
  343. * to be removed (no automatic cleanup happens if your module is unloaded,
  344. * you are responsible here.) If an error occurs, %NULL will be returned.
  345. *
  346. * If debugfs is not enabled in the kernel, the value -%ENODEV will be
  347. * returned.
  348. */
  349. struct dentry *debugfs_create_dir(const char *name, struct dentry *parent)
  350. {
  351. return __create_file(name, S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO,
  352. parent, NULL, NULL);
  353. }
  354. EXPORT_SYMBOL_GPL(debugfs_create_dir);
  355. /**
  356. * debugfs_create_symlink- create a symbolic link in the debugfs filesystem
  357. * @name: a pointer to a string containing the name of the symbolic link to
  358. * create.
  359. * @parent: a pointer to the parent dentry for this symbolic link. This
  360. * should be a directory dentry if set. If this paramater is NULL,
  361. * then the symbolic link will be created in the root of the debugfs
  362. * filesystem.
  363. * @target: a pointer to a string containing the path to the target of the
  364. * symbolic link.
  365. *
  366. * This function creates a symbolic link with the given name in debugfs that
  367. * links to the given target path.
  368. *
  369. * This function will return a pointer to a dentry if it succeeds. This
  370. * pointer must be passed to the debugfs_remove() function when the symbolic
  371. * link is to be removed (no automatic cleanup happens if your module is
  372. * unloaded, you are responsible here.) If an error occurs, %NULL will be
  373. * returned.
  374. *
  375. * If debugfs is not enabled in the kernel, the value -%ENODEV will be
  376. * returned.
  377. */
  378. struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent,
  379. const char *target)
  380. {
  381. struct dentry *result;
  382. char *link;
  383. link = kstrdup(target, GFP_KERNEL);
  384. if (!link)
  385. return NULL;
  386. result = __create_file(name, S_IFLNK | S_IRWXUGO, parent, link, NULL);
  387. if (!result)
  388. kfree(link);
  389. return result;
  390. }
  391. EXPORT_SYMBOL_GPL(debugfs_create_symlink);
  392. static int __debugfs_remove(struct dentry *dentry, struct dentry *parent)
  393. {
  394. int ret = 0;
  395. if (debugfs_positive(dentry)) {
  396. if (dentry->d_inode) {
  397. dget(dentry);
  398. switch (dentry->d_inode->i_mode & S_IFMT) {
  399. case S_IFDIR:
  400. ret = simple_rmdir(parent->d_inode, dentry);
  401. break;
  402. case S_IFLNK:
  403. kfree(dentry->d_inode->i_private);
  404. /* fall through */
  405. default:
  406. simple_unlink(parent->d_inode, dentry);
  407. break;
  408. }
  409. if (!ret)
  410. d_delete(dentry);
  411. dput(dentry);
  412. }
  413. }
  414. return ret;
  415. }
  416. /**
  417. * debugfs_remove - removes a file or directory from the debugfs filesystem
  418. * @dentry: a pointer to a the dentry of the file or directory to be
  419. * removed.
  420. *
  421. * This function removes a file or directory in debugfs that was previously
  422. * created with a call to another debugfs function (like
  423. * debugfs_create_file() or variants thereof.)
  424. *
  425. * This function is required to be called in order for the file to be
  426. * removed, no automatic cleanup of files will happen when a module is
  427. * removed, you are responsible here.
  428. */
  429. void debugfs_remove(struct dentry *dentry)
  430. {
  431. struct dentry *parent;
  432. int ret;
  433. if (IS_ERR_OR_NULL(dentry))
  434. return;
  435. parent = dentry->d_parent;
  436. if (!parent || !parent->d_inode)
  437. return;
  438. mutex_lock(&parent->d_inode->i_mutex);
  439. ret = __debugfs_remove(dentry, parent);
  440. mutex_unlock(&parent->d_inode->i_mutex);
  441. if (!ret)
  442. simple_release_fs(&debugfs_mount, &debugfs_mount_count);
  443. }
  444. EXPORT_SYMBOL_GPL(debugfs_remove);
  445. /**
  446. * debugfs_remove_recursive - recursively removes a directory
  447. * @dentry: a pointer to a the dentry of the directory to be removed.
  448. *
  449. * This function recursively removes a directory tree in debugfs that
  450. * was previously created with a call to another debugfs function
  451. * (like debugfs_create_file() or variants thereof.)
  452. *
  453. * This function is required to be called in order for the file to be
  454. * removed, no automatic cleanup of files will happen when a module is
  455. * removed, you are responsible here.
  456. */
  457. void debugfs_remove_recursive(struct dentry *dentry)
  458. {
  459. struct dentry *child;
  460. struct dentry *parent;
  461. if (IS_ERR_OR_NULL(dentry))
  462. return;
  463. parent = dentry->d_parent;
  464. if (!parent || !parent->d_inode)
  465. return;
  466. parent = dentry;
  467. mutex_lock(&parent->d_inode->i_mutex);
  468. while (1) {
  469. /*
  470. * When all dentries under "parent" has been removed,
  471. * walk up the tree until we reach our starting point.
  472. */
  473. if (list_empty(&parent->d_subdirs)) {
  474. mutex_unlock(&parent->d_inode->i_mutex);
  475. if (parent == dentry)
  476. break;
  477. parent = parent->d_parent;
  478. mutex_lock(&parent->d_inode->i_mutex);
  479. }
  480. child = list_entry(parent->d_subdirs.next, struct dentry,
  481. d_u.d_child);
  482. next_sibling:
  483. /*
  484. * If "child" isn't empty, walk down the tree and
  485. * remove all its descendants first.
  486. */
  487. if (!list_empty(&child->d_subdirs)) {
  488. mutex_unlock(&parent->d_inode->i_mutex);
  489. parent = child;
  490. mutex_lock(&parent->d_inode->i_mutex);
  491. continue;
  492. }
  493. __debugfs_remove(child, parent);
  494. if (parent->d_subdirs.next == &child->d_u.d_child) {
  495. /*
  496. * Try the next sibling.
  497. */
  498. if (child->d_u.d_child.next != &parent->d_subdirs) {
  499. child = list_entry(child->d_u.d_child.next,
  500. struct dentry,
  501. d_u.d_child);
  502. goto next_sibling;
  503. }
  504. /*
  505. * Avoid infinite loop if we fail to remove
  506. * one dentry.
  507. */
  508. mutex_unlock(&parent->d_inode->i_mutex);
  509. break;
  510. }
  511. simple_release_fs(&debugfs_mount, &debugfs_mount_count);
  512. }
  513. parent = dentry->d_parent;
  514. mutex_lock(&parent->d_inode->i_mutex);
  515. __debugfs_remove(dentry, parent);
  516. mutex_unlock(&parent->d_inode->i_mutex);
  517. simple_release_fs(&debugfs_mount, &debugfs_mount_count);
  518. }
  519. EXPORT_SYMBOL_GPL(debugfs_remove_recursive);
  520. /**
  521. * debugfs_rename - rename a file/directory in the debugfs filesystem
  522. * @old_dir: a pointer to the parent dentry for the renamed object. This
  523. * should be a directory dentry.
  524. * @old_dentry: dentry of an object to be renamed.
  525. * @new_dir: a pointer to the parent dentry where the object should be
  526. * moved. This should be a directory dentry.
  527. * @new_name: a pointer to a string containing the target name.
  528. *
  529. * This function renames a file/directory in debugfs. The target must not
  530. * exist for rename to succeed.
  531. *
  532. * This function will return a pointer to old_dentry (which is updated to
  533. * reflect renaming) if it succeeds. If an error occurs, %NULL will be
  534. * returned.
  535. *
  536. * If debugfs is not enabled in the kernel, the value -%ENODEV will be
  537. * returned.
  538. */
  539. struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry,
  540. struct dentry *new_dir, const char *new_name)
  541. {
  542. int error;
  543. struct dentry *dentry = NULL, *trap;
  544. const char *old_name;
  545. trap = lock_rename(new_dir, old_dir);
  546. /* Source or destination directories don't exist? */
  547. if (!old_dir->d_inode || !new_dir->d_inode)
  548. goto exit;
  549. /* Source does not exist, cyclic rename, or mountpoint? */
  550. if (!old_dentry->d_inode || old_dentry == trap ||
  551. d_mountpoint(old_dentry))
  552. goto exit;
  553. dentry = lookup_one_len(new_name, new_dir, strlen(new_name));
  554. /* Lookup failed, cyclic rename or target exists? */
  555. if (IS_ERR(dentry) || dentry == trap || dentry->d_inode)
  556. goto exit;
  557. old_name = fsnotify_oldname_init(old_dentry->d_name.name);
  558. error = simple_rename(old_dir->d_inode, old_dentry, new_dir->d_inode,
  559. dentry);
  560. if (error) {
  561. fsnotify_oldname_free(old_name);
  562. goto exit;
  563. }
  564. d_move(old_dentry, dentry);
  565. fsnotify_move(old_dir->d_inode, new_dir->d_inode, old_name,
  566. S_ISDIR(old_dentry->d_inode->i_mode),
  567. NULL, old_dentry);
  568. fsnotify_oldname_free(old_name);
  569. unlock_rename(new_dir, old_dir);
  570. dput(dentry);
  571. return old_dentry;
  572. exit:
  573. if (dentry && !IS_ERR(dentry))
  574. dput(dentry);
  575. unlock_rename(new_dir, old_dir);
  576. return NULL;
  577. }
  578. EXPORT_SYMBOL_GPL(debugfs_rename);
  579. /**
  580. * debugfs_initialized - Tells whether debugfs has been registered
  581. */
  582. bool debugfs_initialized(void)
  583. {
  584. return debugfs_registered;
  585. }
  586. EXPORT_SYMBOL_GPL(debugfs_initialized);
  587. static struct kobject *debug_kobj;
  588. static int __init debugfs_init(void)
  589. {
  590. int retval;
  591. debug_kobj = kobject_create_and_add("debug", kernel_kobj);
  592. if (!debug_kobj)
  593. return -EINVAL;
  594. retval = register_filesystem(&debug_fs_type);
  595. if (retval)
  596. kobject_put(debug_kobj);
  597. else
  598. debugfs_registered = true;
  599. return retval;
  600. }
  601. core_initcall(debugfs_init);