linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ross Zwisler <zwisler@google.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-trace-devel@vger.kernel.org,
	Stevie Alvarez <stevie.6strings@gmail.com>
Subject: Re: [PATCH v2 09/11] libtraceeval: Make traceeval_remove() check size of keys array
Date: Mon, 2 Oct 2023 14:03:38 -0600	[thread overview]
Message-ID: <20231002200338.GF1532181@google.com> (raw)
In-Reply-To: <20230927123314.989589-10-rostedt@goodmis.org>

On Wed, Sep 27, 2023 at 08:33:12AM -0400, Steven Rostedt wrote:
> From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
> 
> Make traceeval_remove() into a macro to pass in the size of the keys
> array, and rename the function to traceeval_remove_size() that now takes
> the size of the keys array.
> 
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> ---
>  include/traceeval-hist.h | 7 +++++--
>  src/histograms.c         | 7 +++++--
>  2 files changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/include/traceeval-hist.h b/include/traceeval-hist.h
> index 7f48bb92cc96..804a0aaa631d 100644
> --- a/include/traceeval-hist.h
> +++ b/include/traceeval-hist.h
> @@ -196,8 +196,11 @@ int traceeval_insert_size(struct traceeval *teval,
>  	traceeval_insert_size(teval, keys, TRACEEVAL_ARRAY_SIZE(keys), \
>  			      vals, TRACEEVAL_ARRAY_SIZE(vals))
>  
> -int traceeval_remove(struct traceeval *teval,
> -		     const struct traceeval_data *keys);
> +int traceeval_remove_size(struct traceeval *teval,
> +			  const struct traceeval_data *keys, size_t nr_keys);
> +
> +#define traceeval_remove(teval, keys)					\
> +	traceeval_remove_size(teval, keys, TRACEEVAL_ARRAY_SIZE(keys))
>  
>  int traceeval_query_size(struct traceeval *teval, const struct traceeval_data *keys,
>  			 size_t nr_keys, const struct traceeval_data **results);
> diff --git a/src/histograms.c b/src/histograms.c
> index ab8a560fe14d..28cf0d4ed225 100644
> --- a/src/histograms.c
> +++ b/src/histograms.c
> @@ -977,13 +977,16 @@ int traceeval_insert_size(struct traceeval *teval,

I think we need to update the comments above this function to account for the
new name and the additional 'nr_keys' param, but other than that you can add:

Reviewed-by: Ross Zwisler <zwisler@google.com>

>   *         0 if it did not find an time matching @keys
>   *        -1 if there was an error.
>   */
> -int traceeval_remove(struct traceeval *teval,
> -		     const struct traceeval_data *keys)
> +int traceeval_remove_size(struct traceeval *teval,
> +			  const struct traceeval_data *keys, size_t nr_keys)
>  {
>  	struct hash_table *hist = teval->hist;
>  	struct entry *entry;
>  	int check;
>  
> +	if (teval->nr_key_types != nr_keys)
> +		return -1;
> +
>  	entry = NULL;
>  	check = get_entry(teval, keys, &entry);
>  
> -- 
> 2.40.1
> 

  reply	other threads:[~2023-10-02 20:03 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-27 12:33 [PATCH v2 00/11] libtraceeval: Even more updates! Steven Rostedt
2023-09-27 12:33 ` [PATCH v2 01/11] libtraceeval: Add check for updates to know to recreate iter array Steven Rostedt
2023-09-27 12:33 ` [PATCH v2 02/11] libtraceeval: Add traceeval_iterator_query() Steven Rostedt
2023-09-27 12:33 ` [PATCH v2 03/11] libtraceeval: Add traceeval_iterator_results_release() Steven Rostedt
2023-10-02 19:23   ` Ross Zwisler
2023-09-27 12:33 ` [PATCH v2 04/11] libtraceeval: Add traceeval_iterator_stat() Steven Rostedt
2023-09-27 12:33 ` [PATCH v2 05/11] libtraceeval: Add traceeval_iterator_remove() Steven Rostedt
2023-10-02 19:45   ` Ross Zwisler
2023-09-27 12:33 ` [PATCH v2 06/11] libtraceeval histogram: Add type to traceeval_data and make it a structure Steven Rostedt
2023-10-02 19:53   ` Ross Zwisler
2023-10-02 19:54     ` Ross Zwisler
2023-10-03 13:22       ` Steven Rostedt
2023-10-02 20:16     ` Steven Rostedt
2023-09-27 12:33 ` [PATCH v2 07/11] libtraceveal: Add type checks to traceeval_data vals and keys Steven Rostedt
2023-10-02 19:59   ` Ross Zwisler
2023-09-27 12:33 ` [PATCH v2 08/11] libtraceeval: Add size checks to insert and query functions Steven Rostedt
2023-09-27 12:33 ` [PATCH v2 09/11] libtraceeval: Make traceeval_remove() check size of keys array Steven Rostedt
2023-10-02 20:03   ` Ross Zwisler [this message]
2023-09-27 12:33 ` [PATCH v2 10/11] libtraceeval: Make traceeval_stat() " Steven Rostedt
2023-10-02 20:07   ` Ross Zwisler
2023-09-27 12:33 ` [PATCH v2 11/11] libtraceeval: Only do stats on values marked with the STAT flag Steven Rostedt
2023-10-02 20:15   ` Ross Zwisler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231002200338.GF1532181@google.com \
    --to=zwisler@google.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=stevie.6strings@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).