bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eduard Zingerman <eddyz87@gmail.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: bpf@vger.kernel.org, ast@kernel.org, andrii@kernel.org,
	daniel@iogearbox.net,  martin.lau@linux.dev, kernel-team@fb.com,
	yonghong.song@linux.dev,  jose.marchesi@oracle.com,
	alan.maguire@oracle.com
Subject: Re: [PATCH bpf-next v2 2/4] libbpf: API to access btf_dump emit queue and print single type
Date: Tue, 28 May 2024 15:53:18 -0700	[thread overview]
Message-ID: <dbb51b28cfcecc8461f9fe002869ff3206eaea14.camel@gmail.com> (raw)
In-Reply-To: <CAEf4BzbUPTU__d4G3dt6Rga+aNG=kLRxsBM4LJMhYfMKy+RSfQ@mail.gmail.com>

[...]

> > +/* Dumps C language definition or forward declaration for type **id**:
> > + * - returns 1 if type is printable;
> > + * - returns 0 if type is non-printable.
> 
> does it also return <0 on error?

Right

> 
> > + */
> 
> let's follow the format of doc comments, see other APIs. There is
> @brief, @param, @return and so on.

Will do

> pw-bot: cr
> 
> 
> > +LIBBPF_API int btf_dump__dump_one_type(struct btf_dump *d, __u32 id, bool fwd);
> 
> not a fan of a name, how about we do `btf_dump__emit_type(struct
> btf_dump *d, __u32 id, struct btf_dump_emit_type_opts *opts)` and have
> forward declaration flag as options? We have
> btf_dump__emit_type_decl(), this one could be called
> btf_dump__emit_type_def() as well. WDYT?

`btf_dump__emit_type_def` seems good and I can make it accept options
with forward as a flag.

However, in such a case the following is also a contender:

struct btf_dump_type_opts {
	__u32 sz;
        bool skip_deps;		/* flags picked so that by default	 */
        bool forward_only;	/* the behavior matches non-opts variant */
};

LIBBPF_API int btf_dump__dump_type_opts(struct btf_dump *d, __u32 id,
                                        struct btf_dump_type_opts *opts);


I find this contender more ugly but a bit more consistent.
Wdyt?

[...]

  reply	other threads:[~2024-05-28 22:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-17 19:05 [PATCH bpf-next v2 0/4] API to access btf_dump emit queue and print single type Eduard Zingerman
2024-05-17 19:05 ` [PATCH bpf-next v2 1/4] libbpf: put forward declarations to btf_dump->emit_queue Eduard Zingerman
2024-05-28 22:05   ` Andrii Nakryiko
2024-05-28 22:25     ` Eduard Zingerman
2024-05-28 22:39       ` Andrii Nakryiko
2024-05-28 22:41         ` Eduard Zingerman
2024-05-17 19:05 ` [PATCH bpf-next v2 2/4] libbpf: API to access btf_dump emit queue and print single type Eduard Zingerman
2024-05-28 22:18   ` Andrii Nakryiko
2024-05-28 22:53     ` Eduard Zingerman [this message]
2024-05-28 23:19       ` Andrii Nakryiko
2024-05-28 23:39         ` Eduard Zingerman
2024-06-01  7:22     ` Eduard Zingerman
2024-06-04 17:39       ` Andrii Nakryiko
2024-05-17 19:05 ` [PATCH bpf-next v2 3/4] selftests/bpf: tests for btf_dump emit queue API Eduard Zingerman
2024-05-17 19:05 ` [PATCH bpf-next v2 4/4] selftests/bpf: corner case for typedefs handling in btf_dump Eduard Zingerman

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=dbb51b28cfcecc8461f9fe002869ff3206eaea14.camel@gmail.com \
    --to=eddyz87@gmail.com \
    --cc=alan.maguire@oracle.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=jose.marchesi@oracle.com \
    --cc=kernel-team@fb.com \
    --cc=martin.lau@linux.dev \
    --cc=yonghong.song@linux.dev \
    /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).