diff options
author | David Sterba <dsterba@suse.com> | 2019-08-01 13:07:55 -0400 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2019-09-09 08:59:07 -0400 |
commit | f10152bcc962cae6e78ae4eecfa22270f481c0ff (patch) | |
tree | 31596741f22f7f5683f717ae214104fb308becd2 | |
parent | 27992d014554c37aae1cf788fbf6c457b3eceb76 (diff) |
btrfs: sysfs: replace direct access to feature set names with a helper
In order to unexport the feature type array, add a helper for the
enum-to-string conversion.
Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r-- | fs/btrfs/ioctl.c | 2 | ||||
-rw-r--r-- | fs/btrfs/sysfs.c | 7 | ||||
-rw-r--r-- | fs/btrfs/sysfs.h | 2 |
3 files changed, 8 insertions, 3 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index b431f7877e88..4eabd419aaca 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -5259,7 +5259,7 @@ static int check_feature_bits(struct btrfs_fs_info *fs_info, | |||
5259 | u64 change_mask, u64 flags, u64 supported_flags, | 5259 | u64 change_mask, u64 flags, u64 supported_flags, |
5260 | u64 safe_set, u64 safe_clear) | 5260 | u64 safe_set, u64 safe_clear) |
5261 | { | 5261 | { |
5262 | const char *type = btrfs_feature_set_names[set]; | 5262 | const char *type = btrfs_feature_set_name(set); |
5263 | char *names; | 5263 | char *names; |
5264 | u64 disallowed, unsupported; | 5264 | u64 disallowed, unsupported; |
5265 | u64 set_mask = flags & change_mask; | 5265 | u64 set_mask = flags & change_mask; |
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c index bc82ab66ba8f..c7c29e5b38a0 100644 --- a/fs/btrfs/sysfs.c +++ b/fs/btrfs/sysfs.c | |||
@@ -675,12 +675,17 @@ void btrfs_sysfs_remove_mounted(struct btrfs_fs_info *fs_info) | |||
675 | btrfs_sysfs_rm_device_link(fs_info->fs_devices, NULL); | 675 | btrfs_sysfs_rm_device_link(fs_info->fs_devices, NULL); |
676 | } | 676 | } |
677 | 677 | ||
678 | const char * const btrfs_feature_set_names[FEAT_MAX] = { | 678 | static const char * const btrfs_feature_set_names[FEAT_MAX] = { |
679 | [FEAT_COMPAT] = "compat", | 679 | [FEAT_COMPAT] = "compat", |
680 | [FEAT_COMPAT_RO] = "compat_ro", | 680 | [FEAT_COMPAT_RO] = "compat_ro", |
681 | [FEAT_INCOMPAT] = "incompat", | 681 | [FEAT_INCOMPAT] = "incompat", |
682 | }; | 682 | }; |
683 | 683 | ||
684 | const char * const btrfs_feature_set_name(enum btrfs_feature_set set) | ||
685 | { | ||
686 | return btrfs_feature_set_names[set]; | ||
687 | } | ||
688 | |||
684 | char *btrfs_printable_features(enum btrfs_feature_set set, u64 flags) | 689 | char *btrfs_printable_features(enum btrfs_feature_set set, u64 flags) |
685 | { | 690 | { |
686 | size_t bufsize = 4096; /* safe max, 64 names * 64 bytes */ | 691 | size_t bufsize = 4096; /* safe max, 64 names * 64 bytes */ |
diff --git a/fs/btrfs/sysfs.h b/fs/btrfs/sysfs.h index 0c06f2adfae8..d8a6ab1bfde7 100644 --- a/fs/btrfs/sysfs.h +++ b/fs/btrfs/sysfs.h | |||
@@ -78,7 +78,7 @@ attr_to_btrfs_feature_attr(struct attribute *attr) | |||
78 | } | 78 | } |
79 | 79 | ||
80 | char *btrfs_printable_features(enum btrfs_feature_set set, u64 flags); | 80 | char *btrfs_printable_features(enum btrfs_feature_set set, u64 flags); |
81 | extern const char * const btrfs_feature_set_names[FEAT_MAX]; | 81 | const char * const btrfs_feature_set_name(enum btrfs_feature_set set); |
82 | int btrfs_sysfs_add_device_link(struct btrfs_fs_devices *fs_devices, | 82 | int btrfs_sysfs_add_device_link(struct btrfs_fs_devices *fs_devices, |
83 | struct btrfs_device *one_device); | 83 | struct btrfs_device *one_device); |
84 | int btrfs_sysfs_rm_device_link(struct btrfs_fs_devices *fs_devices, | 84 | int btrfs_sysfs_rm_device_link(struct btrfs_fs_devices *fs_devices, |