[issue782] missleading error message on mountroot prompt

Nicolas Thery sinknull at crater.dragonflybsd.org
Sun Aug 26 00:50:21 PDT 2007


Nicolas Thery <nthery at gmail.com> added the comment:

Here is a patch that displays a hopefully more informative message when
kgetdiskbyname() fails and changes mountroot '?' to list only disk devices.

Displaying available disk slices and partitions is trickier
(vfs_mountroot_ask_callback() is called only once per physical disk).  I'm
looking into it ...

Index: dfly/src/sys/kern/vfs_conf.c
===================================================================
--- dfly.orig/src/sys/kern/vfs_conf.c	2007-08-25 22:31:40.028281000 +0200
+++ dfly/src/sys/kern/vfs_conf.c	2007-08-25 22:41:06.000000000 +0200
@@ -304,14 +304,13 @@
 	return(1);
 }
 
-static
-int
+static int
 vfs_mountroot_ask_callback(struct dev_ops *ops, void *arg __unused)
 {
 	cdev_t dev;
 
 	dev = get_dev(ops->head.maj, 0);
-	if (dev_is_good(dev))
+	if (dev_is_good(dev) && (dev_dflags(dev) & D_DISK))
 		kprintf(" \"%s\"", dev_dname(dev));
 	return(0);
 }
@@ -439,7 +438,7 @@
 	}
 
 	if (*cp != '\0') {
-		kprintf("junk after name\n");
+		kprintf("junk after name: %s\n", cp);
 		return (NULL);
 	}
 
@@ -452,7 +451,7 @@
 	info.minor = dkmakeminor(unit, slice, part);
 	dev_ops_scan(kgetdiskbyname_callback, &info);
 	if (info.dev == NULL) {
-		kprintf("no such device '%*.*s'\n", nlen, nlen, name);
+		kprintf("no disk named '%s'\n", name);
 		return (NULL);
 	}
 
@@ -463,8 +462,7 @@
 	return(rdev);
 }
 
-static
-int
+static int
 kgetdiskbyname_callback(struct dev_ops *ops, void *arg)
 {
 	struct kdbn_info *info = arg;

----------
priority:  -> cleanup
status: unread -> chatting

_____________________________________________________
DragonFly issue tracker <bugs at lists.dragonflybsd.org>
<http://bugs.dragonflybsd.org/issue782>
_____________________________________________________





More information about the Bugs mailing list