From nobody Thu Jun 23 22:23:04 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 03DB2859CEE; Thu, 23 Jun 2022 22:23:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LTZWr5lGwz4sbf; Thu, 23 Jun 2022 22:23:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656022984; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6tIQ4W4ZvauNbTikczN8abrtIaglPZakHdfEiU1WEi0=; b=B1n2+h4y+4+pea2/MPnkm9c2tWsYmffkP6bUshM92X5Z4GY72ud50LvMaxTJ76DwJCBPPm vSWlNyUoZr1GsQAVVBv10EBuWe5AkHwmuyj8lajB0qMP51qUi5ho/248aV6uZuwEkxiOHh Zakm7V+64emMshwdYCLMCcj0lktqPAwRBcyNcCRQVeL8LsRxq2PL0oOz66PQ4V29e8ybT0 BYsysZGRrBnvquXNQpv/ktWz7pv2h0ZQJLOO3is3BdQt0Uc9dbLGwr6/wCC4RukJVRiZ4t p7L7/NKC1c/YSoJmFo24hoPScT5WBAHS4PVzd2SSvxUhI/lr2DGtL3IHnf7J+g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A2BF523C7C; Thu, 23 Jun 2022 22:23:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 25NMN4aN055037; Thu, 23 Jun 2022 22:23:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25NMN40s055036; Thu, 23 Jun 2022 22:23:04 GMT (envelope-from git) Date: Thu, 23 Jun 2022 22:23:04 GMT Message-Id: <202206232223.25NMN40s055036@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 70bb14b902ff - stable/13 - ddb: namespacing of struct command List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 70bb14b902ffef656a9497acb5f5073b47c25bed Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656022984; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6tIQ4W4ZvauNbTikczN8abrtIaglPZakHdfEiU1WEi0=; b=DejHa7JjTa1ALaHMVm037OjsAOAHzJJiOMVaMJNpAtcCqRBaqUpcl+sLLCmCsuR5j/QG0B Vb/dej9jVoDvxKF1G+WHYLR24HfkeCYeoVhH2/QMoUql4nqaNfUuwZVgpgIOar0U6oQ78O t5hYDIN0xSvgXPLPLQYi7lFZvOqO3aBGkPD9+SDsk+xufZnOJZgFYN6SFsBaEBefKJmQj/ ucyJ46e3QYwbW/N3dKgZxSrQWDmmx54Ob4p9YPTD32h1QaXSvW0mN/xQvFE2XjCceZfgcQ x2bPUaHm4+pEs+yVrT2Hz4QyHj1XFYOK860ftfhv1rEG4T8oEe9h0uThPgZcUQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1656022984; a=rsa-sha256; cv=none; b=wQ75d7Z4kW/JTDFYReFjBeepI9m4/BSbqEi4iRl1cRiCCa4nDaJ0wKrbjJPTPlOmwnYhR8 KK3FKMDIGt0jwxM6aGM0gxD/T69fMqER0OIAEoTpm8zpOxujQ2mmcSVDD91SyamEDc4MGh GDeFmdgraGcESM6PxU0qEHD/Vn95LnGEzAVYG7D/v3Us0QyMKElwrTfu6mps23On27ISDe 0mOJUbYjkbo9yLCLJg+iHRk8rg+m/oiaAoIYjwANIN5x96tiYnqalNLJhIVbLM2yWnfzWg +lsS71oB8AiRBO8cJKijLpkC3z+FHC+kdZ9MiGAiLpoBu57sstvvVf4ujsB3rg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=70bb14b902ffef656a9497acb5f5073b47c25bed commit 70bb14b902ffef656a9497acb5f5073b47c25bed Author: Mitchell Horne AuthorDate: 2022-06-14 16:09:11 +0000 Commit: Mitchell Horne CommitDate: 2022-06-23 22:19:48 +0000 ddb: namespacing of struct command 'command' is too generic for something specific to the kernel debugger; change this so it is less likely to collide with local variable names. Also rename struct command_table to struct db_command_table. Reviewed by: markj MFC after: 1 week Sponsored by: Juniper Networks, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D35367 (cherry picked from commit 4ef7db5a7e5c06cd8788e6f653ee955ace44b6c9) --- sys/ddb/db_command.c | 57 +++++++++++++++++++++++++------------------------ sys/ddb/ddb.h | 24 +++++++++++---------- sys/dev/cxgbe/t4_main.c | 2 +- 3 files changed, 43 insertions(+), 40 deletions(-) diff --git a/sys/ddb/db_command.c b/sys/ddb/db_command.c index bfd6c700dc22..710b50755272 100644 --- a/sys/ddb/db_command.c +++ b/sys/ddb/db_command.c @@ -83,28 +83,28 @@ static db_cmdfcn_t db_watchdog; * 'show' commands */ -static struct command db_show_active_cmds[] = { +static struct db_command db_show_active_cmds[] = { { "trace", db_stack_trace_active, 0, NULL }, }; -struct command_table db_show_active_table = +struct db_command_table db_show_active_table = LIST_HEAD_INITIALIZER(db_show_active_table); -static struct command db_show_all_cmds[] = { +static struct db_command db_show_all_cmds[] = { { "trace", db_stack_trace_all, 0, NULL }, }; -struct command_table db_show_all_table = +struct db_command_table db_show_all_table = LIST_HEAD_INITIALIZER(db_show_all_table); -static struct command db_show_cmds[] = { +static struct db_command db_show_cmds[] = { { "active", 0, 0, &db_show_active_table }, { "all", 0, 0, &db_show_all_table }, { "registers", db_show_regs, 0, NULL }, { "breaks", db_listbreak_cmd, 0, NULL }, { "threads", db_show_threads, 0, NULL }, }; -struct command_table db_show_table = LIST_HEAD_INITIALIZER(db_show_table); +struct db_command_table db_show_table = LIST_HEAD_INITIALIZER(db_show_table); -static struct command db_cmds[] = { +static struct db_command db_cmds[] = { { "print", db_print_cmd, 0, NULL }, { "p", db_print_cmd, 0, NULL }, { "examine", db_examine_cmd, CS_SET_DOT, NULL }, @@ -155,9 +155,9 @@ static struct command db_cmds[] = { { "textdump", db_textdump_cmd, CS_OWN, NULL }, { "findstack", db_findstack_cmd, 0, NULL }, }; -struct command_table db_cmd_table = LIST_HEAD_INITIALIZER(db_cmd_table); +struct db_command_table db_cmd_table = LIST_HEAD_INITIALIZER(db_cmd_table); -static struct command *db_last_command = NULL; +static struct db_command *db_last_command = NULL; /* * if 'ed' style: 'dot' is set at start of last item printed, @@ -187,13 +187,13 @@ db_skip_to_eol(void) #define CMD_AMBIGUOUS 3 #define CMD_HELP 4 -static void db_cmd_match(char *name, struct command *cmd, - struct command **cmdp, int *resultp); -static void db_cmd_list(struct command_table *table); -static int db_cmd_search(char *name, struct command_table *table, - struct command **cmdp); -static void db_command(struct command **last_cmdp, - struct command_table *cmd_table, int dopager); +static void db_cmd_match(char *name, struct db_command *cmd, + struct db_command **cmdp, int *resultp); +static void db_cmd_list(struct db_command_table *table); +static int db_cmd_search(char *name, struct db_command_table *table, + struct db_command **cmdp); +static void db_command(struct db_command **last_cmdp, + struct db_command_table *cmd_table, int dopager); /* * Initialize the command lists from the static tables. @@ -220,9 +220,9 @@ db_command_init(void) * Register a command. */ void -db_command_register(struct command_table *list, struct command *cmd) +db_command_register(struct db_command_table *list, struct db_command *cmd) { - struct command *c, *last; + struct db_command *c, *last; last = NULL; LIST_FOREACH(c, list, next) { @@ -251,9 +251,9 @@ db_command_register(struct command_table *list, struct command *cmd) * Remove a command previously registered with db_command_register. */ void -db_command_unregister(struct command_table *list, struct command *cmd) +db_command_unregister(struct db_command_table *list, struct db_command *cmd) { - struct command *c; + struct db_command *c; LIST_FOREACH(c, list, next) { if (cmd == c) { @@ -268,7 +268,7 @@ db_command_unregister(struct command_table *list, struct command *cmd) * Helper function to match a single command. */ static void -db_cmd_match(char *name, struct command *cmd, struct command **cmdp, +db_cmd_match(char *name, struct db_command *cmd, struct db_command **cmdp, int *resultp) { char *lp, *rp; @@ -304,10 +304,11 @@ db_cmd_match(char *name, struct command *cmd, struct command **cmdp, * Search for command prefix. */ static int -db_cmd_search(char *name, struct command_table *table, struct command **cmdp) +db_cmd_search(char *name, struct db_command_table *table, + struct db_command **cmdp) { - struct command *cmd; - int result = CMD_NONE; + struct db_command *cmd; + int result = CMD_NONE; LIST_FOREACH(cmd, table, next) { db_cmd_match(name,cmd,cmdp,&result); @@ -325,9 +326,9 @@ db_cmd_search(char *name, struct command_table *table, struct command **cmdp) } static void -db_cmd_list(struct command_table *table) +db_cmd_list(struct db_command_table *table) { - struct command *cmd; + struct db_command *cmd; int have_subcommands; have_subcommands = 0; @@ -351,10 +352,10 @@ db_cmd_list(struct command_table *table) } static void -db_command(struct command **last_cmdp, struct command_table *cmd_table, +db_command(struct db_command **last_cmdp, struct db_command_table *cmd_table, int dopager) { - struct command *cmd = NULL; + struct db_command *cmd = NULL; int t; char modif[TOK_STRING_SIZE]; db_expr_t addr, count; diff --git a/sys/ddb/ddb.h b/sys/ddb/ddb.h index 21bc0712117f..3bd049de422b 100644 --- a/sys/ddb/ddb.h +++ b/sys/ddb/ddb.h @@ -94,11 +94,11 @@ extern vm_offset_t ksymtab, kstrtab, ksymtab_size, ksymtab_relbase; * - The last one for sub-commands of 'show all'; type 'show all' * without any argument to get a list. */ -struct command; -LIST_HEAD(command_table, command); -extern struct command_table db_cmd_table; -extern struct command_table db_show_table; -extern struct command_table db_show_all_table; +struct db_command; +LIST_HEAD(db_command_table, db_command); +extern struct db_command_table db_cmd_table; +extern struct db_command_table db_show_table; +extern struct db_command_table db_show_all_table; /* * Type signature for a function implementing a ddb command. @@ -109,7 +109,7 @@ typedef void db_cmdfcn_t(db_expr_t addr, bool have_addr, db_expr_t count, /* * Command table entry. */ -struct command { +struct db_command { char * name; /* command name */ db_cmdfcn_t *fcn; /* function to call */ int flag; /* extra info: */ @@ -117,8 +117,8 @@ struct command { #define CS_MORE 0x2 /* standard syntax, but may have other words * at end */ #define CS_SET_DOT 0x100 /* set dot after command */ - struct command_table *more; /* another level of command */ - LIST_ENTRY(command) next; /* next entry in the command table */ + struct db_command_table *more; /* another level of command */ + LIST_ENTRY(db_command) next; /* next entry in the command table */ }; /* @@ -128,7 +128,7 @@ struct command { * the module is loaded. */ #define _DB_SET(_suffix, _name, _func, list, _flag, _more) \ -static struct command __CONCAT(_name,_suffix) = { \ +static struct db_command __CONCAT(_name,_suffix) = { \ .name = __STRING(_name), \ .fcn = _func, \ .flag = _flag, \ @@ -224,8 +224,10 @@ bool db_value_of_name(const char *name, db_expr_t *valuep); bool db_value_of_name_pcpu(const char *name, db_expr_t *valuep); bool db_value_of_name_vnet(const char *name, db_expr_t *valuep); int db_write_bytes(vm_offset_t addr, size_t size, char *data); -void db_command_register(struct command_table *, struct command *); -void db_command_unregister(struct command_table *, struct command *); +void db_command_register(struct db_command_table *, + struct db_command *); +void db_command_unregister(struct db_command_table *, + struct db_command *); int db_fetch_ksymtab(vm_offset_t ksym_start, vm_offset_t ksym_end, vm_offset_t relbase); diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index a113a1c662c8..40e2b1b9dbe4 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -12927,7 +12927,7 @@ t4_dump_devlog(struct adapter *sc) } while (i != first && !db_pager_quit); } -static struct command_table db_t4_table = LIST_HEAD_INITIALIZER(db_t4_table); +static struct db_command_table db_t4_table = LIST_HEAD_INITIALIZER(db_t4_table); _DB_SET(_show, t4, NULL, db_show_table, 0, &db_t4_table); DB_FUNC(devlog, db_show_devlog, db_t4_table, CS_OWN, NULL)