@@ -136,49 +136,6 @@ static const char * const cmd_df_usage[] = {
NULL
};
-static char *group_type_str(u64 flag)
-{
- u64 mask = BTRFS_BLOCK_GROUP_TYPE_MASK |
- BTRFS_SPACE_INFO_GLOBAL_RSV;
-
- switch (flag & mask) {
- case BTRFS_BLOCK_GROUP_DATA:
- return "Data";
- case BTRFS_BLOCK_GROUP_SYSTEM:
- return "System";
- case BTRFS_BLOCK_GROUP_METADATA:
- return "Metadata";
- case BTRFS_BLOCK_GROUP_DATA|BTRFS_BLOCK_GROUP_METADATA:
- return "Data+Metadata";
- case BTRFS_SPACE_INFO_GLOBAL_RSV:
- return "GlobalReserve";
- default:
- return "unknown";
- }
-}
-
-static char *group_profile_str(u64 flag)
-{
- switch (flag & BTRFS_BLOCK_GROUP_PROFILE_MASK) {
- case 0:
- return "single";
- case BTRFS_BLOCK_GROUP_RAID0:
- return "RAID0";
- case BTRFS_BLOCK_GROUP_RAID1:
- return "RAID1";
- case BTRFS_BLOCK_GROUP_RAID5:
- return "RAID5";
- case BTRFS_BLOCK_GROUP_RAID6:
- return "RAID6";
- case BTRFS_BLOCK_GROUP_DUP:
- return "DUP";
- case BTRFS_BLOCK_GROUP_RAID10:
- return "RAID10";
- default:
- return "unknown";
- }
-}
-
static int get_df(int fd, struct btrfs_ioctl_space_args **sargs_ret)
{
u64 count = 0;
@@ -2450,3 +2450,46 @@ int find_next_key(struct btrfs_path *path, struct btrfs_key *key)
}
return 1;
}
+
+char *group_type_str(u64 flag)
+{
+ u64 mask = BTRFS_BLOCK_GROUP_TYPE_MASK |
+ BTRFS_SPACE_INFO_GLOBAL_RSV;
+
+ switch (flag & mask) {
+ case BTRFS_BLOCK_GROUP_DATA:
+ return "Data";
+ case BTRFS_BLOCK_GROUP_SYSTEM:
+ return "System";
+ case BTRFS_BLOCK_GROUP_METADATA:
+ return "Metadata";
+ case BTRFS_BLOCK_GROUP_DATA|BTRFS_BLOCK_GROUP_METADATA:
+ return "Data+Metadata";
+ case BTRFS_SPACE_INFO_GLOBAL_RSV:
+ return "GlobalReserve";
+ default:
+ return "unknown";
+ }
+}
+
+char *group_profile_str(u64 flag)
+{
+ switch (flag & BTRFS_BLOCK_GROUP_PROFILE_MASK) {
+ case 0:
+ return "single";
+ case BTRFS_BLOCK_GROUP_RAID0:
+ return "RAID0";
+ case BTRFS_BLOCK_GROUP_RAID1:
+ return "RAID1";
+ case BTRFS_BLOCK_GROUP_RAID5:
+ return "RAID5";
+ case BTRFS_BLOCK_GROUP_RAID6:
+ return "RAID6";
+ case BTRFS_BLOCK_GROUP_DUP:
+ return "DUP";
+ case BTRFS_BLOCK_GROUP_RAID10:
+ return "RAID10";
+ default:
+ return "unknown";
+ }
+}
@@ -161,4 +161,7 @@ static inline u64 btrfs_min_dev_size(u32 leafsize)
int find_next_key(struct btrfs_path *path, struct btrfs_key *key);
+char *group_type_str(u64 flag);
+char *group_profile_str(u64 flag);
+
#endif
Move group_type_str() and group_profile_str() functions to the util.c file, because these are now used also by the command 'btrfs chunk list'. Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it> --- cmds-filesystem.c | 43 ------------------------------------------- utils.c | 43 +++++++++++++++++++++++++++++++++++++++++++ utils.h | 3 +++ 3 files changed, 46 insertions(+), 43 deletions(-)