dyndbg: add filter parameter to ddebug_parse_flags
Subsystems (2)
Jim Cromie
maintainerPATCH 12/16 dyndbg: add filter parameter to ddebug_parse_flags
Add a new *filter param to 2 functions, allowing ddebug_parse_flags() to communicate filter settings to ddebug_change(),
Also, ddebug_change doesnt alter any of its arguments, including its 2 new ones; mods, filter. Say so by adding const modifier to them.
Signed-off-by Jim Cromie <[email protected]>
--- lib/dynamic_debug.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
lib/dynamic_debug.c +12 -5
@@ -134,7 +134,8 @@ static void vpr_info_dq(const struct ddebug_query *query, const char *msg)* logs the changes. Takes ddebug_lock. */ static int ddebug_change (const struct ddebug_query *query, -struct flagsettings *mods) +const struct flagsettings *mods, +const struct flagsettings *filter) {int i;struct ddebug_table *dt;
@@ -430,7 +431,10 @@ static int ddebug_read_flags(const char *str, struct flagsettings *f)* flags fields of matched _ddebug's. Returns 0 on success * or <0 on error. */ -static int ddebug_parse_flags (const char *str,struct flagsettings *mods) + +static int ddebug_parse_flags (const char *str, +struct flagsettings *mods, +struct flagsettings *filter) {int op;
@@ -462,7 +466,9 @@ static int ddebug_parse_flags(const char *str, struct flagsettings *mods) mods->flags =0 ;break ; } -vpr_info ("*flagsp=0x%x *maskp=0x%x\n" , mods->flags, mods->mask); + +vpr_info ("mods:flags=0x%x,mask=0x%x filter:flags=0x%x,mask=0x%x\n" , + mods->flags, mods->mask, filter->flags, filter->mask);return 0 ; }
@@ -470,6 +476,7 @@ static int ddebug_parse_flags(const char *str, struct flagsettings *mods)static int ddebug_exec_query (char *query_string,const char *modname) {struct flagsettings mods = {}; +struct flagsettings filter = {};struct ddebug_query query;#define MAXWORDS 9int nwords, nfound;
@@ -484,12 +491,12 @@ static int ddebug_exec_query(char *query_string, const char *modname)pr_err ("query parse failed\n" );return -EINVAL ; } -if (ddebug_parse_flags (words[nwords-1 ], &mods)) { +if (ddebug_parse_flags (words[nwords-1 ], &mods, &filter)) {pr_err ("flags parse failed\n" );return -EINVAL ; }/* actually go and implement the change */ - nfound =ddebug_change (&query, &mods); + nfound =ddebug_change (&query, &mods, &filter);vpr_info_dq (&query, nfound ?"applied" :"no-match" );return nfound;
Signature · 1 line
2.21.0