CVS commit: src/usr.sbin/vnconfig

2021-01-09 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Jan  9 23:54:26 UTC 2021

Modified Files:
src/usr.sbin/vnconfig: vnconfig.8

Log Message:
Add magic incantation to configure an image for mount_udf(8).


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/usr.sbin/vnconfig/vnconfig.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/vnconfig/vnconfig.8
diff -u src/usr.sbin/vnconfig/vnconfig.8:1.45 src/usr.sbin/vnconfig/vnconfig.8:1.46
--- src/usr.sbin/vnconfig/vnconfig.8:1.45	Sun Oct  7 20:30:50 2018
+++ src/usr.sbin/vnconfig/vnconfig.8	Sat Jan  9 23:54:26 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: vnconfig.8,v 1.45 2018/10/07 20:30:50 wiz Exp $
+.\"	$NetBSD: vnconfig.8,v 1.46 2021/01/09 23:54:26 wiz Exp $
 .\"
 .\" Copyright (c) 1997 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -61,7 +61,7 @@
 .\"
 .\"	@(#)vnconfig.8	8.1 (Berkeley) 6/5/93
 .\"
-.Dd November 6, 2015
+.Dd January 10, 2021
 .Dt VNDCONFIG 8
 .Os
 .Sh NAME
@@ -240,6 +240,13 @@ Configures the vnode disk
 emulating the geometry of 512 bytes per sector, 18 sectors per track,
 2 tracks per cylinder, and 80 cylinders total.
 .Pp
+.Dl vndconfig vnd0 /tmp/image.udf 2048/1/1/0
+.Pp
+Configures the vnode disk
+.Pa vnd0
+for an UDF image to be used with
+.Xr mount_udf 8 .
+.Pp
 .Dl vndconfig -t floppy vnd0 /tmp/floppy.img
 .Pp
 Configures the vnode disk



CVS commit: src/usr.sbin/vnconfig

2018-10-07 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Oct  7 20:30:50 UTC 2018

Modified Files:
src/usr.sbin/vnconfig: vnconfig.8 vnconfig.c

Log Message:
Sort options.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/usr.sbin/vnconfig/vnconfig.8
cvs rdiff -u -r1.47 -r1.48 src/usr.sbin/vnconfig/vnconfig.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/vnconfig/vnconfig.8
diff -u src/usr.sbin/vnconfig/vnconfig.8:1.44 src/usr.sbin/vnconfig/vnconfig.8:1.45
--- src/usr.sbin/vnconfig/vnconfig.8:1.44	Sun Oct  7 11:51:26 2018
+++ src/usr.sbin/vnconfig/vnconfig.8	Sun Oct  7 20:30:50 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: vnconfig.8,v 1.44 2018/10/07 11:51:26 mlelstv Exp $
+.\"	$NetBSD: vnconfig.8,v 1.45 2018/10/07 20:30:50 wiz Exp $
 .\"
 .\" Copyright (c) 1997 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -70,7 +70,7 @@
 .Sh SYNOPSIS
 .Nm
 .\" Fcf:lm:rt:uvz
-.Op Fl crivz
+.Op Fl cirvz
 .Op Fl f Ar disktab
 .Op Fl t Ar typename
 .Ar vnode_disk
@@ -144,6 +144,9 @@ option should look up in
 .Ar disktab
 instead of in
 .Pa /etc/disktab .
+.It Fl i
+Configure the device to use regular file I/O even when direct I/O using
+bmap/strategy would be possible.
 .It Fl l
 List the vnd devices and indicate which ones are in use.
 If one or more specific
@@ -168,9 +171,6 @@ is set to 0,
 then only vnd devices currently in use will be shown.
 .It Fl r
 Configure the device as read-only.
-.It Fl i
-Configure the device to use regular file I/O even when direct I/O using
-bmap/strategy would be possible.
 .It Fl t Ar typename
 If configuring the device, look up
 .Ar typename

