Module Name:    src
Committed By:   joerg
Date:           Sun Dec 15 20:29:09 UTC 2019

Modified Files:
        src/share/man/man4: ddb.4
        src/sys/ddb: db_command.c
        src/sys/kern: vfs_subr.c

Log Message:
Teach ddb(4) about printing the full mount list.


To generate a diff of this commit:
cvs rdiff -u -r1.187 -r1.188 src/share/man/man4/ddb.4
cvs rdiff -u -r1.164 -r1.165 src/sys/ddb/db_command.c
cvs rdiff -u -r1.475 -r1.476 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/share/man/man4/ddb.4
diff -u src/share/man/man4/ddb.4:1.187 src/share/man/man4/ddb.4:1.188
--- src/share/man/man4/ddb.4:1.187	Tue Sep 10 09:32:04 2019
+++ src/share/man/man4/ddb.4	Sun Dec 15 20:29:08 2019
@@ -1,6 +1,6 @@
-.\"	$NetBSD: ddb.4,v 1.187 2019/09/10 09:32:04 ryo Exp $
+.\"	$NetBSD: ddb.4,v 1.188 2019/12/15 20:29:08 joerg Exp $
 .\"
-.\" Copyright (c) 1997 - 2009 The NetBSD Foundation, Inc.
+.\" Copyright (c) 1997 - 2019 The NetBSD Foundation, Inc.
 .\" All rights reserved.
 .\"
 .\" This code is derived from software contributed to The NetBSD Foundation
@@ -56,7 +56,7 @@
 .\" any improvements or extensions that they make and grant Carnegie Mellon
 .\" the rights to redistribute these changes.
 .\"
-.Dd September 10, 2019
+.Dd December 15, 2019
 .Dt DDB 4
 .Os
 .Sh NAME
@@ -575,6 +575,11 @@ If
 is specified, stack traces of LWPs holding locks are also printed.
 This command is only useful if a kernel is compiled with
 .Cd options LOCKDEBUG .
+.It Ic show all mount Ns Op Cm /f
+Display all mount points.
+If
+.Cm /f
+is specified, the complete vnode list is printed.
 .It Ic show all pages
 Display basic information about all physical pages managed by the VM system.
 For more detailed information about a single page, use

Index: src/sys/ddb/db_command.c
diff -u src/sys/ddb/db_command.c:1.164 src/sys/ddb/db_command.c:1.165
--- src/sys/ddb/db_command.c:1.164	Sun Sep 29 02:49:59 2019
+++ src/sys/ddb/db_command.c	Sun Dec 15 20:29:08 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_command.c,v 1.164 2019/09/29 02:49:59 uwe Exp $	*/
+/*	$NetBSD: db_command.c,v 1.165 2019/12/15 20:29:08 joerg Exp $	*/
 
 /*
  * Copyright (c) 1996, 1997, 1998, 1999, 2002, 2009 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.164 2019/09/29 02:49:59 uwe Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.165 2019/12/15 20:29:08 joerg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_aio.h"
@@ -194,6 +194,7 @@ static void	db_lock_print_cmd(db_expr_t,
 static void	db_show_all_locks(db_expr_t, bool, db_expr_t, const char *);
 static void	db_show_lockstats(db_expr_t, bool, db_expr_t, const char *);
 static void	db_mount_print_cmd(db_expr_t, bool, db_expr_t, const char *);
+static void	db_show_all_mount(db_expr_t, bool, db_expr_t, const char *);
 static void	db_mbuf_print_cmd(db_expr_t, bool, db_expr_t, const char *);
 static void	db_map_print_cmd(db_expr_t, bool, db_expr_t, const char *);
 static void	db_namecache_print_cmd(db_expr_t, bool, db_expr_t,
@@ -231,6 +232,8 @@ static const struct db_command db_show_c
 	    0 ,"Show all pools",NULL,NULL) },
 	{ DDB_ADD_CMD("locks",	db_show_all_locks,
 	    0 ,"Show all held locks", "[/t]", NULL) },
+	{ DDB_ADD_CMD("mount",	db_show_all_mount,	0,
+	    "Print all mount structures.", "[/f]", NULL) },
 #ifdef AIO
 	/*added from all sub cmds*/
 	{ DDB_ADD_CMD("aio_jobs",	db_show_aio_jobs,	0,
@@ -1178,6 +1181,19 @@ db_mount_print_cmd(db_expr_t addr, bool 
 #endif
 }
 
+static void
+db_show_all_mount(db_expr_t addr, bool have_addr, db_expr_t count, const char *modif)
+{
+#ifdef _KERNEL	/* XXX CRASH(8) */
+	bool full = false;
+
+	if (modif[0] == 'f')
+		full = true;
+
+	vfs_mount_print_all(full, db_printf);
+#endif
+}
+
 /*ARGSUSED*/
 static void
 db_mbuf_print_cmd(db_expr_t addr, bool have_addr,

Index: src/sys/kern/vfs_subr.c
diff -u src/sys/kern/vfs_subr.c:1.475 src/sys/kern/vfs_subr.c:1.476
--- src/sys/kern/vfs_subr.c:1.475	Sun Dec  1 13:56:29 2019
+++ src/sys/kern/vfs_subr.c	Sun Dec 15 20:29:09 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_subr.c,v 1.475 2019/12/01 13:56:29 ad Exp $	*/
+/*	$NetBSD: vfs_subr.c,v 1.476 2019/12/15 20:29:09 joerg Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2004, 2005, 2007, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.475 2019/12/01 13:56:29 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.476 2019/12/15 20:29:09 joerg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -1551,6 +1551,14 @@ vfs_vnode_lock_print(void *vlock, int fu
 }
 
 void
+vfs_mount_print_all(int full, void (*pr)(const char *, ...))
+{
+	struct mount *mp;
+	for (mp = _mountlist_next(NULL); mp; mp = _mountlist_next(mp))
+		vfs_mount_print(mp, full, pr);
+}
+
+void
 vfs_mount_print(struct mount *mp, int full, void (*pr)(const char *, ...))
 {
 	char sbuf[256];

Reply via email to