Subject: make release failure and opendisk(3) change
To: None <current-users@netbsd.org>
From: Bang Jun-Young <junyoung@mogua.com>
List: current-users
Date: 11/07/2001 23:09:22
Hi,

While I was trying to make release today, I got the following
error:

vnconfig -v -c /dev/vnd0d ramdisk-big.fs.tmp  512/128/1/32
vnconfig: /dev/vnd0d: opendisk: Operation not supported by device
*** Error code 1

This was due to a change made to opendisk(3) by lukem on 11/1:

revision 1.8
date: 2001/11/01 06:53:25;  author: lukem;  state: Exp;  lines: +43 -26
Enforce is iscooked arg;
	if zero, a matching path must be of type S_IFCHR, and
	if non-zero, a matching path must be of type S_IFBLK.

So when you call opendisk for block device, the last argument
must be non-zero, otherwise error is returned.

I'm attaching the patch that fixes the problem. Would anybody
commit this to the tree?

Index: vnconfig.c
===================================================================
RCS file: /cvsroot/basesrc/usr.sbin/vnconfig/vnconfig.c,v
retrieving revision 1.20
diff -u -r1.20 vnconfig.c
--- vnconfig.c	2001/09/26 07:05:39	1.20
+++ vnconfig.c	2001/11/07 13:51:35
@@ -163,7 +163,7 @@
 	char rdev[MAXPATHLEN + 1];
 	int fd, rv;
 
-	fd = opendisk(dev, O_RDWR, rdev, sizeof(rdev), 0);
+	fd = opendisk(dev, O_RDWR, rdev, sizeof(rdev), 1);
 	if (fd < 0) {
 		warn("%s: opendisk", rdev);
 		return (1);


Index: disklabel.c
===================================================================
RCS file: /cvsroot/basesrc/sbin/disklabel/disklabel.c,v
retrieving revision 1.99
diff -u -r1.99 disklabel.c
--- disklabel.c	2001/10/19 01:16:37	1.99
+++ disklabel.c	2001/11/07 13:50:53
@@ -278,7 +278,7 @@
 		usage();
 
 	dkname = argv[0];
-	f = opendisk(dkname, op == READ ? O_RDONLY : O_RDWR, np, MAXPATHLEN, 0);
+	f = opendisk(dkname, op == READ ? O_RDONLY : O_RDWR, np, MAXPATHLEN, 1);
 	specname = np;
 	np += strlen(specname) + 1;
 	if (f < 0)

Jun-Young

-- 
Bang Jun-Young <junyoung@mogua.com>