diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/kernfs.h | 19 | ||||
| -rw-r--r-- | include/linux/sysfs.h | 35 |
2 files changed, 33 insertions, 21 deletions
diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h index 105d09dcb064..fd8f574ef2fe 100644 --- a/include/linux/kernfs.h +++ b/include/linux/kernfs.h | |||
| @@ -71,6 +71,11 @@ struct kernfs_ops { | |||
| 71 | 71 | ||
| 72 | #ifdef CONFIG_SYSFS | 72 | #ifdef CONFIG_SYSFS |
| 73 | 73 | ||
| 74 | struct sysfs_dirent *kernfs_find_and_get_ns(struct sysfs_dirent *parent, | ||
| 75 | const char *name, const void *ns); | ||
| 76 | void kernfs_get(struct sysfs_dirent *sd); | ||
| 77 | void kernfs_put(struct sysfs_dirent *sd); | ||
| 78 | |||
| 74 | struct sysfs_dirent *kernfs_create_dir_ns(struct sysfs_dirent *parent, | 79 | struct sysfs_dirent *kernfs_create_dir_ns(struct sysfs_dirent *parent, |
| 75 | const char *name, void *priv, | 80 | const char *name, void *priv, |
| 76 | const void *ns); | 81 | const void *ns); |
| @@ -95,6 +100,14 @@ void kernfs_notify(struct sysfs_dirent *sd); | |||
| 95 | #else /* CONFIG_SYSFS */ | 100 | #else /* CONFIG_SYSFS */ |
| 96 | 101 | ||
| 97 | static inline struct sysfs_dirent * | 102 | static inline struct sysfs_dirent * |
| 103 | kernfs_find_and_get_ns(struct sysfs_dirent *parent, const char *name, | ||
| 104 | const void *ns) | ||
| 105 | { return NULL; } | ||
| 106 | |||
| 107 | static inline void kernfs_get(struct sysfs_dirent *sd) { } | ||
| 108 | static inline void kernfs_put(struct sysfs_dirent *sd) { } | ||
| 109 | |||
| 110 | static inline struct sysfs_dirent * | ||
| 98 | kernfs_create_dir_ns(struct sysfs_dirent *parent, const char *name, void *priv, | 111 | kernfs_create_dir_ns(struct sysfs_dirent *parent, const char *name, void *priv, |
| 99 | const void *ns) | 112 | const void *ns) |
| 100 | { return ERR_PTR(-ENOSYS); } | 113 | { return ERR_PTR(-ENOSYS); } |
| @@ -133,6 +146,12 @@ static inline void kernfs_notify(struct sysfs_dirent *sd) { } | |||
| 133 | #endif /* CONFIG_SYSFS */ | 146 | #endif /* CONFIG_SYSFS */ |
| 134 | 147 | ||
| 135 | static inline struct sysfs_dirent * | 148 | static inline struct sysfs_dirent * |
| 149 | kernfs_find_and_get(struct sysfs_dirent *sd, const char *name) | ||
| 150 | { | ||
| 151 | return kernfs_find_and_get_ns(sd, name, NULL); | ||
| 152 | } | ||
| 153 | |||
| 154 | static inline struct sysfs_dirent * | ||
| 136 | kernfs_create_dir(struct sysfs_dirent *parent, const char *name, void *priv) | 155 | kernfs_create_dir(struct sysfs_dirent *parent, const char *name, void *priv) |
| 137 | { | 156 | { |
| 138 | return kernfs_create_dir_ns(parent, name, priv, NULL); | 157 | return kernfs_create_dir_ns(parent, name, priv, NULL); |
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index 0ab2b023b613..cd8f90bf51a7 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h | |||
| @@ -243,11 +243,6 @@ void sysfs_remove_link_from_group(struct kobject *kobj, const char *group_name, | |||
| 243 | const char *link_name); | 243 | const char *link_name); |
| 244 | 244 | ||
| 245 | void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr); | 245 | void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr); |
| 246 | struct sysfs_dirent *sysfs_get_dirent_ns(struct sysfs_dirent *parent_sd, | ||
| 247 | const unsigned char *name, | ||
| 248 | const void *ns); | ||
| 249 | struct sysfs_dirent *sysfs_get(struct sysfs_dirent *sd); | ||
| 250 | void sysfs_put(struct sysfs_dirent *sd); | ||
| 251 | 246 | ||
| 252 | int __must_check sysfs_init(void); | 247 | int __must_check sysfs_init(void); |
| 253 | 248 | ||
| @@ -417,19 +412,6 @@ static inline void sysfs_notify(struct kobject *kobj, const char *dir, | |||
| 417 | const char *attr) | 412 | const char *attr) |
| 418 | { | 413 | { |
| 419 | } | 414 | } |
| 420 | static inline struct sysfs_dirent * | ||
| 421 | sysfs_get_dirent_ns(struct sysfs_dirent *parent_sd, const unsigned char *name, | ||
| 422 | const void *ns) | ||
| 423 | { | ||
| 424 | return NULL; | ||
| 425 | } | ||
| 426 | static inline struct sysfs_dirent *sysfs_get(struct sysfs_dirent *sd) | ||
| 427 | { | ||
| 428 | return NULL; | ||
| 429 | } | ||
| 430 | static inline void sysfs_put(struct sysfs_dirent *sd) | ||
| 431 | { | ||
| 432 | } | ||
| 433 | 415 | ||
| 434 | static inline int __must_check sysfs_init(void) | 416 | static inline int __must_check sysfs_init(void) |
| 435 | { | 417 | { |
| @@ -456,15 +438,26 @@ static inline int sysfs_rename_link(struct kobject *kobj, struct kobject *target | |||
| 456 | return sysfs_rename_link_ns(kobj, target, old_name, new_name, NULL); | 438 | return sysfs_rename_link_ns(kobj, target, old_name, new_name, NULL); |
| 457 | } | 439 | } |
| 458 | 440 | ||
| 441 | static inline void sysfs_notify_dirent(struct sysfs_dirent *sd) | ||
| 442 | { | ||
| 443 | kernfs_notify(sd); | ||
| 444 | } | ||
| 445 | |||
| 459 | static inline struct sysfs_dirent * | 446 | static inline struct sysfs_dirent * |
| 460 | sysfs_get_dirent(struct sysfs_dirent *parent_sd, const unsigned char *name) | 447 | sysfs_get_dirent(struct sysfs_dirent *parent_sd, const unsigned char *name) |
| 461 | { | 448 | { |
| 462 | return sysfs_get_dirent_ns(parent_sd, name, NULL); | 449 | return kernfs_find_and_get(parent_sd, name); |
| 463 | } | 450 | } |
| 464 | 451 | ||
| 465 | static inline void sysfs_notify_dirent(struct sysfs_dirent *sd) | 452 | static inline struct sysfs_dirent *sysfs_get(struct sysfs_dirent *sd) |
| 466 | { | 453 | { |
| 467 | kernfs_notify(sd); | 454 | kernfs_get(sd); |
| 455 | return sd; | ||
| 456 | } | ||
| 457 | |||
| 458 | static inline void sysfs_put(struct sysfs_dirent *sd) | ||
| 459 | { | ||
| 460 | kernfs_put(sd); | ||
| 468 | } | 461 | } |
| 469 | 462 | ||
| 470 | #endif /* _SYSFS_H_ */ | 463 | #endif /* _SYSFS_H_ */ |
