git: c4cc0cab1ea6 - main - unr(9): add 'show unrhdr_iter' command

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Mon, 29 May 2023 22:11:24 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=c4cc0cab1ea619e07b52ce4c3825e7941996cb49

commit c4cc0cab1ea619e07b52ce4c3825e7941996cb49
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2023-05-25 18:09:27 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2023-05-29 22:10:36 +0000

    unr(9): add 'show unrhdr_iter' command
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D40089
---
 sys/kern/subr_unit.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/sys/kern/subr_unit.c b/sys/kern/subr_unit.c
index 01bd23a1a2c4..61b7f86cda85 100644
--- a/sys/kern/subr_unit.c
+++ b/sys/kern/subr_unit.c
@@ -1111,6 +1111,23 @@ DB_SHOW_COMMAND(unrhdr, unrhdr_print_unrhdr)
 
 	print_unrhdr((struct unrhdr *)addr);
 }
+
+static void
+print_unrhdr_iter(struct unrhdr_iter *iter)
+{
+	db_printf("iter %p unrhdr %p ipos %d upos %p ufi %d\n",
+	    iter, iter->uh, iter->ipos, iter->upos, iter->upos_first_item);
+}
+
+DB_SHOW_COMMAND(unrhdr_iter, unrhdr_print_iter)
+{
+	if (!have_addr) {
+		db_printf("show unrhdr_iter addr\n");
+		return;
+	}
+
+	print_unrhdr_iter((struct unrhdr_iter *)addr);
+}
 #endif
 
 #ifndef _KERNEL	/* USERLAND test driver */