]>
Commit | Line | Data |
---|---|---|
b8441ed2 TH |
1 | /* |
2 | * kernfs.h - pseudo filesystem decoupled from vfs locking | |
3 | * | |
4 | * This file is released under the GPLv2. | |
5 | */ | |
6 | ||
7 | #ifndef __LINUX_KERNFS_H | |
8 | #define __LINUX_KERNFS_H | |
9 | ||
879f40d1 | 10 | #include <linux/kernel.h> |
5d0e26bb | 11 | #include <linux/err.h> |
879f40d1 | 12 | |
b8441ed2 TH |
13 | struct sysfs_dirent; |
14 | ||
879f40d1 TH |
15 | #ifdef CONFIG_SYSFS |
16 | ||
5d0e26bb TH |
17 | struct sysfs_dirent *kernfs_create_link(struct sysfs_dirent *parent, |
18 | const char *name, | |
19 | struct sysfs_dirent *target); | |
879f40d1 TH |
20 | void kernfs_remove(struct sysfs_dirent *sd); |
21 | int kernfs_remove_by_name_ns(struct sysfs_dirent *parent, const char *name, | |
22 | const void *ns); | |
890ece16 TH |
23 | int kernfs_rename_ns(struct sysfs_dirent *sd, struct sysfs_dirent *new_parent, |
24 | const char *new_name, const void *new_ns); | |
879f40d1 TH |
25 | |
26 | #else /* CONFIG_SYSFS */ | |
27 | ||
5d0e26bb TH |
28 | static inline struct sysfs_dirent * |
29 | kernfs_create_link(struct sysfs_dirent *parent, const char *name, | |
30 | struct sysfs_dirent *target) | |
31 | { return ERR_PTR(-ENOSYS); } | |
32 | ||
879f40d1 TH |
33 | static inline void kernfs_remove(struct sysfs_dirent *sd) { } |
34 | ||
35 | static inline int kernfs_remove_by_name_ns(struct sysfs_dirent *parent, | |
36 | const char *name, const void *ns) | |
37 | { return -ENOSYS; } | |
38 | ||
890ece16 TH |
39 | static inline int kernfs_rename_ns(struct sysfs_dirent *sd, |
40 | struct sysfs_dirent *new_parent, | |
41 | const char *new_name, const void *new_ns) | |
42 | { return -ENOSYS; } | |
43 | ||
879f40d1 TH |
44 | #endif /* CONFIG_SYSFS */ |
45 | ||
46 | static inline int kernfs_remove_by_name(struct sysfs_dirent *parent, | |
47 | const char *name) | |
48 | { | |
49 | return kernfs_remove_by_name_ns(parent, name, NULL); | |
50 | } | |
51 | ||
b8441ed2 | 52 | #endif /* __LINUX_KERNFS_H */ |