summaryrefslogtreecommitdiffstats
path: root/include/linux/sysfs.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-11-23 18:01:46 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-11-27 13:01:03 -0800
commitc84a3b27798dfce928b867fa1c9f3c3fd66f0a31 (patch)
tree87a706232ee20ce8262b4a34bbf9eaf06b3ddfe6 /include/linux/sysfs.h
parent6ce4eac1f600b34f2f7f58f9cd8f0503d79e42ae (diff)
downloadop-kernel-dev-c84a3b27798dfce928b867fa1c9f3c3fd66f0a31.zip
op-kernel-dev-c84a3b27798dfce928b867fa1c9f3c3fd66f0a31.tar.gz
sysfs: drop kobj_ns_type handling, take #2
The way namespace tags are implemented in sysfs is more complicated than necessary. As each tag is a pointer value and required to be non-NULL under a namespace enabled parent, there's no need to record separately what type each tag is. If multiple namespace types are needed, which currently aren't, we can simply compare the tag to a set of allowed tags in the superblock assuming that the tags, being pointers, won't have the same value across multiple types. This patch rips out kobj_ns_type handling from sysfs. sysfs now has an enable switch to turn on namespace under a node. If enabled, all children are required to have non-NULL namespace tags and filtered against the super_block's tag. kobject namespace determination is now performed in lib/kobject.c::create_dir() making sysfs_read_ns_type() unnecessary. The sanity checks are also moved. create_dir() is restructured to ease such addition. This removes most kobject namespace knowledge from sysfs proper which will enable proper separation and layering of sysfs. This is the second try. The first one was cb26a311578e ("sysfs: drop kobj_ns_type handling") which tried to automatically enable namespace if there are children with non-NULL namespace tags; however, it was broken for symlinks as they should inherit the target's tag iff namespace is enabled in the parent. This led to namespace filtering enabled incorrectly for wireless net class devices through phy80211 symlinks and thus network configuration failure. a1212d278c05 ("Revert "sysfs: drop kobj_ns_type handling"") reverted the commit. This shouldn't introduce any behavior changes, for real. v2: Dummy implementation of sysfs_enable_ns() for !CONFIG_SYSFS was missing and caused build failure. Reported by kbuild test robot. Signed-off-by: Tejun Heo <tj@kernel.org> Reported-by: Linus Torvalds <torvalds@linux-foundation.org> Cc: Eric W. Biederman <ebiederm@xmission.com> Cc: Kay Sievers <kay@vrfy.org> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/sysfs.h')
-rw-r--r--include/linux/sysfs.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 6695040..362a34d 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -220,6 +220,8 @@ int sysfs_rename_link_ns(struct kobject *kobj, struct kobject *target,
void sysfs_delete_link(struct kobject *dir, struct kobject *targ,
const char *name);
+void sysfs_enable_ns(struct sysfs_dirent *sd);
+
int __must_check sysfs_create_group(struct kobject *kobj,
const struct attribute_group *grp);
int __must_check sysfs_create_groups(struct kobject *kobj,
@@ -353,6 +355,10 @@ static inline void sysfs_delete_link(struct kobject *k, struct kobject *t,
{
}
+static inline void sysfs_enable_ns(struct sysfs_dirent *sd)
+{
+}
+
static inline int sysfs_create_group(struct kobject *kobj,
const struct attribute_group *grp)
{
OpenPOWER on IntegriCloud