summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorThordur I. Bjornsson <thib@cvs.openbsd.org>2009-08-13 13:49:21 +0000
committerThordur I. Bjornsson <thib@cvs.openbsd.org>2009-08-13 13:49:21 +0000
commit74a6604beb400e6cc433d7fda8960ce8bb0ca9ba (patch)
tree5d65e26b5bc5085f750f7b7e0e479a64fd078070 /sys
parent629efe026cb80764f620bf4e2253c0ca759cb290 (diff)
add a show all vnodes command, use dlg's nice pool_walk() to accomplish
this. ok beck@, dlg@
Diffstat (limited to 'sys')
-rw-r--r--sys/ddb/db_command.c17
-rw-r--r--sys/ddb/db_command.h3
-rw-r--r--sys/ddb/db_interface.h5
-rw-r--r--sys/kern/subr_pool.c9
-rw-r--r--sys/kern/vfs_subr.c6
-rw-r--r--sys/sys/pool.h5
6 files changed, 30 insertions, 15 deletions
diff --git a/sys/ddb/db_command.c b/sys/ddb/db_command.c
index cdfbb648979..1ba56005ab8 100644
--- a/sys/ddb/db_command.c
+++ b/sys/ddb/db_command.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_command.c,v 1.56 2009/08/09 23:04:49 miod Exp $ */
+/* $OpenBSD: db_command.c,v 1.57 2009/08/13 13:49:20 thib Exp $ */
/* $NetBSD: db_command.c,v 1.20 1996/03/30 22:30:05 christos Exp $ */
/*
@@ -347,6 +347,18 @@ db_show_all_mounts(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
vfs_mount_print(mp, full, db_printf);
}
+extern struct pool vnode_pool;
+void
+db_show_all_vnodes(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
+{
+ boolean_t full = FALSE;
+
+ if (modif[0] == 'f')
+ full = TRUE;
+
+ pool_walk(&vnode_pool, full, db_printf, vfs_vnode_print);
+}
+
/*ARGSUSED*/
void
db_object_print_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
@@ -380,7 +392,7 @@ db_vnode_print_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
if (modif[0] == 'f')
full = TRUE;
- vfs_vnode_print((struct vnode *) addr, full, db_printf);
+ vfs_vnode_print((void *)addr, full, db_printf);
}
#ifdef NFSCLIENT
@@ -457,6 +469,7 @@ struct db_command db_show_all_cmds[] = {
{ "callout", db_show_callout, 0, NULL },
{ "pools", db_show_all_pools, 0, NULL },
{ "mounts", db_show_all_mounts, 0, NULL },
+ { "vnodes,", db_show_all_vnodes, 0, NULL },
#ifdef NFSCLIENT
{ "nfsreq", db_show_all_nfsreqs, 0, NULL },
#endif
diff --git a/sys/ddb/db_command.h b/sys/ddb/db_command.h
index 5350d8204ec..b306d206428 100644
--- a/sys/ddb/db_command.h
+++ b/sys/ddb/db_command.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_command.h,v 1.26 2009/08/09 23:04:49 miod Exp $ */
+/* $OpenBSD: db_command.h,v 1.27 2009/08/13 13:49:20 thib Exp $ */
/* $NetBSD: db_command.h,v 1.8 1996/02/05 01:56:55 christos Exp $ */
/*
@@ -43,6 +43,7 @@ void db_map_print_cmd(db_expr_t, int, db_expr_t, char *);
void db_malloc_print_cmd(db_expr_t, int, db_expr_t, char *);
void db_mount_print_cmd(db_expr_t, int, db_expr_t, char *);
void db_show_all_mounts(db_expr_t, int, db_expr_t, char *);
+void db_show_all_vnodes(db_expr_t, int, db_expr_t, char *);
void db_object_print_cmd(db_expr_t, int, db_expr_t, char *);
void db_page_print_cmd(db_expr_t, int, db_expr_t, char *);
void db_extent_print_cmd(db_expr_t, int, db_expr_t, char *);
diff --git a/sys/ddb/db_interface.h b/sys/ddb/db_interface.h
index e15ef4bbcdd..5d57ed043d9 100644
--- a/sys/ddb/db_interface.h
+++ b/sys/ddb/db_interface.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_interface.h,v 1.12 2009/06/17 01:30:30 thib Exp $ */
+/* $OpenBSD: db_interface.h,v 1.13 2009/08/13 13:49:20 thib Exp $ */
/* $NetBSD: db_interface.h,v 1.1 1996/02/05 01:57:03 christos Exp $ */
/*
@@ -46,11 +46,10 @@ void db_show_all_procs(db_expr_t, int, db_expr_t, char *);
void db_show_callout(db_expr_t, int, db_expr_t, char *);
struct mount;
-struct vnode;
/* kern/vfs_subr.c */
void vfs_buf_print(struct buf *, int, int (*)(const char *, ...));
-void vfs_vnode_print(struct vnode *, int, int (*)(const char *, ...));
+void vfs_vnode_print(void *, int, int (*)(const char *, ...));
void vfs_mount_print(struct mount *, int, int (*)(const char *, ...));
/* kern/subr_pool.c */
diff --git a/sys/kern/subr_pool.c b/sys/kern/subr_pool.c
index b59b1efe90d..6841200dca0 100644
--- a/sys/kern/subr_pool.c
+++ b/sys/kern/subr_pool.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_pool.c,v 1.87 2009/08/09 13:41:03 thib Exp $ */
+/* $OpenBSD: subr_pool.c,v 1.88 2009/08/13 13:49:20 thib Exp $ */
/* $NetBSD: subr_pool.c,v 1.61 2001/09/26 07:14:56 chs Exp $ */
/*-
@@ -1293,7 +1293,8 @@ pool_chk(struct pool *pp, const char *label)
}
void
-pool_walk(struct pool *pp, void (*func)(void *))
+pool_walk(struct pool *pp, int full, int (*pr)(const char *, ...),
+ void (*func)(void *, int, int (*)(const char *, ...)))
{
struct pool_item_header *ph;
struct pool_item *pi;
@@ -1305,7 +1306,7 @@ pool_walk(struct pool *pp, void (*func)(void *))
n = ph->ph_nmissing;
while (n--) {
- func(cp);
+ func(cp, full, pr);
cp += pp->pr_size;
}
}
@@ -1320,7 +1321,7 @@ pool_walk(struct pool *pp, void (*func)(void *))
break;
}
if (cp != (caddr_t)pi) {
- func(cp);
+ func(cp, full, pr);
n--;
}
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 98be032d3f4..9afdaa75496 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_subr.c,v 1.181 2009/08/12 16:42:24 beck Exp $ */
+/* $OpenBSD: vfs_subr.c,v 1.182 2009/08/13 13:49:20 thib Exp $ */
/* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */
/*
@@ -2188,8 +2188,9 @@ const char *vtypes[] = { VTYPE_NAMES };
const char *vtags[] = { VTAG_NAMES };
void
-vfs_vnode_print(struct vnode *vp, int full, int (*pr)(const char *, ...))
+vfs_vnode_print(void *v, int full, int (*pr)(const char *, ...))
{
+ struct vnode *vp = v;
#define NENTS(n) (sizeof n / sizeof(n[0]))
(*pr)("tag %s(%d) type %s(%d) mount %p typedata %p\n",
@@ -2307,4 +2308,3 @@ copy_statfs_info(struct statfs *sbp, const struct mount *mp)
bcopy(&mp->mnt_stat.mount_info.ufs_args, &sbp->mount_info.ufs_args,
sizeof(struct ufs_args));
}
-
diff --git a/sys/sys/pool.h b/sys/sys/pool.h
index 77ff2533526..94360d43224 100644
--- a/sys/sys/pool.h
+++ b/sys/sys/pool.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pool.h,v 1.32 2009/08/09 13:41:03 thib Exp $ */
+/* $OpenBSD: pool.h,v 1.33 2009/08/13 13:49:20 thib Exp $ */
/* $NetBSD: pool.h,v 1.27 2001/06/06 22:00:17 rafal Exp $ */
/*-
@@ -160,7 +160,8 @@ int pool_prime(struct pool *, int);
void pool_printit(struct pool *, const char *,
int (*)(const char *, ...));
int pool_chk(struct pool *, const char *);
-void pool_walk(struct pool *, void (*)(void *));
+void pool_walk(struct pool *, int, int (*)(const char *, ...),
+ void (*)(void *, int, int (*)(const char *, ...)));
#endif
#endif /* _KERNEL */