Module Name:    src
Committed By:   uwe
Date:           Wed Feb  1 10:22:20 UTC 2023

Modified Files:
        src/sys/modules/examples/ddbping: ddbping.c

Log Message:
ddbping - restore the original narration of the example, NFCI

Adjust previous change so that it only replaces my home-grown define
for the end marker with the new official DDB_END_CMD marker that it
introduced.  Undo the rest of that last change.

As the author of this example I'm pretty sure what example I wanted to
set and this narration order is an important part of it.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/modules/examples/ddbping/ddbping.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/modules/examples/ddbping/ddbping.c
diff -u src/sys/modules/examples/ddbping/ddbping.c:1.2 src/sys/modules/examples/ddbping/ddbping.c:1.3
--- src/sys/modules/examples/ddbping/ddbping.c:1.2	Tue Feb 23 07:13:53 2021
+++ src/sys/modules/examples/ddbping/ddbping.c	Wed Feb  1 10:22:20 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: ddbping.c,v 1.2 2021/02/23 07:13:53 mrg Exp $ */
+/*	$NetBSD: ddbping.c,v 1.3 2023/02/01 10:22:20 uwe Exp $ */
 /*
  * Copyright (c) 2020 Valery Ushakov
  * All rights reserved.
@@ -28,19 +28,42 @@
  * Example of a kernel module that registers DDB commands.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ddbping.c,v 1.2 2021/02/23 07:13:53 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ddbping.c,v 1.3 2023/02/01 10:22:20 uwe Exp $");
 
 #include <sys/param.h>
 #include <sys/module.h>
 
 #include <ddb/ddb.h>
 
+/* XXX: db_command.h should provide something like this */
+typedef void db_cmdfn_t(db_expr_t, bool, db_expr_t, const char *);
+
+
+static db_cmdfn_t db_ping;
+static db_cmdfn_t db_show_ping;
+
+
+static const struct db_command db_ping_base_tbl[] = {
+	{ DDB_ADD_CMD("ping", db_ping, 0,
+		      "Example command",
+		      NULL, NULL) },
+	{ DDB_END_CMD },
+};
+
+static const struct db_command db_ping_show_tbl[] = {
+	{ DDB_ADD_CMD("ping", db_show_ping, 0,
+		      "Example command stats",
+		      NULL, NULL) },
+	{ DDB_END_CMD },
+};
+
 
 static unsigned int ping_count;
 static unsigned int ping_count_modif;
 static unsigned int ping_count_addr;
 static unsigned int ping_count_count;
 
+
 static void
 db_ping(db_expr_t addr, bool have_addr, db_expr_t count, const char *modif)
 {
@@ -75,20 +98,6 @@ db_show_ping(db_expr_t addr, bool have_a
 	db_printf("with count\t%u\n", ping_count_count);
 }
 
-static const struct db_command db_ping_base_tbl[] = {
-	{ DDB_ADD_CMD("ping", db_ping, 0,
-		      "Example command",
-		      NULL, NULL) },
-	{ DDB_END_CMD },
-};
-
-static const struct db_command db_ping_show_tbl[] = {
-	{ DDB_ADD_CMD("ping", db_show_ping, 0,
-		      "Example command stats",
-		      NULL, NULL) },
-	{ DDB_END_CMD },
-};
-
 
 MODULE(MODULE_CLASS_MISC, ddbping, NULL);
 

Reply via email to