diff mbox

[2/8] Move group_profile_str() in utils.c

Message ID 1418847252-14184-3-git-send-email-kreijack@inwind.it (mailing list archive)
State New, archived
Headers show

Commit Message

Goffredo Baroncelli Dec. 17, 2014, 8:14 p.m. UTC
This is a preparation patch.
Move the group_profile_str() function from cmds-filesystem.c to utils.c
to be re-used from other modules (in this case from mkfs.c)

Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
---
 cmds-filesystem.c | 22 ----------------------
 utils.c           | 22 ++++++++++++++++++++++
 utils.h           |  2 ++
 3 files changed, 24 insertions(+), 22 deletions(-)

Comments

Satoru Takeuchi Dec. 25, 2014, 1:20 a.m. UTC | #1
On 2014/12/18 5:14, Goffredo Baroncelli wrote:
> This is a preparation patch.
> Move the group_profile_str() function from cmds-filesystem.c to utils.c
> to be re-used from other modules (in this case from mkfs.c)
> 
> Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>

Reviewed-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>

> ---
>   cmds-filesystem.c | 22 ----------------------
>   utils.c           | 22 ++++++++++++++++++++++
>   utils.h           |  2 ++
>   3 files changed, 24 insertions(+), 22 deletions(-)
> 
> diff --git a/cmds-filesystem.c b/cmds-filesystem.c
> index 253f105..d1afeba 100644
> --- a/cmds-filesystem.c
> +++ b/cmds-filesystem.c
> @@ -157,28 +157,6 @@ static char *group_type_str(u64 flag)
>   	}
>   }
>   
> -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;
> diff --git a/utils.c b/utils.c
> index 2a92416..19049bb 100644
> --- a/utils.c
> +++ b/utils.c
> @@ -2450,3 +2450,25 @@ int find_next_key(struct btrfs_path *path, struct btrfs_key *key)
>   	}
>   	return 1;
>   }
> +
> +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";
> +	}
> +}
> diff --git a/utils.h b/utils.h
> index 289e86b..bb8a449 100644
> --- a/utils.h
> +++ b/utils.h
> @@ -161,4 +161,6 @@ static inline u64 btrfs_min_dev_size(u32 leafsize)
>   
>   int find_next_key(struct btrfs_path *path, struct btrfs_key *key);
>   
> +char *group_profile_str(u64 flag);
> +
>   #endif
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/cmds-filesystem.c b/cmds-filesystem.c
index 253f105..d1afeba 100644
--- a/cmds-filesystem.c
+++ b/cmds-filesystem.c
@@ -157,28 +157,6 @@  static char *group_type_str(u64 flag)
 	}
 }
 
-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;
diff --git a/utils.c b/utils.c
index 2a92416..19049bb 100644
--- a/utils.c
+++ b/utils.c
@@ -2450,3 +2450,25 @@  int find_next_key(struct btrfs_path *path, struct btrfs_key *key)
 	}
 	return 1;
 }
+
+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";
+	}
+}
diff --git a/utils.h b/utils.h
index 289e86b..bb8a449 100644
--- a/utils.h
+++ b/utils.h
@@ -161,4 +161,6 @@  static inline u64 btrfs_min_dev_size(u32 leafsize)
 
 int find_next_key(struct btrfs_path *path, struct btrfs_key *key);
 
+char *group_profile_str(u64 flag);
+
 #endif