aboutsummaryrefslogtreecommitdiff
path: root/sbin/vinum
diff options
context:
space:
mode:
authorGreg Lehey <grog@FreeBSD.org>2003-05-05 05:27:19 +0000
committerGreg Lehey <grog@FreeBSD.org>2003-05-05 05:27:19 +0000
commit3a508bbd0a7d13fe0d9166eb2f83901910dbffe1 (patch)
treea4160e1e727e540cc0b4c46d1425fefe5e1d3205 /sbin/vinum
parent48f14420c5bc4901f6a8d65dd15c1703170fe995 (diff)
downloadsrc-3a508bbd0a7d13fe0d9166eb2f83901910dbffe1.tar.gz
src-3a508bbd0a7d13fe0d9166eb2f83901910dbffe1.zip
vinum_readpol: Get this right.
Submitted by: Allan Saddi <allan@saddi.com> vinum_read: White space cleanup.
Notes
Notes: svn path=/head/; revision=114691
Diffstat (limited to 'sbin/vinum')
-rw-r--r--sbin/vinum/commands.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/sbin/vinum/commands.c b/sbin/vinum/commands.c
index d9f9cdfd7a4a..e99ee4b84904 100644
--- a/sbin/vinum/commands.c
+++ b/sbin/vinum/commands.c
@@ -36,7 +36,7 @@
* otherwise) arising in any way out of the use of this software, even if
* advised of the possibility of such damage.
*
- * $Id: commands.c,v 1.22 2003/04/28 06:19:06 grog Exp $
+ * $Id: commands.c,v 1.23 2003/05/04 05:23:59 grog Exp grog $
* $FreeBSD$
*/
@@ -153,16 +153,13 @@ vinum_read(int argc, char *argv[], char *arg0[])
int i;
reply = (struct _ioctl_reply *) &buffer;
- buffer [0] = '\0'; /* make sure we don't pass anything*/
- if (argc > 0) /* args specified, */
- {
- for (i = 0; i < argc; i++) /* each drive name */
- {
- strcat (buffer, argv [i]);
- strcat (buffer, " ");
- }
+ buffer[0] = '\0'; /* make sure we don't pass anything */
+ if (argc > 0) { /* args specified, */
+ for (i = 0; i < argc; i++) { /* each drive name */
+ strcat(buffer, argv[i]);
+ strcat(buffer, " ");
+ }
}
-
if (ioctl(superdev, VINUM_STARTCONFIG, &force)) { /* can't get config? */
fprintf(stderr, "Can't configure: %s (%d)\n", strerror(errno), errno);
return;
@@ -2183,20 +2180,20 @@ vinum_readpol(int argc, char *argv[], char *argv0[])
struct _volume vol;
int plexno;
- if (argc == 0) { /* start everything */
- fprintf(stderr, "usage: readpol <volume> <plex>|round\n");
+ if (argc != 2) {
+ fprintf(stderr, "usage: readpol <volume> <plex> | round\n");
return;
}
- object = find_object(argv[1], &type); /* look for it */
+ object = find_object(argv[0], &type); /* look for it */
if (type != volume_object) {
- fprintf(stderr, "%s is not a volume\n", argv[1]);
+ fprintf(stderr, "%s is not a volume\n", argv[0]);
return;
}
get_volume_info(&vol, object);
- if (strcmp(argv[2], "round")) { /* not 'round' */
- object = find_object(argv[2], &type); /* look for it */
+ if (strcmp(argv[1], "round")) { /* not 'round' */
+ object = find_object(argv[1], &type); /* look for it */
if (type != plex_object) {
- fprintf(stderr, "%s is not a plex\n", argv[2]);
+ fprintf(stderr, "%s is not a plex\n", argv[1]);
return;
}
get_plex_info(&plex, object);
@@ -2207,8 +2204,12 @@ vinum_readpol(int argc, char *argv[], char *argv0[])
/* Set the value */
message->index = vol.volno;
message->otherobject = plexno;
- if (ioctl(superdev, VINUM_READPOL, message) < 0)
- fprintf(stderr, "Can't set read policy: %s (%d)\n", strerror(errno), errno);
+ ioctl(superdev, VINUM_READPOL, message);
+ if (reply.error)
+ fprintf(stderr,
+ "Can't set read policy: %s (%d)\n",
+ reply.msg[0] ? reply.msg : strerror(reply.error),
+ reply.error);
if (vflag)
vinum_lpi(plexno, recurse);
}