Re: [PATCH bpf-next v4 5/8] libbpf: Support opening bpf objects of either endianness

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

 



On Fri, Aug 30, 2024 at 06:16:25PM -0700, Eduard Zingerman wrote:
> On Fri, 2024-08-30 at 00:29 -0700, Tony Ambardar wrote:
> 
> [...]
> 
> > @@ -940,6 +942,21 @@ bpf_object__add_programs(struct bpf_object *obj, Elf_Data *sec_data,
> >  	return 0;
> >  }
> >  
> > +static void bpf_object_bswap_progs(struct bpf_object *obj)
> > +{
> > +	struct bpf_program *prog = obj->programs;
> > +	struct bpf_insn *insn;
> > +	int p, i;
> > +
> > +	for (p = 0; p < obj->nr_programs; p++, prog++) {
> > +		insn = prog->insns;
> > +		for (i = 0; i < prog->insns_cnt; i++, insn++)
> > +			bpf_insn_bswap(insn);
> > +		pr_debug("prog '%s': converted %zu insns to native byte order\n",
> > +			 prog->name, prog->insns_cnt);
> 
> Nit: pr_debug already printed available programs at this point,
>      maybe move this call outside of both loops?
> 

Good point. Will update to summarize # of programs converted instead.

> > +	}
> > +}
> > +
> >  static const struct btf_member *
> >  find_member_by_offset(const struct btf_type *t, __u32 bit_offset)
> >  {
> 
> [...]
> 




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux