From owner-freebsd-current@FreeBSD.ORG Fri Oct 19 15:32:30 2012 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 33287C5; Fri, 19 Oct 2012 15:32:30 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 04DC78FC0A; Fri, 19 Oct 2012 15:32:30 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 58B97B91C; Fri, 19 Oct 2012 11:32:29 -0400 (EDT) From: John Baldwin To: freebsd-current@freebsd.org Subject: Re: A little question about safe mode Date: Fri, 19 Oct 2012 08:52:35 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p20; KDE/4.5.5; amd64; ; ) References: <50802138.8020604@FreeBSD.org> <508041F9.9050906@FreeBSD.org> In-Reply-To: <508041F9.9050906@FreeBSD.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201210190852.35915.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 19 Oct 2012 11:32:29 -0400 (EDT) Cc: Alexander Yerenkow , Andriy Gapon X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Oct 2012 15:32:30 -0000 On Thursday, October 18, 2012 1:52:57 pm Andriy Gapon wrote: > on 18/10/2012 18:33 Andriy Gapon said the following: > > on 18/10/2012 18:20 Andriy Gapon said the following: > >> My guess is that the easiest way to avoid this ambiguity and the confusion that it > >> causes (like the problem you described above) is to prepend "/dev/", if it's > >> missing, right in vfs_mountroot.c before calling kernel_mount(). > > > > A patch (not tested): > > > > --- a/sys/kern/vfs_mountroot.c > > +++ b/sys/kern/vfs_mountroot.c > > @@ -676,6 +676,7 @@ static int > > parse_mount(char **conf) > > { > > char errmsg[255]; > > + char devbuf[MNAMELEN]; > > struct mntarg *ma; > > char *dev, *fs, *opts, *tok; > > int delay, error, timeout; > > @@ -693,6 +694,11 @@ parse_mount(char **conf) > > parse_advance(&tok); > > dev = tok; > > > > + if (dev[0] != '\0' && strncmp(dev, "/dev/", 5) != 0) { > > + snprintf(devbuf, sizeof(devbuf), "/dev/%s", dev); > > + dev = devbuf; > > + } > > + > > if (root_mount_mddev != -1) { > > /* Handle substitution for the md unit number. */ > > tok = strstr(dev, "md#"); > > > > > > Oops, the patch incorrectly assumes that all "device names" are device names, > which is incorrect e.g. for ZFS. Maybe some other filesystems too. > So don't try it :-) It seems that perhaps what you want to do is try it with /dev/ and if that doesn't work, fall back to the raw string? -- John Baldwin