sysfs.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * sysfs.h - definitions for the device driver filesystem
  4. *
  5. * Copyright (c) 2001,2002 Patrick Mochel
  6. * Copyright (c) 2004 Silicon Graphics, Inc.
  7. * Copyright (c) 2007 SUSE Linux Products GmbH
  8. * Copyright (c) 2007 Tejun Heo <[email protected]>
  9. *
  10. * Please see Documentation/filesystems/sysfs.rst for more information.
  11. */
  12. #ifndef _SYSFS_H_
  13. #define _SYSFS_H_
  14. #include <linux/kernfs.h>
  15. #include <linux/compiler.h>
  16. #include <linux/errno.h>
  17. #include <linux/list.h>
  18. #include <linux/lockdep.h>
  19. #include <linux/kobject_ns.h>
  20. #include <linux/stat.h>
  21. #include <linux/atomic.h>
  22. struct kobject;
  23. struct module;
  24. struct bin_attribute;
  25. enum kobj_ns_type;
  26. struct attribute {
  27. const char *name;
  28. umode_t mode;
  29. #ifdef CONFIG_DEBUG_LOCK_ALLOC
  30. bool ignore_lockdep:1;
  31. struct lock_class_key *key;
  32. struct lock_class_key skey;
  33. #endif
  34. };
  35. /**
  36. * sysfs_attr_init - initialize a dynamically allocated sysfs attribute
  37. * @attr: struct attribute to initialize
  38. *
  39. * Initialize a dynamically allocated struct attribute so we can
  40. * make lockdep happy. This is a new requirement for attributes
  41. * and initially this is only needed when lockdep is enabled.
  42. * Lockdep gives a nice error when your attribute is added to
  43. * sysfs if you don't have this.
  44. */
  45. #ifdef CONFIG_DEBUG_LOCK_ALLOC
  46. #define sysfs_attr_init(attr) \
  47. do { \
  48. static struct lock_class_key __key; \
  49. \
  50. (attr)->key = &__key; \
  51. } while (0)
  52. #else
  53. #define sysfs_attr_init(attr) do {} while (0)
  54. #endif
  55. /**
  56. * struct attribute_group - data structure used to declare an attribute group.
  57. * @name: Optional: Attribute group name
  58. * If specified, the attribute group will be created in
  59. * a new subdirectory with this name.
  60. * @is_visible: Optional: Function to return permissions associated with an
  61. * attribute of the group. Will be called repeatedly for each
  62. * non-binary attribute in the group. Only read/write
  63. * permissions as well as SYSFS_PREALLOC are accepted. Must
  64. * return 0 if an attribute is not visible. The returned value
  65. * will replace static permissions defined in struct attribute.
  66. * @is_bin_visible:
  67. * Optional: Function to return permissions associated with a
  68. * binary attribute of the group. Will be called repeatedly
  69. * for each binary attribute in the group. Only read/write
  70. * permissions as well as SYSFS_PREALLOC are accepted. Must
  71. * return 0 if a binary attribute is not visible. The returned
  72. * value will replace static permissions defined in
  73. * struct bin_attribute.
  74. * @attrs: Pointer to NULL terminated list of attributes.
  75. * @bin_attrs: Pointer to NULL terminated list of binary attributes.
  76. * Either attrs or bin_attrs or both must be provided.
  77. */
  78. struct attribute_group {
  79. const char *name;
  80. umode_t (*is_visible)(struct kobject *,
  81. struct attribute *, int);
  82. umode_t (*is_bin_visible)(struct kobject *,
  83. struct bin_attribute *, int);
  84. struct attribute **attrs;
  85. struct bin_attribute **bin_attrs;
  86. };
  87. /*
  88. * Use these macros to make defining attributes easier.
  89. * See include/linux/device.h for examples..
  90. */
  91. #define SYSFS_PREALLOC 010000
  92. #define __ATTR(_name, _mode, _show, _store) { \
  93. .attr = {.name = __stringify(_name), \
  94. .mode = VERIFY_OCTAL_PERMISSIONS(_mode) }, \
  95. .show = _show, \
  96. .store = _store, \
  97. }
  98. #define __ATTR_PREALLOC(_name, _mode, _show, _store) { \
  99. .attr = {.name = __stringify(_name), \
  100. .mode = SYSFS_PREALLOC | VERIFY_OCTAL_PERMISSIONS(_mode) },\
  101. .show = _show, \
  102. .store = _store, \
  103. }
  104. #define __ATTR_RO(_name) { \
  105. .attr = { .name = __stringify(_name), .mode = 0444 }, \
  106. .show = _name##_show, \
  107. }
  108. #define __ATTR_RO_MODE(_name, _mode) { \
  109. .attr = { .name = __stringify(_name), \
  110. .mode = VERIFY_OCTAL_PERMISSIONS(_mode) }, \
  111. .show = _name##_show, \
  112. }
  113. #define __ATTR_RW_MODE(_name, _mode) { \
  114. .attr = { .name = __stringify(_name), \
  115. .mode = VERIFY_OCTAL_PERMISSIONS(_mode) }, \
  116. .show = _name##_show, \
  117. .store = _name##_store, \
  118. }
  119. #define __ATTR_WO(_name) { \
  120. .attr = { .name = __stringify(_name), .mode = 0200 }, \
  121. .store = _name##_store, \
  122. }
  123. #define __ATTR_RW(_name) __ATTR(_name, 0644, _name##_show, _name##_store)
  124. #define __ATTR_NULL { .attr = { .name = NULL } }
  125. #ifdef CONFIG_DEBUG_LOCK_ALLOC
  126. #define __ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) { \
  127. .attr = {.name = __stringify(_name), .mode = _mode, \
  128. .ignore_lockdep = true }, \
  129. .show = _show, \
  130. .store = _store, \
  131. }
  132. #else
  133. #define __ATTR_IGNORE_LOCKDEP __ATTR
  134. #endif
  135. #define __ATTRIBUTE_GROUPS(_name) \
  136. static const struct attribute_group *_name##_groups[] = { \
  137. &_name##_group, \
  138. NULL, \
  139. }
  140. #define ATTRIBUTE_GROUPS(_name) \
  141. static const struct attribute_group _name##_group = { \
  142. .attrs = _name##_attrs, \
  143. }; \
  144. __ATTRIBUTE_GROUPS(_name)
  145. #define BIN_ATTRIBUTE_GROUPS(_name) \
  146. static const struct attribute_group _name##_group = { \
  147. .bin_attrs = _name##_attrs, \
  148. }; \
  149. __ATTRIBUTE_GROUPS(_name)
  150. struct file;
  151. struct vm_area_struct;
  152. struct address_space;
  153. struct bin_attribute {
  154. struct attribute attr;
  155. size_t size;
  156. void *private;
  157. struct address_space *(*f_mapping)(void);
  158. ssize_t (*read)(struct file *, struct kobject *, struct bin_attribute *,
  159. char *, loff_t, size_t);
  160. ssize_t (*write)(struct file *, struct kobject *, struct bin_attribute *,
  161. char *, loff_t, size_t);
  162. int (*mmap)(struct file *, struct kobject *, struct bin_attribute *attr,
  163. struct vm_area_struct *vma);
  164. };
  165. /**
  166. * sysfs_bin_attr_init - initialize a dynamically allocated bin_attribute
  167. * @attr: struct bin_attribute to initialize
  168. *
  169. * Initialize a dynamically allocated struct bin_attribute so we
  170. * can make lockdep happy. This is a new requirement for
  171. * attributes and initially this is only needed when lockdep is
  172. * enabled. Lockdep gives a nice error when your attribute is
  173. * added to sysfs if you don't have this.
  174. */
  175. #define sysfs_bin_attr_init(bin_attr) sysfs_attr_init(&(bin_attr)->attr)
  176. /* macros to create static binary attributes easier */
  177. #define __BIN_ATTR(_name, _mode, _read, _write, _size) { \
  178. .attr = { .name = __stringify(_name), .mode = _mode }, \
  179. .read = _read, \
  180. .write = _write, \
  181. .size = _size, \
  182. }
  183. #define __BIN_ATTR_RO(_name, _size) { \
  184. .attr = { .name = __stringify(_name), .mode = 0444 }, \
  185. .read = _name##_read, \
  186. .size = _size, \
  187. }
  188. #define __BIN_ATTR_WO(_name, _size) { \
  189. .attr = { .name = __stringify(_name), .mode = 0200 }, \
  190. .write = _name##_write, \
  191. .size = _size, \
  192. }
  193. #define __BIN_ATTR_RW(_name, _size) \
  194. __BIN_ATTR(_name, 0644, _name##_read, _name##_write, _size)
  195. #define __BIN_ATTR_NULL __ATTR_NULL
  196. #define BIN_ATTR(_name, _mode, _read, _write, _size) \
  197. struct bin_attribute bin_attr_##_name = __BIN_ATTR(_name, _mode, _read, \
  198. _write, _size)
  199. #define BIN_ATTR_RO(_name, _size) \
  200. struct bin_attribute bin_attr_##_name = __BIN_ATTR_RO(_name, _size)
  201. #define BIN_ATTR_WO(_name, _size) \
  202. struct bin_attribute bin_attr_##_name = __BIN_ATTR_WO(_name, _size)
  203. #define BIN_ATTR_RW(_name, _size) \
  204. struct bin_attribute bin_attr_##_name = __BIN_ATTR_RW(_name, _size)
  205. #define __BIN_ATTR_ADMIN_RO(_name, _size) { \
  206. .attr = { .name = __stringify(_name), .mode = 0400 }, \
  207. .read = _name##_read, \
  208. .size = _size, \
  209. }
  210. #define __BIN_ATTR_ADMIN_RW(_name, _size) \
  211. __BIN_ATTR(_name, 0600, _name##_read, _name##_write, _size)
  212. #define BIN_ATTR_ADMIN_RO(_name, _size) \
  213. struct bin_attribute bin_attr_##_name = __BIN_ATTR_ADMIN_RO(_name, _size)
  214. #define BIN_ATTR_ADMIN_RW(_name, _size) \
  215. struct bin_attribute bin_attr_##_name = __BIN_ATTR_ADMIN_RW(_name, _size)
  216. struct sysfs_ops {
  217. ssize_t (*show)(struct kobject *, struct attribute *, char *);
  218. ssize_t (*store)(struct kobject *, struct attribute *, const char *, size_t);
  219. };
  220. #ifdef CONFIG_SYSFS
  221. int __must_check sysfs_create_dir_ns(struct kobject *kobj, const void *ns);
  222. void sysfs_remove_dir(struct kobject *kobj);
  223. int __must_check sysfs_rename_dir_ns(struct kobject *kobj, const char *new_name,
  224. const void *new_ns);
  225. int __must_check sysfs_move_dir_ns(struct kobject *kobj,
  226. struct kobject *new_parent_kobj,
  227. const void *new_ns);
  228. int __must_check sysfs_create_mount_point(struct kobject *parent_kobj,
  229. const char *name);
  230. void sysfs_remove_mount_point(struct kobject *parent_kobj,
  231. const char *name);
  232. int __must_check sysfs_create_file_ns(struct kobject *kobj,
  233. const struct attribute *attr,
  234. const void *ns);
  235. int __must_check sysfs_create_files(struct kobject *kobj,
  236. const struct attribute * const *attr);
  237. int __must_check sysfs_chmod_file(struct kobject *kobj,
  238. const struct attribute *attr, umode_t mode);
  239. struct kernfs_node *sysfs_break_active_protection(struct kobject *kobj,
  240. const struct attribute *attr);
  241. void sysfs_unbreak_active_protection(struct kernfs_node *kn);
  242. void sysfs_remove_file_ns(struct kobject *kobj, const struct attribute *attr,
  243. const void *ns);
  244. bool sysfs_remove_file_self(struct kobject *kobj, const struct attribute *attr);
  245. void sysfs_remove_files(struct kobject *kobj, const struct attribute * const *attr);
  246. int __must_check sysfs_create_bin_file(struct kobject *kobj,
  247. const struct bin_attribute *attr);
  248. void sysfs_remove_bin_file(struct kobject *kobj,
  249. const struct bin_attribute *attr);
  250. int __must_check sysfs_create_link(struct kobject *kobj, struct kobject *target,
  251. const char *name);
  252. int __must_check sysfs_create_link_nowarn(struct kobject *kobj,
  253. struct kobject *target,
  254. const char *name);
  255. void sysfs_remove_link(struct kobject *kobj, const char *name);
  256. int sysfs_rename_link_ns(struct kobject *kobj, struct kobject *target,
  257. const char *old_name, const char *new_name,
  258. const void *new_ns);
  259. void sysfs_delete_link(struct kobject *dir, struct kobject *targ,
  260. const char *name);
  261. int __must_check sysfs_create_group(struct kobject *kobj,
  262. const struct attribute_group *grp);
  263. int __must_check sysfs_create_groups(struct kobject *kobj,
  264. const struct attribute_group **groups);
  265. int __must_check sysfs_update_groups(struct kobject *kobj,
  266. const struct attribute_group **groups);
  267. int sysfs_update_group(struct kobject *kobj,
  268. const struct attribute_group *grp);
  269. void sysfs_remove_group(struct kobject *kobj,
  270. const struct attribute_group *grp);
  271. void sysfs_remove_groups(struct kobject *kobj,
  272. const struct attribute_group **groups);
  273. int sysfs_add_file_to_group(struct kobject *kobj,
  274. const struct attribute *attr, const char *group);
  275. void sysfs_remove_file_from_group(struct kobject *kobj,
  276. const struct attribute *attr, const char *group);
  277. int sysfs_merge_group(struct kobject *kobj,
  278. const struct attribute_group *grp);
  279. void sysfs_unmerge_group(struct kobject *kobj,
  280. const struct attribute_group *grp);
  281. int sysfs_add_link_to_group(struct kobject *kobj, const char *group_name,
  282. struct kobject *target, const char *link_name);
  283. void sysfs_remove_link_from_group(struct kobject *kobj, const char *group_name,
  284. const char *link_name);
  285. int compat_only_sysfs_link_entry_to_kobj(struct kobject *kobj,
  286. struct kobject *target_kobj,
  287. const char *target_name,
  288. const char *symlink_name);
  289. void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr);
  290. int __must_check sysfs_init(void);
  291. static inline void sysfs_enable_ns(struct kernfs_node *kn)
  292. {
  293. return kernfs_enable_ns(kn);
  294. }
  295. int sysfs_file_change_owner(struct kobject *kobj, const char *name, kuid_t kuid,
  296. kgid_t kgid);
  297. int sysfs_change_owner(struct kobject *kobj, kuid_t kuid, kgid_t kgid);
  298. int sysfs_link_change_owner(struct kobject *kobj, struct kobject *targ,
  299. const char *name, kuid_t kuid, kgid_t kgid);
  300. int sysfs_groups_change_owner(struct kobject *kobj,
  301. const struct attribute_group **groups,
  302. kuid_t kuid, kgid_t kgid);
  303. int sysfs_group_change_owner(struct kobject *kobj,
  304. const struct attribute_group *groups, kuid_t kuid,
  305. kgid_t kgid);
  306. __printf(2, 3)
  307. int sysfs_emit(char *buf, const char *fmt, ...);
  308. __printf(3, 4)
  309. int sysfs_emit_at(char *buf, int at, const char *fmt, ...);
  310. #else /* CONFIG_SYSFS */
  311. static inline int sysfs_create_dir_ns(struct kobject *kobj, const void *ns)
  312. {
  313. return 0;
  314. }
  315. static inline void sysfs_remove_dir(struct kobject *kobj)
  316. {
  317. }
  318. static inline int sysfs_rename_dir_ns(struct kobject *kobj,
  319. const char *new_name, const void *new_ns)
  320. {
  321. return 0;
  322. }
  323. static inline int sysfs_move_dir_ns(struct kobject *kobj,
  324. struct kobject *new_parent_kobj,
  325. const void *new_ns)
  326. {
  327. return 0;
  328. }
  329. static inline int sysfs_create_mount_point(struct kobject *parent_kobj,
  330. const char *name)
  331. {
  332. return 0;
  333. }
  334. static inline void sysfs_remove_mount_point(struct kobject *parent_kobj,
  335. const char *name)
  336. {
  337. }
  338. static inline int sysfs_create_file_ns(struct kobject *kobj,
  339. const struct attribute *attr,
  340. const void *ns)
  341. {
  342. return 0;
  343. }
  344. static inline int sysfs_create_files(struct kobject *kobj,
  345. const struct attribute * const *attr)
  346. {
  347. return 0;
  348. }
  349. static inline int sysfs_chmod_file(struct kobject *kobj,
  350. const struct attribute *attr, umode_t mode)
  351. {
  352. return 0;
  353. }
  354. static inline struct kernfs_node *
  355. sysfs_break_active_protection(struct kobject *kobj,
  356. const struct attribute *attr)
  357. {
  358. return NULL;
  359. }
  360. static inline void sysfs_unbreak_active_protection(struct kernfs_node *kn)
  361. {
  362. }
  363. static inline void sysfs_remove_file_ns(struct kobject *kobj,
  364. const struct attribute *attr,
  365. const void *ns)
  366. {
  367. }
  368. static inline bool sysfs_remove_file_self(struct kobject *kobj,
  369. const struct attribute *attr)
  370. {
  371. return false;
  372. }
  373. static inline void sysfs_remove_files(struct kobject *kobj,
  374. const struct attribute * const *attr)
  375. {
  376. }
  377. static inline int sysfs_create_bin_file(struct kobject *kobj,
  378. const struct bin_attribute *attr)
  379. {
  380. return 0;
  381. }
  382. static inline void sysfs_remove_bin_file(struct kobject *kobj,
  383. const struct bin_attribute *attr)
  384. {
  385. }
  386. static inline int sysfs_create_link(struct kobject *kobj,
  387. struct kobject *target, const char *name)
  388. {
  389. return 0;
  390. }
  391. static inline int sysfs_create_link_nowarn(struct kobject *kobj,
  392. struct kobject *target,
  393. const char *name)
  394. {
  395. return 0;
  396. }
  397. static inline void sysfs_remove_link(struct kobject *kobj, const char *name)
  398. {
  399. }
  400. static inline int sysfs_rename_link_ns(struct kobject *k, struct kobject *t,
  401. const char *old_name,
  402. const char *new_name, const void *ns)
  403. {
  404. return 0;
  405. }
  406. static inline void sysfs_delete_link(struct kobject *k, struct kobject *t,
  407. const char *name)
  408. {
  409. }
  410. static inline int sysfs_create_group(struct kobject *kobj,
  411. const struct attribute_group *grp)
  412. {
  413. return 0;
  414. }
  415. static inline int sysfs_create_groups(struct kobject *kobj,
  416. const struct attribute_group **groups)
  417. {
  418. return 0;
  419. }
  420. static inline int sysfs_update_groups(struct kobject *kobj,
  421. const struct attribute_group **groups)
  422. {
  423. return 0;
  424. }
  425. static inline int sysfs_update_group(struct kobject *kobj,
  426. const struct attribute_group *grp)
  427. {
  428. return 0;
  429. }
  430. static inline void sysfs_remove_group(struct kobject *kobj,
  431. const struct attribute_group *grp)
  432. {
  433. }
  434. static inline void sysfs_remove_groups(struct kobject *kobj,
  435. const struct attribute_group **groups)
  436. {
  437. }
  438. static inline int sysfs_add_file_to_group(struct kobject *kobj,
  439. const struct attribute *attr, const char *group)
  440. {
  441. return 0;
  442. }
  443. static inline void sysfs_remove_file_from_group(struct kobject *kobj,
  444. const struct attribute *attr, const char *group)
  445. {
  446. }
  447. static inline int sysfs_merge_group(struct kobject *kobj,
  448. const struct attribute_group *grp)
  449. {
  450. return 0;
  451. }
  452. static inline void sysfs_unmerge_group(struct kobject *kobj,
  453. const struct attribute_group *grp)
  454. {
  455. }
  456. static inline int sysfs_add_link_to_group(struct kobject *kobj,
  457. const char *group_name, struct kobject *target,
  458. const char *link_name)
  459. {
  460. return 0;
  461. }
  462. static inline void sysfs_remove_link_from_group(struct kobject *kobj,
  463. const char *group_name, const char *link_name)
  464. {
  465. }
  466. static inline int compat_only_sysfs_link_entry_to_kobj(struct kobject *kobj,
  467. struct kobject *target_kobj,
  468. const char *target_name,
  469. const char *symlink_name)
  470. {
  471. return 0;
  472. }
  473. static inline void sysfs_notify(struct kobject *kobj, const char *dir,
  474. const char *attr)
  475. {
  476. }
  477. static inline int __must_check sysfs_init(void)
  478. {
  479. return 0;
  480. }
  481. static inline void sysfs_enable_ns(struct kernfs_node *kn)
  482. {
  483. }
  484. static inline int sysfs_file_change_owner(struct kobject *kobj,
  485. const char *name, kuid_t kuid,
  486. kgid_t kgid)
  487. {
  488. return 0;
  489. }
  490. static inline int sysfs_link_change_owner(struct kobject *kobj,
  491. struct kobject *targ,
  492. const char *name, kuid_t kuid,
  493. kgid_t kgid)
  494. {
  495. return 0;
  496. }
  497. static inline int sysfs_change_owner(struct kobject *kobj, kuid_t kuid, kgid_t kgid)
  498. {
  499. return 0;
  500. }
  501. static inline int sysfs_groups_change_owner(struct kobject *kobj,
  502. const struct attribute_group **groups,
  503. kuid_t kuid, kgid_t kgid)
  504. {
  505. return 0;
  506. }
  507. static inline int sysfs_group_change_owner(struct kobject *kobj,
  508. const struct attribute_group *groups,
  509. kuid_t kuid, kgid_t kgid)
  510. {
  511. return 0;
  512. }
  513. __printf(2, 3)
  514. static inline int sysfs_emit(char *buf, const char *fmt, ...)
  515. {
  516. return 0;
  517. }
  518. __printf(3, 4)
  519. static inline int sysfs_emit_at(char *buf, int at, const char *fmt, ...)
  520. {
  521. return 0;
  522. }
  523. #endif /* CONFIG_SYSFS */
  524. static inline int __must_check sysfs_create_file(struct kobject *kobj,
  525. const struct attribute *attr)
  526. {
  527. return sysfs_create_file_ns(kobj, attr, NULL);
  528. }
  529. static inline void sysfs_remove_file(struct kobject *kobj,
  530. const struct attribute *attr)
  531. {
  532. sysfs_remove_file_ns(kobj, attr, NULL);
  533. }
  534. static inline int sysfs_rename_link(struct kobject *kobj, struct kobject *target,
  535. const char *old_name, const char *new_name)
  536. {
  537. return sysfs_rename_link_ns(kobj, target, old_name, new_name, NULL);
  538. }
  539. static inline void sysfs_notify_dirent(struct kernfs_node *kn)
  540. {
  541. kernfs_notify(kn);
  542. }
  543. static inline struct kernfs_node *sysfs_get_dirent(struct kernfs_node *parent,
  544. const char *name)
  545. {
  546. return kernfs_find_and_get(parent, name);
  547. }
  548. static inline struct kernfs_node *sysfs_get(struct kernfs_node *kn)
  549. {
  550. kernfs_get(kn);
  551. return kn;
  552. }
  553. static inline void sysfs_put(struct kernfs_node *kn)
  554. {
  555. kernfs_put(kn);
  556. }
  557. #endif /* _SYSFS_H_ */