From patchwork Tue Nov 25 15:57:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Goffredo Baroncelli X-Patchwork-Id: 5380361 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 855F0C11AC for ; Tue, 25 Nov 2014 15:57:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C6E6620123 for ; Tue, 25 Nov 2014 15:57:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C9D71201BB for ; Tue, 25 Nov 2014 15:57:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751096AbaKYP5i (ORCPT ); Tue, 25 Nov 2014 10:57:38 -0500 Received: from mail-wi0-f175.google.com ([209.85.212.175]:56206 "EHLO mail-wi0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751257AbaKYP5h (ORCPT ); Tue, 25 Nov 2014 10:57:37 -0500 Received: by mail-wi0-f175.google.com with SMTP id l15so9596384wiw.14 for ; Tue, 25 Nov 2014 07:57:36 -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=LPs6zkCekSPzGnHuneuvgL08TSCy5x6b/6IhwPzkAjU=; b=bCZBxjr5pCvrBdfYwT4TW2Aj8ZM3luFpGg+eJo5ej/BxhjJAaR6ejjhW4T7PjRJyol tQFK9Uvako/cMNA1Yy80nlS9Pms1mqOMGB+YiGKkUPryM/v68ETIQV+B7G6jdMLj6XHI /PfRqdILhsrKUy+Gtw2uUY9Xi3fIdy9G4gb7ZiJNcpS7QK0OQ9eyzy3q6wycc5eas0SN agyK8+iZgfDQ7KVuO+NOU2/E2OLM6tFvP8GHn0ZHhWqns2cICrJX8ikzEQV35v/CB3GQ jUTun4UoTYqyPmfqK6uPpvXIOM7nOZ9ZsjOsSVW44x3TpAHjnA5HKVMoSAGyUa/hpV97 uNFA== X-Received: by 10.180.91.201 with SMTP id cg9mr33626365wib.63.1416931056218; Tue, 25 Nov 2014 07:57:36 -0800 (PST) Received: from venice.bhome (ppp-131-78.24-151.libero.it. [151.24.78.131]) by mx.google.com with ESMTPSA id n8sm2457641wjx.0.2014.11.25.07.57.35 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Nov 2014 07:57:35 -0800 (PST) From: Goffredo Baroncelli X-Google-Original-From: Goffredo Baroncelli To: linux-btrfs@vger.kernel.org Cc: David Sterba , Goffredo Baroncelli Subject: [PATCH 1/4] Move group_type_str() and group_profile_str(). Date: Tue, 25 Nov 2014 16:57:22 +0100 Message-Id: <1416931045-24259-2-git-send-email-kreijack@inwind.it> X-Mailer: git-send-email 2.1.3 In-Reply-To: <1416931045-24259-1-git-send-email-kreijack@inwind.it> References: <1416931045-24259-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 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 --- cmds-filesystem.c | 43 ------------------------------------------- utils.c | 43 +++++++++++++++++++++++++++++++++++++++++++ utils.h | 3 +++ 3 files changed, 46 insertions(+), 43 deletions(-) diff --git a/cmds-filesystem.c b/cmds-filesystem.c index cd6b3c6..269e758 100644 --- a/cmds-filesystem.c +++ b/cmds-filesystem.c @@ -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; diff --git a/utils.c b/utils.c index 2a92416..c9b9e0e 100644 --- a/utils.c +++ b/utils.c @@ -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"; + } +} diff --git a/utils.h b/utils.h index 289e86b..21e3e83 100644 --- a/utils.h +++ b/utils.h @@ -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