Once again, adjust the interface between 3 static functions: - ddebug_exec_query calls .. - ddebug_parse_query - unchanged here, mentioned for context - ddebug_parse_flags, to read the modifying flags - ddebug_change, to apply mods to callsites that match the query
This time, add a 2nd flag_settings variable int ddebug_exec_query(), to specify a secondary constraint on callsites which match the query, and which are therefore about to be modified. Here, we only add the channel; ddebug_parse_flags doesnt fill the filter, and ddebug_change doesnt act upon it. 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 <jim.cro...@gmail.com> --- lib/dynamic_debug.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 8400e4f90b67..0fcc688789f4 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -146,7 +146,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 flag_settings *modifiers) + const struct flag_settings *modifiers, + const struct flag_settings *filter) { int i; struct ddebug_table *dt; @@ -456,7 +457,9 @@ static int ddebug_read_flags(const char *str, struct flag_settings *modifiers) * flags fields of matched _ddebug's. Returns 0 on success * or <0 on error. */ -static int ddebug_parse_flags(const char *str, struct flag_settings *modifiers) +static int ddebug_parse_flags(const char *str, + struct flag_settings *modifiers, + struct flag_settings *filter) { int op; @@ -489,7 +492,8 @@ static int ddebug_parse_flags(const char *str, struct flag_settings *modifiers) modifiers->flags = 0; break; } - vpr_info("*flagsp=0x%x *maskp=0x%x\n", modifiers->flags, modifiers->mask); + vpr_info("mods:flags=0x%x,mask=0x%x filter:flags=0x%x,mask=0x%x\n", + modifiers->flags, modifiers->mask, filter->flags, filter->mask); return 0; } @@ -498,6 +502,7 @@ static int ddebug_exec_query(char *query_string, const char *modname) { struct flag_settings modifiers = {}; struct ddebug_query query = {}; + struct flag_settings filter = {}; #define MAXWORDS 9 int nwords, nfound; char *words[MAXWORDS]; @@ -508,7 +513,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], &modifiers)) { + if (ddebug_parse_flags(words[nwords-1], &modifiers, &filter)) { pr_err("flags parse failed\n"); return -EINVAL; } @@ -517,7 +522,7 @@ static int ddebug_exec_query(char *query_string, const char *modname) return -EINVAL; } /* actually go and implement the change */ - nfound = ddebug_change(&query, &modifiers); + nfound = ddebug_change(&query, &modifiers, &filter); vpr_info_dq(&query, nfound ? "applied" : "no-match"); return nfound; -- 2.26.2