[PATCH] Add -v option to btrfsctl to control verbosity: Be quiet unless requested.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 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


--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux