dyndbg: add filter parameter to ddebug_parse_flags
Subsystems (2)
Jim Cromie
maintainerPATCH 11/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 doesn't 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
@@ -147,7 +147,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;
@@ -445,7 +446,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;
@@ -477,7 +481,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 ; }
@@ -485,6 +491,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;
@@ -496,7 +503,7 @@ static int ddebug_exec_query(char *query_string, const char *modname)return -EINVAL ; }/* check flags 1st (last arg) so query is pairs of spec,val */ -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 ; }
@@ -505,7 +512,7 @@ static int ddebug_exec_query(char *query_string, const char *modname)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.23.0