Convert 'quiet' to 'not verbose' in various places.

If we change some functions to accept 'verbose', where <0 means to be
quiet, in place of 'quiet', then we will be able to merge
'quiet' and 'verbose' together for simplicity.

Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
NeilBrown 2012-07-09 17:18:09 +10:00
parent 9e33d55609
commit ba728be72f
10 changed files with 113 additions and 111 deletions

View File

@ -616,11 +616,11 @@ int Detail_Platform(struct superswitch *ss, int scan, int verbose)
if (ss && ss->detail_platform)
err = ss->detail_platform(verbose, 0);
else if (ss) {
if (verbose)
if (verbose > 0)
pr_err("%s metadata is platform independent\n",
ss->name ? : "[no name]");
} else if (!scan) {
if (verbose)
if (verbose > 0)
pr_err("specify a metadata type or --scan\n");
}
@ -632,11 +632,11 @@ int Detail_Platform(struct superswitch *ss, int scan, int verbose)
if (meta == ss)
continue;
if (verbose)
if (verbose > 0)
pr_err("checking metadata %s\n",
meta->name ? : "[no name]");
if (!meta->detail_platform) {
if (verbose)
if (verbose > 0)
pr_err("%s metadata is platform independent\n",
meta->name ? : "[no name]");
} else

40
Grow.c
View File

