diff options
| author | Eric Paris <eparis@redhat.com> | 2013-11-22 18:57:08 -0500 |
|---|---|---|
| committer | Eric Paris <eparis@redhat.com> | 2013-11-22 18:57:54 -0500 |
| commit | fc582aef7dcc27a7120cf232c1e76c569c7b6eab (patch) | |
| tree | 7d275dd4ceab6067b91e9a25a5f6338b425fbccd /include/linux/sysfs.h | |
| parent | 9175c9d2aed528800175ef81c90569d00d23f9be (diff) | |
| parent | 5e01dc7b26d9f24f39abace5da98ccbd6a5ceb52 (diff) | |
Merge tag 'v3.12'
Linux 3.12
Conflicts:
fs/exec.c
Diffstat (limited to 'include/linux/sysfs.h')
| -rw-r--r-- | include/linux/sysfs.h | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index 9e8a9b555ad6..11baec7c9b26 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h | |||
| @@ -51,9 +51,9 @@ do { \ | |||
| 51 | static struct lock_class_key __key; \ | 51 | static struct lock_class_key __key; \ |
| 52 | \ | 52 | \ |
| 53 | (attr)->key = &__key; \ | 53 | (attr)->key = &__key; \ |
| 54 | } while(0) | 54 | } while (0) |
| 55 | #else | 55 | #else |
| 56 | #define sysfs_attr_init(attr) do {} while(0) | 56 | #define sysfs_attr_init(attr) do {} while (0) |
| 57 | #endif | 57 | #endif |
| 58 | 58 | ||
| 59 | struct attribute_group { | 59 | struct attribute_group { |
| @@ -69,7 +69,7 @@ struct attribute_group { | |||
| 69 | * for examples.. | 69 | * for examples.. |
| 70 | */ | 70 | */ |
| 71 | 71 | ||
| 72 | #define __ATTR(_name,_mode,_show,_store) { \ | 72 | #define __ATTR(_name, _mode, _show, _store) { \ |
| 73 | .attr = {.name = __stringify(_name), .mode = _mode }, \ | 73 | .attr = {.name = __stringify(_name), .mode = _mode }, \ |
| 74 | .show = _show, \ | 74 | .show = _show, \ |
| 75 | .store = _store, \ | 75 | .store = _store, \ |
| @@ -80,6 +80,11 @@ struct attribute_group { | |||
| 80 | .show = _name##_show, \ | 80 | .show = _name##_show, \ |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | #define __ATTR_WO(_name) { \ | ||
| 84 | .attr = { .name = __stringify(_name), .mode = S_IWUSR }, \ | ||
| 85 | .store = _name##_store, \ | ||
| 86 | } | ||
| 87 | |||
| 83 | #define __ATTR_RW(_name) __ATTR(_name, (S_IWUSR | S_IRUGO), \ | 88 | #define __ATTR_RW(_name) __ATTR(_name, (S_IWUSR | S_IRUGO), \ |
| 84 | _name##_show, _name##_store) | 89 | _name##_show, _name##_store) |
| 85 | 90 | ||
| @@ -108,8 +113,6 @@ static const struct attribute_group _name##_group = { \ | |||
| 108 | }; \ | 113 | }; \ |
| 109 | __ATTRIBUTE_GROUPS(_name) | 114 | __ATTRIBUTE_GROUPS(_name) |
| 110 | 115 | ||
| 111 | #define attr_name(_attr) (_attr).attr.name | ||
| 112 | |||
| 113 | struct file; | 116 | struct file; |
| 114 | struct vm_area_struct; | 117 | struct vm_area_struct; |
| 115 | 118 | ||
| @@ -119,7 +122,7 @@ struct bin_attribute { | |||
| 119 | void *private; | 122 | void *private; |
| 120 | ssize_t (*read)(struct file *, struct kobject *, struct bin_attribute *, | 123 | ssize_t (*read)(struct file *, struct kobject *, struct bin_attribute *, |
| 121 | char *, loff_t, size_t); | 124 | char *, loff_t, size_t); |
| 122 | ssize_t (*write)(struct file *,struct kobject *, struct bin_attribute *, | 125 | ssize_t (*write)(struct file *, struct kobject *, struct bin_attribute *, |
| 123 | char *, loff_t, size_t); | 126 | char *, loff_t, size_t); |
| 124 | int (*mmap)(struct file *, struct kobject *, struct bin_attribute *attr, | 127 | int (*mmap)(struct file *, struct kobject *, struct bin_attribute *attr, |
| 125 | struct vm_area_struct *vma); | 128 | struct vm_area_struct *vma); |
| @@ -153,7 +156,7 @@ struct bin_attribute { | |||
| 153 | 156 | ||
| 154 | #define __BIN_ATTR_RW(_name, _size) __BIN_ATTR(_name, \ | 157 | #define __BIN_ATTR_RW(_name, _size) __BIN_ATTR(_name, \ |
| 155 | (S_IWUSR | S_IRUGO), _name##_read, \ | 158 | (S_IWUSR | S_IRUGO), _name##_read, \ |
| 156 | _name##_write) | 159 | _name##_write, _size) |
| 157 | 160 | ||
| 158 | #define __BIN_ATTR_NULL __ATTR_NULL | 161 | #define __BIN_ATTR_NULL __ATTR_NULL |
| 159 | 162 | ||
| @@ -168,8 +171,8 @@ struct bin_attribute bin_attr_##_name = __BIN_ATTR_RO(_name, _size) | |||
| 168 | struct bin_attribute bin_attr_##_name = __BIN_ATTR_RW(_name, _size) | 171 | struct bin_attribute bin_attr_##_name = __BIN_ATTR_RW(_name, _size) |
| 169 | 172 | ||
| 170 | struct sysfs_ops { | 173 | struct sysfs_ops { |
| 171 | ssize_t (*show)(struct kobject *, struct attribute *,char *); | 174 | ssize_t (*show)(struct kobject *, struct attribute *, char *); |
| 172 | ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t); | 175 | ssize_t (*store)(struct kobject *, struct attribute *, const char *, size_t); |
| 173 | const void *(*namespace)(struct kobject *, const struct attribute *); | 176 | const void *(*namespace)(struct kobject *, const struct attribute *); |
| 174 | }; | 177 | }; |
| 175 | 178 | ||
| @@ -215,10 +218,14 @@ void sysfs_delete_link(struct kobject *dir, struct kobject *targ, | |||
| 215 | 218 | ||
| 216 | int __must_check sysfs_create_group(struct kobject *kobj, | 219 | int __must_check sysfs_create_group(struct kobject *kobj, |
| 217 | const struct attribute_group *grp); | 220 | const struct attribute_group *grp); |
| 221 | int __must_check sysfs_create_groups(struct kobject *kobj, | ||
| 222 | const struct attribute_group **groups); | ||
| 218 | int sysfs_update_group(struct kobject *kobj, | 223 | int sysfs_update_group(struct kobject *kobj, |
| 219 | const struct attribute_group *grp); | 224 | const struct attribute_group *grp); |
| 220 | void sysfs_remove_group(struct kobject *kobj, | 225 | void sysfs_remove_group(struct kobject *kobj, |
| 221 | const struct attribute_group *grp); | 226 | const struct attribute_group *grp); |
| 227 | void sysfs_remove_groups(struct kobject *kobj, | ||
| 228 | const struct attribute_group **groups); | ||
| 222 | int sysfs_add_file_to_group(struct kobject *kobj, | 229 | int sysfs_add_file_to_group(struct kobject *kobj, |
| 223 | const struct attribute *attr, const char *group); | 230 | const struct attribute *attr, const char *group); |
| 224 | void sysfs_remove_file_from_group(struct kobject *kobj, | 231 | void sysfs_remove_file_from_group(struct kobject *kobj, |
| @@ -343,6 +350,12 @@ static inline int sysfs_create_group(struct kobject *kobj, | |||
| 343 | return 0; | 350 | return 0; |
| 344 | } | 351 | } |
| 345 | 352 | ||
| 353 | static inline int sysfs_create_groups(struct kobject *kobj, | ||
| 354 | const struct attribute_group **groups) | ||
| 355 | { | ||
| 356 | return 0; | ||
| 357 | } | ||
| 358 | |||
| 346 | static inline int sysfs_update_group(struct kobject *kobj, | 359 | static inline int sysfs_update_group(struct kobject *kobj, |
| 347 | const struct attribute_group *grp) | 360 | const struct attribute_group *grp) |
| 348 | { | 361 | { |
| @@ -354,6 +367,11 @@ static inline void sysfs_remove_group(struct kobject *kobj, | |||
| 354 | { | 367 | { |
| 355 | } | 368 | } |
| 356 | 369 | ||
| 370 | static inline void sysfs_remove_groups(struct kobject *kobj, | ||
| 371 | const struct attribute_group **groups) | ||
| 372 | { | ||
| 373 | } | ||
| 374 | |||
| 357 | static inline int sysfs_add_file_to_group(struct kobject *kobj, | 375 | static inline int sysfs_add_file_to_group(struct kobject *kobj, |
| 358 | const struct attribute *attr, const char *group) | 376 | const struct attribute *attr, const char *group) |
| 359 | { | 377 | { |
