Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP1:GA
btrfsprogs.356
0139-btrfs-progs-move-group-type-and-profile-pr...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0139-btrfs-progs-move-group-type-and-profile-pretty-print.patch of Package btrfsprogs.356
From 3d1ed6d152107b03c26935a8486af47e22685150 Mon Sep 17 00:00:00 2001 From: David Sterba <dsterba@suse.cz> Date: Thu, 23 Oct 2014 19:05:31 +0200 Subject: [PATCH 139/303] btrfs-progs: move group type and profile pretty printers to utils Move and add the btrfs_ prefix. Signed-off-by: David Sterba <dsterba@suse.cz> --- cmds-filesystem.c | 47 ++--------------------------------------------- utils.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ utils.h | 2 ++ 3 files changed, 48 insertions(+), 45 deletions(-) Index: btrfs-progs-v3.16.2/cmds-filesystem.c =================================================================== --- btrfs-progs-v3.16.2.orig/cmds-filesystem.c +++ btrfs-progs-v3.16.2/cmds-filesystem.c @@ -127,49 +127,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; @@ -225,8 +182,8 @@ static void print_df(struct btrfs_ioctl_ for (i = 0; i < sargs->total_spaces; i++, sp++) { printf("%s, %s: total=%s, used=%s\n", - group_type_str(sp->flags), - group_profile_str(sp->flags), + btrfs_group_type_str(sp->flags), + btrfs_group_profile_str(sp->flags), pretty_size_mode(sp->total_bytes, unit_mode), pretty_size_mode(sp->used_bytes, unit_mode)); } Index: btrfs-progs-v3.16.2/utils.c =================================================================== --- btrfs-progs-v3.16.2.orig/utils.c +++ btrfs-progs-v3.16.2/utils.c @@ -2491,3 +2491,47 @@ void units_set_base(unsigned *units, uns *units = base | mode; } + +char* btrfs_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* btrfs_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"; + } +} + Index: btrfs-progs-v3.16.2/utils.h =================================================================== --- btrfs-progs-v3.16.2.orig/utils.h +++ btrfs-progs-v3.16.2/utils.h @@ -161,5 +161,7 @@ static inline u64 btrfs_min_dev_size(u32 return 2 * (BTRFS_MKFS_SYSTEM_GROUP_SIZE + btrfs_min_global_blk_rsv_size(leafsize)); } +char* btrfs_group_type_str(u64 flag); +char* btrfs_group_profile_str(u64 flag); #endif
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor