aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sysfs.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/sysfs.h')
-rw-r--r--include/linux/sysfs.h39
1 files changed, 27 insertions, 12 deletions
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index f0496b3d1811..96eb576d82fd 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -16,19 +16,15 @@
16#include <linux/errno.h> 16#include <linux/errno.h>
17#include <linux/list.h> 17#include <linux/list.h>
18#include <linux/lockdep.h> 18#include <linux/lockdep.h>
19#include <linux/kobject_ns.h>
19#include <asm/atomic.h> 20#include <asm/atomic.h>
20 21
21struct kobject; 22struct kobject;
22struct module; 23struct module;
24enum kobj_ns_type;
23 25
24/* FIXME
25 * The *owner field is no longer used.
26 * x86 tree has been cleaned up. The owner
27 * attribute is still left for other arches.
28 */
29struct attribute { 26struct attribute {
30 const char *name; 27 const char *name;
31 struct module *owner;
32 mode_t mode; 28 mode_t mode;
33#ifdef CONFIG_DEBUG_LOCK_ALLOC 29#ifdef CONFIG_DEBUG_LOCK_ALLOC
34 struct lock_class_key *key; 30 struct lock_class_key *key;
@@ -86,17 +82,18 @@ struct attribute_group {
86 82
87#define attr_name(_attr) (_attr).attr.name 83#define attr_name(_attr) (_attr).attr.name
88 84
85struct file;
89struct vm_area_struct; 86struct vm_area_struct;
90 87
91struct bin_attribute { 88struct bin_attribute {
92 struct attribute attr; 89 struct attribute attr;
93 size_t size; 90 size_t size;
94 void *private; 91 void *private;
95 ssize_t (*read)(struct kobject *, struct bin_attribute *, 92 ssize_t (*read)(struct file *, struct kobject *, struct bin_attribute *,
96 char *, loff_t, size_t); 93 char *, loff_t, size_t);
97 ssize_t (*write)(struct kobject *, struct bin_attribute *, 94 ssize_t (*write)(struct file *,struct kobject *, struct bin_attribute *,
98 char *, loff_t, size_t); 95 char *, loff_t, size_t);
99 int (*mmap)(struct kobject *, struct bin_attribute *attr, 96 int (*mmap)(struct file *, struct kobject *, struct bin_attribute *attr,
100 struct vm_area_struct *vma); 97 struct vm_area_struct *vma);
101}; 98};
102 99
@@ -134,8 +131,8 @@ int __must_check sysfs_create_file(struct kobject *kobj,
134 const struct attribute *attr); 131 const struct attribute *attr);
135int __must_check sysfs_create_files(struct kobject *kobj, 132int __must_check sysfs_create_files(struct kobject *kobj,
136 const struct attribute **attr); 133 const struct attribute **attr);
137int __must_check sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, 134int __must_check sysfs_chmod_file(struct kobject *kobj,
138 mode_t mode); 135 const struct attribute *attr, mode_t mode);
139void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr); 136void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr);
140void sysfs_remove_files(struct kobject *kobj, const struct attribute **attr); 137void sysfs_remove_files(struct kobject *kobj, const struct attribute **attr);
141 138
@@ -154,6 +151,9 @@ void sysfs_remove_link(struct kobject *kobj, const char *name);
154int sysfs_rename_link(struct kobject *kobj, struct kobject *target, 151int sysfs_rename_link(struct kobject *kobj, struct kobject *target,
155 const char *old_name, const char *new_name); 152 const char *old_name, const char *new_name);
156 153
154void sysfs_delete_link(struct kobject *dir, struct kobject *targ,
155 const char *name);
156
157int __must_check sysfs_create_group(struct kobject *kobj, 157int __must_check sysfs_create_group(struct kobject *kobj,
158 const struct attribute_group *grp); 158 const struct attribute_group *grp);
159int sysfs_update_group(struct kobject *kobj, 159int sysfs_update_group(struct kobject *kobj,
@@ -168,10 +168,15 @@ void sysfs_remove_file_from_group(struct kobject *kobj,
168void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr); 168void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr);
169void sysfs_notify_dirent(struct sysfs_dirent *sd); 169void sysfs_notify_dirent(struct sysfs_dirent *sd);
170struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd, 170struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd,
171 const void *ns,
171 const unsigned char *name); 172 const unsigned char *name);
172struct sysfs_dirent *sysfs_get(struct sysfs_dirent *sd); 173struct sysfs_dirent *sysfs_get(struct sysfs_dirent *sd);
173void sysfs_put(struct sysfs_dirent *sd); 174void sysfs_put(struct sysfs_dirent *sd);
174void sysfs_printk_last_file(void); 175void sysfs_printk_last_file(void);
176
177/* Called to clear a ns tag when it is no longer valid */
178void sysfs_exit_ns(enum kobj_ns_type type, const void *tag);
179
175int __must_check sysfs_init(void); 180int __must_check sysfs_init(void);
176 181
177#else /* CONFIG_SYSFS */ 182#else /* CONFIG_SYSFS */
@@ -215,7 +220,7 @@ static inline int sysfs_create_files(struct kobject *kobj,
215} 220}
216 221
217static inline int sysfs_chmod_file(struct kobject *kobj, 222static inline int sysfs_chmod_file(struct kobject *kobj,
218 struct attribute *attr, mode_t mode) 223 const struct attribute *attr, mode_t mode)
219{ 224{
220 return 0; 225 return 0;
221} 226}
@@ -264,6 +269,11 @@ static inline int sysfs_rename_link(struct kobject *k, struct kobject *t,
264 return 0; 269 return 0;
265} 270}
266 271
272static inline void sysfs_delete_link(struct kobject *k, struct kobject *t,
273 const char *name)
274{
275}
276
267static inline int sysfs_create_group(struct kobject *kobj, 277static inline int sysfs_create_group(struct kobject *kobj,
268 const struct attribute_group *grp) 278 const struct attribute_group *grp)
269{ 279{
@@ -301,6 +311,7 @@ static inline void sysfs_notify_dirent(struct sysfs_dirent *sd)
301} 311}
302static inline 312static inline
303struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd, 313struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd,
314 const void *ns,
304 const unsigned char *name) 315 const unsigned char *name)
305{ 316{
306 return NULL; 317 return NULL;
@@ -313,6 +324,10 @@ static inline void sysfs_put(struct sysfs_dirent *sd)
313{ 324{
314} 325}
315 326
327static inline void sysfs_exit_ns(int type, const void *tag)
328{
329}
330
316static inline int __must_check sysfs_init(void) 331static inline int __must_check sysfs_init(void)
317{ 332{
318 return 0; 333 return 0;