Index: src/usr.sbin/vnconfig/vnconfig.c
diff -u src/usr.sbin/vnconfig/vnconfig.c:1.47 src/usr.sbin/vnconfig/vnconfig.c:1.48
--- src/usr.sbin/vnconfig/vnconfig.c:1.47	Sun Oct  7 11:51:26 2018
+++ src/usr.sbin/vnconfig/vnconfig.c	Sun Oct  7 20:30:50 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnconfig.c,v 1.47 2018/10/07 11:51:26 mlelstv Exp $	*/
+/*	$NetBSD: vnconfig.c,v 1.48 2018/10/07 20:30:50 wiz Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -432,7 +432,7 @@ usage(void)
 {
 	const char *p = getprogname();
 	(void)fprintf(stderr, 
-	"Usage: %s [-crivz] [-f dsktab] [-t type] vnode_disk"
+	"Usage: %s [-cirvz] [-f dsktab] [-t type] vnode_disk"
 		" reg-file [geomspec]\n"
 	"   %s -u [-Fv] vnode_disk\n"
 	"   %s -l [-m num | vnode_disk...]\n", p, p, p);



CVS commit: src/usr.sbin/vnconfig

2018-05-01 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue May  1 09:03:49 UTC 2018

Modified Files:
src/usr.sbin/vnconfig: vnconfig.8

Log Message:
Fix missed s/vnconfig/vndconfig/ in an example.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/usr.sbin/vnconfig/vnconfig.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/vnconfig/vnconfig.8
diff -u src/usr.sbin/vnconfig/vnconfig.8:1.42 src/usr.sbin/vnconfig/vnconfig.8:1.43
--- src/usr.sbin/vnconfig/vnconfig.8:1.42	Sun Apr 10 09:49:14 2016
+++ src/usr.sbin/vnconfig/vnconfig.8	Tue May  1 09:03:49 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: vnconfig.8,v 1.42 2016/04/10 09:49:14 wiz Exp $
+.\"	$NetBSD: vnconfig.8,v 1.43 2018/05/01 09:03:49 uwe Exp $
 .\"
 .\" Copyright (c) 1997 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -265,7 +265,7 @@ use:
 Using
 .Dl vndconfig -m0 -l /dev/vnd*d
 will omit those devices that are not in use, whereas
-.Dl vnconfig -l
+.Dl vndconfig -l
 will list all devices known to the kernel (at least 4
 without
 .Fl m )



CVS commit: src/usr.sbin/vnconfig

2018-03-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar 12 01:15:00 UTC 2018

Modified Files:
src/usr.sbin/vnconfig: vnconfig.c

Log Message:
improve previous, use getprogname() to get the invocation name.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/usr.sbin/vnconfig/vnconfig.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/vnconfig/vnconfig.c
diff -u src/usr.sbin/vnconfig/vnconfig.c:1.45 src/usr.sbin/vnconfig/vnconfig.c:1.46
--- src/usr.sbin/vnconfig/vnconfig.c:1.45	Sun Mar 11 21:10:25 2018
+++ src/usr.sbin/vnconfig/vnconfig.c	Sun Mar 11 21:15:00 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnconfig.c,v 1.45 2018/03/12 01:10:25 khorben Exp $	*/
+/*	$NetBSD: vnconfig.c,v 1.46 2018/03/12 01:15:00 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -423,11 +423,11 @@ getgeom(struct vndgeom *vng, char *cp)
 static void
 usage(void)
 {
-
-	(void)fprintf(stderr, "%s%s",
-	"usage: vndconfig [-crvz] [-f dsktab] [-t type] vnode_disk"
-		" reg-file [geomspec]\n",
-	"   vndconfig -u [-Fv] vnode_disk\n"
-	"   vndconfig -l [-m num | vnode_disk...]\n");
+	const char *p = getprogname();
+	(void)fprintf(stderr, 
+	"Usage: %s [-crvz] [-f dsktab] [-t type] vnode_disk"
+		" reg-file [geomspec]\n"
+	"   %s -u [-Fv] vnode_disk\n"
+	"   %s -l [-m num | vnode_disk...]\n", p, p, p);
 	exit(1);
 }



CVS commit: src/usr.sbin/vnconfig

2018-03-11 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Mon Mar 12 01:10:25 UTC 2018

Modified Files:
src/usr.sbin/vnconfig: vnconfig.c

Log Message:
Reflect the new name of vndconfig(8) in the usage screen

vnconfig(8) was renamed to vndconfig(8) in NetBSD 7. While the manual page
now defaults to vndconfig, the usage screen still referred to the old name.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/usr.sbin/vnconfig/vnconfig.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/vnconfig/vnconfig.c
diff -u src/usr.sbin/vnconfig/vnconfig.c:1.44 src/usr.sbin/vnconfig/vnconfig.c:1.45
--- src/usr.sbin/vnconfig/vnconfig.c:1.44	Sun Apr 10 09:04:09 2016
+++ src/usr.sbin/vnconfig/vnconfig.c	Mon Mar 12 01:10:25 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnconfig.c,v 1.44 2016/04/10 09:04:09 martin Exp $	*/
+/*	$NetBSD: vnconfig.c,v 1.45 2018/03/12 01:10:25 khorben Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -425,9 +425,9 @@ usage(void)
 {
 
 	(void)fprintf(stderr, "%s%s",
-	"usage: vnconfig [-crvz] [-f dsktab] [-t type] vnode_disk"
+	"usage: vndconfig [-crvz] [-f dsktab] [-t type] vnode_disk"
 		" reg-file [geomspec]\n",
-	"   vnconfig -u [-Fv] vnode_disk\n"
-	"   vnconfig -l [-m num | vnode_disk...]\n");
+	"   vndconfig -u [-Fv] vnode_disk\n"
+	"   vndconfig -l [-m num | vnode_disk...]\n");
 	exit(1);
 }



CVS commit: src/usr.sbin/vnconfig

2016-04-10 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Apr 10 09:49:14 UTC 2016

Modified Files:
src/usr.sbin/vnconfig: vnconfig.8

Log Message:
Sort sections. Use more markup.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/usr.sbin/vnconfig/vnconfig.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/vnconfig/vnconfig.8
diff -u src/usr.sbin/vnconfig/vnconfig.8:1.41 src/usr.sbin/vnconfig/vnconfig.8:1.42
--- src/usr.sbin/vnconfig/vnconfig.8:1.41	Sun Apr 10 09:04:09 2016
+++ src/usr.sbin/vnconfig/vnconfig.8	Sun Apr 10 09:49:14 2016
@@ -1,4 +1,4 @@
-.\"	$NetBSD: vnconfig.8,v 1.41 2016/04/10 09:04:09 martin Exp $
+.\"	$NetBSD: vnconfig.8,v 1.42 2016/04/10 09:49:14 wiz Exp $
 .\"
 .\" Copyright (c) 1997 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -196,6 +196,12 @@ If no action option
 is given,
 .Fl c
 is assumed.
+.Sh FILES
+.Bl -tag -width /etc/disktab -compact
+.It Pa /dev/rvnd??
+.It Pa /dev/vnd??
+.It Pa /etc/disktab
+.El
 .Sh EXIT STATUS
 .Nm
 will exit with status 0 if the operation requested
@@ -210,12 +216,6 @@ one which is still in use;
 or if devices are specified that do not exist or are not
 .Xr vnd 4
 devices, giving an improper geometry, etc.
-.Sh FILES
-.Bl -tag -width /etc/disktab -compact
-.It Pa /dev/rvnd??
-.It Pa /dev/vnd??
-.It Pa /etc/disktab
-.El
 .Sh EXAMPLES
 .Dl vndconfig vnd0 /tmp/diskimage
 or
@@ -252,10 +252,13 @@ Unconfigures the
 .Pa vnd0
 device.
 .Pp
-To obtain status on all vnd devices listed in /dev
+To obtain status on all vnd devices listed in
+.Pa /dev
 (assuming a system where the
 .Sq d
-partition is the whole device (RAW_PART)), use:
+partition is the whole device
+.Pq Dv RAW_PART ) ,
+use:
 .Pp
 .Dl vndconfig -l /dev/vnd*d
 .Pp
@@ -266,7 +269,9 @@ will omit those devices that are not in 
 will list all devices known to the kernel (at least 4
 without
 .Fl m )
-regardless of what might appear in /dev (or elsewhere.)
+regardless of what might appear in
+.Pa /dev
+(or elsewhere.)
 .Sh SEE ALSO
 .Xr vndcompress 1 ,
 .Xr opendisk 3 ,



CVS commit: src/usr.sbin/vnconfig

2015-11-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Nov  9 17:39:20 UTC 2015

Modified Files:
src/usr.sbin/vnconfig: vnconfig.c

Log Message:
Since now the kernel returns ENXIO again for devices exceeding the
number of devices configured in the kernel, use that instead of
scanning /dev.
XXX: pullup to 7 together with the kernel change.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/usr.sbin/vnconfig/vnconfig.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/vnconfig/vnconfig.c
diff -u src/usr.sbin/vnconfig/vnconfig.c:1.42 src/usr.sbin/vnconfig/vnconfig.c:1.43
--- src/usr.sbin/vnconfig/vnconfig.c:1.42	Fri May 23 16:50:16 2014
+++ src/usr.sbin/vnconfig/vnconfig.c	Mon Nov  9 12:39:20 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnconfig.c,v 1.42 2014/05/23 20:50:16 dholland Exp $	*/
+/*	$NetBSD: vnconfig.c,v 1.43 2015/11/09 17:39:20 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -73,13 +73,11 @@
 #include 
 #include 
 #include 
-#include 
 
 #include 
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -100,7 +98,7 @@ static int	force = 0;
 static int	compressed = 0;
 static char	*tabname;
 
-static void	show(int, int);
+static int	show(int, int);
 static int	config(char *, char *, char *, int);
 static int	getgeom(struct vndgeom *, char *);
 __dead static void	usage(void);
@@ -177,26 +175,8 @@ main(int argc, char *argv[])
 		if (argc)
 			show(v, -1);
 		else {
-			DIR *dirp;
-			struct dirent *dp;
-			__BITMAP_TYPE(, uint32_t, 65536) bm;
-
-			__BITMAP_ZERO();
-
-			if ((dirp = opendir(_PATH_DEV)) == NULL)
-err(1, "opendir: %s", _PATH_DEV);
-
-			while ((dp = readdir(dirp)) != NULL) {
-if (strncmp(dp->d_name, "rvnd", 4) != 0)
-	continue;
-n = atoi(dp->d_name + 4);
-if (__BITMAP_ISSET(n, ))
-	continue;
-__BITMAP_SET(n, );
-show(v, n);
-			}
-
-			closedir(dirp);
+			for (n = 0; show(v, n); n++)
+continue;
 		}
 		close(v);
 		rv = 0;
@@ -204,7 +184,7 @@ main(int argc, char *argv[])
 	return rv;
 }
 
-static void
+static int
 show(int v, int n)
 {
 	struct vnd_user vnu;
@@ -213,12 +193,15 @@ show(int v, int n)
 	int i, nmount;
 
 	vnu.vnu_unit = n;
-	if (ioctl(v, VNDIOCGET, ) == -1)
-		err(1, "VNDIOCGET");
+	if (ioctl(v, VNDIOCGET, ) == -1) {
+		if (errno != ENXIO)
+			err(1, "VNDIOCGET");
+		return 0;
+	}
 
 	if (vnu.vnu_ino == 0) {
 		printf("vnd%d: not in use\n", vnu.vnu_unit);
-		return;
+		return 1;
 	}
 
 	printf("vnd%d: ", vnu.vnu_unit);
@@ -251,6 +234,7 @@ show(int v, int n)
 		(unsigned long long)minor(vnu.vnu_dev));
 
 	printf("inode %llu\n", (unsigned long long)vnu.vnu_ino);
+	return 1;
 }
 
 static int



CVS commit: src/usr.sbin/vnconfig

2015-11-05 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Nov  5 22:35:24 UTC 2015

Modified Files:
src/usr.sbin/vnconfig: vnconfig.8

Log Message:
Update to keep up with reality.  In NetBSD 7, the vnconfig command was
renamed.  So add this fact to the HISTORY section and remove BUGS.

XXX Pull-up to NetBSD-7 !


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/usr.sbin/vnconfig/vnconfig.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/vnconfig/vnconfig.8
diff -u src/usr.sbin/vnconfig/vnconfig.8:1.39 src/usr.sbin/vnconfig/vnconfig.8:1.40
--- src/usr.sbin/vnconfig/vnconfig.8:1.39	Sun Jun  9 18:39:31 2013
+++ src/usr.sbin/vnconfig/vnconfig.8	Thu Nov  5 22:35:24 2015
@@ -1,4 +1,4 @@
-.\"	$NetBSD: vnconfig.8,v 1.39 2013/06/09 18:39:31 christos Exp $
+.\"	$NetBSD: vnconfig.8,v 1.40 2015/11/05 22:35:24 pgoyette Exp $
 .\"
 .\" Copyright (c) 1997 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -61,7 +61,7 @@
 .\"
 .\"	@(#)vnconfig.8	8.1 (Berkeley) 6/5/93
 .\"
-.Dd June 9, 2013
+.Dd November 6, 2015
 .Dt VNDCONFIG 8
 .Os
 .Sh NAME
@@ -221,9 +221,12 @@ device.
 .Xr umount 8
 .Sh HISTORY
 The
-.Nm
+.Nm vnconfig
 command appeared in
 .Nx 1.0 .
-.Sh BUGS
-This command should really be named
-.Nm vndconfig .
+It was renamed to
+.Nm
+in
+.Nx 7.0
+for consistency with other similar commands.
+(The original name was also retained for backwards compatability.)



CVS commit: src/usr.sbin/vnconfig

2014-05-23 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Fri May 23 20:50:16 UTC 2014

Modified Files:
src/usr.sbin/vnconfig: vnconfig.c

Log Message:
PR bin/48829 Thomas Schmitt: vnconfig pretends to succeed on
nonexistent files


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/usr.sbin/vnconfig/vnconfig.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/vnconfig/vnconfig.c
diff -u src/usr.sbin/vnconfig/vnconfig.c:1.41 src/usr.sbin/vnconfig/vnconfig.c:1.42
--- src/usr.sbin/vnconfig/vnconfig.c:1.41	Sun Jun  9 13:25:40 2013
+++ src/usr.sbin/vnconfig/vnconfig.c	Fri May 23 20:50:16 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnconfig.c,v 1.41 2013/06/09 13:25:40 christos Exp $	*/
+/*	$NetBSD: vnconfig.c,v 1.42 2014/05/23 20:50:16 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -318,9 +318,10 @@ config(char *dev, char *file, char *geom
 		int	ffd;
 
 		ffd = open(file, readonly ? O_RDONLY : O_RDWR);
-		if (ffd  0)
+		if (ffd  0) {
 			warn(%s, file);
-		else {
+			rv = -1;
+		} else {
 			(void) close(ffd);
 
 			rv = ioctl(fd, VNDIOCSET, vndio);



CVS commit: src/usr.sbin/vnconfig

2013-06-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jun  9 13:25:41 UTC 2013

Modified Files:
src/usr.sbin/vnconfig: vnconfig.c

Log Message:
Now that we grow vnd's dynamically we cannot depend on the kernel returning
ENXIO when we exceed the number of configured vnds, so in the -l case, print
info for all vnds we can find device nodes for in /dev.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/usr.sbin/vnconfig/vnconfig.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/vnconfig/vnconfig.c
diff -u src/usr.sbin/vnconfig/vnconfig.c:1.40 src/usr.sbin/vnconfig/vnconfig.c:1.41
--- src/usr.sbin/vnconfig/vnconfig.c:1.40	Tue Aug 30 16:54:18 2011
+++ src/usr.sbin/vnconfig/vnconfig.c	Sun Jun  9 09:25:40 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnconfig.c,v 1.40 2011/08/30 20:54:18 joerg Exp $	*/
+/*	$NetBSD: vnconfig.c,v 1.41 2013/06/09 13:25:40 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -73,11 +73,13 @@
 #include sys/buf.h
 #include sys/disklabel.h
 #include sys/disk.h
+#include sys/bitops.h
 
 #include dev/vndvar.h
 
 #include disktab.h
 #include err.h
+#include dirent.h
 #include errno.h
 #include fcntl.h
 #include stddef.h
@@ -86,6 +88,7 @@
 #include string.h
 #include unistd.h
 #include util.h
+#include paths.h
 
 #define VND_CONFIG	1
 #define VND_UNCONFIG	2
@@ -97,6 +100,7 @@ static int	force = 0;
 static int	compressed = 0;
 static char	*tabname;
 
+static void	show(int, int);
 static int	config(char *, char *, char *, int);
 static int	getgeom(struct vndgeom *, char *);
 __dead static void	usage(void);
@@ -157,10 +161,9 @@ main(int argc, char *argv[])
 			usage();
 		rv = config(argv[0], NULL, NULL, action);
 	} else { /* VND_GET */
