Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern If vfs_mountroot fails, print a list of supported f...



details:   https://anonhg.NetBSD.org/src/rev/9db15dda21f5
branches:  trunk
changeset: 747540:9db15dda21f5
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sat Sep 19 16:20:41 2009 +0000

description:
If vfs_mountroot fails, print a list of supported file systems. If no
file systems are supported by the kernel, print a big fat warning instead.

diffstat:

 sys/kern/vfs_subr.c |  33 +++++++++++++++++++++++++++++++--
 1 files changed, 31 insertions(+), 2 deletions(-)

diffs (61 lines):

diff -r f3afdab195ca -r 9db15dda21f5 sys/kern/vfs_subr.c
--- a/sys/kern/vfs_subr.c       Sat Sep 19 16:18:00 2009 +0000
+++ b/sys/kern/vfs_subr.c       Sat Sep 19 16:20:41 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_subr.c,v 1.383 2009/06/26 18:58:14 dyoung Exp $    */
+/*     $NetBSD: vfs_subr.c,v 1.384 2009/09/19 16:20:41 jmcneill Exp $  */
 
 /*-
  * Copyright (c) 1997, 1998, 2004, 2005, 2007, 2008 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.383 2009/06/26 18:58:14 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.384 2009/09/19 16:20:41 jmcneill Exp $");
 
 #include "opt_ddb.h"
 #include "opt_compat_netbsd.h"
@@ -2411,6 +2411,34 @@
 }
 
 /*
+ * Print a list of supported file system types (used by vfs_mountroot)
+ */
+static void
+vfs_print_fstypes(void)
+{
+       struct vfsops *v;
+       int cnt = 0;
+
+       mutex_enter(&vfs_list_lock);
+       LIST_FOREACH(v, &vfs_list, vfs_list)
+               ++cnt;
+       mutex_exit(&vfs_list_lock);
+
+       if (cnt == 0) {
+               printf("WARNING: No file system modules have been loaded.\n");
+               return;
+       }
+
+       printf("Supported file systems:");
+       mutex_enter(&vfs_list_lock);
+       LIST_FOREACH(v, &vfs_list, vfs_list) {
+               printf(" %s", v->vfs_name);
+       }
+       mutex_exit(&vfs_list_lock);
+       printf("\n");
+}
+
+/*
  * Mount the root file system.  If the operator didn't specify a
  * file system to use, try all possible file systems until one
  * succeeds.
@@ -2492,6 +2520,7 @@
        mutex_exit(&vfs_list_lock);
 
        if (v == NULL) {
+               vfs_print_fstypes();
                printf("no file system for %s", device_xname(root_device));
                if (device_class(root_device) == DV_DISK)
                        printf(" (dev 0x%llx)", (unsigned long long)rootdev);



Home | Main Index | Thread Index | Old Index