[Midnightbsd-cvs] src [11213] trunk/sbin/gvinum: sync

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun Jul 1 16:47:52 EDT 2018


Revision: 11213
          http://svnweb.midnightbsd.org/src/?rev=11213
Author:   laffer1
Date:     2018-07-01 16:47:52 -0400 (Sun, 01 Jul 2018)
Log Message:
-----------
sync

Modified Paths:
--------------
    trunk/sbin/gvinum/Makefile
    trunk/sbin/gvinum/gvinum.8
    trunk/sbin/gvinum/gvinum.c
    trunk/sbin/gvinum/gvinum.h

Property Changed:
----------------
    trunk/sbin/gvinum/gvinum.8

Modified: trunk/sbin/gvinum/Makefile
===================================================================
--- trunk/sbin/gvinum/Makefile	2018-07-01 20:47:24 UTC (rev 11212)
+++ trunk/sbin/gvinum/Makefile	2018-07-01 20:47:52 UTC (rev 11213)
@@ -1,4 +1,5 @@
 # $MidnightBSD$
+# $FreeBSD: stable/10/sbin/gvinum/Makefile 239781 2012-08-28 14:20:41Z brooks $
 
 PROG=	gvinum
 SRCS=	gvinum.c gvinum.h geom_vinum_share.c
@@ -5,7 +6,7 @@
 MAN=	gvinum.8
 
 WARNS?=	2
-CFLAGS=	-I${.CURDIR}/../../sys -I${DESTDIR}/${INCLUDEDIR}/edit
+CFLAGS+=	-I${.CURDIR}/../../sys -I${DESTDIR}/${INCLUDEDIR}/edit
 
 DPADD=	${LIBEDIT} ${LIBTERMCAP} ${LIBDEVSTAT} ${LIBKVM} ${LIBGEOM}
 LDADD=	-ledit -ltermcap -ldevstat -lkvm -lgeom

Modified: trunk/sbin/gvinum/gvinum.8
===================================================================
--- trunk/sbin/gvinum/gvinum.8	2018-07-01 20:47:24 UTC (rev 11212)
+++ trunk/sbin/gvinum/gvinum.8	2018-07-01 20:47:52 UTC (rev 11213)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"  Copyright (c) 2005 Chris Jones
 .\"  All rights reserved.
 .\"
@@ -26,9 +27,9 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/sbin/gvinum/gvinum.8 307403 2016-10-16 22:02:50Z sevan $
 .\"
-.Dd April 10, 2009
+.Dd May 6, 2014
 .Dt GVINUM 8
 .Os
 .Sh NAME
@@ -168,7 +169,7 @@
 .Fl f
 flag is specified, or otherwise at the location of the parity check pointer.
 All subdisks in the plex must be up for a parity check.
-.It Ic resetconfig
+.It Ic resetconfig Oo Fl f Oc
 Reset the complete
 .Nm
 configuration.
@@ -279,11 +280,11 @@
 objects
 .El
 .Sh EXAMPLES
-To create a mirror on disks /dev/ad1 and /dev/ad2, create a filesystem, mount,
-unmount and then stop
+To create a mirror on disks /dev/ada1 and /dev/ada2, create a filesystem,
+mount, unmount and then stop
 .Ic gvinum :
 .Pp
-.Dl "gvinum mirror /dev/ad1 /dev/ad2"
+.Dl "gvinum mirror /dev/ada1 /dev/ada2"
 .Dl "newfs /dev/gvinum/gvinumvolume0"
 .Dl "mount /dev/gvinum/gvinumvolume0 /mnt"
 .Dl "..."
@@ -290,16 +291,16 @@
 .Dl "unmount /mnt"
 .Dl "gvinum stop"
 .Pp
-To create a striped mirror on disks /dev/ad1 /dev/ad2 /dev/ad3 and /dev/ad4
-named "data" and create a filesystem:
+To create a striped mirror on disks /dev/ada1 /dev/ada2 /dev/ada3 and
+/dev/ada4 named "data" and create a filesystem:
 .Pp
-.Dl "gvinum mirror -s -n data /dev/ad1 /dev/ad2 /dev/ad3 /dev/ad4"
+.Dl "gvinum mirror -s -n data /dev/ada1 /dev/ada2 /dev/ada3 /dev/ada4"
 .Dl "newfs /dev/gvinum/data"
 .Pp
-To create a raid5 array on disks /dev/ad1 /dev/ad2 and /dev/ad3, with stripesize
-493k you can use the raid5 command:
+To create a raid5 array on disks /dev/ada1 /dev/ada2 and /dev/ada3,
+with stripesize 493k you can use the raid5 command:
 .Pp
-.Dl "gvinum raid5 -s 493k /dev/ad1 /dev/ad2 /dev/ad3"
+.Dl "gvinum raid5 -s 493k /dev/ada1 /dev/ada2 /dev/ada3"
 .Pp
 Then the volume will be created automatically.
 Afterwards, you have to initialize the volume:
@@ -313,9 +314,9 @@
 Imagine that one of the drives fails, and the output of 'printconfig' looks
 something like this:
 .Pp
-.Dl "drive gvinumdrive1 device /dev/ad2"
+.Dl "drive gvinumdrive1 device /dev/ada2"
 .Dl "drive gvinumdrive2 device /dev/???"
-.Dl "drive gvinumdrive0 device /dev/ad1"
+.Dl "drive gvinumdrive0 device /dev/ada1"
 .Dl "volume myraid5vol"
 .Dl "plex name myraid5vol.p0 org raid5 986s vol myraid5vol"
 .Dl "sd name myraid5vol.p0.s2 drive gvinumdrive2 len 32538s driveoffset 265s"
@@ -327,7 +328,7 @@
 .Pp
 Create a new drive with this configuration:
 .Pp
-.Dl "drive gdrive4 device /dev/ad4"
+.Dl "drive gdrive4 device /dev/ada4"
 .Pp
 Then move the stale subdisk to the new drive:
 .Pp
@@ -344,7 +345,7 @@
 Given the configuration as in the previous example, growing a RAID-5 or STRIPED
 array is accomplished by using the grow command:
 .Pp
-.Dl "gvinum grow myraid5vol.p0 /dev/ad4"
+.Dl "gvinum grow myraid5vol.p0 /dev/ada4"
 .Pp
 If everything went ok, the plex state should now be set to growable.
 You can then start the growing with the
@@ -359,7 +360,6 @@
 .Pp
 For a more advanced usage and detailed explanation of gvinum, the
 handbook is recommended.
-.Pp
 .Sh SEE ALSO
 .Xr geom 4 ,
 .Xr geom 8
@@ -389,13 +389,16 @@
 .An "Chris Jones"
 through the 2005 Google Summer
 of Code program.
-.Ic a partial rewrite of gvinum was done by "Lukas Ertl" and "Ulf Lilleengen"
+A partial rewrite of gvinum was done by
+.An "Lukas Ertl"
+and
+.An "Ulf Lilleengen"
 through the 2007 Google Summer of Code program.
 The documentation have been updated to reflect the new functionality.
 .Sh AUTHORS
-.An Lukas Ertl Aq le at FreeBSD.org
-.An Chris Jones Aq soc-cjones at FreeBSD.org
-.An Ulf Lilleengen Aq lulf at FreeBSD.org
+.An Lukas Ertl Aq Mt le at FreeBSD.org
+.An Chris Jones Aq Mt soc-cjones at FreeBSD.org
+.An Ulf Lilleengen Aq Mt lulf at FreeBSD.org
 .Sh BUGS
 Currently,
 .Nm
@@ -420,9 +423,9 @@
 Currently,
 .Nm
 does not yet fully implement all of the functions found in
-.Xr vinum 4 .
+.Nm vinum .
 Specifically, the following commands from
-.Xr vinum 4
+.Nm vinum
 are not supported:
 .Bl -tag -width indent
 .It Ic debug


Property changes on: trunk/sbin/gvinum/gvinum.8
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/sbin/gvinum/gvinum.c
===================================================================
--- trunk/sbin/gvinum/gvinum.c	2018-07-01 20:47:24 UTC (rev 11212)
+++ trunk/sbin/gvinum/gvinum.c	2018-07-01 20:47:52 UTC (rev 11213)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  *  Copyright (c) 2004 Lukas Ertl
  *  Copyright (c) 2005 Chris Jones
@@ -29,7 +30,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sbin/gvinum/gvinum.c 266043 2014-05-14 16:18:08Z marius $
  */
 
 #include <sys/param.h>
@@ -58,35 +59,36 @@
 
 #include "gvinum.h"
 
-void	gvinum_attach(int, char **);
-void	gvinum_concat(int, char **);
-void	gvinum_create(int, char **);
-void	gvinum_detach(int, char **);
-void	gvinum_grow(int, char **);
-void	gvinum_help(void);
-void	gvinum_list(int, char **);
-void	gvinum_move(int, char **);
-void	gvinum_mirror(int, char **);
-void	gvinum_parityop(int, char **, int);
-void	gvinum_printconfig(int, char **);
-void	gvinum_raid5(int, char **);
-void	gvinum_rename(int, char **);
-void	gvinum_resetconfig(void);
-void	gvinum_rm(int, char **);
-void	gvinum_saveconfig(void);
-void	gvinum_setstate(int, char **);
-void	gvinum_start(int, char **);
-void	gvinum_stop(int, char **);
-void	gvinum_stripe(int, char **);
-void	parseline(int, char **);
-void	printconfig(FILE *, char *);
+static void gvinum_attach(int, char * const *);
+static void gvinum_concat(int, char * const *);
+static void gvinum_create(int, char * const *);
+static void gvinum_detach(int, char * const *);
+static void gvinum_grow(int, char * const *);
+static void gvinum_help(void);
+static void gvinum_list(int, char * const *);
+static void gvinum_move(int, char * const *);
+static void gvinum_mirror(int, char * const *);
+static void gvinum_parityop(int, char * const * , int);
+static void gvinum_printconfig(int, char * const *);
+static void gvinum_raid5(int, char * const *);
+static void gvinum_rename(int, char * const *);
+static void gvinum_resetconfig(int, char * const *);
+static void gvinum_rm(int, char * const *);
+static void gvinum_saveconfig(void);
+static void gvinum_setstate(int, char * const *);
+static void gvinum_start(int, char * const *);
+static void gvinum_stop(int, char * const *);
+static void gvinum_stripe(int, char * const *);
+static void parseline(int, char * const *);
+static void printconfig(FILE *, const char *);
 
-char	*create_drive(char *);
-void	 create_volume(int, char **, char *);
-char	*find_name(const char *, int, int);
-char	*find_pattern(char *, char *);
-void	 copy_device(struct gv_drive *, const char *);
-#define find_drive() find_name("gvinumdrive", GV_TYPE_DRIVE, GV_MAXDRIVENAME)
+static char *create_drive(const char *);
+static void create_volume(int, char * const * , const char *);
+static char *find_name(const char *, int, int);
+static const char *find_pattern(char *, const char *);
+static void copy_device(struct gv_drive *, const char *);
+#define	find_drive()							\
+    find_name("gvinumdrive", GV_TYPE_DRIVE, GV_MAXDRIVENAME)
 
 int
 main(int argc, char **argv)
@@ -95,8 +97,10 @@
 	char buffer[BUFSIZ], *inputline, *token[GV_MAXARGS];
 
 	/* Load the module if necessary. */
-	if (kldfind(GVINUMMOD) < 0 && kldload(GVINUMMOD) < 0)
-		err(1, GVINUMMOD ": Kernel module not available");
+	if (modfind(GVINUMMOD) < 0) {
+		if (kldload(GVINUMKLD) < 0 && modfind(GVINUMMOD) < 0)
+			err(1, GVINUMKLD ": Kernel module not available");
+	}
 
 	/* Arguments given on the command line. */
 	if (argc > 1) {
@@ -130,8 +134,8 @@
 }
 
 /* Attach a plex to a volume or a subdisk to a plex. */