+		int n, v;
 		const char *vn;
 		char path[64];
-		struct vnd_user vnu;
-		int v, n;
 
 		if (argc != 0  argc != 1)
 			usage();
@@ -171,66 +174,83 @@ main(int argc, char *argv[])
 		if (v == -1)
 			err(1, open: %s, vn);
 
-		for (n = 0; ; n++) {
-			vnu.vnu_unit = argc ? -1 : n;
-			rv = ioctl(v, VNDIOCGET, vnu);
-			if (rv == -1) {
-if (errno == ENXIO)
-	break;
-err(1, VNDIOCGET);
+		if (argc)
+			show(v, -1);
+		else {
+			DIR *dirp;
+			struct dirent *dp;
+			__BITMAP_TYPE(, uint32_t, 65536) bm;
+
+			__BITMAP_ZERO(bm);
+
+			if ((dirp = opendir(_PATH_DEV)) == NULL)
+err(1, opendir: %s, _PATH_DEV);
+
+			while ((dp = readdir(dirp)) != NULL) {
+if (strncmp(dp-d_name, rvnd, 4) != 0)
+	continue;
+n = atoi(dp-d_name + 4);
+if (__BITMAP_ISSET(n, bm))
+	continue;
+__BITMAP_SET(n, bm);
+show(v, n);
 			}
 
-			if (vnu.vnu_ino == 0)
-printf(vnd%d: not in use\n,
-vnu.vnu_unit);
-			else {
-char *dev;
-struct statvfs *mnt = NULL;
-int i, nmount;
-
-nmount = 0;	/* XXXGCC -Wuninitialized */
-
-printf(vnd%d: , vnu.vnu_unit);
-
-dev = devname(vnu.vnu_dev, S_IFBLK);
-if (dev != NULL)
-	nmount = getmntinfo(mnt, MNT_NOWAIT);
-else
-	mnt = NULL;
-if (mnt != NULL) {
-	for (i = 0; i  nmount; i++) {
-		if (strncmp(
-		mnt[i].f_mntfromname,
-		/dev/, 5) == 0 
-		strcmp(
-		mnt[i].f_mntfromname + 5,
-		dev) == 0)
-			break;
-	}
-	if (i  nmount)
-		printf(%s (%s) ,
-		mnt[i].f_mntonname,
-		mnt[i].f_mntfromname);
-	else
-		printf(%s , dev);
-}
-else if (dev != NULL)
-	printf(%s , dev);
-else
-	printf(dev %llu,%llu ,
-	(unsigned long long)major(vnu.vnu_dev),
-	(unsigned long long)minor(vnu.vnu_dev));
+			closedir(dirp);
+		}
+		close(v);
+		rv = 0;
+	}
+	return rv;
+}
 
-printf(inode %llu\n,
-(unsigned long long)vnu.vnu_ino);
-			}
+static void
+show(int v, int n)
+{
+	struct vnd_user vnu;
+	char *dev;
+	struct statvfs *mnt;
+	int i, nmount;
+
+	vnu.vnu_unit = n;
+	if (ioctl(v, VNDIOCGET, vnu) == -1)
+		err(1, VNDIOCGET);
+
+	if (vnu.vnu_ino == 0) {
+		printf(vnd%d: not in use\n, vnu.vnu_unit);
+		return;
+	}
 
-			if (argc)
+	printf(vnd%d: , vnu.vnu_unit);
+
+	dev = devname(vnu.vnu_dev, S_IFBLK);
+	if (dev != NULL)
+		nmount = getmntinfo(mnt, MNT_NOWAIT);
+	else {
+		mnt = NULL;
+		nmount = 0;
+	}
+
+	if (mnt != NULL) {
+		for (i = 0; i  nmount; i++) {
+			if (strncmp(mnt[i].f_mntfromname, /dev/, 5) == 0 
+			strcmp(mnt[i].f_mntfromname + 5, dev) == 0)
 break;
 		}
-		close(v);
+		if (i  nmount)
+			printf(%s (%s) , mnt[i].f_mntonname,
+			mnt[i].f_mntfromname);
+		else
+			printf(%s , dev);
 	}
-	exit(rv);
+	else if (dev != NULL)
+		printf(%s , dev);
+	else
+		printf(dev %llu,%llu ,
+		(unsigned long long)major(vnu.vnu_dev),
+		(unsigned long long)minor(vnu.vnu_dev));
+
+	printf(inode %llu\n, (unsigned long long)vnu.vnu_ino);
 }
 
 static int



CVS commit: src/usr.sbin/vnconfig

2013-06-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jun  9 18:39:05 UTC 2013

Modified Files:
src/usr.sbin/vnconfig: Makefile vnconfig.8

Log Message:
Alias this to vndconfig for symmetry.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/vnconfig/Makefile
cvs rdiff -u -r1.37 -r1.38 src/usr.sbin/vnconfig/vnconfig.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/vnconfig/Makefile
diff -u src/usr.sbin/vnconfig/Makefile:1.6 src/usr.sbin/vnconfig/Makefile:1.7
--- src/usr.sbin/vnconfig/Makefile:1.6	Sat Nov 30 01:04:57 2002
+++ src/usr.sbin/vnconfig/Makefile	Sun Jun  9 14:39:05 2013
@@ -1,8 +1,10 @@
-#	$NetBSD: Makefile,v 1.6 2002/11/30 06:04:57 lukem Exp $
+#	$NetBSD: Makefile,v 1.7 2013/06/09 18:39:05 christos Exp $
 
 PROG=		vnconfig
 MAN=		vnconfig.8
 DPADD+=		${LIBUTIL}
 LDADD+=		-lutil
+LINKS+=		vnconfig vndconfig
+MLINKS+=	vnconfig.8 vndconfig.8
 
 .include bsd.prog.mk

