Date: Mon, 22 Dec 2008 17:38:14 +0100 From: Hans Petter Selasky <hselasky@freebsd.org> To: Alfred Perlstein <bright@elvis.mu.org> Cc: fs@freebsd.org, jhb@freebsd.org Subject: Small patch for vfs_mount.c needs review Message-ID: <200812221738.16396.hselasky@freebsd.org> In-Reply-To: <20081222121725.GN18389@elvis.mu.org> References: <20081221112157.GU18389@elvis.mu.org> <200812221125.58857.hselasky@c2i.net> <20081222121725.GN18389@elvis.mu.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--Boundary-00=_4J8TJJP/MuRjiyU Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, Here is a small patch for vfs_mount.c which irons out some problems with USB2 and booting from a memory stick. This patch is just a workaround. I think that an event driven model would be better where the OS is allowed to boot at the moment the root partition disk is plugged in. Typically the USB memory stick will appear within 2 seconds of waiting. The patch has been tested with FreeSBIE. I hope that the mailing list software did not strip away the attached patch. --HPS --Boundary-00=_4J8TJJP/MuRjiyU Content-Type: text/x-diff; charset="iso-8859-1"; name="vfs_mount.c.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="vfs_mount.c.diff" --- vfs_mount.c.orig Mon Dec 22 14:43:36 2008 +++ vfs_mount.c Mon Dec 22 15:09:14 2008 @@ -58,6 +58,7 @@ #include <sys/sysent.h> #include <sys/systm.h> #include <sys/vnode.h> +#include <sys/cons.h> #include <vm/uma.h> #include <geom/geom.h> @@ -1606,7 +1607,11 @@ vfs_mountroot(void) { char *cp; - int error, i, asked = 0; + const char *rootdevname_orig; + int error; + unsigned int i; + unsigned char asked = 0; /* set if asked for mount point */ + unsigned char timeout = 16; /* seconds */ root_mount_prepare(); @@ -1624,6 +1629,10 @@ asked = 1; } + /* store a copy of the initial root device name */ + rootdevname_orig = ctrootdevname; + retry: + /* * The root filesystem information is compiled in, and we are * booted with instructions to use it. @@ -1674,12 +1683,27 @@ if (!vfs_mountroot_try(ctrootdevname)) goto mounted; /* - * Everything so far has failed, prompt on the console if we haven't - * already tried that. + * Check if we should try more times. + */ + if (timeout != 0) { + timeout--; + pause("WROOT", hz); + if (cncheckc() == -1) { + /* no key press - try again */ + ctrootdevname = rootdevname_orig; + goto retry; + } + } + + /* + * Everything so far has failed, prompt on the console if we + * haven't already tried that. */ - if (!asked) + if (!asked) { + printf("\n"); if (!vfs_mountroot_ask()) goto mounted; + } panic("Root mount failed, startup aborted."); --Boundary-00=_4J8TJJP/MuRjiyU--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200812221738.16396.hselasky>