summaryrefslogtreecommitdiff
path: root/fs/btrfs/sysfs.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/sysfs.h')
-rw-r--r--fs/btrfs/sysfs.h10
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 {
.store = _store, \
}
+#define BTRFS_ATTR_RW(_name, _mode, _show, _store) \
+static struct kobj_attribute btrfs_attr_##_name = \
+ __INIT_KOBJ_ATTR(_name, _mode, _show, _store)
+#define BTRFS_ATTR(_name, _mode, _show) \
+ BTRFS_ATTR_RW(_name, _mode, _show, NULL)
+#define BTRFS_ATTR_PTR(_name) (&btrfs_attr_##_name.attr)
+
struct btrfs_feature_attr {
struct kobj_attribute kobj_attr;
enum btrfs_feature_set feature_set;
@@ -40,4 +47,7 @@ static struct btrfs_feature_attr btrfs_attr_##_name = { \
/* convert from attribute */
#define to_btrfs_feature_attr(a) \
container_of(a, struct btrfs_feature_attr, kobj_attr)
+#define attr_to_btrfs_attr(a) container_of(a, struct kobj_attribute, attr)
+#define attr_to_btrfs_feature_attr(a) \
+ to_btrfs_feature_attr(attr_to_btrfs_attr(a))
#endif /* _BTRFS_SYSFS_H_ */