All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maximilian Mehnert <maximilian.mehnert@gmx.de>
To: linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: [PATCH] Add -v option to btrfsctl to control verbosity: Be quiet unless requested.
Date: Sat, 22 Jan 2011 12:59:22 +0100	[thread overview]
Message-ID: <4D3AC69A.2080302@gmx.de> (raw)

---
  btrfsctl.c |   10 ++++++++--
  1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/btrfsctl.c b/btrfsctl.c
index 92bdf39..156ed62 100644
--- a/btrfsctl.c
+++ b/btrfsctl.c
@@ -106,6 +106,7 @@ int main(int ac, char **av)
  	char *pos;
  	char *fullpath;
  	u64 objectid = 0;
+	int verbose = 0;
   	if (ac == 2 && strcmp(av[1], "-a") == 0) {
  		fprintf(stderr, "Scanning for Btrfs filesystems\n");
@@ -217,6 +218,9 @@ int main(int ac, char **av)
  				}
  			}
  		}
+		else if (strcmp(av[i], "-v") == 0) {
+			verbose = 1;
+		}
  	}
  	if (command == 0) {
  		fprintf(stderr, "no valid commands given\n");
@@ -254,11 +258,13 @@ int main(int ac, char **av)
  		exit(1);
  	}
  	if (ret == 0) {
-		printf("operation complete\n");
+		if (verbose) printf("operation complete\n");
  	} else {
  		printf("ioctl failed with error %d\n", ret);
  	}
-	printf("%s\n", BTRFS_BUILD_VERSION);
+	if (verbose) {
+		printf("%s\n", BTRFS_BUILD_VERSION);
+	}
  	if (ret)
  		exit(1);
  -- 1.7.2.3



             reply	other threads:[~2011-01-22 11:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-22 11:59 Maximilian Mehnert [this message]
2011-01-22 12:11 ` [PATCH] Add -v option to btrfsctl to control verbosity: Be quiet unless requested Felix Blanke
2011-01-22 12:26   ` Maximilian Mehnert
2011-01-22 12:46     ` Felix Blanke

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=4D3AC69A.2080302@gmx.de \
    --to=maximilian.mehnert@gmx.de \
    --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.