Examine: split 'verbose' out from 'brief'.

The value of 'verbose' is sometimes mixed into 'brief', particularly
for Examine.
This is messy and confusing.  So keep them separate.
'brief' still gets assumed when 'scan' is set, unless we are very
verbose.

Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
NeilBrown 2012-07-09 17:19:48 +10:00
parent 171dccc813
commit 265460abab
3 changed files with 12 additions and 9 deletions

View File

@ -30,7 +30,8 @@
#endif
#include "md_u.h"
#include "md_p.h"
int Examine(struct mddev_dev *devlist, int brief, int export, int scan,
int Examine(struct mddev_dev *devlist, int brief, int verbose,
int export, int scan,
int SparcAdjust, struct supertype *forcest,
char *homehost)
{
@ -161,10 +162,10 @@ int Examine(struct mddev_dev *devlist, int brief, int export, int scan,
char *d;
int newline = 0;
ap->st->ss->brief_examine_super(ap->st, brief > 1);
ap->st->ss->brief_examine_super(ap->st, verbose > 0);
if (ap->spares)
newline += printf(" spares=%d", ap->spares);
if (brief > 1) {
if (verbose > 0) {
newline += printf(" devices");
for (d=dl_next(ap->devs); d!= ap->devs; d=dl_next(d)) {
printf("%c%s", sep, d);
@ -174,11 +175,11 @@ int Examine(struct mddev_dev *devlist, int brief, int export, int scan,
if (ap->st->ss->brief_examine_subarrays) {
if (newline)
printf("\n");
ap->st->ss->brief_examine_subarrays(ap->st, brief > 1);
ap->st->ss->brief_examine_subarrays(ap->st, verbose);
}
ap->st->ss->free_super(ap->st);
/* FIXME free ap */
if (ap->spares || brief > 1)
if (ap->spares || verbose > 0)
printf("\n");
}
}

View File

@ -1221,6 +1221,10 @@ int main(int argc, char *argv[])
ident.autof = c.autof;
if (c.scan && c.verbose < 2)
/* --scan implied --brief unless -vv */
c.brief = 1;
rv = 0;
switch(mode) {
case MANAGE:
@ -1350,9 +1354,7 @@ int main(int argc, char *argv[])
pr_err("No devices listed in %s\n", configfile?configfile:DefaultConfFile);
exit(1);
}
if (c.brief && c.verbose > 0)
c.brief = 2;
rv = Examine(devlist, c.scan?(c.verbose>1?0:c.verbose):c.brief,
rv = Examine(devlist, c.brief, c.verbose,
c.export, c.scan,
c.SparcAdjust, ss, c.homehost);
} else if (devmode == DetailPlatform) {

View File

@ -1116,7 +1116,7 @@ extern int Create(struct supertype *st, char *mddev,
extern int Detail(char *dev, int brief, int export, int test, char *homehost, char *prefer);
extern int Detail_Platform(struct superswitch *ss, int scan, int verbose);
extern int Query(char *dev);
extern int Examine(struct mddev_dev *devlist, int brief, int export, int scan,
extern int Examine(struct mddev_dev *devlist, int brief, int verbose, int export, int scan,
int SparcAdjust, struct supertype *forcest, char *homehost);
extern int Monitor(struct mddev_dev *devlist,
char *mailaddr, char *alert_cmd,