Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Teach ddb(4) about printing the full mount list.



details:   https://anonhg.NetBSD.org/src/rev/7e453a9f0c6a
branches:  trunk
changeset: 967616:7e453a9f0c6a
user:      joerg <joerg%NetBSD.org@localhost>
date:      Sun Dec 15 20:29:08 2019 +0000

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

diffstat:

 share/man/man4/ddb.4 |  11 ++++++++---
 sys/ddb/db_command.c |  20 ++++++++++++++++++--
 sys/kern/vfs_subr.c  |  12 ++++++++++--
 3 files changed, 36 insertions(+), 7 deletions(-)

diffs (121 lines):

diff -r f450c61e3e6d -r 7e453a9f0c6a share/man/man4/ddb.4
--- a/share/man/man4/ddb.4      Sun Dec 15 20:25:25 2019 +0000
+++ b/share/man/man4/ddb.4      Sun Dec 15 20:29:08 2019 +0000
@@ -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 @@
 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
diff -r f450c61e3e6d -r 7e453a9f0c6a sys/ddb/db_command.c
--- a/sys/ddb/db_command.c      Sun Dec 15 20:25:25 2019 +0000
+++ b/sys/ddb/db_command.c      Sun Dec 15 20:29:08 2019 +0000
@@ -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_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 @@
            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 @@
 #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,
diff -r f450c61e3e6d -r 7e453a9f0c6a sys/kern/vfs_subr.c
--- a/sys/kern/vfs_subr.c       Sun Dec 15 20:25:25 2019 +0000
+++ b/sys/kern/vfs_subr.c       Sun Dec 15 20:29:08 2019 +0000
@@ -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 @@
 }
 
 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];



Home | Main Index | Thread Index | Old Index