From patchwork Mon Dec 15 20:02:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Goffredo Baroncelli X-Patchwork-Id: 5497421 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 249B59F1D4 for ; Mon, 15 Dec 2014 20:01:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 49D36209EB for ; Mon, 15 Dec 2014 20:01:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 48F02209E5 for ; Mon, 15 Dec 2014 20:01:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751014AbaLOUBo (ORCPT ); Mon, 15 Dec 2014 15:01:44 -0500 Received: from mail-wg0-f48.google.com ([74.125.82.48]:51195 "EHLO mail-wg0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750722AbaLOUBm (ORCPT ); Mon, 15 Dec 2014 15:01:42 -0500 Received: by mail-wg0-f48.google.com with SMTP id y19so15556841wgg.7 for ; Mon, 15 Dec 2014 12:01:40 -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=maQANy8FNOa6w842V8ab/3x6ZrJRKK67VOsQlU+0Hx8=; b=0qteFtT6TTEbVLaEtfAHkZZYKb+1f6AI13SjBDap4d67G4yCHHOgiezJxptQkEWWor nnkf1Dwui78DM8v3jXD2psXfbR6M7VLWITUsOd/V8KnxsmyZ2qG7JFJV2rAbmQSWk5zx wLAwxNyYN2Dp4Lhl0t48AN7vzL2XHEM/a0nDZXoi1UdlF7Boj1yEH7RZAm4D90LGCcfo H2FC6JPHbLOdS5tN8lt+AJjaidTpHvfcKP41lg38UIUQV9A9G2xyw+Lc2Tm8LSOt84Z7 g1Tpl/Ab+wNXLwHgAeiawE7BlO6ntWoseFA6vGEjoVHIhV9o6LqBNRXPOWbzDqjEZldV vZlw== X-Received: by 10.194.85.137 with SMTP id h9mr45192361wjz.70.1418673700814; Mon, 15 Dec 2014 12:01:40 -0800 (PST) Received: from venice.bhome (ppp-222-126.24-151.libero.it. [151.24.126.222]) by mx.google.com with ESMTPSA id kn5sm14212241wjb.48.2014.12.15.12.01.39 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 15 Dec 2014 12:01:40 -0800 (PST) From: Goffredo Baroncelli X-Google-Original-From: Goffredo Baroncelli To: linux-btrfs@vger.kernel.org Cc: Goffredo Baroncelli Subject: [PATCH 1/7] Add -v -q switches to mkfs.btrfs. Date: Mon, 15 Dec 2014 21:02:54 +0100 Message-Id: <1418673780-22000-2-git-send-email-kreijack@inwind.it> X-Mailer: git-send-email 2.1.3 In-Reply-To: <1418673780-22000-1-git-send-email-kreijack@inwind.it> References: <1418673780-22000-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 Add -v -q switches to mkfs.btrfs, to control the verbosity of mkfs.btrfs. Signed-off-by: Goffredo Baroncelli --- mkfs.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/mkfs.c b/mkfs.c index e10e62d..26f8041 100644 --- a/mkfs.c +++ b/mkfs.c @@ -288,8 +288,10 @@ static void print_usage(void) fprintf(stderr, "\t -r --rootdir the source directory\n"); fprintf(stderr, "\t -K --nodiscard do not perform whole device TRIM\n"); fprintf(stderr, "\t -O --features comma separated list of filesystem features\n"); + fprintf(stderr, "\t -q --quiet enable quiet mode\n"); fprintf(stderr, "\t -U --uuid specify the filesystem UUID\n"); fprintf(stderr, "\t -V --version print the mkfs.btrfs version and exit\n"); + fprintf(stderr, "\t -v --verbose enable verbose mode\n"); fprintf(stderr, "%s\n", BTRFS_BUILD_VERSION); exit(1); } @@ -351,6 +353,8 @@ static struct option long_options[] = { { "version", 0, NULL, 'V' }, { "rootdir", 1, NULL, 'r' }, { "nodiscard", 0, NULL, 'K' }, + { "verbose", 0, NULL, 'v' }, + { "quiet", 0, NULL, 'q' }, { "features", 1, NULL, 'O' }, { "uuid", required_argument, NULL, 'U' }, { NULL, 0, NULL, 0} @@ -998,7 +1002,7 @@ out: * This ignores symlinks with unreadable targets and subdirs that can't * be read. It's a best-effort to give a rough estimate of the size of * a subdir. It doesn't guarantee that prepopulating btrfs from this - * tree won't still run out of space. + * tree won't still run out of space. * * The rounding up to 4096 is questionable. Previous code used du -B 4096. */ @@ -1266,6 +1270,8 @@ int main(int ac, char **av) int discard = 1; int ssd = 0; int force_overwrite = 0; + int verbose = 0; + int quiet = 0; char *source_dir = NULL; int source_dir_set = 0; @@ -1355,6 +1361,12 @@ int main(int ac, char **av) case 'K': discard = 0; break; + case 'v': + verbose = 1; + break; + case 'q': + quiet = 1; + break; default: print_usage(); } @@ -1387,7 +1399,7 @@ int main(int ac, char **av) exit(1); } } - + while (dev_cnt-- > 0) { file = av[optind++]; if (is_block_device(file))