Re: [PATCH v3 bpf-next 1/2] bpf: add a ksym BPF iterator

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

 



On Mon, Jul 4, 2022 at 6:55 AM Alan Maguire <alan.maguire@xxxxxxxxxx> wrote:
>  static inline int kallsyms_for_perf(void)
>  {
>  #ifdef CONFIG_PERF_EVENTS
> @@ -885,6 +967,18 @@ const char *kdb_walk_kallsyms(loff_t *pos)
>  static int __init kallsyms_init(void)
>  {
>         proc_create("kallsyms", 0444, NULL, &kallsyms_proc_ops);
> +#if defined(CONFIG_BPF_SYSCALL)
> +       {
> +               int ret;
> +
> +               ksym_iter_reg_info.ctx_arg_info[0].btf_id = *btf_ksym_iter_id;
> +               ret = bpf_iter_reg_target(&ksym_iter_reg_info);
> +               if (ret) {
> +                       pr_warn("Warning: could not register bpf ksym iterator: %d\n", ret);
> +                       return ret;
> +               }
> +       }
> +#endif

The ifdef-s inside the function body are not pretty.
I feel the v2 version was cleaner.
static void __init bpf_ksym_iter_register()
were only missing late_initcall(bpf_ksym_iter_register);
to make it single #ifdef CONFIG_BPF_SYSCALL for everything.
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