If we fail to open the super device, open the "wrong" device (that is,

the debug superdevice when we're compiled without debug, or the normal
superdevice when we're compiled with debug.  If this succeeds, print
an informative comment and exit.

make_devices: Create both debug and normal superdevices.
This commit is contained in:
Greg Lehey 1999-03-19 07:21:27 +00:00
parent 3c7e349bca
commit fd20bb017e

View file

@ -134,7 +134,33 @@ main(int argc, char *argv[])
superdev = open(VINUM_SUPERDEV_NAME, O_RDWR); /* open vinum superdevice */
if (superdev < 0) { /* no go */
if (errno == ENOENT) /* we don't have our node, */
if (errno == ENODEV) { /* not configured, */
superdev = open(VINUM_WRONGSUPERDEV_NAME, O_RDWR); /* do we have a debug mismatch? */
if (superdev >= 0) { /* yup! */
#if VINUMDEBUG
fprintf(stderr,
"This program is compiled with debug support, but the kernel module does\n"
"not have debug support. This program must be matched with the kernel\n"
"module. Please alter /usr/src/sbin/" VINUMMOD "/Makefile and remove\n"
"the option -DVINUMDEBUG from the CFLAGS definition, or alternatively\n"
"edit /usr/src/sys/modules/" VINUMMOD "/Makefile and add the option\n"
"-DVINUMDEBUG to the CFLAGS definition. Then rebuild the component\n"
"of your choice with 'make clean all install'. If you rebuild the kernel\n"
"module, you must stop " VINUMMOD " and restart it\n");
#else
fprintf(stderr,
"This program is compiled without debug support, but the kernel module\n"
"includes debug support. This program must be matched with the kernel\n"
"module. Please alter /usr/src/sbin/" VINUMMOD "/Makefile and add\n"
"the option -DVINUMDEBUG to the CFLAGS definition, or alternatively\n"
"edit /usr/src/sys/modules/" VINUMMOD "/Makefile and remove the option\n"
"-DVINUMDEBUG from the CFLAGS definition. Then rebuild the component\n"
"of your choice with 'make clean all install'. If you rebuild the kernel\n"
"module, you must stop " VINUMMOD " and restart it\n");
#endif
return 1;
}
} else if (errno == ENOENT) /* we don't have our node, */
make_devices(); /* create them first */
if (superdev < 0) {
perror("Can't open " VINUM_SUPERDEV_NAME);
@ -402,6 +428,11 @@ make_devices(void)
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)
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 */