diff options
author | grog <grog@FreeBSD.org> | 1999-03-19 07:21:27 +0000 |
---|---|---|
committer | grog <grog@FreeBSD.org> | 1999-03-19 07:21:27 +0000 |
commit | ed579de08d60d573129e44f0a75b50b3e27d0198 (patch) | |
tree | 830ed381683f0fe358746980e13049d996ed9edf /sbin/vinum/v.c | |
parent | a7a3e25040cb860f8878c2ee615f4e6cced0385c (diff) | |
download | FreeBSD-src-ed579de08d60d573129e44f0a75b50b3e27d0198.zip FreeBSD-src-ed579de08d60d573129e44f0a75b50b3e27d0198.tar.gz |
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.
Diffstat (limited to 'sbin/vinum/v.c')
-rw-r--r-- | sbin/vinum/v.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/sbin/vinum/v.c b/sbin/vinum/v.c index b4aac6d..66f0c68 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 */ |