-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kdb: Categorize kdb commands (similar to SysRq categorization)
This patch introduces several new flags to collect kdb commands into groups (later allowing them to be optionally disabled). This follows similar prior art to enable/disable magic sysrq commands. The commands have been categorized as follows: Always on: go (w/o args), env, set, help, ?, cpu (w/o args), sr, dmesg, disable_nmi, defcmd, summary, grephelp Mem read: md, mdr, mdp, mds, ef, bt (with args), per_cpu Mem write: mm Reg read: rd Reg write: go (with args), rm Inspect: bt (w/o args), btp, bta, btc, btt, ps, pid, lsmod Flow ctrl: bp, bl, bph, bc, be, bd, ss Signal: kill Reboot: reboot All: cpu, kgdb, (and all of the above), nmi_console Signed-off-by: Daniel Thompson <[email protected]> Cc: Jason Wessel <[email protected]> Signed-off-by: Jason Wessel <[email protected]>
- Loading branch information
1 parent
e8ab24d
commit 9452e97
Showing
4 changed files
with
148 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,9 +13,53 @@ | |
* Copyright (C) 2009 Jason Wessel <[email protected]> | ||
*/ | ||
|
||
/* Shifted versions of the command enable bits are be used if the command | ||
* has no arguments (see kdb_check_flags). This allows commands, such as | ||
* go, to have different permissions depending upon whether it is called | ||
* with an argument. | ||
*/ | ||
#define KDB_ENABLE_NO_ARGS_SHIFT 10 | ||
|
||
typedef enum { | ||
KDB_REPEAT_NO_ARGS = 0x1, /* Repeat the command w/o arguments */ | ||
KDB_REPEAT_WITH_ARGS = 0x2, /* Repeat the command w/ its arguments */ | ||
KDB_ENABLE_ALL = (1 << 0), /* Enable everything */ | ||
KDB_ENABLE_MEM_READ = (1 << 1), | ||
KDB_ENABLE_MEM_WRITE = (1 << 2), | ||
KDB_ENABLE_REG_READ = (1 << 3), | ||
KDB_ENABLE_REG_WRITE = (1 << 4), | ||
KDB_ENABLE_INSPECT = (1 << 5), | ||
KDB_ENABLE_FLOW_CTRL = (1 << 6), | ||
KDB_ENABLE_SIGNAL = (1 << 7), | ||
KDB_ENABLE_REBOOT = (1 << 8), | ||
/* User exposed values stop here, all remaining flags are | ||
* exclusively used to describe a commands behaviour. | ||
*/ | ||
|
||
KDB_ENABLE_ALWAYS_SAFE = (1 << 9), | ||
KDB_ENABLE_MASK = (1 << KDB_ENABLE_NO_ARGS_SHIFT) - 1, | ||
|
||
KDB_ENABLE_ALL_NO_ARGS = KDB_ENABLE_ALL << KDB_ENABLE_NO_ARGS_SHIFT, | ||
KDB_ENABLE_MEM_READ_NO_ARGS = KDB_ENABLE_MEM_READ | ||
<< KDB_ENABLE_NO_ARGS_SHIFT, | ||
KDB_ENABLE_MEM_WRITE_NO_ARGS = KDB_ENABLE_MEM_WRITE | ||
<< KDB_ENABLE_NO_ARGS_SHIFT, | ||
KDB_ENABLE_REG_READ_NO_ARGS = KDB_ENABLE_REG_READ | ||
<< KDB_ENABLE_NO_ARGS_SHIFT, | ||
KDB_ENABLE_REG_WRITE_NO_ARGS = KDB_ENABLE_REG_WRITE | ||
<< KDB_ENABLE_NO_ARGS_SHIFT, | ||
KDB_ENABLE_INSPECT_NO_ARGS = KDB_ENABLE_INSPECT | ||
<< KDB_ENABLE_NO_ARGS_SHIFT, | ||
KDB_ENABLE_FLOW_CTRL_NO_ARGS = KDB_ENABLE_FLOW_CTRL | ||
<< KDB_ENABLE_NO_ARGS_SHIFT, | ||
KDB_ENABLE_SIGNAL_NO_ARGS = KDB_ENABLE_SIGNAL | ||
<< KDB_ENABLE_NO_ARGS_SHIFT, | ||
KDB_ENABLE_REBOOT_NO_ARGS = KDB_ENABLE_REBOOT | ||
<< KDB_ENABLE_NO_ARGS_SHIFT, | ||
KDB_ENABLE_ALWAYS_SAFE_NO_ARGS = KDB_ENABLE_ALWAYS_SAFE | ||
<< KDB_ENABLE_NO_ARGS_SHIFT, | ||
KDB_ENABLE_MASK_NO_ARGS = KDB_ENABLE_MASK << KDB_ENABLE_NO_ARGS_SHIFT, | ||
|
||
KDB_REPEAT_NO_ARGS = 0x40000000, /* Repeat the command w/o arguments */ | ||
KDB_REPEAT_WITH_ARGS = 0x80000000, /* Repeat the command with args */ | ||
} kdb_cmdflags_t; | ||
|
||
typedef int (*kdb_func_t)(int, const char **); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters