Re: [PATCH v2 dwarves 1/5] dwarf_loader: introduce pre/post cus__load_module hooks to conf_load

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

 



On Thursday, October 10th, 2024 at 1:56 AM, Eduard Zingerman <eddyz87@xxxxxxxxx> wrote:

> 
> 
> On Wed, 2024-10-09 at 23:35 +0000, Ihor Solodrai wrote:
> 
> [...]
> 
> > @@ -106,6 +114,14 @@ struct conf_load {
> > struct conf_fprintf *conf_fprintf;
> > int (*threads_prepare)(struct conf_load *conf, int nr_threads, void **thr_data);
> > int (*threads_collect)(struct conf_load *conf, int nr_threads, void **thr_data, int error);
> > + int (*pre_cus__load_module)(struct process_dwflmod_parms *parms,
> > + Dwfl_Module *mod,
> > + Dwarf *dw,
> > + Elf *elf);
> > + int (*post_cus__load_module)(struct process_dwflmod_parms *parms,
> > + Dwfl_Module *mod,
> > + Dwarf *dw,
> > + Elf *elf);
> > };
> 
> 
> I'd name these `module_pre_load` and `module_post_load`.
> The `post_cus__load_module` does not seem to be used in this
> patch-set, so I'd exclude it for now.

I used these names with the idea that more hooks may be added in the
future, so a convention like pre_<exact_fname> and post_<exact_fname>
is appropriate. Maybe that's too verbose. How about `pre_load_module`?

> 
> I'd also keep the number of parameters to the minimum,
> this patch-set defines only btf_encoder__pre_cus__load_module and it
> only uses `elf` parameter. But since the hook goal is to operate on
> modules I'd pass only Dwfl_Module and use dwfl_module_getelf to get
> a link to Elf instance.
> 
> > /** struct conf_fprintf - hints to the __fprintf routines

When I first introduced these hooks in WIP changes some values from
parms had to be passed, which is not true for this patchset.

However I tend to agree with the approach of adding as little code as
necessary. In v3 I am removing the post hook and leaving two arguments
(elf and mod).

> 
> 
> [...]






[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux