diff options
Diffstat (limited to 'include/linux/sysfs.h')
-rw-r--r-- | include/linux/sysfs.h | 88 |
1 files changed, 60 insertions, 28 deletions
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index 11baec7c9b26..6695040a0317 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h | |||
@@ -173,7 +173,6 @@ struct bin_attribute bin_attr_##_name = __BIN_ATTR_RW(_name, _size) | |||
173 | struct sysfs_ops { | 173 | struct sysfs_ops { |
174 | ssize_t (*show)(struct kobject *, struct attribute *, char *); | 174 | ssize_t (*show)(struct kobject *, struct attribute *, char *); |
175 | ssize_t (*store)(struct kobject *, struct attribute *, const char *, size_t); | 175 | ssize_t (*store)(struct kobject *, struct attribute *, const char *, size_t); |
176 | const void *(*namespace)(struct kobject *, const struct attribute *); | ||
177 | }; | 176 | }; |
178 | 177 | ||
179 | struct sysfs_dirent; | 178 | struct sysfs_dirent; |
@@ -183,19 +182,23 @@ struct sysfs_dirent; | |||
183 | int sysfs_schedule_callback(struct kobject *kobj, void (*func)(void *), | 182 | int sysfs_schedule_callback(struct kobject *kobj, void (*func)(void *), |
184 | void *data, struct module *owner); | 183 | void *data, struct module *owner); |
185 | 184 | ||
186 | int __must_check sysfs_create_dir(struct kobject *kobj); | 185 | int __must_check sysfs_create_dir_ns(struct kobject *kobj, const void *ns); |
187 | void sysfs_remove_dir(struct kobject *kobj); | 186 | void sysfs_remove_dir(struct kobject *kobj); |
188 | int __must_check sysfs_rename_dir(struct kobject *kobj, const char *new_name); | 187 | int __must_check sysfs_rename_dir_ns(struct kobject *kobj, const char *new_name, |
189 | int __must_check sysfs_move_dir(struct kobject *kobj, | 188 | const void *new_ns); |
190 | struct kobject *new_parent_kobj); | 189 | int __must_check sysfs_move_dir_ns(struct kobject *kobj, |
191 | 190 | struct kobject *new_parent_kobj, | |
192 | int __must_check sysfs_create_file(struct kobject *kobj, | 191 | const void *new_ns); |
193 | const struct attribute *attr); | 192 | |
193 | int __must_check sysfs_create_file_ns(struct kobject *kobj, | ||
194 | const struct attribute *attr, | ||
195 | const void *ns); | ||
194 | int __must_check sysfs_create_files(struct kobject *kobj, | 196 | int __must_check sysfs_create_files(struct kobject *kobj, |
195 | const struct attribute **attr); | 197 | const struct attribute **attr); |
196 | int __must_check sysfs_chmod_file(struct kobject *kobj, | 198 | int __must_check sysfs_chmod_file(struct kobject *kobj, |
197 | const struct attribute *attr, umode_t mode); | 199 | const struct attribute *attr, umode_t mode); |
198 | void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr); | 200 | void sysfs_remove_file_ns(struct kobject *kobj, const struct attribute *attr, |
201 | const void *ns); | ||
199 | void sysfs_remove_files(struct kobject *kobj, const struct attribute **attr); | 202 | void sysfs_remove_files(struct kobject *kobj, const struct attribute **attr); |
200 | 203 | ||
201 | int __must_check sysfs_create_bin_file(struct kobject *kobj, | 204 | int __must_check sysfs_create_bin_file(struct kobject *kobj, |
@@ -210,8 +213,9 @@ int __must_check sysfs_create_link_nowarn(struct kobject *kobj, | |||
210 | const char *name); | 213 | const char *name); |
211 | void sysfs_remove_link(struct kobject *kobj, const char *name); | 214 | void sysfs_remove_link(struct kobject *kobj, const char *name); |
212 | 215 | ||
213 | int sysfs_rename_link(struct kobject *kobj, struct kobject *target, | 216 | int sysfs_rename_link_ns(struct kobject *kobj, struct kobject *target, |
214 | const char *old_name, const char *new_name); | 217 | const char *old_name, const char *new_name, |
218 | const void *new_ns); | ||
215 | 219 | ||
216 | void sysfs_delete_link(struct kobject *dir, struct kobject *targ, | 220 | void sysfs_delete_link(struct kobject *dir, struct kobject *targ, |
217 | const char *name); | 221 | const char *name); |
@@ -241,9 +245,9 @@ void sysfs_remove_link_from_group(struct kobject *kobj, const char *group_name, | |||
241 | 245 | ||
242 | void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr); | 246 | void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr); |
243 | void sysfs_notify_dirent(struct sysfs_dirent *sd); | 247 | void sysfs_notify_dirent(struct sysfs_dirent *sd); |
244 | struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd, | 248 | struct sysfs_dirent *sysfs_get_dirent_ns(struct sysfs_dirent *parent_sd, |
245 | const void *ns, | 249 | const unsigned char *name, |
246 | const unsigned char *name); | 250 | const void *ns); |
247 | struct sysfs_dirent *sysfs_get(struct sysfs_dirent *sd); | 251 | struct sysfs_dirent *sysfs_get(struct sysfs_dirent *sd); |
248 | void sysfs_put(struct sysfs_dirent *sd); | 252 | void sysfs_put(struct sysfs_dirent *sd); |
249 | 253 | ||
@@ -257,7 +261,7 @@ static inline int sysfs_schedule_callback(struct kobject *kobj, | |||
257 | return -ENOSYS; | 261 | return -ENOSYS; |
258 | } | 262 | } |
259 | 263 | ||
260 | static inline int sysfs_create_dir(struct kobject *kobj) | 264 | static inline int sysfs_create_dir_ns(struct kobject *kobj, const void *ns) |
261 | { | 265 | { |
262 | return 0; | 266 | return 0; |
263 | } | 267 | } |
@@ -266,19 +270,22 @@ static inline void sysfs_remove_dir(struct kobject *kobj) | |||
266 | { | 270 | { |
267 | } | 271 | } |
268 | 272 | ||
269 | static inline int sysfs_rename_dir(struct kobject *kobj, const char *new_name) | 273 | static inline int sysfs_rename_dir_ns(struct kobject *kobj, |
274 | const char *new_name, const void *new_ns) | ||
270 | { | 275 | { |
271 | return 0; | 276 | return 0; |
272 | } | 277 | } |
273 | 278 | ||
274 | static inline int sysfs_move_dir(struct kobject *kobj, | 279 | static inline int sysfs_move_dir_ns(struct kobject *kobj, |
275 | struct kobject *new_parent_kobj) | 280 | struct kobject *new_parent_kobj, |
281 | const void *new_ns) | ||
276 | { | 282 | { |
277 | return 0; | 283 | return 0; |
278 | } | 284 | } |
279 | 285 | ||
280 | static inline int sysfs_create_file(struct kobject *kobj, | 286 | static inline int sysfs_create_file_ns(struct kobject *kobj, |
281 | const struct attribute *attr) | 287 | const struct attribute *attr, |
288 | const void *ns) | ||
282 | { | 289 | { |
283 | return 0; | 290 | return 0; |
284 | } | 291 | } |
@@ -295,8 +302,9 @@ static inline int sysfs_chmod_file(struct kobject *kobj, | |||
295 | return 0; | 302 | return 0; |
296 | } | 303 | } |
297 | 304 | ||
298 | static inline void sysfs_remove_file(struct kobject *kobj, | 305 | static inline void sysfs_remove_file_ns(struct kobject *kobj, |
299 | const struct attribute *attr) | 306 | const struct attribute *attr, |
307 | const void *ns) | ||
300 | { | 308 | { |
301 | } | 309 | } |
302 | 310 | ||
@@ -333,8 +341,9 @@ static inline void sysfs_remove_link(struct kobject *kobj, const char *name) | |||
333 | { | 341 | { |
334 | } | 342 | } |
335 | 343 | ||
336 | static inline int sysfs_rename_link(struct kobject *k, struct kobject *t, | 344 | static inline int sysfs_rename_link_ns(struct kobject *k, struct kobject *t, |
337 | const char *old_name, const char *new_name) | 345 | const char *old_name, |
346 | const char *new_name, const void *ns) | ||
338 | { | 347 | { |
339 | return 0; | 348 | return 0; |
340 | } | 349 | } |
@@ -413,10 +422,9 @@ static inline void sysfs_notify(struct kobject *kobj, const char *dir, | |||
413 | static inline void sysfs_notify_dirent(struct sysfs_dirent *sd) | 422 | static inline void sysfs_notify_dirent(struct sysfs_dirent *sd) |
414 | { | 423 | { |
415 | } | 424 | } |
416 | static inline | 425 | static inline struct sysfs_dirent * |
417 | struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd, | 426 | sysfs_get_dirent_ns(struct sysfs_dirent *parent_sd, const unsigned char *name, |
418 | const void *ns, | 427 | const void *ns) |
419 | const unsigned char *name) | ||
420 | { | 428 | { |
421 | return NULL; | 429 | return NULL; |
422 | } | 430 | } |
@@ -435,4 +443,28 @@ static inline int __must_check sysfs_init(void) | |||
435 | 443 | ||
436 | #endif /* CONFIG_SYSFS */ | 444 | #endif /* CONFIG_SYSFS */ |
437 | 445 | ||
446 | static inline int __must_check sysfs_create_file(struct kobject *kobj, | ||
447 | const struct attribute *attr) | ||
448 | { | ||
449 | return sysfs_create_file_ns(kobj, attr, NULL); | ||
450 | } | ||
451 | |||
452 | static inline void sysfs_remove_file(struct kobject *kobj, | ||
453 | const struct attribute *attr) | ||
454 | { | ||
455 | return sysfs_remove_file_ns(kobj, attr, NULL); | ||
456 | } | ||
457 | |||
458 | static inline int sysfs_rename_link(struct kobject *kobj, struct kobject *target, | ||
459 | const char *old_name, const char *new_name) | ||
460 | { | ||
461 | return sysfs_rename_link_ns(kobj, target, old_name, new_name, NULL); | ||
462 | } | ||
463 | |||
464 | static inline struct sysfs_dirent * | ||
465 | sysfs_get_dirent(struct sysfs_dirent *parent_sd, const unsigned char *name) | ||
466 | { | ||
467 | return sysfs_get_dirent_ns(parent_sd, name, NULL); | ||
468 | } | ||
469 | |||
438 | #endif /* _SYSFS_H_ */ | 470 | #endif /* _SYSFS_H_ */ |