file.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528
  1. /*
  2. * file.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/filesystems for more details.
  13. *
  14. */
  15. #include <linux/module.h>
  16. #include <linux/fs.h>
  17. #include <linux/pagemap.h>
  18. #include <linux/namei.h>
  19. #include <linux/debugfs.h>
  20. static ssize_t default_read_file(struct file *file, char __user *buf,
  21. size_t count, loff_t *ppos)
  22. {
  23. return 0;
  24. }
  25. static ssize_t default_write_file(struct file *file, const char __user *buf,
  26. size_t count, loff_t *ppos)
  27. {
  28. return count;
  29. }
  30. static int default_open(struct inode *inode, struct file *file)
  31. {
  32. if (inode->i_private)
  33. file->private_data = inode->i_private;
  34. return 0;
  35. }
  36. const struct file_operations debugfs_file_operations = {
  37. .read = default_read_file,
  38. .write = default_write_file,
  39. .open = default_open,
  40. .llseek = noop_llseek,
  41. };
  42. static void *debugfs_follow_link(struct dentry *dentry, struct nameidata *nd)
  43. {
  44. nd_set_link(nd, dentry->d_inode->i_private);
  45. return NULL;
  46. }
  47. const struct inode_operations debugfs_link_operations = {
  48. .readlink = generic_readlink,
  49. .follow_link = debugfs_follow_link,
  50. };
  51. static int debugfs_u8_set(void *data, u64 val)
  52. {
  53. *(u8 *)data = val;
  54. return 0;
  55. }
  56. static int debugfs_u8_get(void *data, u64 *val)
  57. {
  58. *val = *(u8 *)data;
  59. return 0;
  60. }
  61. DEFINE_SIMPLE_ATTRIBUTE(fops_u8, debugfs_u8_get, debugfs_u8_set, "%llu\n");
  62. DEFINE_SIMPLE_ATTRIBUTE(fops_u8_ro, debugfs_u8_get, NULL, "%llu\n");
  63. DEFINE_SIMPLE_ATTRIBUTE(fops_u8_wo, NULL, debugfs_u8_set, "%llu\n");
  64. /**
  65. * debugfs_create_u8 - create a debugfs file that is used to read and write an unsigned 8-bit value
  66. * @name: a pointer to a string containing the name of the file to create.
  67. * @mode: the permission that the file should have
  68. * @parent: a pointer to the parent dentry for this file. This should be a
  69. * directory dentry if set. If this parameter is %NULL, then the
  70. * file will be created in the root of the debugfs filesystem.
  71. * @value: a pointer to the variable that the file should read to and write
  72. * from.
  73. *
  74. * This function creates a file in debugfs with the given name that
  75. * contains the value of the variable @value. If the @mode variable is so
  76. * set, it can be read from, and written to.
  77. *
  78. * This function will return a pointer to a dentry if it succeeds. This
  79. * pointer must be passed to the debugfs_remove() function when the file is
  80. * to be removed (no automatic cleanup happens if your module is unloaded,
  81. * you are responsible here.) If an error occurs, %NULL will be returned.
  82. *
  83. * If debugfs is not enabled in the kernel, the value -%ENODEV will be
  84. * returned. It is not wise to check for this value, but rather, check for
  85. * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling
  86. * code.
  87. */
  88. struct dentry *debugfs_create_u8(const char *name, mode_t mode,
  89. struct dentry *parent, u8 *value)
  90. {
  91. /* if there are no write bits set, make read only */
  92. if (!(mode & S_IWUGO))
  93. return debugfs_create_file(name, mode, parent, value, &fops_u8_ro);
  94. /* if there are no read bits set, make write only */
  95. if (!(mode & S_IRUGO))
  96. return debugfs_create_file(name, mode, parent, value, &fops_u8_wo);
  97. return debugfs_create_file(name, mode, parent, value, &fops_u8);
  98. }
  99. EXPORT_SYMBOL_GPL(debugfs_create_u8);
  100. static int debugfs_u16_set(void *data, u64 val)
  101. {
  102. *(u16 *)data = val;
  103. return 0;
  104. }
  105. static int debugfs_u16_get(void *data, u64 *val)
  106. {
  107. *val = *(u16 *)data;
  108. return 0;
  109. }
  110. DEFINE_SIMPLE_ATTRIBUTE(fops_u16, debugfs_u16_get, debugfs_u16_set, "%llu\n");
  111. DEFINE_SIMPLE_ATTRIBUTE(fops_u16_ro, debugfs_u16_get, NULL, "%llu\n");
  112. DEFINE_SIMPLE_ATTRIBUTE(fops_u16_wo, NULL, debugfs_u16_set, "%llu\n");
  113. /**
  114. * debugfs_create_u16 - create a debugfs file that is used to read and write an unsigned 16-bit value
  115. * @name: a pointer to a string containing the name of the file to create.
  116. * @mode: the permission that the file should have
  117. * @parent: a pointer to the parent dentry for this file. This should be a
  118. * directory dentry if set. If this parameter is %NULL, then the
  119. * file will be created in the root of the debugfs filesystem.
  120. * @value: a pointer to the variable that the file should read to and write
  121. * from.
  122. *
  123. * This function creates a file in debugfs with the given name that
  124. * contains the value of the variable @value. If the @mode variable is so
  125. * set, it can be read from, and written to.
  126. *
  127. * This function will return a pointer to a dentry if it succeeds. This
  128. * pointer must be passed to the debugfs_remove() function when the file is
  129. * to be removed (no automatic cleanup happens if your module is unloaded,
  130. * you are responsible here.) If an error occurs, %NULL will be returned.
  131. *
  132. * If debugfs is not enabled in the kernel, the value -%ENODEV will be
  133. * returned. It is not wise to check for this value, but rather, check for
  134. * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling
  135. * code.
  136. */
  137. struct dentry *debugfs_create_u16(const char *name, mode_t mode,
  138. struct dentry *parent, u16 *value)
  139. {
  140. /* if there are no write bits set, make read only */
  141. if (!(mode & S_IWUGO))
  142. return debugfs_create_file(name, mode, parent, value, &fops_u16_ro);
  143. /* if there are no read bits set, make write only */
  144. if (!(mode & S_IRUGO))
  145. return debugfs_create_file(name, mode, parent, value, &fops_u16_wo);
  146. return debugfs_create_file(name, mode, parent, value, &fops_u16);
  147. }
  148. EXPORT_SYMBOL_GPL(debugfs_create_u16);
  149. static int debugfs_u32_set(void *data, u64 val)
  150. {
  151. *(u32 *)data = val;
  152. return 0;
  153. }
  154. static int debugfs_u32_get(void *data, u64 *val)
  155. {
  156. *val = *(u32 *)data;
  157. return 0;
  158. }
  159. DEFINE_SIMPLE_ATTRIBUTE(fops_u32, debugfs_u32_get, debugfs_u32_set, "%llu\n");
  160. DEFINE_SIMPLE_ATTRIBUTE(fops_u32_ro, debugfs_u32_get, NULL, "%llu\n");
  161. DEFINE_SIMPLE_ATTRIBUTE(fops_u32_wo, NULL, debugfs_u32_set, "%llu\n");
  162. /**
  163. * debugfs_create_u32 - create a debugfs file that is used to read and write an unsigned 32-bit value
  164. * @name: a pointer to a string containing the name of the file to create.
  165. * @mode: the permission that the file should have
  166. * @parent: a pointer to the parent dentry for this file. This should be a
  167. * directory dentry if set. If this parameter is %NULL, then the
  168. * file will be created in the root of the debugfs filesystem.
  169. * @value: a pointer to the variable that the file should read to and write
  170. * from.
  171. *
  172. * This function creates a file in debugfs with the given name that
  173. * contains the value of the variable @value. If the @mode variable is so
  174. * set, it can be read from, and written to.
  175. *
  176. * This function will return a pointer to a dentry if it succeeds. This
  177. * pointer must be passed to the debugfs_remove() function when the file is
  178. * to be removed (no automatic cleanup happens if your module is unloaded,
  179. * you are responsible here.) If an error occurs, %NULL will be returned.
  180. *
  181. * If debugfs is not enabled in the kernel, the value -%ENODEV will be
  182. * returned. It is not wise to check for this value, but rather, check for
  183. * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling
  184. * code.
  185. */
  186. struct dentry *debugfs_create_u32(const char *name, mode_t mode,
  187. struct dentry *parent, u32 *value)
  188. {
  189. /* if there are no write bits set, make read only */
  190. if (!(mode & S_IWUGO))
  191. return debugfs_create_file(name, mode, parent, value, &fops_u32_ro);
  192. /* if there are no read bits set, make write only */
  193. if (!(mode & S_IRUGO))
  194. return debugfs_create_file(name, mode, parent, value, &fops_u32_wo);
  195. return debugfs_create_file(name, mode, parent, value, &fops_u32);
  196. }
  197. EXPORT_SYMBOL_GPL(debugfs_create_u32);
  198. static int debugfs_u64_set(void *data, u64 val)
  199. {
  200. *(u64 *)data = val;
  201. return 0;
  202. }
  203. static int debugfs_u64_get(void *data, u64 *val)
  204. {
  205. *val = *(u64 *)data;
  206. return 0;
  207. }
  208. DEFINE_SIMPLE_ATTRIBUTE(fops_u64, debugfs_u64_get, debugfs_u64_set, "%llu\n");
  209. DEFINE_SIMPLE_ATTRIBUTE(fops_u64_ro, debugfs_u64_get, NULL, "%llu\n");
  210. DEFINE_SIMPLE_ATTRIBUTE(fops_u64_wo, NULL, debugfs_u64_set, "%llu\n");
  211. /**
  212. * debugfs_create_u64 - create a debugfs file that is used to read and write an unsigned 64-bit value
  213. * @name: a pointer to a string containing the name of the file to create.
  214. * @mode: the permission that the file should have
  215. * @parent: a pointer to the parent dentry for this file. This should be a
  216. * directory dentry if set. If this parameter is %NULL, then the
  217. * file will be created in the root of the debugfs filesystem.
  218. * @value: a pointer to the variable that the file should read to and write
  219. * from.
  220. *
  221. * This function creates a file in debugfs with the given name that
  222. * contains the value of the variable @value. If the @mode variable is so
  223. * set, it can be read from, and written to.
  224. *
  225. * This function will return a pointer to a dentry if it succeeds. This
  226. * pointer must be passed to the debugfs_remove() function when the file is
  227. * to be removed (no automatic cleanup happens if your module is unloaded,
  228. * you are responsible here.) If an error occurs, %NULL will be returned.
  229. *
  230. * If debugfs is not enabled in the kernel, the value -%ENODEV will be
  231. * returned. It is not wise to check for this value, but rather, check for
  232. * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling
  233. * code.
  234. */
  235. struct dentry *debugfs_create_u64(const char *name, mode_t mode,
  236. struct dentry *parent, u64 *value)
  237. {
  238. /* if there are no write bits set, make read only */
  239. if (!(mode & S_IWUGO))
  240. return debugfs_create_file(name, mode, parent, value, &fops_u64_ro);
  241. /* if there are no read bits set, make write only */
  242. if (!(mode & S_IRUGO))
  243. return debugfs_create_file(name, mode, parent, value, &fops_u64_wo);
  244. return debugfs_create_file(name, mode, parent, value, &fops_u64);
  245. }
  246. EXPORT_SYMBOL_GPL(debugfs_create_u64);
  247. DEFINE_SIMPLE_ATTRIBUTE(fops_x8, debugfs_u8_get, debugfs_u8_set, "0x%02llx\n");
  248. DEFINE_SIMPLE_ATTRIBUTE(fops_x8_ro, debugfs_u8_get, NULL, "0x%02llx\n");
  249. DEFINE_SIMPLE_ATTRIBUTE(fops_x8_wo, NULL, debugfs_u8_set, "0x%02llx\n");
  250. DEFINE_SIMPLE_ATTRIBUTE(fops_x16, debugfs_u16_get, debugfs_u16_set, "0x%04llx\n");
  251. DEFINE_SIMPLE_ATTRIBUTE(fops_x16_ro, debugfs_u16_get, NULL, "0x%04llx\n");
  252. DEFINE_SIMPLE_ATTRIBUTE(fops_x16_wo, NULL, debugfs_u16_set, "0x%04llx\n");
  253. DEFINE_SIMPLE_ATTRIBUTE(fops_x32, debugfs_u32_get, debugfs_u32_set, "0x%08llx\n");
  254. DEFINE_SIMPLE_ATTRIBUTE(fops_x32_ro, debugfs_u32_get, NULL, "0x%08llx\n");
  255. DEFINE_SIMPLE_ATTRIBUTE(fops_x32_wo, NULL, debugfs_u32_set, "0x%08llx\n");
  256. DEFINE_SIMPLE_ATTRIBUTE(fops_x64, debugfs_u64_get, debugfs_u64_set, "0x%016llx\n");
  257. /*
  258. * debugfs_create_x{8,16,32,64} - create a debugfs file that is used to read and write an unsigned {8,16,32,64}-bit value
  259. *
  260. * These functions are exactly the same as the above functions (but use a hex
  261. * output for the decimal challenged). For details look at the above unsigned
  262. * decimal functions.
  263. */
  264. /**
  265. * debugfs_create_x8 - create a debugfs file that is used to read and write an unsigned 8-bit value
  266. * @name: a pointer to a string containing the name of the file to create.
  267. * @mode: the permission that the file should have
  268. * @parent: a pointer to the parent dentry for this file. This should be a
  269. * directory dentry if set. If this parameter is %NULL, then the
  270. * file will be created in the root of the debugfs filesystem.
  271. * @value: a pointer to the variable that the file should read to and write
  272. * from.
  273. */
  274. struct dentry *debugfs_create_x8(const char *name, mode_t mode,
  275. struct dentry *parent, u8 *value)
  276. {
  277. /* if there are no write bits set, make read only */
  278. if (!(mode & S_IWUGO))
  279. return debugfs_create_file(name, mode, parent, value, &fops_x8_ro);
  280. /* if there are no read bits set, make write only */
  281. if (!(mode & S_IRUGO))
  282. return debugfs_create_file(name, mode, parent, value, &fops_x8_wo);
  283. return debugfs_create_file(name, mode, parent, value, &fops_x8);
  284. }
  285. EXPORT_SYMBOL_GPL(debugfs_create_x8);
  286. /**
  287. * debugfs_create_x16 - create a debugfs file that is used to read and write an unsigned 16-bit value
  288. * @name: a pointer to a string containing the name of the file to create.
  289. * @mode: the permission that the file should have
  290. * @parent: a pointer to the parent dentry for this file. This should be a
  291. * directory dentry if set. If this parameter is %NULL, then the
  292. * file will be created in the root of the debugfs filesystem.
  293. * @value: a pointer to the variable that the file should read to and write
  294. * from.
  295. */
  296. struct dentry *debugfs_create_x16(const char *name, mode_t mode,
  297. struct dentry *parent, u16 *value)
  298. {
  299. /* if there are no write bits set, make read only */
  300. if (!(mode & S_IWUGO))
  301. return debugfs_create_file(name, mode, parent, value, &fops_x16_ro);
  302. /* if there are no read bits set, make write only */
  303. if (!(mode & S_IRUGO))
  304. return debugfs_create_file(name, mode, parent, value, &fops_x16_wo);
  305. return debugfs_create_file(name, mode, parent, value, &fops_x16);
  306. }
  307. EXPORT_SYMBOL_GPL(debugfs_create_x16);
  308. /**
  309. * debugfs_create_x32 - create a debugfs file that is used to read and write an unsigned 32-bit value
  310. * @name: a pointer to a string containing the name of the file to create.
  311. * @mode: the permission that the file should have
  312. * @parent: a pointer to the parent dentry for this file. This should be a
  313. * directory dentry if set. If this parameter is %NULL, then the
  314. * file will be created in the root of the debugfs filesystem.
  315. * @value: a pointer to the variable that the file should read to and write
  316. * from.
  317. */
  318. struct dentry *debugfs_create_x32(const char *name, mode_t mode,
  319. struct dentry *parent, u32 *value)
  320. {
  321. /* if there are no write bits set, make read only */
  322. if (!(mode & S_IWUGO))
  323. return debugfs_create_file(name, mode, parent, value, &fops_x32_ro);
  324. /* if there are no read bits set, make write only */
  325. if (!(mode & S_IRUGO))
  326. return debugfs_create_file(name, mode, parent, value, &fops_x32_wo);
  327. return debugfs_create_file(name, mode, parent, value, &fops_x32);
  328. }
  329. EXPORT_SYMBOL_GPL(debugfs_create_x32);
  330. /**
  331. * debugfs_create_x64 - create a debugfs file that is used to read and write an unsigned 64-bit value
  332. * @name: a pointer to a string containing the name of the file to create.
  333. * @mode: the permission that the file should have
  334. * @parent: a pointer to the parent dentry for this file. This should be a
  335. * directory dentry if set. If this parameter is %NULL, then the
  336. * file will be created in the root of the debugfs filesystem.
  337. * @value: a pointer to the variable that the file should read to and write
  338. * from.
  339. */
  340. struct dentry *debugfs_create_x64(const char *name, mode_t mode,
  341. struct dentry *parent, u64 *value)
  342. {
  343. return debugfs_create_file(name, mode, parent, value, &fops_x64);
  344. }
  345. EXPORT_SYMBOL_GPL(debugfs_create_x64);
  346. static int debugfs_size_t_set(void *data, u64 val)
  347. {
  348. *(size_t *)data = val;
  349. return 0;
  350. }
  351. static int debugfs_size_t_get(void *data, u64 *val)
  352. {
  353. *val = *(size_t *)data;
  354. return 0;
  355. }
  356. DEFINE_SIMPLE_ATTRIBUTE(fops_size_t, debugfs_size_t_get, debugfs_size_t_set,
  357. "%llu\n"); /* %llu and %zu are more or less the same */
  358. /**
  359. * debugfs_create_size_t - create a debugfs file that is used to read and write an size_t value
  360. * @name: a pointer to a string containing the name of the file to create.
  361. * @mode: the permission that the file should have
  362. * @parent: a pointer to the parent dentry for this file. This should be a
  363. * directory dentry if set. If this parameter is %NULL, then the
  364. * file will be created in the root of the debugfs filesystem.
  365. * @value: a pointer to the variable that the file should read to and write
  366. * from.
  367. */
  368. struct dentry *debugfs_create_size_t(const char *name, mode_t mode,
  369. struct dentry *parent, size_t *value)
  370. {
  371. return debugfs_create_file(name, mode, parent, value, &fops_size_t);
  372. }
  373. EXPORT_SYMBOL_GPL(debugfs_create_size_t);
  374. static ssize_t read_file_bool(struct file *file, char __user *user_buf,
  375. size_t count, loff_t *ppos)
  376. {
  377. char buf[3];
  378. u32 *val = file->private_data;
  379. if (*val)
  380. buf[0] = 'Y';
  381. else
  382. buf[0] = 'N';
  383. buf[1] = '\n';
  384. buf[2] = 0x00;
  385. return simple_read_from_buffer(user_buf, count, ppos, buf, 2);
  386. }
  387. static ssize_t write_file_bool(struct file *file, const char __user *user_buf,
  388. size_t count, loff_t *ppos)
  389. {
  390. char buf[32];
  391. size_t buf_size;
  392. bool bv;
  393. u32 *val = file->private_data;
  394. buf_size = min(count, (sizeof(buf)-1));
  395. if (copy_from_user(buf, user_buf, buf_size))
  396. return -EFAULT;
  397. if (strtobool(buf, &bv) == 0)
  398. *val = bv;
  399. return count;
  400. }
  401. static const struct file_operations fops_bool = {
  402. .read = read_file_bool,
  403. .write = write_file_bool,
  404. .open = default_open,
  405. .llseek = default_llseek,
  406. };
  407. /**
  408. * debugfs_create_bool - create a debugfs file that is used to read and write a boolean value
  409. * @name: a pointer to a string containing the name of the file to create.
  410. * @mode: the permission that the file should have
  411. * @parent: a pointer to the parent dentry for this file. This should be a
  412. * directory dentry if set. If this parameter is %NULL, then the
  413. * file will be created in the root of the debugfs filesystem.
  414. * @value: a pointer to the variable that the file should read to and write
  415. * from.
  416. *
  417. * This function creates a file in debugfs with the given name that
  418. * contains the value of the variable @value. If the @mode variable is so
  419. * set, it can be read from, and written to.
  420. *
  421. * This function will return a pointer to a dentry if it succeeds. This
  422. * pointer must be passed to the debugfs_remove() function when the file is
  423. * to be removed (no automatic cleanup happens if your module is unloaded,
  424. * you are responsible here.) If an error occurs, %NULL will be returned.
  425. *
  426. * If debugfs is not enabled in the kernel, the value -%ENODEV will be
  427. * returned. It is not wise to check for this value, but rather, check for
  428. * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling
  429. * code.
  430. */
  431. struct dentry *debugfs_create_bool(const char *name, mode_t mode,
  432. struct dentry *parent, u32 *value)
  433. {
  434. return debugfs_create_file(name, mode, parent, value, &fops_bool);
  435. }
  436. EXPORT_SYMBOL_GPL(debugfs_create_bool);
  437. static ssize_t read_file_blob(struct file *file, char __user *user_buf,
  438. size_t count, loff_t *ppos)
  439. {
  440. struct debugfs_blob_wrapper *blob = file->private_data;
  441. return simple_read_from_buffer(user_buf, count, ppos, blob->data,
  442. blob->size);
  443. }
  444. static const struct file_operations fops_blob = {
  445. .read = read_file_blob,
  446. .open = default_open,
  447. .llseek = default_llseek,
  448. };
  449. /**
  450. * debugfs_create_blob - create a debugfs file that is used to read a binary blob
  451. * @name: a pointer to a string containing the name of the file to create.
  452. * @mode: the permission that the file should have
  453. * @parent: a pointer to the parent dentry for this file. This should be a
  454. * directory dentry if set. If this parameter is %NULL, then the
  455. * file will be created in the root of the debugfs filesystem.
  456. * @blob: a pointer to a struct debugfs_blob_wrapper which contains a pointer
  457. * to the blob data and the size of the data.
  458. *
  459. * This function creates a file in debugfs with the given name that exports
  460. * @blob->data as a binary blob. If the @mode variable is so set it can be
  461. * read from. Writing is not supported.
  462. *
  463. * This function will return a pointer to a dentry if it succeeds. This
  464. * pointer must be passed to the debugfs_remove() function when the file is
  465. * to be removed (no automatic cleanup happens if your module is unloaded,
  466. * you are responsible here.) If an error occurs, %NULL will be returned.
  467. *
  468. * If debugfs is not enabled in the kernel, the value -%ENODEV will be
  469. * returned. It is not wise to check for this value, but rather, check for
  470. * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling
  471. * code.
  472. */
  473. struct dentry *debugfs_create_blob(const char *name, mode_t mode,
  474. struct dentry *parent,
  475. struct debugfs_blob_wrapper *blob)
  476. {
  477. return debugfs_create_file(name, mode, parent, blob, &fops_blob);
  478. }
  479. EXPORT_SYMBOL_GPL(debugfs_create_blob);