Re: [PATCH bpf-next v2 07/11] libbpf: move function is_ldimm64() earlier in libbpf.c

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

 



On Wed, Feb 17, 2021 at 12:55 PM Yonghong Song <yhs@xxxxxx> wrote:
>
> Move function is_ldimm64() close to the beginning of libbpf.c,
> so it can be reused by later code and the next patch as well.
> There is no functionality change.
>
> Signed-off-by: Yonghong Song <yhs@xxxxxx>
> ---

Thanks!

Acked-by: Andrii Nakryiko <andrii@xxxxxxxxxx>

>  tools/lib/bpf/libbpf.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index d43cc3f29dae..21a3eedf070d 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -574,6 +574,11 @@ static bool insn_is_subprog_call(const struct bpf_insn *insn)
>                insn->off == 0;
>  }
>
> +static bool is_ldimm64(struct bpf_insn *insn)
> +{
> +       return insn->code == (BPF_LD | BPF_IMM | BPF_DW);
> +}
> +
>  static int
>  bpf_object__init_prog(struct bpf_object *obj, struct bpf_program *prog,
>                       const char *name, size_t sec_idx, const char *sec_name,
> @@ -3395,7 +3400,7 @@ static int bpf_program__record_reloc(struct bpf_program *prog,
>                 return 0;
>         }
>
> -       if (insn->code != (BPF_LD | BPF_IMM | BPF_DW)) {
> +       if (!is_ldimm64(insn)) {
>                 pr_warn("prog '%s': invalid relo against '%s' for insns[%d].code 0x%x\n",
>                         prog->name, sym_name, insn_idx, insn->code);
>                 return -LIBBPF_ERRNO__RELOC;
> @@ -5566,11 +5571,6 @@ static void bpf_core_poison_insn(struct bpf_program *prog, int relo_idx,
>         insn->imm = 195896080; /* => 0xbad2310 => "bad relo" */
>  }
>
> -static bool is_ldimm64(struct bpf_insn *insn)
> -{
> -       return insn->code == (BPF_LD | BPF_IMM | BPF_DW);
> -}
> -
>  static int insn_bpf_size_to_bytes(struct bpf_insn *insn)
>  {
>         switch (BPF_SIZE(insn->code)) {
> --
> 2.24.1
>



[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