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
This commit is contained in:
parent
648a47b854
commit
4ef7db5a7e
@ -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;
|
||||
|
@ -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, \
|
||||
@ -225,8 +225,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);
|
||||
|
||||
|
@ -12932,7 +12932,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)
|
||||
|
Loading…
Reference in New Issue
Block a user