BPF List
 help / color / mirror / Atom feed
From: Alan Maguire <alan.maguire@oracle.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Daniel Xu <dxu@dxuuu.xyz>,
	jolsa@kernel.org, quentin@isovalent.com, eddyz87@gmail.com,
	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: Thu, 18 Apr 2024 10:31:37 +0100	[thread overview]
Message-ID: <95ccc774-18df-4c2b-94f6-a731565ff367@oracle.com> (raw)
In-Reply-To: <Zh_RUWT4b3QC31k6@x1>

On 17/04/2024 14:40, Arnaldo Carvalho de Melo wrote:
> On Wed, Apr 17, 2024 at 10:20:41AM +0100, Alan Maguire wrote:
>> 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
> 
> I can remove that while applying the series, which I'm doing now.
>

great, thanks! BTW patch 2 will probably require a small tweak for
merging into next:

-	BTF_FEATURE(decl_tag_kfuncs, btf_decl_tag_kfuncs, false),
+	BTF_FEATURE(decl_tag_kfuncs, btf_decl_tag_kfuncs, false, true),

this will ensure it is considered a standard feature and is enabled for
"all"; for readability it might make sense to position it wth the other
features prior to

        BTF_FEATURE(reproducible_build, reproducible_build, false, false),

...since then we'd have the standard features grouped before the
non-standard ones, making it a bit more readable; not a big deal tho.
thanks!

> - Arnaldo
>  
>>> +}
>>> +
>>>  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-18  9:32 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
2024-04-17 13:40     ` Arnaldo Carvalho de Melo
2024-04-18  9:31       ` Alan Maguire [this message]
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=95ccc774-18df-4c2b-94f6-a731565ff367@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