@ -1418,7 +1418,7 @@ static int set_array_size(struct supertype *st, struct mdinfo *sra,
static int reshape_array(char *container, int fd, char *devname,
struct supertype *st, struct mdinfo *info,
int force, struct mddev_dev *devlist,
char *backup_file, int quiet, int forked,
char *backup_file, int verbose, int forked,
int restart, int freeze_reshape);
static int reshape_container(char *container, char *devname,
int mdfd,
@ -1426,9 +1426,9 @@ static int reshape_container(char *container, char *devname,
struct mdinfo *info,
int force,
char *backup_file,
int quiet, int restart, int freeze_reshape);
int verbose, int restart, int freeze_reshape);
int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
int Grow_reshape(char *devname, int fd, int verbose, char *backup_file,
long long size,
int level, char *layout_str, int chunksize, int raid_disks,
struct mddev_dev *devlist,
@ -1621,7 +1621,7 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
orig_size = array.size;
if (reshape_super(st, size, UnSet, UnSet, 0, 0, UnSet, NULL,
devname, APPLY_METADATA_CHANGES, !quiet)) {
devname, APPLY_METADATA_CHANGES, verbose > 0)) {
rv = 1;
goto release;
}
@ -1755,7 +1755,7 @@ size_change_error:
if (reshape_super(st, orig_size, UnSet, UnSet, 0, 0,
UnSet, NULL, devname,
ROLLBACK_METADATA_CHANGES,
!quiet) == 0)
verbose) == 0)
sync_metadata(st);
pr_err("Cannot set device size for %s: %s\n",
devname, strerror(err));
@ -1777,7 +1777,7 @@ size_change_error:
size = get_component_size(fd)/2;
if (size == 0)
size = array.size;
if (!quiet) {
if (verbose >= 0) {
if (size == orig_size)
pr_err("component size of %s "
"unchanged at %lluK\n",
@ -1800,7 +1800,7 @@ size_change_error:
(chunksize == 0 || chunksize == array.chunk_size) &&
(raid_disks == 0 || raid_disks == array.raid_disks)) {
/* Nothing more to do */
if (!changed && !quiet)
if (!changed && verbose >= 0)
pr_err("%s: no change requested\n",
devname);
goto release;
@ -1955,7 +1955,7 @@ size_change_error:
if (ioctl(fd, SET_ARRAY_INFO, &array) != 0) {
pr_err("failed to set new layout\n");
rv = 1;
} else if (!quiet)
} else if (verbose >= 0)
printf("layout for %s set to %d\n",
devname, array.layout);
}
@ -1969,7 +1969,7 @@ size_change_error:
* performed at the level of the container
*/
rv = reshape_container(container, devname, -1, st, &info,
force, backup_file, quiet, 0, 0);
force, backup_file, verbose, 0, 0);
frozen = 0;
} else {
/* get spare devices from external metadata
@ -1992,13 +1992,13 @@ size_change_error:
info.new_layout, info.new_chunk,
info.array.raid_disks, info.delta_disks,
backup_file, devname, APPLY_METADATA_CHANGES,
quiet)) {
verbose)) {
rv = 1;
goto release;
}
sync_metadata(st);
rv = reshape_array(container, fd, devname, st, &info, force,
devlist, backup_file, quiet, 0, 0, 0);
devlist, backup_file, verbose, 0, 0, 0);
frozen = 0;
}
release:
@ -2068,7 +2068,7 @@ static int verify_reshape_position(struct mdinfo *info, int level)
static int reshape_array(char *container, int fd, char *devname,
struct supertype *st, struct mdinfo *info,
int force, struct mddev_dev *devlist,
char *backup_file, int quiet, int forked,
char *backup_file, int verbose, int forked,
int restart, int freeze_reshape)
{
struct reshape reshape;
@ -2208,7 +2208,7 @@ static int reshape_array(char *container, int fd, char *devname,
" before level can be changed\n");
goto release;
}
if (!quiet)
if (verbose >= 0)
pr_err("level of %s changed to %s\n",
devname, c);
orig_level = array.level;
@ -2266,7 +2266,7 @@ static int reshape_array(char *container, int fd, char *devname,
* level and frozen, we can safely add them.
*/
if (devlist)
Manage_subdevs(devname, fd, devlist, !quiet,
Manage_subdevs(devname, fd, devlist, verbose,
0,NULL, 0);
if (reshape.backup_blocks == 0) {
@ -2286,7 +2286,7 @@ static int reshape_array(char *container, int fd, char *devname,
if (ioctl(fd, SET_ARRAY_INFO, &array) != 0) {
pr_err("failed to set new layout\n");
goto release;
} else if (!quiet)
} else if (verbose >= 0)
printf("layout for %s set to %d\n",
devname, array.layout);
}
@ -2297,7 +2297,7 @@ static int reshape_array(char *container, int fd, char *devname,
if (ioctl(fd, SET_ARRAY_INFO, &array) != 0) {
pr_err("failed to set raid disks\n");
goto release;
} else if (!quiet) {
} else if (verbose >= 0) {
printf("raid_disks for %s set to %d\n",
devname, array.raid_disks);
}
@ -2308,7 +2308,7 @@ static int reshape_array(char *container, int fd, char *devname,
"chunk_size", info->new_chunk) != 0) {
pr_err("failed to set chunk size\n");
goto release;
} else if (!quiet)
} else if (verbose >= 0)
printf("chunk size for %s set to %d\n",
devname, array.chunk_size);
}
@ -2666,7 +2666,7 @@ int reshape_container(char *container, char *devname,
struct mdinfo *info,
int force,
char *backup_file,
int quiet, int restart, int freeze_reshape)
int verbose, int restart, int freeze_reshape)
{
struct mdinfo *cc = NULL;
int rv = restart;
@ -2680,7 +2680,7 @@ int reshape_container(char *container, char *devname,
info->new_layout, info->new_chunk,
info->array.raid_disks, info->delta_disks,
backup_file, devname, APPLY_METADATA_CHANGES,
quiet)) {
verbose)) {
unfreeze(st);
return 1;
}
@ -2792,7 +2792,7 @@ int reshape_container(char *container, char *devname,
rv = reshape_array(container, fd, adev, st,
content, force, NULL,
backup_file, quiet, 1, restart,
backup_file, verbose, 1, restart,
freeze_reshape);
close(fd);

22
Kill.c
View File

@ -29,7 +29,7 @@
#include "md_u.h"
#include "md_p.h"
int Kill(char *dev, struct supertype *st, int force, int quiet, int noexcl)
int Kill(char *dev, struct supertype *st, int force, int verbose, int noexcl)
{
/*
* Nothing fancy about Kill. It just zeroes out a superblock
@ -46,7 +46,7 @@ int Kill(char *dev, struct supertype *st, int force, int quiet, int noexcl)
noexcl = 1;
fd = open(dev, O_RDWR|(noexcl ? 0 : O_EXCL));
if (fd < 0) {
if (!quiet)
if (verbose >= 0)
pr_err("Couldn't open %s for write - not zeroing\n",
dev);
return 2;
@ -54,7 +54,7 @@ int Kill(char *dev, struct supertype *st, int force, int quiet, int noexcl)
if (st == NULL)
st = guess_super(fd);
if (st == NULL || st->ss->init_super == NULL) {
if (!quiet)
if (verbose >= 0)
pr_err("Unrecognised md component device - %s\n", dev);
close(fd);
return 2;
@ -65,12 +65,12 @@ int Kill(char *dev, struct supertype *st, int force, int quiet, int noexcl)
st->ss->free_super(st);
st->ss->init_super(st, NULL, 0, "", NULL, NULL);
if (st->ss->store_super(st, fd)) {
if (!quiet)
if (verbose >= 0)
pr_err("Could not zero superblock on %s\n",
dev);
rv = 1;
} else if (rv) {
if (!quiet)
if (verbose >= 0)
pr_err("superblock zeroed anyway\n");
rv = 0;
}
@ -79,7 +79,7 @@ int Kill(char *dev, struct supertype *st, int force, int quiet, int noexcl)
return rv;
}
int Kill_subarray(char *dev, char *subarray, int quiet)
int Kill_subarray(char *dev, char *subarray, int verbose)
{
/* Delete a subarray out of a container, the subarry must be
* inactive. The subarray string must be a subarray index
@ -95,19 +95,19 @@ int Kill_subarray(char *dev, char *subarray, int quiet)
memset(st, 0, sizeof(*st));
fd = open_subarray(dev, subarray, st, quiet);
fd = open_subarray(dev, subarray, st, verbose < 0);
if (fd < 0)
return 2;
if (!st->ss->kill_subarray) {
if (!quiet)
if (verbose >= 0)
pr_err("Operation not supported for %s metadata\n",
st->ss->name);
goto free_super;
}
if (is_subarray_active(subarray, st->devname)) {
if (!quiet)
if (verbose >= 0)
pr_err("Subarray-%s still active, aborting\n",
subarray);
goto free_super;
@ -119,7 +119,7 @@ int Kill_subarray(char *dev, char *subarray, int quiet)
/* ok we've found our victim, drop the axe */
rv = st->ss->kill_subarray(st);
if (rv) {
if (!quiet)
if (verbose >= 0)
pr_err("Failed to delete subarray-%s from %s\n",
subarray, dev);
goto free_super;
@ -131,7 +131,7 @@ int Kill_subarray(char *dev, char *subarray, int quiet)
else
st->ss->sync_metadata(st);
if (!quiet)
if (verbose >= 0)
pr_err("Deleted subarray-%s from %s, UUIDs may have changed\n",
subarray, dev);

View File

@ -174,17 +174,20 @@ static void remove_devices(int devnum, char *path)
}
int Manage_runstop(char *devname, int fd, int runstop, int quiet)
int Manage_runstop(char *devname, int fd, int runstop,
int verbose, int will_retry)
{
/* Run or stop the array. array must already be configured
* required >= 0.90.0
* Only print failure messages if quiet == 0;
* quiet > 0 means really be quiet
* quiet < 0 means we will try again if it fails.
* 'Run' requires >= 0.90.0
* 'will_retry' is only relevant for 'stop', and means
* that error messages are not wanted.
*/
mdu_param_t param; /* unused */
int rv = 0;
if (will_retry && verbose == 0)
verbose = -1;
if (runstop == -1 && md_get_version(fd) < 9000) {
if (ioctl(fd, STOP_MD, 0)) {
pr_err("stopping device %s "
@ -198,20 +201,15 @@ int Manage_runstop(char *devname, int fd, int runstop, int quiet)
pr_err("need md driver version 0.90.0 or later\n");
return 1;
}
/*
if (ioctl(fd, GET_ARRAY_INFO, &array)) {
pr_err("%s does not appear to be active.\n",
devname);
return 1;
}
*/
if (runstop>0) {
if (ioctl(fd, RUN_ARRAY, &param)) {
pr_err("failed to run array %s: %s\n",
devname, strerror(errno));
if (verbose >= 0)
pr_err("failed to run array %s: %s\n",
devname, strerror(errno));
return 1;
}
if (quiet <= 0)
if (verbose >= 0)
pr_err("started %s\n", devname);
} else if (runstop < 0){
struct map_ent *map = NULL;
@ -232,11 +230,12 @@ int Manage_runstop(char *devname, int fd, int runstop, int quiet)
if (fd < 0 || fd2devnum(fd) != devnum) {
if (fd >= 0)
close(fd);
pr_err("Cannot get exclusive access to %s:"
"Perhaps a running "
"process, mounted filesystem "
"or active volume group?\n",
devname);
if (verbose >= 0)
pr_err("Cannot get exclusive access to %s:"
"Perhaps a running "
"process, mounted filesystem "
"or active volume group?\n",
devname);
return 1;
}
mdi = sysfs_read(fd, -1, GET_LEVEL|GET_VERSION);
@ -256,9 +255,10 @@ int Manage_runstop(char *devname, int fd, int runstop, int quiet)
usleep(200000);
count--;
}
if (err && !quiet) {
pr_err("failed to stop array %s: %s\n",
devname, strerror(errno));
if (err) {
if (verbose >= 0)
pr_err("failed to stop array %s: %s\n",
devname, strerror(errno));
rv = 1;
goto out;
}
@ -268,9 +268,10 @@ int Manage_runstop(char *devname, int fd, int runstop, int quiet)
fd = open_dev_excl(devnum);
if (fd < 0) {
pr_err("failed to completely stop %s"
": Device is busy\n",
devname);
if (verbose >= 0)
pr_err("failed to completely stop %s"
": Device is busy\n",
devname);
rv = 1;
goto out;
}
@ -294,7 +295,7 @@ int Manage_runstop(char *devname, int fd, int runstop, int quiet)
strncmp(m->metadata_version, "external:", 9)==0 &&
is_subarray(m->metadata_version+9) &&
devname2devnum(m->metadata_version+10) == devnum) {
if (!quiet)
if (verbose >= 0)
pr_err("Cannot stop container %s: "
"member %s still active\n",
devname, m->dev);
@ -316,7 +317,7 @@ int Manage_runstop(char *devname, int fd, int runstop, int quiet)
count --;
}
if (fd >= 0 && err) {
if (quiet == 0) {
if (verbose >= 0) {
pr_err("failed to stop array %s: %s\n",
devname, strerror(errno));
if (errno == EBUSY)
@ -345,7 +346,7 @@ int Manage_runstop(char *devname, int fd, int runstop, int quiet)
}
if (quiet <= 0)
if (verbose >= 0)
pr_err("stopped %s\n", devname);
map_lock(&map);
map_remove(&map, devnum);
@ -1204,19 +1205,19 @@ int autodetect(void)
return rv;
}
int Update_subarray(char *dev, char *subarray, char *update, struct mddev_ident *ident, int quiet)
int Update_subarray(char *dev, char *subarray, char *update, struct mddev_ident *ident, int verbose)
{
struct supertype supertype, *st = &supertype;
int fd, rv = 2;
memset(st, 0, sizeof(*st));
fd = open_subarray(dev, subarray, st, quiet);
fd = open_subarray(dev, subarray, st, verbose < 0);
if (fd < 0)
return 2;
if (!st->ss->update_subarray) {
if (!quiet)
if (verbose >= 0)
pr_err("Operation not supported for %s metadata\n",
st->ss->name);
goto free_super;
@ -1228,7 +1229,7 @@ int Update_subarray(char *dev, char *subarray, char *update, struct mddev_ident
rv = st->ss->update_subarray(st, subarray, update, ident);
if (rv) {
if (!quiet)
if (verbose >= 0)
pr_err("Failed to update %s of subarray-%s in %s\n",
update, subarray, dev);
} else if (st->update_tail)
@ -1236,7 +1237,7 @@ int Update_subarray(char *dev, char *subarray, char *update, struct mddev_ident
else
st->ss->sync_metadata(st);
if (rv == 0 && strcmp(update, "name") == 0 && !quiet)
if (rv == 0 && strcmp(update, "name") == 0 && verbose >= 0)
pr_err("Updated subarray-%s name from %s, UUIDs may have changed\n",
subarray, dev);

50
mdadm.c
View File

@ -38,12 +38,12 @@ static int scan_assemble(int autof, struct supertype *ss,
int freeze_reshape);
static int misc_scan(char devmode, int verbose, int export, int test,
char *homehost, char *prefer);
static int stop_scan(int quiet);
static int stop_scan(int verbose);
static int misc_list(struct mddev_dev *devlist,
int brief, int verbose, int export, int test,
char *homehost, char *prefer, char *subarray,
char *update, struct mddev_ident *ident,
struct supertype *ss, int force, int quiet);
struct supertype *ss, int force);
int main(int argc, char *argv[])
@ -1239,7 +1239,7 @@ int main(int argc, char *argv[])
if (!rv && c.readonly < 0)
rv = Manage_ro(devlist->devname, mdfd, c.readonly);
if (!rv && c.runstop)
rv = Manage_runstop(devlist->devname, mdfd, c.runstop, c.quiet);
rv = Manage_runstop(devlist->devname, mdfd, c.runstop, c.verbose-c.quiet, 0);
break;
case ASSEMBLE:
if (devs_found == 1 && ident.uuid_set == 0 &&
@ -1371,18 +1371,18 @@ int main(int argc, char *argv[])
pr_err("No devices listed in %s\n", configfile?configfile:DefaultConfFile);
exit(1);
}
if (c.brief && c.verbose)
if (c.brief && c.verbose > 0)
c.brief = 2;
rv = Examine(devlist, c.scan?(c.verbose>1?0:c.verbose+1):c.brief,
rv = Examine(devlist, c.scan?(c.verbose>1?0:c.verbose):c.brief,
c.export, c.scan,
c.SparcAdjust, ss, c.homehost);
} else if (devmode == DetailPlatform) {
rv = Detail_Platform(ss ? ss->ss : NULL, ss ? c.scan : 1, c.verbose);
rv = Detail_Platform(ss ? ss->ss : NULL, ss ? c.scan : 1, c.verbose-c.quiet);
} else if (devlist == NULL) {
if (devmode == 'S' && c.scan)
rv = stop_scan(c.quiet);
rv = stop_scan(c.verbose-c.quiet);
else if ((devmode == 'D' || devmode == Waitclean) && c.scan)
rv = misc_scan(devmode, c.verbose, c.export,
rv = misc_scan(devmode, c.verbose-c.quiet, c.export,
c.test, c.homehost, c.prefer);
else if (devmode == UdevRules)
rv = Write_rules(udev_filename);
@ -1391,10 +1391,10 @@ int main(int argc, char *argv[])
exit(2);
}
} else
rv = misc_list(devlist, c.brief, c.verbose, c.export, c.test,
rv = misc_list(devlist, c.brief, c.verbose-c.quiet, c.export, c.test,
c.homehost, c.prefer, c.subarray, c.update,
&ident,
ss, c.force, c.quiet);
ss, c.force);
break;
case MONITOR:
if (!devlist && !c.scan) {
@ -1482,10 +1482,10 @@ int main(int argc, char *argv[])
} else if (grow_continue)
rv = Grow_continue_command(devlist->devname,
mdfd, c.backup_file,
c.verbose);
c.verbose-c.quiet);
else if (size >= 0 || raiddisks != 0 || layout_str != NULL
|| chunk != 0 || level != UnSet) {
rv = Grow_reshape(devlist->devname, mdfd, c.quiet, c.backup_file,
rv = Grow_reshape(devlist->devname, mdfd, c.verbose-c.quiet, c.backup_file,
size, level, layout_str, chunk, raiddisks,
devlist->next,
assume_clean, c.force);
@ -1505,7 +1505,7 @@ int main(int argc, char *argv[])
pr_err("--incremental --scan --fail not supported.\n");
break;
}
rv = IncrementalScan(c.verbose);
rv = IncrementalScan(c.verbose-c.quiet);
}
if (!devlist) {
if (!rebuild_map && !c.scan) {
@ -1684,7 +1684,7 @@ static int misc_scan(char devmode, int verbose, int export, int test,
return rv;
}
static int stop_scan(int quiet)
static int stop_scan(int verbose)
{
/* apply --stop to all devices in /proc/mdstat */
/* Due to possible stacking of devices, repeat until
@ -1710,7 +1710,7 @@ static int stop_scan(int quiet)
}
mdfd = open_mddev(name, 1);
if (mdfd >= 0) {
if (Manage_runstop(name, mdfd, -1, quiet?1:last?0:-1))
if (Manage_runstop(name, mdfd, -1, verbose, !last))
err = 1;
else
progress = 1;
@ -1730,7 +1730,7 @@ static int misc_list(struct mddev_dev *devlist,
int brief, int verbose, int export, int test,
char *homehost, char *prefer, char *subarray,
char *update, struct mddev_ident *ident,
struct supertype *ss, int force, int quiet)
struct supertype *ss, int force)
{
struct mddev_dev *dv;
int rv = 0;
@ -1746,12 +1746,12 @@ static int misc_list(struct mddev_dev *devlist,
continue;
case KillOpt: /* Zero superblock */
if (ss)
rv |= Kill(dv->devname, ss, force, quiet,0);
rv |= Kill(dv->devname, ss, force, verbose,0);
else {
int q = quiet;
int v = verbose;
do {
rv |= Kill(dv->devname, NULL, force, q, 0);
q = 1;
rv |= Kill(dv->devname, NULL, force, v, 0);
v = -1;
} while (rv == 0);
rv &= ~2;
}
@ -1764,9 +1764,9 @@ static int misc_list(struct mddev_dev *devlist,
case WaitOpt:
rv |= Wait(dv->devname); continue;
case Waitclean:
rv |= WaitClean(dv->devname, -1, verbose-quiet); continue;
rv |= WaitClean(dv->devname, -1, verbose); continue;
case KillSubarray:
rv |= Kill_subarray(dv->devname, subarray, quiet);
rv |= Kill_subarray(dv->devname, subarray, verbose);
continue;
case UpdateSubarray:
if (update == NULL) {
@ -1775,16 +1775,16 @@ static int misc_list(struct mddev_dev *devlist,
continue;
}
rv |= Update_subarray(dv->devname, subarray,
update, ident, quiet);
update, ident, verbose);
continue;
}
mdfd = open_mddev(dv->devname, 1);
if (mdfd>=0) {
switch(dv->disposition) {
case 'R':
rv |= Manage_runstop(dv->devname, mdfd, 1, quiet); break;
rv |= Manage_runstop(dv->devname, mdfd, 1, verbose, 0); break;
case 'S':
rv |= Manage_runstop(dv->devname, mdfd, -1, quiet); break;
rv |= Manage_runstop(dv->devname, mdfd, -1, verbose, 0); break;
case 'o':
rv |= Manage_ro(dv->devname, mdfd, 1); break;
case 'w':

View File

@ -1065,7 +1065,8 @@ extern int add_dev(const char *name, const struct stat *stb, int flag, struct FT
extern int Manage_ro(char *devname, int fd, int readonly);
extern int Manage_runstop(char *devname, int fd, int runstop, int quiet);
extern int Manage_runstop(char *devname, int fd, int runstop, int quiet,
int will_retry);
extern int Manage_resize(char *devname, int fd, long long size, int raid_disks);
extern int Manage_subdevs(char *devname, int fd,
struct mddev_dev *devlist, int verbose, int test,
@ -1127,8 +1128,8 @@ extern int Monitor(struct mddev_dev *devlist,
int dosyslog, int test, char *pidfile, int increments,
int share, char *prefer);
extern int Kill(char *dev, struct supertype *st, int force, int quiet, int noexcl);
extern int Kill_subarray(char *dev, char *subarray, int quiet);
extern int Kill(char *dev, struct supertype *st, int force, int verbose, int noexcl);
extern int Kill_subarray(char *dev, char *subarray, int verbose);
extern int Update_subarray(char *dev, char *subarray, char *update, struct mddev_ident *ident, int quiet);
extern int Wait(char *dev);
extern int WaitClean(char *dev, int sock, int verbose);

View File

@ -2477,7 +2477,7 @@ static int write_init_super_ddf(struct supertype *st)
} else {
struct dl *d;
for (d = ddf->dlist; d; d=d->next)
while (Kill(d->devname, NULL, 0, 1, 1) == 0);
while (Kill(d->devname, NULL, 0, -1, 1) == 0);
return __write_init_super_ddf(st);
}
}

View File

@ -1567,7 +1567,7 @@ static int ahci_enumerate_ports(const char *hba_path, int port_count, int host_b
unsigned long port_mask = (1 << port_count) - 1;
if (port_count > (int)sizeof(port_mask) * 8) {
if (verbose)
if (verbose > 0)
pr_err("port_count %d out of range\n", port_count);
return 2;
}
@ -1600,14 +1600,14 @@ static int ahci_enumerate_ports(const char *hba_path, int port_count, int host_b
/* retrieve the scsi device type */
if (asprintf(&device, "/sys/dev/block/%d:%d/device/xxxxxxx", major, minor) < 0) {
if (verbose)
if (verbose > 0)
pr_err("failed to allocate 'device'\n");
err = 2;
break;
}
sprintf(device, "/sys/dev/block/%d:%d/device/type", major, minor);
if (load_sys(device, buf) != 0) {
if (verbose)
if (verbose > 0)
pr_err("failed to read device type for %s\n",
path);
err = 2;
@ -1660,7 +1660,7 @@ static int ahci_enumerate_ports(const char *hba_path, int port_count, int host_b
/* chop device path to 'host%d' and calculate the port number */
c = strchr(&path[hba_len], '/');
if (!c) {
if (verbose)
if (verbose > 0)
pr_err("%s - invalid path name\n", path + hba_len);
err = 2;
break;
@ -1669,7 +1669,7 @@ static int ahci_enumerate_ports(const char *hba_path, int port_count, int host_b
if (sscanf(&path[hba_len], "host%d", &port) == 1)
port -= host_base;
else {
if (verbose) {
if (verbose > 0) {
*c = '/'; /* repair the full string */
pr_err("failed to determine port number for %s\n",
path);
@ -1836,12 +1836,12 @@ static int detail_platform_imsm(int verbose, int enumerate_only)
list = find_intel_devices();
if (!list) {
if (verbose)
if (verbose > 0)
pr_err("no active Intel(R) RAID "
"controller found.\n");
free_sys_dev(&list);
return 2;
} else if (verbose)
} else if (verbose > 0)
print_found_intel_controllers(list);
for (hba = list; hba; hba = hba->next) {
@ -1860,7 +1860,7 @@ static int detail_platform_imsm(int verbose, int enumerate_only)
if (hba->type == SYS_DEV_SATA) {
host_base = ahci_get_port_count(hba->path, &port_count);
if (ahci_enumerate_ports(hba->path, port_count, host_base, verbose)) {
if (verbose)
if (verbose > 0)
pr_err("failed to enumerate "
"ports on SATA controller at %s.", hba->pci_id);
result |= 2;
@ -5175,7 +5175,7 @@ static int write_init_super_imsm(struct supertype *st)
} else {
struct dl *d;
for (d = super->disks; d; d = d->next)
Kill(d->devname, NULL, 0, 1, 1);
Kill(d->devname, NULL, 0, -1, 1);
return write_super_imsm(st, 1);
}
}
@ -5220,7 +5220,7 @@ static int validate_geometry_imsm_container(struct supertype *st, int level,
fd = open(dev, O_RDONLY|O_EXCL, 0);
if (fd < 0) {
if (verbose)
if (verbose > 0)
pr_err("imsm: Cannot open %s: %s\n",
dev, strerror(errno));
return 0;
@ -5234,7 +5234,7 @@ static int validate_geometry_imsm_container(struct supertype *st, int level,
* note that there is no fd for the disks in array.
*/
super = alloc_super();
rv = find_intel_hba_capability(fd, super, verbose ? dev : NULL);
rv = find_intel_hba_capability(fd, super, verbose > 0 ? dev : NULL);
if (rv != 0) {
#if DEBUG
char str[256];

View File

@ -768,7 +768,7 @@ static int write_init_super0(struct supertype *st)
continue;
if (di->fd == -1)
continue;
while (Kill(di->devname, NULL, 0, 1, 1) == 0)
while (Kill(di->devname, NULL, 0, -1, 1) == 0)
;
sb->disks[di->disk.number].state &= ~(1<<MD_DISK_FAULTY);

View File

@ -1101,7 +1101,7 @@ static int write_init_super1(struct supertype *st)
if (di->fd < 0)
continue;
while (Kill(di->devname, NULL, 0, 1, 1) == 0)
while (Kill(di->devname, NULL, 0, -1, 1) == 0)
;
sb->dev_number = __cpu_to_le32(di->disk.number);