aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.cz>2015-02-24 13:40:41 -0500
committerDavid Sterba <dsterba@suse.cz>2015-03-03 11:24:02 -0500
commit093adbcedf123f366e5eef0c4ccd815920f725f3 (patch)
treee1b1a6d5d52f76038af853d2c4b40f6cf7821467 /fs
parent9d644a623ec48e28ca3887e616456aba63fd0558 (diff)
btrfs: switch helper macros to static inlines in sysfs.h
The conversion macros use nested container_of that leads to a warning fs/btrfs/sysfs.c: In function 'btrfs_feature_visible': fs/btrfs/sysfs.c:183:8: warning: declaration of '__mptr' shadows a previous local fs/btrfs/sysfs.c:183:8: warning: shadowed declaration is here Use of functions will add proper type checking. Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/sysfs.h22
1 files changed, 17 insertions, 5 deletions
diff --git a/fs/btrfs/sysfs.h b/fs/btrfs/sysfs.h
index f7dd298b3cf6..3a4bbed723fd 100644
--- a/fs/btrfs/sysfs.h
+++ b/fs/btrfs/sysfs.h
@@ -61,11 +61,23 @@ static struct btrfs_feature_attr btrfs_attr_##_name = { \
61 BTRFS_FEAT_ATTR(name, FEAT_INCOMPAT, BTRFS_FEATURE_INCOMPAT, feature) 61 BTRFS_FEAT_ATTR(name, FEAT_INCOMPAT, BTRFS_FEATURE_INCOMPAT, feature)
62 62
63/* convert from attribute */ 63/* convert from attribute */
64#define to_btrfs_feature_attr(a) \ 64static inline struct btrfs_feature_attr *
65 container_of(a, struct btrfs_feature_attr, kobj_attr) 65to_btrfs_feature_attr(struct kobj_attribute *a)
66#define attr_to_btrfs_attr(a) container_of(a, struct kobj_attribute, attr) 66{
67#define attr_to_btrfs_feature_attr(a) \ 67 return container_of(a, struct btrfs_feature_attr, kobj_attr);
68 to_btrfs_feature_attr(attr_to_btrfs_attr(a)) 68}
69
70static inline struct kobj_attribute *attr_to_btrfs_attr(struct attribute *attr)
71{
72 return container_of(attr, struct kobj_attribute, attr);
73}
74
75static inline struct btrfs_feature_attr *
76attr_to_btrfs_feature_attr(struct attribute *attr)
77{
78 return to_btrfs_feature_attr(attr_to_btrfs_attr(attr));
79}
80
69char *btrfs_printable_features(enum btrfs_feature_set set, u64 flags); 81char *btrfs_printable_features(enum btrfs_feature_set set, u64 flags);
70extern const char * const btrfs_feature_set_names[3]; 82extern const char * const btrfs_feature_set_names[3];
71extern struct kobj_type space_info_ktype; 83extern struct kobj_type space_info_ktype;