aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-11-28 14:54:27 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-11-29 20:48:14 -0500
commit024f647117d697165aaadf3f1af1343b7000149a (patch)
tree79dcad5d6babfe359c443093fe7e5bed84322ef7 /include
parentd19b9846df64d8845be682b6318bd1aee246cf60 (diff)
sysfs, kernfs: introduce kernfs_notify()
Introduce kernfs interface to wake up poll(2) which takes and returns sysfs_dirents. sysfs_notify_dirent() is renamed to kernfs_notify() and sysfs_notify() is updated so that it doesn't directly grab sysfs_mutex but acquires the target sysfs_dirents using sysfs_get_dirent(). sysfs_notify_dirent() is reimplemented as a dumb inline wrapper around kernfs_notify(). This patch doesn't introduce any behavior changes. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/kernfs.h3
-rw-r--r--include/linux/sysfs.h9
2 files changed, 8 insertions, 4 deletions
diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h
index ba993ebcd81e..f20796ecc76e 100644
--- a/include/linux/kernfs.h
+++ b/include/linux/kernfs.h
@@ -84,6 +84,7 @@ int kernfs_rename_ns(struct sysfs_dirent *sd, struct sysfs_dirent *new_parent,
84 const char *new_name, const void *new_ns); 84 const char *new_name, const void *new_ns);
85void kernfs_enable_ns(struct sysfs_dirent *sd); 85void kernfs_enable_ns(struct sysfs_dirent *sd);
86int kernfs_setattr(struct sysfs_dirent *sd, const struct iattr *iattr); 86int kernfs_setattr(struct sysfs_dirent *sd, const struct iattr *iattr);
87void kernfs_notify(struct sysfs_dirent *sd);
87 88
88#else /* CONFIG_SYSFS */ 89#else /* CONFIG_SYSFS */
89 90
@@ -120,6 +121,8 @@ static inline int kernfs_setattr(struct sysfs_dirent *sd,
120 const struct iattr *iattr) 121 const struct iattr *iattr)
121{ return -ENOSYS; } 122{ return -ENOSYS; }
122 123
124static inline void kernfs_notify(struct sysfs_dirent *sd) { }
125
123#endif /* CONFIG_SYSFS */ 126#endif /* CONFIG_SYSFS */
124 127
125static inline struct sysfs_dirent * 128static inline struct sysfs_dirent *
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 2bc735d3e938..0ab2b023b613 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -243,7 +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
245void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr); 245void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr);
246void sysfs_notify_dirent(struct sysfs_dirent *sd);
247struct sysfs_dirent *sysfs_get_dirent_ns(struct sysfs_dirent *parent_sd, 246struct sysfs_dirent *sysfs_get_dirent_ns(struct sysfs_dirent *parent_sd,
248 const unsigned char *name, 247 const unsigned char *name,
249 const void *ns); 248 const void *ns);
@@ -418,9 +417,6 @@ static inline void sysfs_notify(struct kobject *kobj, const char *dir,
418 const char *attr) 417 const char *attr)
419{ 418{
420} 419}
421static inline void sysfs_notify_dirent(struct sysfs_dirent *sd)
422{
423}
424static inline struct sysfs_dirent * 420static inline struct sysfs_dirent *
425sysfs_get_dirent_ns(struct sysfs_dirent *parent_sd, const unsigned char *name, 421sysfs_get_dirent_ns(struct sysfs_dirent *parent_sd, const unsigned char *name,
426 const void *ns) 422 const void *ns)
@@ -466,4 +462,9 @@ sysfs_get_dirent(struct sysfs_dirent *parent_sd, const unsigned char *name)
466 return sysfs_get_dirent_ns(parent_sd, name, NULL); 462 return sysfs_get_dirent_ns(parent_sd, name, NULL);
467} 463}
468 464
465static inline void sysfs_notify_dirent(struct sysfs_dirent *sd)
466{
467 kernfs_notify(sd);
468}
469
469#endif /* _SYSFS_H_ */ 470#endif /* _SYSFS_H_ */