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.h43
1 files changed, 28 insertions, 15 deletions
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 7d5d1ec95c2e..be8228e50a27 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -19,10 +19,15 @@ struct kobject;
19struct module; 19struct module;
20struct nameidata; 20struct nameidata;
21struct dentry; 21struct dentry;
22struct sysfs_dirent;
22 23
24/* FIXME
25 * The *owner field is no longer used, but leave around
26 * until the tree gets cleaned up fully.
27 */
23struct attribute { 28struct attribute {
24 const char * name; 29 const char * name;
25 struct module * owner; 30 struct module * owner;
26 mode_t mode; 31 mode_t mode;
27}; 32};
28 33
@@ -39,14 +44,14 @@ struct attribute_group {
39 */ 44 */
40 45
41#define __ATTR(_name,_mode,_show,_store) { \ 46#define __ATTR(_name,_mode,_show,_store) { \
42 .attr = {.name = __stringify(_name), .mode = _mode, .owner = THIS_MODULE }, \ 47 .attr = {.name = __stringify(_name), .mode = _mode }, \
43 .show = _show, \ 48 .show = _show, \
44 .store = _store, \ 49 .store = _store, \
45} 50}
46 51
47#define __ATTR_RO(_name) { \ 52#define __ATTR_RO(_name) { \
48 .attr = { .name = __stringify(_name), .mode = 0444, .owner = THIS_MODULE }, \ 53 .attr = { .name = __stringify(_name), .mode = 0444 }, \
49 .show = _name##_show, \ 54 .show = _name##_show, \
50} 55}
51 56
52#define __ATTR_NULL { .attr = { .name = NULL } } 57#define __ATTR_NULL { .attr = { .name = NULL } }
@@ -59,8 +64,10 @@ struct bin_attribute {
59 struct attribute attr; 64 struct attribute attr;
60 size_t size; 65 size_t size;
61 void *private; 66 void *private;
62 ssize_t (*read)(struct kobject *, char *, loff_t, size_t); 67 ssize_t (*read)(struct kobject *, struct bin_attribute *,
63 ssize_t (*write)(struct kobject *, char *, loff_t, size_t); 68 char *, loff_t, size_t);
69 ssize_t (*write)(struct kobject *, struct bin_attribute *,
70 char *, loff_t, size_t);
64 int (*mmap)(struct kobject *, struct bin_attribute *attr, 71 int (*mmap)(struct kobject *, struct bin_attribute *attr,
65 struct vm_area_struct *vma); 72 struct vm_area_struct *vma);
66}; 73};
@@ -70,12 +77,16 @@ struct sysfs_ops {
70 ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t); 77 ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t);
71}; 78};
72 79
80#define SYSFS_TYPE_MASK 0x00ff
73#define SYSFS_ROOT 0x0001 81#define SYSFS_ROOT 0x0001
74#define SYSFS_DIR 0x0002 82#define SYSFS_DIR 0x0002
75#define SYSFS_KOBJ_ATTR 0x0004 83#define SYSFS_KOBJ_ATTR 0x0004
76#define SYSFS_KOBJ_BIN_ATTR 0x0008 84#define SYSFS_KOBJ_BIN_ATTR 0x0008
77#define SYSFS_KOBJ_LINK 0x0020 85#define SYSFS_KOBJ_LINK 0x0020
78#define SYSFS_NOT_PINNED (SYSFS_KOBJ_ATTR | SYSFS_KOBJ_BIN_ATTR | SYSFS_KOBJ_LINK) 86#define SYSFS_COPY_NAME (SYSFS_DIR | SYSFS_KOBJ_LINK)
87
88#define SYSFS_FLAG_MASK ~SYSFS_TYPE_MASK
89#define SYSFS_FLAG_REMOVED 0x0100
79 90
80#ifdef CONFIG_SYSFS 91#ifdef CONFIG_SYSFS
81 92
@@ -83,13 +94,14 @@ extern int sysfs_schedule_callback(struct kobject *kobj,
83 void (*func)(void *), void *data, struct module *owner); 94 void (*func)(void *), void *data, struct module *owner);
84 95
85extern int __must_check 96extern int __must_check
86sysfs_create_dir(struct kobject *, struct dentry *); 97sysfs_create_dir(struct kobject *kobj, struct sysfs_dirent *shadow_parent_sd);
87 98
88extern void 99extern void
89sysfs_remove_dir(struct kobject *); 100sysfs_remove_dir(struct kobject *);
90 101
91extern int __must_check 102extern int __must_check
92sysfs_rename_dir(struct kobject *, struct dentry *, const char *new_name); 103sysfs_rename_dir(struct kobject *kobj, struct sysfs_dirent *new_parent_sd,
104 const char *new_name);
93 105
94extern int __must_check 106extern int __must_check
95sysfs_move_dir(struct kobject *, struct kobject *); 107sysfs_move_dir(struct kobject *, struct kobject *);
@@ -129,8 +141,8 @@ void sysfs_notify(struct kobject * k, char *dir, char *attr);
129 141
130extern int sysfs_make_shadowed_dir(struct kobject *kobj, 142extern int sysfs_make_shadowed_dir(struct kobject *kobj,
131 void * (*follow_link)(struct dentry *, struct nameidata *)); 143 void * (*follow_link)(struct dentry *, struct nameidata *));
132extern struct dentry *sysfs_create_shadow_dir(struct kobject *kobj); 144extern struct sysfs_dirent *sysfs_create_shadow_dir(struct kobject *kobj);
133extern void sysfs_remove_shadow_dir(struct dentry *dir); 145extern void sysfs_remove_shadow_dir(struct sysfs_dirent *shadow_sd);
134 146
135extern int __must_check sysfs_init(void); 147extern int __must_check sysfs_init(void);
136 148
@@ -142,7 +154,8 @@ static inline int sysfs_schedule_callback(struct kobject *kobj,
142 return -ENOSYS; 154 return -ENOSYS;
143} 155}
144 156
145static inline int sysfs_create_dir(struct kobject * k, struct dentry *shadow) 157static inline int sysfs_create_dir(struct kobject *kobj,
158 struct sysfs_dirent *shadow_parent_sd)
146{ 159{
147 return 0; 160 return 0;
148} 161}
@@ -152,9 +165,9 @@ static inline void sysfs_remove_dir(struct kobject * k)
152 ; 165 ;
153} 166}
154 167
155static inline int sysfs_rename_dir(struct kobject * k, 168static inline int sysfs_rename_dir(struct kobject *kobj,
156 struct dentry *new_parent, 169 struct sysfs_dirent *new_parent_sd,
157 const char *new_name) 170 const char *new_name)
158{ 171{
159 return 0; 172 return 0;
160} 173}