diff --git a/sbin/vinum/v.c b/sbin/vinum/v.c index b4aac6dbf20..66f0c688c2d 100644 --- a/sbin/vinum/v.c +++ b/sbin/vinum/v.c @@ -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 */