From patchwork Mon Dec 15 20:02:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Goffredo Baroncelli X-Patchwork-Id: 5497441 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 2C8F9BEEA8 for ; Mon, 15 Dec 2014 20:02:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 63FAD209E5 for ; Mon, 15 Dec 2014 20:02:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 842EC209D3 for ; Mon, 15 Dec 2014 20:02:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751305AbaLOUCd (ORCPT ); Mon, 15 Dec 2014 15:02:33 -0500 Received: from mail-wi0-f182.google.com ([209.85.212.182]:33983 "EHLO mail-wi0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750862AbaLOUCc (ORCPT ); Mon, 15 Dec 2014 15:02:32 -0500 Received: by mail-wi0-f182.google.com with SMTP id h11so10287488wiw.3 for ; Mon, 15 Dec 2014 12:02:31 -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=XYiMrPb1tN9wgRZhCVoSvm8QTnKj68HYJZ5Qkgqd9ss=; b=PIzIxbJh1khVHkwmJz0lL4jomB7d7cCHEHke/EjNDHW9A+3dR5oljIdlwLn2TU0QQp Kbhxejc40QtDPYKhvdbUP62Q+Xv1rxdUK6xvDHG7q1deEEQtTa4hk8y2lAOBPoMESNcM ebm77aDt1ElAVXETsvRTYvSmwrSvJUVoSq1G/ftsyZxcR+HFOfdJrmP2YFNtsRsaBjbQ FUa/GNRMId7eKmUJ9wkWyrkUv6y2Q40NVo+Km5h1pqgwUGlXvy1Vs732Y0zkoMNIuvgR TjIN+UN/2sf4ldRI9zDA8RtasgYptMnKy6pY4wB6HCzg4wdiTbdnn/IE4VaBRWYeaxUE UKRg== X-Received: by 10.180.198.164 with SMTP id jd4mr33731293wic.42.1418673751336; Mon, 15 Dec 2014 12:02:31 -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.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 15 Dec 2014 12:02:30 -0800 (PST) From: Goffredo Baroncelli X-Google-Original-From: Goffredo Baroncelli To: linux-btrfs@vger.kernel.org Cc: Goffredo Baroncelli Subject: [PATCH 3/7] Add verbose option to btrfs_add_to_fsid() Date: Mon, 15 Dec 2014 21:02:56 +0100 Message-Id: <1418673780-22000-4-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 verbose option to btrfs_add_to_fsid() in order to avoid to print the information to console when not needed. The same information is print in the summary of the mkfs.btrfs command. Signed-off-by: Goffredo Baroncelli --- utils.c | 7 ++++--- utils.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/utils.c b/utils.c index 19049bb..dcb4f74 100644 --- a/utils.c +++ b/utils.c @@ -610,7 +610,7 @@ static int zero_dev_clamped(int fd, off_t start, ssize_t len, u64 dev_size) int btrfs_add_to_fsid(struct btrfs_trans_handle *trans, struct btrfs_root *root, int fd, char *path, u64 block_count, u32 io_width, u32 io_align, - u32 sectorsize) + u32 sectorsize, int verbose) { struct btrfs_super_block *disk_super; struct btrfs_super_block *super = root->fs_info->super_copy; @@ -659,8 +659,9 @@ int btrfs_add_to_fsid(struct btrfs_trans_handle *trans, memcpy(disk_super, super, sizeof(*disk_super)); - printf("adding device %s id %llu\n", path, - (unsigned long long)device->devid); + if (verbose) + printf("adding device %s id %llu\n", path, + (unsigned long long)device->devid); btrfs_set_super_bytenr(disk_super, BTRFS_SUPER_INFO_OFFSET); btrfs_set_stack_device_id(dev_item, device->devid); diff --git a/utils.h b/utils.h index bb8a449..9218199 100644 --- a/utils.h +++ b/utils.h @@ -79,7 +79,7 @@ int btrfs_prepare_device(int fd, char *file, int zero_end, u64 *block_count_ret, int btrfs_add_to_fsid(struct btrfs_trans_handle *trans, struct btrfs_root *root, int fd, char *path, u64 block_count, u32 io_width, u32 io_align, - u32 sectorsize); + u32 sectorsize, int verbose); int btrfs_scan_for_fsid(int run_ioctls); int btrfs_register_one_device(const char *fname); int btrfs_register_all_devices(void);