From owner-freebsd-current@FreeBSD.ORG Thu Oct 18 15:33:17 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 317844F7; Thu, 18 Oct 2012 15:33:17 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 4D7E98FC17; Thu, 18 Oct 2012 15:33:15 +0000 (UTC) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id SAA20262; Thu, 18 Oct 2012 18:33:13 +0300 (EEST) (envelope-from avg@FreeBSD.org) Message-ID: <50802138.8020604@FreeBSD.org> Date: Thu, 18 Oct 2012 18:33:12 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:16.0) Gecko/20121014 Thunderbird/16.0.1 MIME-Version: 1.0 To: Alexander Yerenkow Subject: Re: A little question about safe mode References: <507FB6C7.50402@FreeBSD.org> <507FEC7F.4030306@FreeBSD.org> <50801E32.80309@FreeBSD.org> In-Reply-To: <50801E32.80309@FreeBSD.org> X-Enigmail-Version: 1.4.5 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: freebsd-current 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: Thu, 18 Oct 2012 15:33:17 -0000 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#"); -- Andriy Gapon