summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/sysfs.h
diff options
context:
space:
mode:
authorJeff Mahoney <jeffm@suse.com>2013-11-01 13:06:58 -0400
committerChris Mason <clm@fb.com>2014-01-28 13:19:25 -0800
commit5ac1d209f11271fbfad0fa31ba56ec64c142d9ea (patch)
tree15f67ec6c85caa87b3358df2876f51becdf04b49 /fs/btrfs/sysfs.h
parent079b72bca30dbc74c86c7c7825b8c34eb86ce3ee (diff)
downloadlinux-5ac1d209f11271fbfad0fa31ba56ec64c142d9ea.tar.gz
linux-5ac1d209f11271fbfad0fa31ba56ec64c142d9ea.tar.bz2
linux-5ac1d209f11271fbfad0fa31ba56ec64c142d9ea.zip
btrfs: publish per-super attributes in sysfs
This patch adds per-super attributes to sysfs. It doesn't publish any attributes yet, but does the proper lifetime handling as well as the basic infrastructure to add new attributes. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <clm@fb.com>
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_ */