On Tue, Oct 03, 2017 at 10:57:45AM -0700, Jakub Kicinski wrote: > Separate the instruction printing into a standalone source file. > This way sneaky code from tools/ can use it directly. > > Signed-off-by: Jakub Kicinski <jakub.kicin...@netronome.com> > --- > Like this? ... > +static void print_bpf_end_insn(void (*verbose)(const char *, ...), > + const struct bpf_insn *insn) > +{ > + verbose("(%02x) r%d = %s%d r%d\n", insn->code, insn->dst_reg, > + BPF_SRC(insn->code) == BPF_TO_BE ? "be" : "le", > + insn->imm, insn->dst_reg); > +} ... > + print_bpf_insn(verbose, insn, env->allow_ptr_leaks);
since you're changing it please please please kill that global verbose() ugliness. It's been on todo list for long time. iirc that's the only thing that prevents us to remove global bpf_verifier_lock. if we don't do it as part of this change, we'd need another one in the future with equal amount of changed lines, so let's do it now.