All of lore.kernel.org
 help / color / mirror / Atom feed
From: Goffredo Baroncelli <kreijack@gmail.com>
To: linux-btrfs@vger.kernel.org
Cc: Goffredo Baroncelli <kreijack@inwind.it>
Subject: [PATCH 3/8] Add verbose option to btrfs_add_to_fsid()
Date: Wed, 17 Dec 2014 21:14:07 +0100	[thread overview]
Message-ID: <1418847252-14184-4-git-send-email-kreijack@inwind.it> (raw)
In-Reply-To: <1418847252-14184-1-git-send-email-kreijack@inwind.it>

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 <kreijack@inwind.it>
---
 mkfs.c  | 3 ++-
 utils.c | 7 ++++---
 utils.h | 2 +-
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/mkfs.c b/mkfs.c
index a5f19cc..042d12e 100644
--- a/mkfs.c
+++ b/mkfs.c
@@ -1638,7 +1638,8 @@ int main(int ac, char **av)
 		mixed = old_mixed;
 
 		ret = btrfs_add_to_fsid(trans, root, fd, file, dev_block_count,
-					sectorsize, sectorsize, sectorsize);
+					sectorsize, sectorsize, sectorsize,
+					verbose);
 		BUG_ON(ret);
 		btrfs_register_one_device(file);
 	}
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);
-- 
2.1.3


  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 ` [PATCH 2/8] Move group_profile_str() in utils.c Goffredo Baroncelli
2014-12-25  1:20   ` Satoru Takeuchi
2014-12-17 20:14 ` Goffredo Baroncelli [this message]
2014-12-25  1:28   ` [PATCH 3/8] Add verbose option to btrfs_add_to_fsid() 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-4-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.