Bug #782

missleading error message on mountroot prompt

Added by corecode almost 7 years ago. Updated over 6 years ago.

Status:ClosedStart date:
Priority:LowDue date:
Assignee:-% Done:

0%

Category:-
Target version:-

Description

hey,

when entering "ufs:ad0s1a" on mountroot>, the system told me something like

no such device 'ad'

entering "ufs:ad2s1a" however worked. the error message is highly missleading, suggesting that there is no "ad" driver at all.

additionally, the mountroot prompt would benefit from a proper device listing (only listing disk devices, but then also listing available slices and partitions).

cheers
simon

History

#1 Updated by nthery almost 7 years ago

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;

#2 Updated by corecode almost 7 years ago

Thanks, looks good! I'll leave it to you to commit :)

Not tested, however.

cheers
simon

#3 Updated by dillon almost 7 years ago

:Nicolas Thery wrote:
:> Here is a patch that displays a hopefully more informative message when
:> kgetdiskbyname() fails and changes mountroot '?' to list only disk devices.
:
:Thanks, looks good! I'll leave it to you to commit :)
:
:Not tested, however.
:
:cheers
: simon

I've tested it with boot -a and it works well, I am committing it.

-Matt

Also available in: Atom PDF