diff options
Diffstat (limited to 'include/linux/sysfs.h')
-rw-r--r-- | include/linux/sysfs.h | 147 |
1 files changed, 55 insertions, 92 deletions
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index be8228e50a27..149ab62329e2 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h | |||
@@ -3,6 +3,8 @@ | |||
3 | * | 3 | * |
4 | * Copyright (c) 2001,2002 Patrick Mochel | 4 | * Copyright (c) 2001,2002 Patrick Mochel |
5 | * Copyright (c) 2004 Silicon Graphics, Inc. | 5 | * Copyright (c) 2004 Silicon Graphics, Inc. |
6 | * Copyright (c) 2007 SUSE Linux Products GmbH | ||
7 | * Copyright (c) 2007 Tejun Heo <teheo@suse.de> | ||
6 | * | 8 | * |
7 | * Please see Documentation/filesystems/sysfs.txt for more information. | 9 | * Please see Documentation/filesystems/sysfs.txt for more information. |
8 | */ | 10 | */ |
@@ -17,23 +19,20 @@ | |||
17 | 19 | ||
18 | struct kobject; | 20 | struct kobject; |
19 | struct module; | 21 | struct module; |
20 | struct nameidata; | ||
21 | struct dentry; | ||
22 | struct sysfs_dirent; | ||
23 | 22 | ||
24 | /* FIXME | 23 | /* FIXME |
25 | * The *owner field is no longer used, but leave around | 24 | * The *owner field is no longer used, but leave around |
26 | * until the tree gets cleaned up fully. | 25 | * until the tree gets cleaned up fully. |
27 | */ | 26 | */ |
28 | struct attribute { | 27 | struct attribute { |
29 | const char * name; | 28 | const char *name; |
30 | struct module * owner; | 29 | struct module *owner; |
31 | mode_t mode; | 30 | mode_t mode; |
32 | }; | 31 | }; |
33 | 32 | ||
34 | struct attribute_group { | 33 | struct attribute_group { |
35 | const char * name; | 34 | const char *name; |
36 | struct attribute ** attrs; | 35 | struct attribute **attrs; |
37 | }; | 36 | }; |
38 | 37 | ||
39 | 38 | ||
@@ -77,72 +76,41 @@ struct sysfs_ops { | |||
77 | ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t); | 76 | ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t); |
78 | }; | 77 | }; |
79 | 78 | ||
80 | #define SYSFS_TYPE_MASK 0x00ff | ||
81 | #define SYSFS_ROOT 0x0001 | ||
82 | #define SYSFS_DIR 0x0002 | ||
83 | #define SYSFS_KOBJ_ATTR 0x0004 | ||
84 | #define SYSFS_KOBJ_BIN_ATTR 0x0008 | ||
85 | #define SYSFS_KOBJ_LINK 0x0020 | ||
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 | ||
90 | |||
91 | #ifdef CONFIG_SYSFS | 79 | #ifdef CONFIG_SYSFS |
92 | 80 | ||
93 | extern int sysfs_schedule_callback(struct kobject *kobj, | 81 | int sysfs_schedule_callback(struct kobject *kobj, void (*func)(void *), |
94 | void (*func)(void *), void *data, struct module *owner); | 82 | void *data, struct module *owner); |
95 | |||
96 | extern int __must_check | ||
97 | sysfs_create_dir(struct kobject *kobj, struct sysfs_dirent *shadow_parent_sd); | ||
98 | |||
99 | extern void | ||
100 | sysfs_remove_dir(struct kobject *); | ||
101 | |||
102 | extern int __must_check | ||
103 | sysfs_rename_dir(struct kobject *kobj, struct sysfs_dirent *new_parent_sd, | ||
104 | const char *new_name); | ||
105 | |||
106 | extern int __must_check | ||
107 | sysfs_move_dir(struct kobject *, struct kobject *); | ||
108 | |||
109 | extern int __must_check | ||
110 | sysfs_create_file(struct kobject *, const struct attribute *); | ||
111 | 83 | ||
112 | extern int __must_check | 84 | int __must_check sysfs_create_dir(struct kobject *kobj); |
113 | sysfs_update_file(struct kobject *, const struct attribute *); | 85 | void sysfs_remove_dir(struct kobject *kobj); |
86 | int __must_check sysfs_rename_dir(struct kobject *kobj, const char *new_name); | ||
87 | int __must_check sysfs_move_dir(struct kobject *kobj, | ||
88 | struct kobject *new_parent_kobj); | ||
114 | 89 | ||
115 | extern int __must_check | 90 | int __must_check sysfs_create_file(struct kobject *kobj, |
116 | sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode); | 91 | const struct attribute *attr); |
117 | 92 | int __must_check sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, | |
118 | extern void | 93 | mode_t mode); |
119 | sysfs_remove_file(struct kobject *, const struct attribute *); | 94 | void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr); |
120 | |||
121 | extern int __must_check | ||
122 | sysfs_create_link(struct kobject * kobj, struct kobject * target, const char * name); | ||
123 | |||
124 | extern void | ||
125 | sysfs_remove_link(struct kobject *, const char * name); | ||
126 | 95 | ||
127 | int __must_check sysfs_create_bin_file(struct kobject *kobj, | 96 | int __must_check sysfs_create_bin_file(struct kobject *kobj, |
128 | struct bin_attribute *attr); | 97 | struct bin_attribute *attr); |
129 | void sysfs_remove_bin_file(struct kobject *kobj, struct bin_attribute *attr); | 98 | void sysfs_remove_bin_file(struct kobject *kobj, struct bin_attribute *attr); |
130 | 99 | ||
131 | int __must_check sysfs_create_group(struct kobject *, | 100 | int __must_check sysfs_create_link(struct kobject *kobj, struct kobject *target, |
132 | const struct attribute_group *); | 101 | const char *name); |
133 | void sysfs_remove_group(struct kobject *, const struct attribute_group *); | 102 | void sysfs_remove_link(struct kobject *kobj, const char *name); |
103 | |||
104 | int __must_check sysfs_create_group(struct kobject *kobj, | ||
105 | const struct attribute_group *grp); | ||
106 | void sysfs_remove_group(struct kobject *kobj, | ||
107 | const struct attribute_group *grp); | ||
134 | int sysfs_add_file_to_group(struct kobject *kobj, | 108 | int sysfs_add_file_to_group(struct kobject *kobj, |
135 | const struct attribute *attr, const char *group); | 109 | const struct attribute *attr, const char *group); |
136 | void sysfs_remove_file_from_group(struct kobject *kobj, | 110 | void sysfs_remove_file_from_group(struct kobject *kobj, |
137 | const struct attribute *attr, const char *group); | 111 | const struct attribute *attr, const char *group); |
138 | |||
139 | void sysfs_notify(struct kobject * k, char *dir, char *attr); | ||
140 | |||
141 | 112 | ||
142 | extern int sysfs_make_shadowed_dir(struct kobject *kobj, | 113 | void sysfs_notify(struct kobject *kobj, char *dir, char *attr); |
143 | void * (*follow_link)(struct dentry *, struct nameidata *)); | ||
144 | extern struct sysfs_dirent *sysfs_create_shadow_dir(struct kobject *kobj); | ||
145 | extern void sysfs_remove_shadow_dir(struct sysfs_dirent *shadow_sd); | ||
146 | 114 | ||
147 | extern int __must_check sysfs_init(void); | 115 | extern int __must_check sysfs_init(void); |
148 | 116 | ||
@@ -154,75 +122,76 @@ static inline int sysfs_schedule_callback(struct kobject *kobj, | |||
154 | return -ENOSYS; | 122 | return -ENOSYS; |
155 | } | 123 | } |
156 | 124 | ||
157 | static inline int sysfs_create_dir(struct kobject *kobj, | 125 | static inline int sysfs_create_dir(struct kobject *kobj) |
158 | struct sysfs_dirent *shadow_parent_sd) | ||
159 | { | 126 | { |
160 | return 0; | 127 | return 0; |
161 | } | 128 | } |
162 | 129 | ||
163 | static inline void sysfs_remove_dir(struct kobject * k) | 130 | static inline void sysfs_remove_dir(struct kobject *kobj) |
164 | { | 131 | { |
165 | ; | 132 | ; |
166 | } | 133 | } |
167 | 134 | ||
168 | static inline int sysfs_rename_dir(struct kobject *kobj, | 135 | static inline int sysfs_rename_dir(struct kobject *kobj, const char *new_name) |
169 | struct sysfs_dirent *new_parent_sd, | ||
170 | const char *new_name) | ||
171 | { | 136 | { |
172 | return 0; | 137 | return 0; |
173 | } | 138 | } |
174 | 139 | ||
175 | static inline int sysfs_move_dir(struct kobject * k, struct kobject * new_parent) | 140 | static inline int sysfs_move_dir(struct kobject *kobj, |
141 | struct kobject *new_parent_kobj) | ||
176 | { | 142 | { |
177 | return 0; | 143 | return 0; |
178 | } | 144 | } |
179 | 145 | ||
180 | static inline int sysfs_create_file(struct kobject * k, const struct attribute * a) | 146 | static inline int sysfs_create_file(struct kobject *kobj, |
147 | const struct attribute *attr) | ||
181 | { | 148 | { |
182 | return 0; | 149 | return 0; |
183 | } | 150 | } |
184 | 151 | ||
185 | static inline int sysfs_update_file(struct kobject * k, const struct attribute * a) | 152 | static inline int sysfs_chmod_file(struct kobject *kobj, |
186 | { | 153 | struct attribute *attr, mode_t mode) |
187 | return 0; | ||
188 | } | ||
189 | static inline int sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode) | ||
190 | { | 154 | { |
191 | return 0; | 155 | return 0; |
192 | } | 156 | } |
193 | 157 | ||
194 | static inline void sysfs_remove_file(struct kobject * k, const struct attribute * a) | 158 | static inline void sysfs_remove_file(struct kobject *kobj, |
159 | const struct attribute *attr) | ||
195 | { | 160 | { |
196 | ; | 161 | ; |
197 | } | 162 | } |
198 | 163 | ||
199 | static inline int sysfs_create_link(struct kobject * k, struct kobject * t, const char * n) | 164 | static inline int sysfs_create_bin_file(struct kobject *kobj, |
165 | struct bin_attribute *attr) | ||
200 | { | 166 | { |
201 | return 0; | 167 | return 0; |
202 | } | 168 | } |
203 | 169 | ||
204 | static inline void sysfs_remove_link(struct kobject * k, const char * name) | 170 | static inline int sysfs_remove_bin_file(struct kobject *kobj, |
171 | struct bin_attribute *attr) | ||
205 | { | 172 | { |
206 | ; | 173 | return 0; |
207 | } | 174 | } |
208 | 175 | ||
209 | 176 | static inline int sysfs_create_link(struct kobject *kobj, | |
210 | static inline int sysfs_create_bin_file(struct kobject * k, struct bin_attribute * a) | 177 | struct kobject *target, const char *name) |
211 | { | 178 | { |
212 | return 0; | 179 | return 0; |
213 | } | 180 | } |
214 | 181 | ||
215 | static inline int sysfs_remove_bin_file(struct kobject * k, struct bin_attribute * a) | 182 | static inline void sysfs_remove_link(struct kobject *kobj, const char *name) |
216 | { | 183 | { |
217 | return 0; | 184 | ; |
218 | } | 185 | } |
219 | 186 | ||
220 | static inline int sysfs_create_group(struct kobject * k, const struct attribute_group *g) | 187 | static inline int sysfs_create_group(struct kobject *kobj, |
188 | const struct attribute_group *grp) | ||
221 | { | 189 | { |
222 | return 0; | 190 | return 0; |
223 | } | 191 | } |
224 | 192 | ||
225 | static inline void sysfs_remove_group(struct kobject * k, const struct attribute_group * g) | 193 | static inline void sysfs_remove_group(struct kobject *kobj, |
194 | const struct attribute_group *grp) | ||
226 | { | 195 | { |
227 | ; | 196 | ; |
228 | } | 197 | } |
@@ -238,14 +207,8 @@ static inline void sysfs_remove_file_from_group(struct kobject *kobj, | |||
238 | { | 207 | { |
239 | } | 208 | } |
240 | 209 | ||
241 | static inline void sysfs_notify(struct kobject * k, char *dir, char *attr) | 210 | static inline void sysfs_notify(struct kobject *kobj, char *dir, char *attr) |
242 | { | ||
243 | } | ||
244 | |||
245 | static inline int sysfs_make_shadowed_dir(struct kobject *kobj, | ||
246 | void * (*follow_link)(struct dentry *, struct nameidata *)) | ||
247 | { | 211 | { |
248 | return 0; | ||
249 | } | 212 | } |
250 | 213 | ||
251 | static inline int __must_check sysfs_init(void) | 214 | static inline int __must_check sysfs_init(void) |