summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgrog <grog@FreeBSD.org>1999-07-22 08:40:37 +0000
committergrog <grog@FreeBSD.org>1999-07-22 08:40:37 +0000
commit83880cb90483b6146cb79be6d0ff689512baa4e6 (patch)
tree5039e963053bb1b3a87073076933dd4529dbd651
parent9cda945475738ff06fb37e22dc4b701bf47c33d4 (diff)
downloadFreeBSD-src-83880cb90483b6146cb79be6d0ff689512baa4e6.zip
FreeBSD-src-83880cb90483b6146cb79be6d0ff689512baa4e6.tar.gz
Modify device numbering method to work with latest -CURRENT. Briefly,
the device numbers are now minor number only, so that we can still compare them after dev_t has turned into a blob. Broken-by: dev_t changes Reported-by: Vallo Kallaste <vallo@matti.ee> "Niels Chr. Bank-Pedersen" <ncbp@bank-pedersen.dk>
-rw-r--r--sbin/vinum/v.c8
-rw-r--r--sys/dev/vinum/vinum.c14
-rw-r--r--sys/dev/vinum/vinumvar.h12
3 files changed, 19 insertions, 15 deletions
diff --git a/sbin/vinum/v.c b/sbin/vinum/v.c
index f95223c..ecf6600 100644
--- a/sbin/vinum/v.c
+++ b/sbin/vinum/v.c
@@ -36,7 +36,7 @@
*
*/
-/* $Id: v.c,v 1.25 1999/03/21 01:18:23 grog Exp grog $ */
+/* $Id: v.c,v 1.16 1999/07/02 07:59:45 grog Exp $ */
#include <ctype.h>
#include <errno.h>
@@ -483,19 +483,19 @@ make_devices(void)
if (mknod(VINUM_SUPERDEV_NAME,
S_IRWXU | S_IFBLK, /* block device, user only */
- VINUM_SUPERDEV) < 0)
+ makedev(BDEV_MAJOR, VINUM_SUPERDEV)) < 0)
fprintf(stderr, "Can't create %s: %s\n", VINUM_SUPERDEV_NAME, strerror(errno));
if (mknod(VINUM_WRONGSUPERDEV_NAME,
S_IRWXU | S_IFBLK, /* block device, user only */
- VINUM_WRONGSUPERDEV) < 0)
+ makedev(BDEV_MAJOR, VINUM_WRONGSUPERDEV)) < 0)
fprintf(stderr, "Can't create %s: %s\n", VINUM_WRONGSUPERDEV_NAME, strerror(errno));
superdev = open(VINUM_SUPERDEV_NAME, O_RDWR); /* open the super device */
if (mknod(VINUM_DAEMON_DEV_NAME, /* daemon super device */
S_IRWXU | S_IFBLK, /* block device, user only */
- VINUM_DAEMON_DEV) < 0)
+ makedev(BDEV_MAJOR, VINUM_DAEMON_DEV)) < 0)
fprintf(stderr, "Can't create %s: %s\n", VINUM_DAEMON_DEV_NAME, strerror(errno));
if (ioctl(superdev, VINUM_GETCONFIG, &vinum_conf) < 0) {
diff --git a/sys/dev/vinum/vinum.c b/sys/dev/vinum/vinum.c
index d9e4599..1844fb3 100644
--- a/sys/dev/vinum/vinum.c
+++ b/sys/dev/vinum/vinum.c
@@ -33,7 +33,7 @@
* otherwise) arising in any way out of the use of this software, even if
* advised of the possibility of such damage.
*
- * $Id: vinum.c,v 1.24 1999/03/19 05:35:25 grog Exp grog $
+ * $Id: vinum.c,v 1.25 1999/06/29 04:07:55 grog Exp $
*/
#define STATIC static /* nothing while we're testing XXX */
@@ -266,7 +266,9 @@ vinumopen(dev_t dev,
struct volume *vol;
struct plex *plex;
struct sd *sd;
+ int devminor;
+ devminor = minor(dev);
error = 0;
/* First, decide what we're looking at */
switch (DEVTYPE(dev)) {
@@ -343,9 +345,9 @@ vinumopen(dev_t dev,
case VINUM_SUPERDEV_TYPE:
error = suser(p); /* are we root? */
if (error == 0) { /* yes, can do */
- if (dev == VINUM_DAEMON_DEV) /* daemon device */
+ if (devminor == VINUM_DAEMON_DEV) /* daemon device */
vinum_conf.flags |= VF_DAEMONOPEN; /* we're open */
- else if (dev == VINUM_SUPERDEV)
+ else if (devminor == VINUM_SUPERDEV)
vinum_conf.flags |= VF_OPEN; /* we're open */
else
error = ENODEV; /* nothing, maybe a debug mismatch */
@@ -364,7 +366,9 @@ vinumclose(dev_t dev,
{
unsigned int index;
struct volume *vol;
+ int devminor;
+ devminor = minor(dev);
index = Volno(dev);
/* First, decide what we're looking at */
switch (DEVTYPE(dev)) {
@@ -413,9 +417,9 @@ vinumclose(dev_t dev,
* don't worry about whether we're root:
* nobody else would get this far.
*/
- if (dev == VINUM_SUPERDEV) /* normal superdev */
+ if (devminor == VINUM_SUPERDEV) /* normal superdev */
vinum_conf.flags &= ~VF_OPEN; /* no longer open */
- else if (dev == VINUM_DAEMON_DEV) { /* the daemon device */
+ else if (devminor == VINUM_DAEMON_DEV) { /* the daemon device */
vinum_conf.flags &= ~VF_DAEMONOPEN; /* no longer open */
if (vinum_conf.flags & VF_STOPPING) /* we're stopping, */
wakeup(&vinumclose); /* we can continue stopping now */
diff --git a/sys/dev/vinum/vinumvar.h b/sys/dev/vinum/vinumvar.h
index d914dd8..5af8a98 100644
--- a/sys/dev/vinum/vinumvar.h
+++ b/sys/dev/vinum/vinumvar.h
@@ -33,7 +33,7 @@
* otherwise) arising in any way out of the use of this software, even if
* advised of the possibility of such damage.
*
- * $Id: vinumvar.h,v 1.19 1999/03/23 02:48:20 grog Exp grog $
+ * $Id: vinumvar.h,v 1.20 1999/07/02 07:56:47 grog Exp $
*/
#include <sys/time.h>
@@ -127,14 +127,14 @@ enum constants {
*/
#ifdef VINUMDEBUG
-#define VINUM_SUPERDEV VINUMBDEV (1, 0, 0, VINUM_SUPERDEV_TYPE) /* superdevice number */
-#define VINUM_WRONGSUPERDEV VINUMBDEV (2, 0, 0, VINUM_SUPERDEV_TYPE) /* non-debug superdevice number */
+#define VINUM_SUPERDEV VINUMMINOR (1, 0, 0, VINUM_SUPERDEV_TYPE) /* superdevice number */
+#define VINUM_WRONGSUPERDEV VINUMMINOR (2, 0, 0, VINUM_SUPERDEV_TYPE) /* non-debug superdevice number */
#else
-#define VINUM_SUPERDEV VINUMBDEV (2, 0, 0, VINUM_SUPERDEV_TYPE) /* superdevice number */
-#define VINUM_WRONGSUPERDEV VINUMBDEV (1, 0, 0, VINUM_SUPERDEV_TYPE) /* debug superdevice number */
+#define VINUM_SUPERDEV VINUMMINOR (2, 0, 0, VINUM_SUPERDEV_TYPE) /* superdevice number */
+#define VINUM_WRONGSUPERDEV VINUMMINOR (1, 0, 0, VINUM_SUPERDEV_TYPE) /* debug superdevice number */
#endif
-#define VINUM_DAEMON_DEV VINUMBDEV (0, 0, 0, VINUM_SUPERDEV_TYPE) /* daemon superdevice number */
+#define VINUM_DAEMON_DEV VINUMMINOR (0, 0, 0, VINUM_SUPERDEV_TYPE) /* daemon superdevice number */
/*
* the number of object entries to cater for initially, and also the
OpenPOWER on IntegriCloud