Re: [RFC bpf-next v1 4/8] selftests/bpf: extract utility function for BPF disassembly

Eduard Zingerman
2024-07-02T21:23:35Z

On Tue, 2024-07-02 at 14:16 -0700, Andrii Nakryiko wrote:

[...]

> struct bpf_insn *insn = skip_first_insn ? buf + 1 : buf, *insn_end = buf + cnt;
>
> while (insn != insn_end) {
> insn = disasm_insn(insn, insn_buf, sizeof(insn_buf));
> fprintf(prog_out, "%s\n", insn_buf);
> }
>
> less addition, but it's simple enough in both cases, of course (I just
> find 1 or 2 as a result kind of a bad contract, but whatever)

Will change.

[...]

> > > > + sscanf(buf, "(%*[^)]) %n", &pfx_end);
> > >
> > > let me simplify this a bit ;)
> > >
> > > pfx_end = 5;
> > >
> > > not as sophisticated, but equivalent
> >
> > Okay :(
>
> if 5 makes you sad, do keep sscanf(), of course, no worries :)

The obscure doc makes me even more sad. …