Index: src/usr.sbin/vnconfig/vnconfig.8
diff -u src/usr.sbin/vnconfig/vnconfig.8:1.37 src/usr.sbin/vnconfig/vnconfig.8:1.38
--- src/usr.sbin/vnconfig/vnconfig.8:1.37	Sun Jul  8 18:49:55 2012
+++ src/usr.sbin/vnconfig/vnconfig.8	Sun Jun  9 14:39:05 2013
@@ -1,4 +1,4 @@
-.\	$NetBSD: vnconfig.8,v 1.37 2012/07/08 22:49:55 wiz Exp $
+.\	$NetBSD: vnconfig.8,v 1.38 2013/06/09 18:39:05 christos Exp $
 .\
 .\ Copyright (c) 1997 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -62,10 +62,10 @@
 .\	@(#)vnconfig.8	8.1 (Berkeley) 6/5/93
 .\
 .Dd July 9, 2012
-.Dt VNCONFIG 8
+.Dt VNDCONFIG 8
 .Os
 .Sh NAME
-.Nm vnconfig
+.Nm vndconfig
 .Nd configure vnode disks
 .Sh SYNOPSIS
 .Nm
@@ -182,23 +182,23 @@ is assumed.
 .It Pa /etc/disktab
 .El
 .Sh EXAMPLES
-.Dl vnconfig vnd0 /tmp/diskimage
+.Dl vndconfig vnd0 /tmp/diskimage
 or
-.Dl vnconfig /dev/rvnd0c /tmp/diskimage
+.Dl vndconfig /dev/rvnd0c /tmp/diskimage
 .Pp
 Configures the vnode disk
 .Pa vnd0 .
 Please note that use of the second form of the command is discouraged because
 it requires knowledge of the raw partition which varies between architectures.
 .Pp
-.Dl vnconfig vnd0 /tmp/floppy.img 512/18/2/80
+.Dl vndconfig vnd0 /tmp/floppy.img 512/18/2/80
 .Pp
 Configures the vnode disk
 .Pa vnd0
 emulating the geometry of 512 bytes per sector, 18 sectors per track,
 2 tracks per cylinder, and 80 cylinders total.
 .Pp
-.Dl vnconfig -t floppy vnd0 /tmp/floppy.img
+.Dl vndconfig -t floppy vnd0 /tmp/floppy.img
 .Pp
 Configures the vnode disk
 .Pa vnd0
@@ -207,7 +207,7 @@ using the geometry specified in the
 entry in
 .Pa /etc/disktab .
 .Pp
-.Dl vnconfig -u vnd0
+.Dl vndconfig -u vnd0
 .Pp
 Unconfigures the
 .Pa vnd0



CVS commit: src/usr.sbin/vnconfig

2013-06-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jun  9 18:39:31 UTC 2013

Modified Files:
src/usr.sbin/vnconfig: vnconfig.8

Log Message:
bump date.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/usr.sbin/vnconfig/vnconfig.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/vnconfig/vnconfig.8
diff -u src/usr.sbin/vnconfig/vnconfig.8:1.38 src/usr.sbin/vnconfig/vnconfig.8:1.39
--- src/usr.sbin/vnconfig/vnconfig.8:1.38	Sun Jun  9 14:39:05 2013
+++ src/usr.sbin/vnconfig/vnconfig.8	Sun Jun  9 14:39:31 2013
@@ -1,4 +1,4 @@
-.\	$NetBSD: vnconfig.8,v 1.38 2013/06/09 18:39:05 christos Exp $
+.\	$NetBSD: vnconfig.8,v 1.39 2013/06/09 18:39:31 christos Exp $
 .\
 .\ Copyright (c) 1997 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -61,7 +61,7 @@
 .\
 .\	@(#)vnconfig.8	8.1 (Berkeley) 6/5/93
 .\
-.Dd July 9, 2012
+.Dd June 9, 2013
 .Dt VNDCONFIG 8
 .Os
 .Sh NAME



CVS commit: src/usr.sbin/vnconfig

2013-06-09 Thread Julio Merino
Module Name:src
Committed By:   jmmv
Date:   Sun Jun  9 22:00:50 UTC 2013

Modified Files:
src/usr.sbin/vnconfig: Makefile

Log Message:
Fix LINKS spec.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/vnconfig/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/vnconfig/Makefile
diff -u src/usr.sbin/vnconfig/Makefile:1.7 src/usr.sbin/vnconfig/Makefile:1.8
--- src/usr.sbin/vnconfig/Makefile:1.7	Sun Jun  9 18:39:05 2013
+++ src/usr.sbin/vnconfig/Makefile	Sun Jun  9 22:00:50 2013
@@ -1,10 +1,10 @@
-#	$NetBSD: Makefile,v 1.7 2013/06/09 18:39:05 christos Exp $
+#	$NetBSD: Makefile,v 1.8 2013/06/09 22:00:50 jmmv Exp $
 
 PROG=		vnconfig
 MAN=		vnconfig.8
 DPADD+=		${LIBUTIL}
 LDADD+=		-lutil
-LINKS+=		vnconfig vndconfig
+LINKS+=		${BINDIR}/vnconfig ${BINDIR}/vndconfig
 MLINKS+=	vnconfig.8 vndconfig.8
 
 .include bsd.prog.mk



CVS commit: src/usr.sbin/vnconfig

2012-07-08 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Jul  8 22:49:56 UTC 2012

Modified Files:
src/usr.sbin/vnconfig: vnconfig.8

Log Message:
From Bug Hunting: Add vndcompress(1) to SEE ALSO, bump date.

While here:
New sentence, new line.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/usr.sbin/vnconfig/vnconfig.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/vnconfig/vnconfig.8
diff -u src/usr.sbin/vnconfig/vnconfig.8:1.36 src/usr.sbin/vnconfig/vnconfig.8:1.37
--- src/usr.sbin/vnconfig/vnconfig.8:1.36	Wed Feb  9 10:25:40 2011
+++ src/usr.sbin/vnconfig/vnconfig.8	Sun Jul  8 22:49:55 2012
@@ -1,4 +1,4 @@
-.\	$NetBSD: vnconfig.8,v 1.36 2011/02/09 10:25:40 rmind Exp $
+.\	$NetBSD: vnconfig.8,v 1.37 2012/07/08 22:49:55 wiz Exp $
 .\
 .\ Copyright (c) 1997 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -61,7 +61,7 @@
 .\
 .\	@(#)vnconfig.8	8.1 (Berkeley) 6/5/93
 .\
-.Dd July 16, 2005
+.Dd July 9, 2012
 .Dt VNCONFIG 8
 .Os
 .Sh NAME
@@ -123,7 +123,8 @@ argument is:
 If geometry is not specified, the kernel will choose a default based on 1MB
 cylinders.
 .Ar secsize
-is the number of bytes per sector.  It must be an even multiple of 512.
+is the number of bytes per sector.
+It must be an even multiple of 512.
 .Ar nsectors
 is the number of sectors per track.
 .Ar ntracks
@@ -142,7 +143,8 @@ option should look up in
 instead of in
 .Pa /etc/disktab .
 .It Fl l
-List the vnd devices and indicate which ones are in use.  If a specific
+List the vnd devices and indicate which ones are in use.
+If a specific
 .Ar vnode_disk
 is given, then only that will be described.
 .It Fl t Ar typename
@@ -150,7 +152,8 @@ If configuring the device, look up
 .Ar typename
 in
 .Pa /etc/disktab
-and use the geometry specified in the entry.  This option and the
+and use the geometry specified in the entry.
+This option and the
 .Ar geomspec
 argument are mutually exclusive.
 .It Fl r
@@ -210,6 +213,7 @@ Unconfigures the
 .Pa vnd0
 device.
 .Sh SEE ALSO
+.Xr vndcompress 1 ,
 .Xr opendisk 3 ,
 .Xr vnd 4 ,
 .Xr mount 8 ,



CVS commit: src/usr.sbin/vnconfig

2011-08-30 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Tue Aug 30 20:54:18 UTC 2011

Modified Files:
src/usr.sbin/vnconfig: vnconfig.c

Log Message:
ANSIfy + static + __dead


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/usr.sbin/vnconfig/vnconfig.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/vnconfig/vnconfig.c
diff -u src/usr.sbin/vnconfig/vnconfig.c:1.39 src/usr.sbin/vnconfig/vnconfig.c:1.40
--- src/usr.sbin/vnconfig/vnconfig.c:1.39	Tue Feb  8 20:20:28 2011
+++ src/usr.sbin/vnconfig/vnconfig.c	Tue Aug 30 20:54:18 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnconfig.c,v 1.39 2011/02/08 20:20:28 rmind Exp $	*/
+/*	$NetBSD: vnconfig.c,v 1.40 2011/08/30 20:54:18 joerg Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -91,22 +91,18 @@
 #define VND_UNCONFIG	2
 #define VND_GET		3
 
-int	verbose = 0;
-int	readonly = 0;
-int	force = 0;
-int	compressed = 0;
-char	*tabname;
-
-int	config __P((char *, char *, char *, int));
-int	getgeom __P((struct vndgeom *, char *));
-int	main __P((int, char **));
-char   *rawdevice __P((char *));
-void	usage __P((void));
+static int	verbose = 0;
+static int	readonly = 0;
+static int	force = 0;
+static int	compressed = 0;
+static char	*tabname;
+
+static int	config(char *, char *, char *, int);
+static int	getgeom(struct vndgeom *, char *);
+__dead static void	usage(void);
 
 int
-main(argc, argv)
-	int argc;
-	char *argv[];
+main(int argc, char *argv[])
 {
 	int ch, rv, action = VND_CONFIG;
 
@@ -237,10 +233,8 @@
 	exit(rv);
 }
 
-int
-config(dev, file, geom, action)
-	char *dev, *file, *geom;
-	int action;
+static int
+config(char *dev, char *file, char *geom, int action)
 {
 	struct vnd_ioctl vndio;
 	struct disklabel *lp;
@@ -337,10 +331,8 @@
 	return (rv  0);
 }
 
-int
-getgeom(vng, cp)
-	struct vndgeom *vng;
-	char *cp;
+static int
+getgeom(struct vndgeom *vng, char *cp)
 {
 	char *secsize, *nsectors, *ntracks, *ncylinders;
 
@@ -381,8 +373,8 @@
 	return (0);
 }
 
-void
-usage()
+static void
+usage(void)
 {
 
 	(void)fprintf(stderr, %s%s,



CVS commit: src/usr.sbin/vnconfig

2009-12-06 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Sun Dec  6 16:35:16 UTC 2009

Modified Files:
src/usr.sbin/vnconfig: vnconfig.c

Log Message:
VNDIOCSET now returns a 64bit unsigned size.
Use compat ioctls if the kernel rejects the request.
Fixes PR/41873.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/usr.sbin/vnconfig/vnconfig.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/vnconfig/vnconfig.c
diff -u src/usr.sbin/vnconfig/vnconfig.c:1.37 src/usr.sbin/vnconfig/vnconfig.c:1.38
--- src/usr.sbin/vnconfig/vnconfig.c:1.37	Sun Apr 19 00:56:32 2009
+++ src/usr.sbin/vnconfig/vnconfig.c	Sun Dec  6 16:35:16 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnconfig.c,v 1.37 2009/04/19 00:56:32 lukem Exp $	*/
+/*	$NetBSD: vnconfig.c,v 1.38 2009/12/06 16:35:16 dsl Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -119,6 +119,7 @@
 #include err.h
 #include errno.h
 #include fcntl.h
+#include stddef.h
 #include stdio.h
 #include stdlib.h
 #include string.h
@@ -326,6 +327,10 @@
 		if (force)
 			vndio.vnd_flags |= VNDIOF_FORCE;
 		rv = ioctl(fd, VNDIOCCLR, vndio);
+#ifdef VNDIOOCCLR
+		if (rv  errno == ENOTTY)
+			rv = ioctl(fd, VNDIOOCCLR, vndio);
+#endif
 		if (rv)
 			warn(%s: VNDIOCCLR, rdev);
 		else if (verbose)
@@ -344,10 +349,16 @@
 			(void) close(ffd);
 
 			rv = ioctl(fd, VNDIOCSET, vndio);
+#ifdef VNDIOOCSET
+			if (rv  errno == ENOTTY) {
+rv = ioctl(fd, VNDIOOCSET, vndio);
+vndio.vnd_size = vndio.vnd_osize;
+			}
+#endif
 			if (rv)
 warn(%s: VNDIOCSET, rdev);
 			else if (verbose) {
-printf(%s: %d bytes on %s, rdev,
+printf(%s: % PRIu64  bytes on %s, rdev,
 vndio.vnd_size, file);
 if (vndio.vnd_flags  VNDIOF_HASGEOM)
 	printf( using geometry %d/%d/%d/%d,



CVS commit: src/usr.sbin/vnconfig

2009-04-18 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Sun Apr 19 00:56:32 UTC 2009

Modified Files:
src/usr.sbin/vnconfig: vnconfig.c

Log Message:
Fix -Wcast-qual and -Wshadow issues


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/usr.sbin/vnconfig/vnconfig.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/vnconfig/vnconfig.c
diff -u src/usr.sbin/vnconfig/vnconfig.c:1.36 src/usr.sbin/vnconfig/vnconfig.c:1.37
--- src/usr.sbin/vnconfig/vnconfig.c:1.36	Mon Dec 29 03:49:17 2008
+++ src/usr.sbin/vnconfig/vnconfig.c	Sun Apr 19 00:56:32 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnconfig.c,v 1.36 2008/12/29 03:49:17 christos Exp $	*/
+/*	$NetBSD: vnconfig.c,v 1.37 2009/04/19 00:56:32 lukem Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -199,7 +199,8 @@
 			usage();
 		rv = config(argv[0], NULL, NULL, action);
 	} else { /* VND_GET */
-		char *vn, path[64];
+		const char *vn;
+		char path[64];
 		struct vnd_user vnu;
 		int v, n;
 
@@ -227,19 +228,19 @@
 			else {
 char *dev;
 struct statvfs *mnt = NULL;
-int i, n;
+int i, nmount;
 
-n = 0;	/* XXXGCC -Wuninitialized */
+nmount = 0;	/* XXXGCC -Wuninitialized */
 
 printf(vnd%d: , vnu.vnu_unit);
 
 dev = devname(vnu.vnu_dev, S_IFBLK);
 if (dev != NULL)
-	n = getmntinfo(mnt, MNT_NOWAIT);
+	nmount = getmntinfo(mnt, MNT_NOWAIT);
 else
 	mnt = NULL;
 if (mnt != NULL) {
-	for (i = 0; i  n; i++) {
+	for (i = 0; i  nmount; i++) {
 		if (strncmp(
 		mnt[i].f_mntfromname,
 		/dev/, 5) == 0 
@@ -248,7 +249,7 @@
 		dev) == 0)
 			break;
 	}
-	if (i  n)
+	if (i  nmount)
 		printf(%s (%s) ,
 		mnt[i].f_mntonname,
 		mnt[i].f_mntfromname);