-void
-gvinum_attach(int argc, char **argv)
+static void
+gvinum_attach(int argc, char * const *argv)
 {
 	struct gctl_req *req;
 	const char *errstr;
@@ -167,8 +171,8 @@
 	gctl_free(req);
 }
 
-void
-gvinum_create(int argc, char **argv)
+static void
+gvinum_create(int argc, char * const *argv)
 {
 	struct gctl_req *req;
 	struct gv_drive *d;
@@ -191,8 +195,8 @@
 			flags |= GV_FLAG_F;
 		/* Else it must be a file. */
 		} else {
-			if ((tmp = fopen(argv[1], "r")) == NULL) {
-				warn("can't open '%s' for reading", argv[1]);
+			if ((tmp = fopen(argv[i], "r")) == NULL) {
+				warn("can't open '%s' for reading", argv[i]);
 				return;
 			}
 		}	
@@ -400,8 +404,8 @@
 }
 
 /* Create a concatenated volume. */
-void
-gvinum_concat(int argc, char **argv)
+static void
+gvinum_concat(int argc, char * const *argv)
 {
 
 	if (argc < 2) {
@@ -411,10 +415,9 @@
 	create_volume(argc, argv, "concat");
 }
 
-
 /* Create a drive quick and dirty. */
-char *
-create_drive(char *device)
+static char *
+create_drive(const char *device)
 {
 	struct gv_drive *d;
 	struct gctl_req *req;
@@ -421,6 +424,7 @@
 	const char *errstr;
 	char *drivename, *dname;
 	int drives, i, flags, volumes, subdisks, plexes;
+	int found = 0;
 
 	flags = plexes = subdisks = volumes = 0;
 	drives = 1;
@@ -448,10 +452,8 @@
 	errstr = gctl_issue(req);
 	if (errstr != NULL) {
 		warnx("error creating drive: %s", errstr);
-		gctl_free(req);
-		return (NULL);
+		drivename = NULL;
 	} else {
-		gctl_free(req);
 		/* XXX: This is needed because we have to make sure the drives
 		 * are created before we return. */
 		/* Loop until it's in the config. */
@@ -461,25 +463,29 @@
 			/* If we got a different name, quit. */
 			if (dname == NULL)
 				continue;
-			if (strcmp(dname, drivename)) {
-				free(dname);
-				return (drivename);
-			}
+			if (strcmp(dname, drivename))
+				found = 1;
 			free(dname);
 			dname = NULL;
+			if (found)
+				break;
 			usleep(100000); /* Sleep for 0.1s */
 		}
+		if (found == 0) {
+			warnx("error creating drive");
+			drivename = NULL;
+		}
 	}
 	gctl_free(req);
 	return (drivename);
 }
 
-/* 
+/*
  * General routine for creating a volume. Mainly for use by concat, mirror,
  * raid5 and stripe commands.
  */
-void
-create_volume(int argc, char **argv, char *verb)
+static void
+create_volume(int argc, char * const *argv, const char *verb)
 {
 	struct gctl_req *req;
 	const char *errstr;
@@ -513,7 +519,7 @@
 			snprintf(buf, sizeof(buf), "drive%d", drives++);
 
 			/* First we create the drive. */
-			drivename = create_drive(argv[i]); 
+			drivename = create_drive(argv[i]);
 			if (drivename == NULL)
 				goto bad;
 			/* Then we add it to the request. */
@@ -529,7 +535,7 @@
 
 	/* Then we send a request to actually create the volumes. */
 	gctl_ro_param(req, "verb", -1, verb);
-	gctl_ro_param(req, "flags", sizeof(int), &flags); 
+	gctl_ro_param(req, "flags", sizeof(int), &flags);
 	gctl_ro_param(req, "drives", sizeof(int), &drives);
 	gctl_ro_param(req, "name", -1, volname);
 	errstr = gctl_issue(req);
@@ -540,8 +546,8 @@
 }
 
 /* Parse a line of the config, return the word after <pattern>. */
-char *
-find_pattern(char *line, char *pattern)
+static const char *
+find_pattern(char *line, const char *pattern)
 {
 	char *ptr;
 
@@ -558,12 +564,12 @@
 }
 
 /* Find a free name for an object given a prefix. */
