aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/kernfs.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-11-23 17:21:50 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-11-27 16:57:56 -0500
commit5d0e26bb59a680a5d97db5b6629941603e8de229 (patch)
tree221776b29c3cdc947c5e8637856a111d1dc05368 /include/linux/kernfs.h
parent879f40d193bb3c6c13930e88e3e9d5d7baf84d19 (diff)
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 <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.h9
1 files changed, 9 insertions, 0 deletions
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 @@
8#define __LINUX_KERNFS_H 8#define __LINUX_KERNFS_H
9 9
10#include <linux/kernel.h> 10#include <linux/kernel.h>
11#include <linux/err.h>
11 12
12struct sysfs_dirent; 13struct sysfs_dirent;
13 14
14#ifdef CONFIG_SYSFS 15#ifdef CONFIG_SYSFS
15 16
17struct sysfs_dirent *kernfs_create_link(struct sysfs_dirent *parent,
18 const char *name,
19 struct sysfs_dirent *target);
16void kernfs_remove(struct sysfs_dirent *sd); 20void kernfs_remove(struct sysfs_dirent *sd);
17int kernfs_remove_by_name_ns(struct sysfs_dirent *parent, const char *name, 21int kernfs_remove_by_name_ns(struct sysfs_dirent *parent, const char *name,
18 const void *ns); 22 const void *ns);
19 23
20#else /* CONFIG_SYSFS */ 24#else /* CONFIG_SYSFS */
21 25
26static inline struct sysfs_dirent *
27kernfs_create_link(struct sysfs_dirent *parent, const char *name,
28 struct sysfs_dirent *target)
29{ return ERR_PTR(-ENOSYS); }
30
22static inline void kernfs_remove(struct sysfs_dirent *sd) { } 31static inline void kernfs_remove(struct sysfs_dirent *sd) { }
23 32
24static inline int kernfs_remove_by_name_ns(struct sysfs_dirent *parent, 33static inline int kernfs_remove_by_name_ns(struct sysfs_dirent *parent,