diff options
Diffstat (limited to 'fs/btrfs/sysfs.h')
-rw-r--r-- | fs/btrfs/sysfs.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/btrfs/sysfs.h b/fs/btrfs/sysfs.h index 863e031ed1c1..d7c61bdf04ba 100644 --- a/fs/btrfs/sysfs.h +++ b/fs/btrfs/sysfs.h | |||
@@ -15,6 +15,13 @@ enum btrfs_feature_set { | |||
15 | .store = _store, \ | 15 | .store = _store, \ |
16 | } | 16 | } |
17 | 17 | ||
18 | #define BTRFS_ATTR_RW(_name, _mode, _show, _store) \ | ||
19 | static struct kobj_attribute btrfs_attr_##_name = \ | ||
20 | __INIT_KOBJ_ATTR(_name, _mode, _show, _store) | ||
21 | #define BTRFS_ATTR(_name, _mode, _show) \ | ||
22 | BTRFS_ATTR_RW(_name, _mode, _show, NULL) | ||
23 | #define BTRFS_ATTR_PTR(_name) (&btrfs_attr_##_name.attr) | ||
24 | |||
18 | struct btrfs_feature_attr { | 25 | struct btrfs_feature_attr { |
19 | struct kobj_attribute kobj_attr; | 26 | struct kobj_attribute kobj_attr; |
20 | enum btrfs_feature_set feature_set; | 27 | enum btrfs_feature_set feature_set; |
@@ -40,4 +47,7 @@ static struct btrfs_feature_attr btrfs_attr_##_name = { \ | |||
40 | /* convert from attribute */ | 47 | /* convert from attribute */ |
41 | #define to_btrfs_feature_attr(a) \ | 48 | #define to_btrfs_feature_attr(a) \ |
42 | container_of(a, struct btrfs_feature_attr, kobj_attr) | 49 | container_of(a, struct btrfs_feature_attr, kobj_attr) |
50 | #define attr_to_btrfs_attr(a) container_of(a, struct kobj_attribute, attr) | ||
51 | #define attr_to_btrfs_feature_attr(a) \ | ||
52 | to_btrfs_feature_attr(attr_to_btrfs_attr(a)) | ||
43 | #endif /* _BTRFS_SYSFS_H_ */ | 53 | #endif /* _BTRFS_SYSFS_H_ */ |