From: Goffredo Baroncelli <kreijack@gmail.com>
To: linux-btrfs@vger.kernel.org
Cc: Goffredo Baroncelli <kreijack@inwind.it>
Subject: [PATCH 2/8] Move group_profile_str() in utils.c
Date: Wed, 17 Dec 2014 21:14:06 +0100 [thread overview]
Message-ID: <1418847252-14184-3-git-send-email-kreijack@inwind.it> (raw)
In-Reply-To: <1418847252-14184-1-git-send-email-kreijack@inwind.it>
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(-)
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
--
2.1.3
next prev parent reply other threads:[~2014-12-17 20:12 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-17 20:14 [PATCH V2][BTRFS-PROGS] Improve output of mkfs.btrfs command Goffredo Baroncelli
2014-12-17 20:14 ` [PATCH 1/8] Add -v -q switches to mkfs.btrfs Goffredo Baroncelli
2014-12-25 1:19 ` Satoru Takeuchi
2014-12-17 20:14 ` Goffredo Baroncelli [this message]
2014-12-25 1:20 ` [PATCH 2/8] Move group_profile_str() in utils.c Satoru Takeuchi
2014-12-17 20:14 ` [PATCH 3/8] Add verbose option to btrfs_add_to_fsid() Goffredo Baroncelli
2014-12-25 1:28 ` Satoru Takeuchi
2014-12-17 20:14 ` [PATCH 4/8] Add strdup in btrfs_add_to_fsid() to track the device path Goffredo Baroncelli
2014-12-25 1:29 ` Satoru Takeuchi
2014-12-17 20:14 ` [PATCH 5/8] Return the fsid from make_btrfs() Goffredo Baroncelli
2014-12-25 2:44 ` Satoru Takeuchi
2014-12-25 9:22 ` Goffredo Baroncelli
2014-12-17 20:14 ` [PATCH 6/8] Track the size of the chunk created Goffredo Baroncelli
2014-12-17 20:14 ` [PATCH 7/8] Print the summary Goffredo Baroncelli
2014-12-17 20:14 ` [PATCH 8/8] Add -v and -q switches in the mkfs.btrfs man page Goffredo Baroncelli
2014-12-17 22:38 ` [PATCH V2][BTRFS-PROGS] Improve output of mkfs.btrfs command Martin Steigerwald
2014-12-18 2:28 ` Anand Jain
2015-03-23 23:46 ` David Sterba
2015-03-25 19:07 ` Goffredo Baroncelli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1418847252-14184-3-git-send-email-kreijack@inwind.it \
--to=kreijack@gmail.com \
--cc=kreijack@inwind.it \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).