BPF List
 help / color / mirror / Atom feed
From: Alan Maguire <alan.maguire@oracle.com>
To: Daniel Xu <dxu@dxuuu.xyz>,
	acme@kernel.org, jolsa@kernel.org, quentin@isovalent.com,
	eddyz87@gmail.com
Cc: andrii.nakryiko@gmail.com, ast@kernel.org, daniel@iogearbox.net,
	bpf@vger.kernel.org
Subject: Re: [PATCH dwarves v6 1/3] gobuffer: Add gobuffer__sort() helper
Date: Wed, 17 Apr 2024 10:20:41 +0100	[thread overview]
Message-ID: <76869286-5593-470e-b04a-e38f1613c361@oracle.com> (raw)
In-Reply-To: <ba9ff49e099583ab854d3d3c8c215c3ca1b6f930.1711389163.git.dxu@dxuuu.xyz>

On 25/03/2024 17:53, Daniel Xu wrote:
> Add a helper to sort the gobuffer. Trivial wrapper around qsort().
> 
> Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
Reviewed-by: Alan Maguire <alan.maguire@oracle.com>
> ---
>  gobuffer.c | 5 +++++
>  gobuffer.h | 2 ++
>  2 files changed, 7 insertions(+)
> 
> diff --git a/gobuffer.c b/gobuffer.c
> index 02b2084..4655339 100644
> --- a/gobuffer.c
> +++ b/gobuffer.c
> @@ -102,6 +102,11 @@ void gobuffer__copy(const struct gobuffer *gb, void *dest)
>  	}
>  }
>  
> +void gobuffer__sort(struct gobuffer *gb, unsigned int size, int (*compar)(const void *, const void *))
> +{
> +	qsort((void *)gb->entries, gb->nr_entries, size, compar);

nit shouldn't need to cast char * gb->entries to void * ; not worth
respinning the series for though unless there are other issues

> +}
> +
>  const void *gobuffer__compress(struct gobuffer *gb, unsigned int *size)
>  {
>  	z_stream z = {
> diff --git a/gobuffer.h b/gobuffer.h
> index a12c5c8..cd218b6 100644
> --- a/gobuffer.h
> +++ b/gobuffer.h
> @@ -21,6 +21,8 @@ void __gobuffer__delete(struct gobuffer *gb);
>  
>  void gobuffer__copy(const struct gobuffer *gb, void *dest);
>  
> +void gobuffer__sort(struct gobuffer *gb, unsigned int size, int (*compar)(const void *, const void *));
> +
>  int gobuffer__add(struct gobuffer *gb, const void *s, unsigned int len);
>  int gobuffer__allocate(struct gobuffer *gb, unsigned int len);
>  

  reply	other threads:[~2024-04-17  9:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-25 17:53 [PATCH dwarves v6 0/3] pahole: Inject kfunc decl tags into BTF Daniel Xu
2024-03-25 17:53 ` [PATCH dwarves v6 1/3] gobuffer: Add gobuffer__sort() helper Daniel Xu
2024-04-17  9:20   ` Alan Maguire [this message]
2024-04-17 13:40     ` Arnaldo Carvalho de Melo
2024-04-18  9:31       ` Alan Maguire
2024-03-25 17:53 ` [PATCH dwarves v6 2/3] pahole: Add --btf_feature=decl_tag_kfuncs feature Daniel Xu
2024-03-25 17:53 ` [PATCH dwarves v6 3/3] pahole: Inject kfunc decl tags into BTF Daniel Xu
2024-04-17  9:32   ` Alan Maguire
2024-04-02 20:24 ` [PATCH dwarves v6 0/3] " Arnaldo Carvalho de Melo

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=76869286-5593-470e-b04a-e38f1613c361@oracle.com \
    --to=alan.maguire@oracle.com \
    --cc=acme@kernel.org \
    --cc=andrii.nakryiko@gmail.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=dxu@dxuuu.xyz \
    --cc=eddyz87@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=quentin@isovalent.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