diff options
author | Tejun Heo | 2013-11-29 17:18:32 -0500 |
---|---|---|
committer | Greg Kroah-Hartman | 2013-11-29 18:21:01 -0800 |
commit | cf9e5a73aaff0204801dd19cb4bd91d32f32026a (patch) | |
tree | 4a63d030a4c2ee08c06b97d348bcf42bdf7a3cd4 /fs/kernfs/dir.c | |
parent | fa736a951e456b996a76826ba78ff974414c3b55 (diff) |
sysfs, kernfs: make sysfs_dirent definition public
sysfs_dirent includes some information which should be available to
kernfs users - the type, flags, name and parent pointer. This patch
moves sysfs_dirent definition from kernfs/kernfs-internal.h to
include/linux/kernfs.h so that kernfs users can access them.
The type part of flags is exported as enum kernfs_node_type, the flags
kernfs_node_flag, sysfs_type() and kernfs_enable_ns() are moved to
include/linux/kernfs.h and the former is updated to return the enum
type. sysfs_dirent->s_parent and ->s_name are marked explicitly as
public.
This patch doesn't introduce any functional changes.
v2: Flags exported too and kernfs_enable_ns() definition moved.
v3: While moving kernfs_enable_ns() to include/linux/kernfs.h, v1 and
v2 put the definition outside CONFIG_SYSFS replacing the dummy
implementation with the actual implementation too. Unfortunately,
this can lead to oops when !CONFIG_SYSFS because
kernfs_enable_ns() may be called on a NULL @sd and now tries to
dereference @sd instead of not doing anything. This issue was
reported by Yuanhan Liu.
Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/kernfs/dir.c')
-rw-r--r-- | fs/kernfs/dir.c | 15 |
1 files changed, 0 insertions, 15 deletions
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c index eaffa83719d5..7c5b51793689 100644 --- a/fs/kernfs/dir.c +++ b/fs/kernfs/dir.c @@ -895,21 +895,6 @@ int kernfs_rename_ns(struct sysfs_dirent *sd, struct sysfs_dirent *new_parent, return error; } -/** - * kernfs_enable_ns - enable namespace under a directory - * @sd: directory of interest, should be empty - * - * This is to be called right after @sd is created to enable namespace - * under it. All children of @sd must have non-NULL namespace tags and - * only the ones which match the super_block's tag will be visible. - */ -void kernfs_enable_ns(struct sysfs_dirent *sd) -{ - WARN_ON_ONCE(sysfs_type(sd) != SYSFS_DIR); - WARN_ON_ONCE(!RB_EMPTY_ROOT(&sd->s_dir.children)); - sd->s_flags |= SYSFS_FLAG_NS; -} - /* Relationship between s_mode and the DT_xxx types */ static inline unsigned char dt_type(struct sysfs_dirent *sd) { |