Date: Fri, 19 Oct 2012 12:03:14 +0300 From: Alexander Yerenkow <yerenkow@gmail.com> To: Andriy Gapon <avg@freebsd.org> Cc: freebsd-current <freebsd-current@freebsd.org> Subject: Re: A little question about safe mode Message-ID: <CAPJF9wn-fKHDGk3kkHP%2Bfqmeo=YkCvF54KbTPrn%2BH5r5PQT1ZA@mail.gmail.com> In-Reply-To: <508041F9.9050906@FreeBSD.org> References: <CAPJF9wm-dvUwgQzZzijakD=FBM9HTBQ%2BF4jC510KX%2BUOG-SfgA@mail.gmail.com> <507FB6C7.50402@FreeBSD.org> <CAPJF9wku0MiuLv=s2NG7F3zpKFq94_NcUZ_F9TXhBssWE7bFeg@mail.gmail.com> <507FEC7F.4030306@FreeBSD.org> <CAPJF9wm9DxZxr5GDCxkoedG%2BdppJsLEN=zYmEEXByaATM4pE3A@mail.gmail.com> <50801E32.80309@FreeBSD.org> <50802138.8020604@FreeBSD.org> <508041F9.9050906@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
2012/10/18 Andriy Gapon <avg@freebsd.org>:
> 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 :-)
I think correct patch should fix path and prepend "/dev/" only for
ufs:, for now.
Or at least help should mention this moment.
>
> --
> Andriy Gapon
--
Regards,
Alexander Yerenkow
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAPJF9wn-fKHDGk3kkHP%2Bfqmeo=YkCvF54KbTPrn%2BH5r5PQT1ZA>