-char *
+static char *
 find_name(const char *prefix, int type, int namelen)
 {
 	struct gctl_req *req;
-	char comment[1], buf[GV_CFG_LEN - 1], *name, *sname, *ptr;
-	const char *errstr;
+	char comment[1], buf[GV_CFG_LEN - 1], *sname, *ptr;
+	const char *errstr, *name;
 	int i, n, begin, len, conflict;
 	char line[1024];
 
@@ -628,9 +634,10 @@
 	return (NULL);
 }
 
-void
+static void
 copy_device(struct gv_drive *d, const char *device)
 {
+
 	if (strncmp(device, "/dev/", 5) == 0)
 		strlcpy(d->device, (device + 5), sizeof(d->device));
 	else
@@ -638,8 +645,8 @@
 }
 
 /* Detach a plex or subdisk from its parent. */
-void
-gvinum_detach(int argc, char **argv)
+static void
+gvinum_detach(int argc, char * const *argv)
 {
 	const char *errstr;
 	struct gctl_req *req;
@@ -649,7 +656,7 @@
 	optreset = 1;
 	optind = 1;
 	while ((i = getopt(argc, argv, "f")) != -1) {
-		switch(i) {
+		switch (i) {
 		case 'f':
 			flags |= GV_FLAG_F;
 			break;
@@ -677,9 +684,10 @@
 	gctl_free(req);
 }
 
-void
+static void
 gvinum_help(void)
 {
+
 	printf("COMMANDS\n"
 	    "checkparity [-f] plex\n"
 	    "        Check the parity blocks of a RAID-5 plex.\n"
@@ -718,7 +726,7 @@
 	    "        Change the name of the specified object.\n"
 	    "rebuildparity plex [-f]\n"
 	    "        Rebuild the parity blocks of a RAID-5 plex.\n"
-	    "resetconfig\n"
+	    "resetconfig [-f]\n"
 	    "        Reset the complete gvinum configuration\n"
 	    "rm [-r] [-f] volume | plex | subdisk | drive\n"
 	    "        Remove an object.\n"
@@ -734,12 +742,10 @@
 	    "stripe [-fv] [-n name] drives\n"
 	    "        Create a striped volume from the specified drives.\n"
 	);
-
-	return;
 }
 
-void
-gvinum_setstate(int argc, char **argv)
+static void
+gvinum_setstate(int argc, char * const *argv)
 {
 	struct gctl_req *req;
 	int flags, i;
@@ -793,8 +799,8 @@
 	gctl_free(req);
 }
 
-void
-gvinum_list(int argc, char **argv)
+static void
+gvinum_list(int argc, char * const *argv)
 {
 	struct gctl_req *req;
 	int flags, i, j;
@@ -855,12 +861,11 @@
 
 	printf("%s", config);
 	gctl_free(req);
-	return;
 }
 
 /* Create a mirrored volume. */
-void
-gvinum_mirror(int argc, char **argv)
+static void
+gvinum_mirror(int argc, char * const *argv)
 {
 
 	if (argc < 2) {
@@ -871,8 +876,8 @@
 }
 
 /* Note that move is currently of form '[-r] target object [...]' */
-void
-gvinum_move(int argc, char **argv)
+static void
+gvinum_move(int argc, char * const *argv)
 {
 	struct gctl_req *req;
 	const char *errstr;
@@ -922,17 +927,17 @@
 	if (errstr != NULL)
 		warnx("can't move object(s):  %s", errstr);
 	gctl_free(req);
-	return;
 }
 
-void
-gvinum_printconfig(int argc, char **argv)
+static void
+gvinum_printconfig(int argc, char * const *argv)
 {
+
 	printconfig(stdout, "");
 }
 
-void
-gvinum_parityop(int argc, char **argv, int rebuild)
+static void
+gvinum_parityop(int argc, char * const *argv, int rebuild)
 {
 	struct gctl_req *req;
 	int flags, i;
@@ -956,7 +961,6 @@
 		case 'v':
 			flags |= GV_FLAG_V;
 			break;
-		case '?':
 		default:
 			warnx("invalid flag '%c'", i);
 			return;
@@ -984,8 +988,8 @@
 }
 
 /* Create a RAID-5 volume. */
-void
-gvinum_raid5(int argc, char **argv)
+static void
+gvinum_raid5(int argc, char * const *argv)
 {
 
 	if (argc < 2) {
@@ -995,9 +999,8 @@
 	create_volume(argc, argv, "raid5");
 }
 
-
-void
-gvinum_rename(int argc, char **argv)
+static void
+gvinum_rename(int argc, char * const *argv)
 {
 	struct gctl_req *req;
 	const char *errstr;
@@ -1013,7 +1016,6 @@
 			case 'r':
 				flags |= GV_FLAG_R;
 				break;
-			case '?':
 			default:
 				return;
 			}
@@ -1046,11 +1048,10 @@
 	if (errstr != NULL)
 		warnx("can't rename object:  %s", errstr);
 	gctl_free(req);
-	return;
 }
 
-void
-gvinum_rm(int argc, char **argv)
+static void
+gvinum_rm(int argc, char * const *argv)
 {
 	struct gctl_req *req;
 	int flags, i, j;
@@ -1068,7 +1069,6 @@
 		case 'r':
 			flags |= GV_FLAG_R;
 			break;
-		case '?':
 		default:
 			return;
 		}
@@ -1096,27 +1096,41 @@
 	gctl_free(req);
 }
 
-void
-gvinum_resetconfig(void)
+static void
+gvinum_resetconfig(int argc, char * const *argv)
 {
 	struct gctl_req *req;
 	const char *errstr;
 	char reply[32];
+	int flags, i;
 
-	if (!isatty(STDIN_FILENO)) {
-		warn("Please enter this command from a tty device\n");
-		return;
+	flags = 0;
+	while ((i = getopt(argc, argv, "f")) != -1) {
+		switch (i) {
+		case 'f':
+			flags |= GV_FLAG_F;
+			break;
+		default:
+			warn("invalid flag: %c", i);
+			return;
+		}
 	}
-	printf(" WARNING!  This command will completely wipe out your gvinum"
-	    "configuration.\n"
-	    " All data will be lost.  If you really want to do this,"
-	    " enter the text\n\n"
-	    " NO FUTURE\n"
-	    " Enter text -> ");
-	fgets(reply, sizeof(reply), stdin);
-	if (strcmp(reply, "NO FUTURE\n")) {
-		printf("\n No change\n");
-		return;
+	if ((flags & GV_FLAG_F) == 0) {
+		if (!isatty(STDIN_FILENO)) {
+			warn("Please enter this command from a tty device\n");
+			return;
+		}
+		printf(" WARNING!  This command will completely wipe out"
+		    " your gvinum configuration.\n"
+		    " All data will be lost.  If you really want to do this,"
+		    " enter the text\n\n"
+		    " NO FUTURE\n"
+		    " Enter text -> ");
+		fgets(reply, sizeof(reply), stdin);
+		if (strcmp(reply, "NO FUTURE\n")) {
+			printf("\n No change\n");
+			return;
+		}
 	}
 	req = gctl_get_handle();
 	gctl_ro_param(req, "class", -1, "VINUM");
@@ -1131,7 +1145,7 @@
 	printf("gvinum configuration obliterated\n");
 }
 
-void
+static void
 gvinum_saveconfig(void)
 {
 	struct gctl_req *req;
@@ -1146,8 +1160,8 @@
 	gctl_free(req);
 }
 
-void
-gvinum_start(int argc, char **argv)
+static void
+gvinum_start(int argc, char * const *argv)
 {
 	struct gctl_req *req;
 	int i, initsize, j;
@@ -1167,7 +1181,6 @@
 		case 'S':
 			initsize = atoi(optarg);
 			break;
-		case '?':
 		default:
 			return;
 		}
@@ -1199,14 +1212,15 @@
 	gctl_free(req);
 }
 
-void
-gvinum_stop(int argc, char **argv)
+static void
+gvinum_stop(int argc, char * const *argv)
 {
 	int err, fileid;
 
-	fileid = kldfind(GVINUMMOD);
+	fileid = kldfind(GVINUMKLD);
 	if (fileid == -1) {
-		warn("cannot find " GVINUMMOD);
+		if (modfind(GVINUMMOD) < 0)
+			warn("cannot find " GVINUMKLD);
 		return;
 	}
 
@@ -1216,7 +1230,7 @@
 	 * event thread will be free for the g_wither_geom() call from
 	 * gv_unload().  It's silly, but it works.
 	 */
-	printf("unloading " GVINUMMOD " kernel module... ");
+	printf("unloading " GVINUMKLD " kernel module... ");
 	fflush(stdout);
 	if ((err = kldunload(fileid)) != 0 && (errno == EAGAIN)) {
 		sleep(1);
@@ -1224,7 +1238,7 @@
 	}
 	if (err != 0) {
 		printf(" failed!\n");
-		warn("cannot unload " GVINUMMOD);
+		warn("cannot unload " GVINUMKLD);
 		return;
 	}
 
@@ -1233,8 +1247,8 @@
 }
 
 /* Create a striped volume. */
-void
-gvinum_stripe(int argc, char **argv)
+static void
+gvinum_stripe(int argc, char * const *argv)
 {
 
 	if (argc < 2) {
@@ -1245,8 +1259,8 @@
 }
 
 /* Grow a subdisk by adding disk backed by provider. */
-void
-gvinum_grow(int argc, char **argv)
+static void
+gvinum_grow(int argc, char * const *argv)
 {
 	struct gctl_req *req;
 	char *drive, *sdname;
@@ -1256,6 +1270,7 @@
 	const char *errstr;
 	int drives, volumes, plexes, subdisks, flags;
 
+	flags = 0;
 	drives = volumes = plexes = subdisks = 0;
 	if (argc < 3) {
 		warnx("usage:\tgrow plex drive\n");
@@ -1323,9 +1338,10 @@
 	gctl_free(req);
 }
 
-void
-parseline(int argc, char **argv)
+static void
+parseline(int argc, char * const *argv)
 {
+
 	if (argc <= 0)
 		return;
 
@@ -1366,7 +1382,7 @@
 	else if (!strcmp(argv[0], "rename"))
 		gvinum_rename(argc, argv);
 	else if (!strcmp(argv[0], "resetconfig"))
-		gvinum_resetconfig();
+		gvinum_resetconfig(argc, argv);
 	else if (!strcmp(argv[0], "rm"))
 		gvinum_rm(argc, argv);
 	else if (!strcmp(argv[0], "saveconfig"))
@@ -1385,8 +1401,6 @@
 		gvinum_parityop(argc, argv, 1);
 	else
 		printf("unknown command '%s'\n", argv[0]);
-
-	return;
 }
 
 /*
@@ -1394,8 +1408,8 @@
  * gvinum_create when called without an argument, in order to give the user
  * something to edit.
  */
-void
-printconfig(FILE *of, char *comment)
+static void
+printconfig(FILE *of, const char *comment)
 {
 	struct gctl_req *req;
 	struct utsname uname_s;

Modified: trunk/sbin/gvinum/gvinum.h
===================================================================
--- trunk/sbin/gvinum/gvinum.h	2018-07-01 20:47:24 UTC (rev 11212)
+++ trunk/sbin/gvinum/gvinum.h	2018-07-01 20:47:52 UTC (rev 11213)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1997, 1998
  *	Nan Yang Computer Services Limited.  All rights reserved.
@@ -34,6 +35,7 @@
  * advised of the possibility of such damage.
  */
 
-/* $MidnightBSD$ */
+/* $FreeBSD: stable/10/sbin/gvinum/gvinum.h 265536 2014-05-07 09:55:47Z marius $ */
 
-#define GVINUMMOD	"geom_vinum"
+#define	GVINUMMOD	"g_vinum"
+#define	GVINUMKLD	"geom_vinum"



More information about the Midnightbsd-cvs mailing list