From patchwork Wed Dec 17 20:14:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Goffredo Baroncelli X-Patchwork-Id: 5509111 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id BE9FA9F1D4 for ; Wed, 17 Dec 2014 20:13:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D9514209DC for ; Wed, 17 Dec 2014 20:13:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0C3C7208BC for ; Wed, 17 Dec 2014 20:13:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751251AbaLQUM7 (ORCPT ); Wed, 17 Dec 2014 15:12:59 -0500 Received: from mail-wi0-f181.google.com ([209.85.212.181]:52004 "EHLO mail-wi0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750953AbaLQUM6 (ORCPT ); Wed, 17 Dec 2014 15:12:58 -0500 Received: by mail-wi0-f181.google.com with SMTP id r20so46300wiv.8 for ; Wed, 17 Dec 2014 12:12:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=bk8w4H0k8weqoAs6tb2Qh6qBZ2MevvZa3Qcfre/P0Kg=; b=ZvAJEg06WaQHeSXGCggN3pWgDZ6WNHO7hF7NsItH2Vm+LHMQZWfKBMcb7Xk7MeJoZo MjSybIARjWhsjAGnk3OmQK1qW43RRmmG+jryAGWbijJqwIGbItKX6XHkwruPwNN6w5+K tFgjI37OJuP89rO+tuYNPDZFZzWdQwnsVSImeRHwMAMbiiIzUB9H9GRzV4Yo01Jjepnx LDieXe0unYicF4vUI4DGX1IjjUBz5aTm6cOQb12ySveWuw9UgnijjZWvrTZIB83a1zkM 7tvGnPAO1BMAqsJHi8XqqflumvvgY+UwsCKckD1+fLLdXgl6xdA9p4VILEYO3F5nrdTl kzLA== X-Received: by 10.180.72.178 with SMTP id e18mr17390698wiv.23.1418847177151; Wed, 17 Dec 2014 12:12:57 -0800 (PST) Received: from venice.bhome (ppp-133-85.24-151.libero.it. [151.24.85.133]) by mx.google.com with ESMTPSA id pu3sm6360357wjc.14.2014.12.17.12.12.56 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 17 Dec 2014 12:12:56 -0800 (PST) From: Goffredo Baroncelli X-Google-Original-From: Goffredo Baroncelli To: linux-btrfs@vger.kernel.org Cc: Goffredo Baroncelli Subject: [PATCH 2/8] Move group_profile_str() in utils.c Date: Wed, 17 Dec 2014 21:14:06 +0100 Message-Id: <1418847252-14184-3-git-send-email-kreijack@inwind.it> X-Mailer: git-send-email 2.1.3 In-Reply-To: <1418847252-14184-1-git-send-email-kreijack@inwind.it> References: <1418847252-14184-1-git-send-email-kreijack@inwind.it> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Satoru Takeuchi --- 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