summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.cz>2015-06-04 19:08:15 +0200
committerDavid Sterba <dsterba@suse.cz>2015-06-04 19:10:55 +0200
commit11ddfeb2611011ee682d3d0482eeef3485dc136a (patch)
tree8ccebd0dcc19a319cf3cdb502a149df7b3180289
parent65cc6883c0594f0132d400a5beac4c4fc1fd7bce (diff)
btrfs-progs: add function to stringify filesystem features
Signed-off-by: David Sterba <dsterba@suse.cz>
-rw-r--r--utils.c15
-rw-r--r--utils.h1
2 files changed, 16 insertions, 0 deletions
diff --git a/utils.c b/utils.c
index eede72f4..4554f0d1 100644
--- a/utils.c
+++ b/utils.c
@@ -593,6 +593,21 @@ static int parse_one_fs_feature(const char *name, u64 *flags)
return !found;
}
+void btrfs_parse_features_to_string(char *buf, u64 flags)
+{
+ int i;
+
+ buf[0] = 0;
+
+ for (i = 0; i < ARRAY_SIZE(mkfs_features); i++) {
+ if (flags & mkfs_features[i].flag) {
+ if (*buf)
+ strcat(buf, ", ");
+ strcat(buf, mkfs_features[i].name);
+ }
+ }
+}
+
void btrfs_process_fs_features(u64 flags)
{
int i;
diff --git a/utils.h b/utils.h
index a0057de7..871cbd8c 100644
--- a/utils.h
+++ b/utils.h
@@ -88,6 +88,7 @@ void units_set_base(unsigned *units, unsigned base);
void btrfs_list_all_fs_features(u64 mask_disallowed);
char* btrfs_parse_fs_features(char *namelist, u64 *flags);
void btrfs_process_fs_features(u64 flags);
+void btrfs_parse_features_to_string(char *buf, u64 flags);
int make_btrfs(int fd, const char *device, const char *label,
char *fs_uuid, u64 blocks[6], u64 num_bytes, u32 nodesize,