All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 12/16] dyndbg: add filter parameter to ddebug_parse_flags
@ 2019-10-29 20:01 Jim Cromie
  0 siblings, 0 replies; 3+ messages in thread
From: Jim Cromie @ 2019-10-29 20:01 UTC (permalink / raw)
  To: jbaron, linux-kernel; +Cc: linux, greg, Jim Cromie

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 <jim.cromie@gmail.com>
---
 lib/dynamic_debug.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 5cb44088fff5..173b28250bd6 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -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 9
 	int 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;
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 12/16] dyndbg: add filter parameter to ddebug_parse_flags
  2020-06-05 16:26 ` [PATCH 12/16] dyndbg: add filter parameter to ddebug_parse_flags Jim Cromie
@ 2020-06-12 21:05   ` Jason Baron
  0 siblings, 0 replies; 3+ messages in thread
From: Jason Baron @ 2020-06-12 21:05 UTC (permalink / raw)
  To: Jim Cromie, linux-kernel, akpm, gregkh; +Cc: linux



On 6/5/20 12:26 PM, Jim Cromie wrote:
> Add a new *filter param to ddebug_parse_flags(), allowing it to
> communicate optional filter flags back to its caller: ddebug_change()
>

I think you meant ddebug_exec_query() here?

Thanks,


-Jason


> 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.cromie@gmail.com>
> ---
>  lib/dynamic_debug.c | 17 ++++++++++++-----
>  1 file changed, 12 insertions(+), 5 deletions(-)
> 
> diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
> index 2ecabfd3f432..32eb7d9545c7 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 flagsettings *mods)
> +			 const struct flagsettings *mods,
> +			 const struct flagsettings *filter)
>  {
>  	int i;
>  	struct ddebug_table *dt;
> @@ -444,7 +445,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;
>  
> @@ -476,7 +480,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;
>  }
> @@ -484,6 +490,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 9
>  	int nwords, nfound;
> @@ -495,7 +502,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;
>  	}
> @@ -504,7 +511,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;
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 12/16] dyndbg: add filter parameter to ddebug_parse_flags
  2020-06-05 16:26 [PATCH 00/16] dynamic_debug: cleanups, 2 features Jim Cromie
@ 2020-06-05 16:26 ` Jim Cromie
  2020-06-12 21:05   ` Jason Baron
  0 siblings, 1 reply; 3+ messages in thread
From: Jim Cromie @ 2020-06-05 16:26 UTC (permalink / raw)
  To: jbaron, linux-kernel, akpm, gregkh; +Cc: linux, Jim Cromie

Add a new *filter param to ddebug_parse_flags(), allowing it to
communicate optional filter flags back to its caller: 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 <jim.cromie@gmail.com>
---
 lib/dynamic_debug.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 2ecabfd3f432..32eb7d9545c7 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 flagsettings *mods)
+			 const struct flagsettings *mods,
+			 const struct flagsettings *filter)
 {
 	int i;
 	struct ddebug_table *dt;
@@ -444,7 +445,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;
 
@@ -476,7 +480,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;
 }
@@ -484,6 +490,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 9
 	int nwords, nfound;
@@ -495,7 +502,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;
 	}
@@ -504,7 +511,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;
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-06-12 21:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-29 20:01 [PATCH 12/16] dyndbg: add filter parameter to ddebug_parse_flags Jim Cromie
2020-06-05 16:26 [PATCH 00/16] dynamic_debug: cleanups, 2 features Jim Cromie
2020-06-05 16:26 ` [PATCH 12/16] dyndbg: add filter parameter to ddebug_parse_flags Jim Cromie
2020-06-12 21:05   ` Jason Baron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.