btrfs-progs: print fs features filtered by a mask
authorDavid Sterba <dsterba@suse.cz>
Mon, 23 Mar 2015 18:49:51 +0000 (19:49 +0100)
committerDavid Sterba <dsterba@suse.cz>
Tue, 7 Apr 2015 17:25:16 +0000 (19:25 +0200)
mkfs and convert will not support the same features, -O will print only
the list according to the given mask.

Signed-off-by: David Sterba <dsterba@suse.cz>
mkfs.c
utils.c
utils.h

diff --git a/mkfs.c b/mkfs.c
index 59486bd..8eab0e5 100644 (file)
--- a/mkfs.c
+++ b/mkfs.c
@@ -1208,7 +1208,7 @@ int main(int ac, char **av)
                                }
                                free(orig);
                                if (features & BTRFS_FEATURE_LIST_ALL) {
-                                       btrfs_list_all_fs_features();
+                                       btrfs_list_all_fs_features(0);
                                        exit(0);
                                }
                                break;
diff --git a/utils.c b/utils.c
index ca8e49a..b175b01 100644 (file)
--- a/utils.c
+++ b/utils.c
@@ -606,14 +606,16 @@ void btrfs_process_fs_features(u64 flags)
        }
 }
 
-void btrfs_list_all_fs_features(void)
+void btrfs_list_all_fs_features(u64 mask_disallowed)
 {
        int i;
 
-       fprintf(stderr, "Filesystem features available at mkfs time:\n");
+       fprintf(stderr, "Filesystem features available:\n");
        for (i = 0; i < ARRAY_SIZE(mkfs_features) - 1; i++) {
                char *is_default = "";
 
+               if (mkfs_features[i].flag & mask_disallowed)
+                       continue;
                if (mkfs_features[i].flag & BTRFS_MKFS_DEFAULT_FEATURES)
                        is_default = ", default";
                fprintf(stderr, "%-20s- %s (0x%llx%s)\n",
diff --git a/utils.h b/utils.h
index 4903976..b2748c0 100644 (file)
--- a/utils.h
+++ b/utils.h
@@ -85,7 +85,7 @@ void set_argv0(char **argv);
 void units_set_mode(unsigned *units, unsigned mode);
 void units_set_base(unsigned *units, unsigned base);
 
-void btrfs_list_all_fs_features(void);
+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);