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>
This commit is contained in:
parent
3b21348301
commit
aa30608b44
@ -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) {
|
||||
|
@ -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 */
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user