diff options
author | Tejun Heo <tj@kernel.org> | 2013-11-30 02:19:09 +0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-11-30 06:41:28 +0400 |
commit | ac9bba031001704a2339713cc12148857eccc5e5 (patch) | |
tree | c058217a47c51021d97454639ed0f7480c73fe6a /include/linux/kernfs.h | |
parent | cf9e5a73aaff0204801dd19cb4bd91d32f32026a (diff) | |
download | linux-ac9bba031001704a2339713cc12148857eccc5e5.tar.xz |
sysfs, kernfs: implement kernfs_ns_enabled()
fs/sysfs/symlink.c::sysfs_delete_link() tests @sd->s_flags for
SYSFS_FLAG_NS. Let's add kernfs_ns_enabled() so that sysfs doesn't
have to test sysfs_dirent flag directly. This makes things tidier for
kernfs proper too.
This is purely cosmetic.
v2: To avoid possible NULL deref, use noop dummy implementation which
always returns false when !CONFIG_SYSFS.
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/kernfs.h')
-rw-r--r-- | include/linux/kernfs.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h index faaf4f29e33d..d65541308419 100644 --- a/include/linux/kernfs.h +++ b/include/linux/kernfs.h @@ -190,6 +190,17 @@ static inline void kernfs_enable_ns(struct sysfs_dirent *sd) sd->s_flags |= SYSFS_FLAG_NS; } +/** + * kernfs_ns_enabled - test whether namespace is enabled + * @sd: the node to test + * + * Test whether namespace filtering is enabled for the children of @ns. + */ +static inline bool kernfs_ns_enabled(struct sysfs_dirent *sd) +{ + return sd->s_flags & SYSFS_FLAG_NS; +} + struct sysfs_dirent *kernfs_find_and_get_ns(struct sysfs_dirent *parent, const char *name, const void *ns); void kernfs_get(struct sysfs_dirent *sd); @@ -232,6 +243,9 @@ static inline enum kernfs_node_type sysfs_type(struct sysfs_dirent *sd) static inline void kernfs_enable_ns(struct sysfs_dirent *sd) { } +static inline bool kernfs_ns_enabled(struct sysfs_dirent *sd) +{ return false; } + static inline struct sysfs_dirent * kernfs_find_and_get_ns(struct sysfs_dirent *parent, const char *name, const void *ns) |