aboutsummaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorGreg Lehey <grog@FreeBSD.org>1999-03-19 07:21:27 +0000
committerGreg Lehey <grog@FreeBSD.org>1999-03-19 07:21:27 +0000
commitfd20bb017ec5a272b6724d4d5dec30ec4da7df6a (patch)
tree91a5029219a8cbbd87056cafffecdb761c2e9b40 /sbin
parent3c7e349bca815b06e917be10e10414c6ff57c711 (diff)
downloadsrc-fd20bb017ec5a272b6724d4d5dec30ec4da7df6a.tar.gz
src-fd20bb017ec5a272b6724d4d5dec30ec4da7df6a.zip
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.
Notes
Notes: svn path=/head/; revision=44888
Diffstat (limited to 'sbin')
-rw-r--r--sbin/vinum/v.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/sbin/vinum/v.c b/sbin/vinum/v.c
index b4aac6dbf204..66f0c688c2da 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 */