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.h88
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)
173struct sysfs_ops { 173struct 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
179struct sysfs_dirent; 178struct sysfs_dirent;
@@ -183,19 +182,23 @@ struct sysfs_dirent;
183int sysfs_schedule_callback(struct kobject *kobj, void (*func)(void *), 182int sysfs_schedule_callback(struct kobject *kobj, void (*func)(void *),
184 void *data, struct module *owner); 183 void *data, struct module *owner);
185 184
186int __must_check sysfs_create_dir(struct kobject *kobj); 185int __must_check sysfs_create_dir_ns(struct kobject *kobj, const void *ns);
187void sysfs_remove_dir(struct kobject *kobj); 186void sysfs_remove_dir(struct kobject *kobj);
188int __must_check sysfs_rename_dir(struct kobject *kobj, const char *new_name); 187int __must_check sysfs_rename_dir_ns(struct kobject *kobj, const char *new_name,
189int __must_check sysfs_move_dir(struct kobject *kobj, 188 const void *new_ns);
190 struct kobject *new_parent_kobj); 189int __must_check sysfs_move_dir_ns(struct kobject *kobj,
191 190 struct kobject *new_parent_kobj,
192int __must_check sysfs_create_file(struct kobject *kobj, 191 const void *new_ns);
193 const struct attribute *attr); 192
193int __must_check sysfs_create_file_ns(struct kobject *kobj,
194 const struct attribute *attr,
195 const void *ns);
194int __must_check sysfs_create_files(struct kobject *kobj, 196int __must_check sysfs_create_files(struct kobject *kobj,
195 const struct attribute **attr); 197 const struct attribute **attr);
196int __must_check sysfs_chmod_file(struct kobject *kobj, 198int __must_check sysfs_chmod_file(struct kobject *kobj,
197 const struct attribute *attr, umode_t mode); 199 const struct attribute *attr, umode_t mode);
198void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr); 200void sysfs_remove_file_ns(struct kobject *kobj, const struct attribute *attr,
201 const void *ns);
199void sysfs_remove_files(struct kobject *kobj, const struct attribute **attr); 202void sysfs_remove_files(struct kobject *kobj, const struct attribute **attr);
200 203
201int __must_check sysfs_create_bin_file(struct kobject *kobj, 204int __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);
211void sysfs_remove_link(struct kobject *kobj, const char *name); 214void sysfs_remove_link(struct kobject *kobj, const char *name);
212 215
213int sysfs_rename_link(struct kobject *kobj, struct kobject *target, 216int 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
216void sysfs_delete_link(struct kobject *dir, struct kobject *targ, 220void 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
242void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr); 246void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr);
243void sysfs_notify_dirent(struct sysfs_dirent *sd); 247void sysfs_notify_dirent(struct sysfs_dirent *sd);
244struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd, 248struct 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);
247struct sysfs_dirent *sysfs_get(struct sysfs_dirent *sd); 251struct sysfs_dirent *sysfs_get(struct sysfs_dirent *sd);
248void sysfs_put(struct sysfs_dirent *sd); 252void 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
260static inline int sysfs_create_dir(struct kobject *kobj) 264static 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
269static inline int sysfs_rename_dir(struct kobject *kobj, const char *new_name) 273static 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
274static inline int sysfs_move_dir(struct kobject *kobj, 279static 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
280static inline int sysfs_create_file(struct kobject *kobj, 286static 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
298static inline void sysfs_remove_file(struct kobject *kobj, 305static 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
336static inline int sysfs_rename_link(struct kobject *k, struct kobject *t, 344static 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,
413static inline void sysfs_notify_dirent(struct sysfs_dirent *sd) 422static inline void sysfs_notify_dirent(struct sysfs_dirent *sd)
414{ 423{
415} 424}
416static inline 425static inline struct sysfs_dirent *
417struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd, 426sysfs_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
446static 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
452static 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
458static 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
464static inline struct sysfs_dirent *
465sysfs_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_ */