From 5d0e26bb59a680a5d97db5b6629941603e8de229 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Sat, 23 Nov 2013 17:21:50 -0500 Subject: sysfs, kernfs: introduce kernfs_create_link() Separate out kernfs symlink interface - kernfs_create_link() - which takes and returns sysfs_dirents, from sysfs_do_create_link_sd(). sysfs_do_create_link_sd() now just determines the parent and target sysfs_dirents and invokes the new interface and handles dup warning. This patch doesn't introduce behavior changes. v2: Dummy implementation for !CONFIG_SYSFS updated to return -ENOSYS. Signed-off-by: Tejun Heo Signed-off-by: Greg Kroah-Hartman --- include/linux/kernfs.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include/linux/kernfs.h') diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h index 83e151ad0619..fe6290d41776 100644 --- a/include/linux/kernfs.h +++ b/include/linux/kernfs.h @@ -8,17 +8,26 @@ #define __LINUX_KERNFS_H #include +#include struct sysfs_dirent; #ifdef CONFIG_SYSFS +struct sysfs_dirent *kernfs_create_link(struct sysfs_dirent *parent, + const char *name, + struct sysfs_dirent *target); void kernfs_remove(struct sysfs_dirent *sd); int kernfs_remove_by_name_ns(struct sysfs_dirent *parent, const char *name, const void *ns); #else /* CONFIG_SYSFS */ +static inline struct sysfs_dirent * +kernfs_create_link(struct sysfs_dirent *parent, const char *name, + struct sysfs_dirent *target) +{ return ERR_PTR(-ENOSYS); } + static inline void kernfs_remove(struct sysfs_dirent *sd) { } static inline int kernfs_remove_by_name_ns(struct sysfs_dirent *parent, -- cgit v1.2.3