Re: [PATCH bpf-next v2 2/4] libbpf: API to access btf_dump emit queue and print single type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[...]

> > +/* 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?

[...]





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux