Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 093adbce authored by David Sterba's avatar David Sterba
Browse files

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: default avatarDavid Sterba <dsterba@suse.cz>
parent 9d644a62
Loading
Loading
Loading
Loading
+17 −5
Original line number Original line Diff line number Diff line
@@ -61,11 +61,23 @@ static struct btrfs_feature_attr btrfs_attr_##_name = { \
	BTRFS_FEAT_ATTR(name, FEAT_INCOMPAT, BTRFS_FEATURE_INCOMPAT, feature)
	BTRFS_FEAT_ATTR(name, FEAT_INCOMPAT, BTRFS_FEATURE_INCOMPAT, feature)


/* convert from attribute */
/* convert from attribute */
#define to_btrfs_feature_attr(a) \
static inline struct btrfs_feature_attr *
			container_of(a, struct btrfs_feature_attr, kobj_attr)
to_btrfs_feature_attr(struct kobj_attribute *a)
#define attr_to_btrfs_attr(a) container_of(a, struct kobj_attribute, attr)
{
#define attr_to_btrfs_feature_attr(a) \
	return container_of(a, struct btrfs_feature_attr, kobj_attr);
			to_btrfs_feature_attr(attr_to_btrfs_attr(a))
}

static inline struct kobj_attribute *attr_to_btrfs_attr(struct attribute *attr)
{
	return container_of(attr, struct kobj_attribute, attr);
}

static inline struct btrfs_feature_attr *
attr_to_btrfs_feature_attr(struct attribute *attr)
{
	return to_btrfs_feature_attr(attr_to_btrfs_attr(attr));
}

char *btrfs_printable_features(enum btrfs_feature_set set, u64 flags);
char *btrfs_printable_features(enum btrfs_feature_set set, u64 flags);
extern const char * const btrfs_feature_set_names[3];
extern const char * const btrfs_feature_set_names[3];
extern struct kobj_type space_info_ktype;
extern struct kobj_type space_info_ktype;