From 61117794b5c536b200c07d3de33899989c03e745 Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Sat, 24 Jan 2015 14:10:51 +0100 Subject: [PATCH] Print full stats only if verbose is specified --- Makefile.am | 2 +- cmdline/device.c | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Makefile.am b/Makefile.am index e64e8ec7..ec2a5c0a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -205,7 +205,7 @@ endif $(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(CONF) up $(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(CONF) down $(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(CONF) test-devices - $(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(CONF) smart + $(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(CONF) smart -v if HAVE_SYMLINK $(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(PAR1) pool endif diff --git a/cmdline/device.c b/cmdline/device.c index 8faa81a8..66386551 100644 --- a/cmdline/device.c +++ b/cmdline/device.c @@ -307,7 +307,7 @@ static void printp(double v, size_t pad) printl(buf, pad); } -static void state_smart(unsigned n, tommy_list* low) +static void state_smart(int verbose, unsigned n, tommy_list* low) { tommy_node* i; unsigned j; @@ -434,9 +434,13 @@ static void state_smart(unsigned n, tommy_list* low) printf("\n"); printf("Probability that one disk is going to fail in the next year is: %.0f%%\n", p_at_least_one_failure * 100); - printf("\n"); + + /* prints extra stats only in verbose mode */ + if (!verbose) + return; /* |<##################################################################72>|####80>| */ + printf("\n"); printf("Probability of data loss in the next year for different parity and\n"); printf("combined scrub and repair time:\n"); printf("\n"); @@ -529,7 +533,7 @@ void state_device(struct snapraid_state* state, int operation) #endif if (operation == DEVICE_SMART) - state_smart(state->level + tommy_list_count(&state->disklist), &low); + state_smart(state->opt.verbose, state->level + tommy_list_count(&state->disklist), &low); } tommy_list_foreach(&high, free);