Module Name:    src
Committed By:   jmcneill
Date:           Sat Sep 19 16:20:41 UTC 2009

Modified Files:
        src/sys/kern: vfs_subr.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.383 -r1.384 src/sys/kern/vfs_subr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/vfs_subr.c
diff -u src/sys/kern/vfs_subr.c:1.383 src/sys/kern/vfs_subr.c:1.384
--- src/sys/kern/vfs_subr.c:1.383	Fri Jun 26 18:58:14 2009
+++ src/sys/kern/vfs_subr.c	Sat Sep 19 16:20:41 2009
@@ -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);

Reply via email to