diff mbox series

[2/2] bpftool: Adjust to new print_bpf_insn interface

Message ID 20180321150212.5586-2-jolsa@kernel.org
State Changes Requested, archived
Delegated to: BPF Maintainers
Headers show
Series None | expand

Commit Message

Jiri Olsa March 21, 2018, 3:02 p.m. UTC
Change bpftool to skip the removed struct bpf_verifier_env
argument in print_bpf_insn. It was passed as NULL anyway.

No functional change intended.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/bpf/bpftool/prog.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Quentin Monnet March 21, 2018, 4:39 p.m. UTC | #1
2018-03-21 16:02 UTC+0100 ~ Jiri Olsa <jolsa@kernel.org>
> Change bpftool to skip the removed struct bpf_verifier_env
> argument in print_bpf_insn. It was passed as NULL anyway.
> 
> No functional change intended.
> 
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
>  tools/bpf/bpftool/prog.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c
> index e549e329be82..108001d974ee 100644
> --- a/tools/bpf/bpftool/prog.c
> +++ b/tools/bpf/bpftool/prog.c
> @@ -489,7 +489,7 @@ static struct kernel_sym *kernel_syms_search(struct dump_data *dd,
>  		       sizeof(*dd->sym_mapping), kernel_syms_cmp) : NULL;
>  }
>  
> -static void print_insn(struct bpf_verifier_env *env, const char *fmt, ...)
> +static void print_insn(void *private_data, const char *fmt, ...)
>  {
>  	va_list args;
>  
> @@ -576,7 +576,7 @@ static void dump_xlated_plain(struct dump_data *dd, void *buf,
>  		double_insn = insn[i].code == (BPF_LD | BPF_IMM | BPF_DW);
>  
>  		printf("% 4d: ", i);
> -		print_bpf_insn(&cbs, NULL, insn + i, true);
> +		print_bpf_insn(&cbs, insn + i, true);
>  
>  		if (opcodes) {
>  			printf("       ");
> @@ -590,7 +590,7 @@ static void dump_xlated_plain(struct dump_data *dd, void *buf,
>  	}
>  }
>  
> -static void print_insn_json(struct bpf_verifier_env *env, const char *fmt, ...)
> +static void print_insn_json(void *private_data, const char *fmt, ...)
>  {
>  	unsigned int l = strlen(fmt);
>  	char chomped_fmt[l];
> @@ -628,7 +628,7 @@ static void dump_xlated_json(struct dump_data *dd, void *buf,
>  
>  		jsonw_start_object(json_wtr);
>  		jsonw_name(json_wtr, "disasm");
> -		print_bpf_insn(&cbs, NULL, insn + i, true);
> +		print_bpf_insn(&cbs, insn + i, true);
>  
>  		if (opcodes) {
>  			jsonw_name(json_wtr, "opcodes");
> 

Hi Jiri, this code has changed in the tree. It was moved to
tools/bpf/bpftool/xlated_dumper.c, and there is now a third function to
update: print_insn_for_graph(). Could you please rebase the patch?

Quentin
Jiri Olsa March 21, 2018, 4:43 p.m. UTC | #2
On Wed, Mar 21, 2018 at 04:39:09PM +0000, Quentin Monnet wrote:
> 2018-03-21 16:02 UTC+0100 ~ Jiri Olsa <jolsa@kernel.org>
> > Change bpftool to skip the removed struct bpf_verifier_env
> > argument in print_bpf_insn. It was passed as NULL anyway.
> > 
> > No functional change intended.
> > 
> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > ---
> >  tools/bpf/bpftool/prog.c | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c
> > index e549e329be82..108001d974ee 100644
> > --- a/tools/bpf/bpftool/prog.c
> > +++ b/tools/bpf/bpftool/prog.c
> > @@ -489,7 +489,7 @@ static struct kernel_sym *kernel_syms_search(struct dump_data *dd,
> >  		       sizeof(*dd->sym_mapping), kernel_syms_cmp) : NULL;
> >  }
> >  
> > -static void print_insn(struct bpf_verifier_env *env, const char *fmt, ...)
> > +static void print_insn(void *private_data, const char *fmt, ...)
> >  {
> >  	va_list args;
> >  
> > @@ -576,7 +576,7 @@ static void dump_xlated_plain(struct dump_data *dd, void *buf,
> >  		double_insn = insn[i].code == (BPF_LD | BPF_IMM | BPF_DW);
> >  
> >  		printf("% 4d: ", i);
> > -		print_bpf_insn(&cbs, NULL, insn + i, true);
> > +		print_bpf_insn(&cbs, insn + i, true);
> >  
> >  		if (opcodes) {
> >  			printf("       ");
> > @@ -590,7 +590,7 @@ static void dump_xlated_plain(struct dump_data *dd, void *buf,
> >  	}
> >  }
> >  
> > -static void print_insn_json(struct bpf_verifier_env *env, const char *fmt, ...)
> > +static void print_insn_json(void *private_data, const char *fmt, ...)
> >  {
> >  	unsigned int l = strlen(fmt);
> >  	char chomped_fmt[l];
> > @@ -628,7 +628,7 @@ static void dump_xlated_json(struct dump_data *dd, void *buf,
> >  
> >  		jsonw_start_object(json_wtr);
> >  		jsonw_name(json_wtr, "disasm");
> > -		print_bpf_insn(&cbs, NULL, insn + i, true);
> > +		print_bpf_insn(&cbs, insn + i, true);
> >  
> >  		if (opcodes) {
> >  			jsonw_name(json_wtr, "opcodes");
> > 
> 
> Hi Jiri, this code has changed in the tree. It was moved to
> tools/bpf/bpftool/xlated_dumper.c, and there is now a third function to
> update: print_insn_for_graph(). Could you please rebase the patch?

sure.. I was over perf tree, I'll check on bpf tree

thanks,
jirka
Daniel Borkmann March 21, 2018, 4:44 p.m. UTC | #3
On 03/21/2018 05:43 PM, Jiri Olsa wrote:
> On Wed, Mar 21, 2018 at 04:39:09PM +0000, Quentin Monnet wrote:
>> 2018-03-21 16:02 UTC+0100 ~ Jiri Olsa <jolsa@kernel.org>
>>> Change bpftool to skip the removed struct bpf_verifier_env
>>> argument in print_bpf_insn. It was passed as NULL anyway.
>>>
>>> No functional change intended.
>>>
>>> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
>>> ---
>>>  tools/bpf/bpftool/prog.c | 8 ++++----
>>>  1 file changed, 4 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c
>>> index e549e329be82..108001d974ee 100644
>>> --- a/tools/bpf/bpftool/prog.c
>>> +++ b/tools/bpf/bpftool/prog.c
>>> @@ -489,7 +489,7 @@ static struct kernel_sym *kernel_syms_search(struct dump_data *dd,
>>>  		       sizeof(*dd->sym_mapping), kernel_syms_cmp) : NULL;
>>>  }
>>>  
>>> -static void print_insn(struct bpf_verifier_env *env, const char *fmt, ...)
>>> +static void print_insn(void *private_data, const char *fmt, ...)
>>>  {
>>>  	va_list args;
>>>  
>>> @@ -576,7 +576,7 @@ static void dump_xlated_plain(struct dump_data *dd, void *buf,
>>>  		double_insn = insn[i].code == (BPF_LD | BPF_IMM | BPF_DW);
>>>  
>>>  		printf("% 4d: ", i);
>>> -		print_bpf_insn(&cbs, NULL, insn + i, true);
>>> +		print_bpf_insn(&cbs, insn + i, true);
>>>  
>>>  		if (opcodes) {
>>>  			printf("       ");
>>> @@ -590,7 +590,7 @@ static void dump_xlated_plain(struct dump_data *dd, void *buf,
>>>  	}
>>>  }
>>>  
>>> -static void print_insn_json(struct bpf_verifier_env *env, const char *fmt, ...)
>>> +static void print_insn_json(void *private_data, const char *fmt, ...)
>>>  {
>>>  	unsigned int l = strlen(fmt);
>>>  	char chomped_fmt[l];
>>> @@ -628,7 +628,7 @@ static void dump_xlated_json(struct dump_data *dd, void *buf,
>>>  
>>>  		jsonw_start_object(json_wtr);
>>>  		jsonw_name(json_wtr, "disasm");
>>> -		print_bpf_insn(&cbs, NULL, insn + i, true);
>>> +		print_bpf_insn(&cbs, insn + i, true);
>>>  
>>>  		if (opcodes) {
>>>  			jsonw_name(json_wtr, "opcodes");
>>>
>>
>> Hi Jiri, this code has changed in the tree. It was moved to
>> tools/bpf/bpftool/xlated_dumper.c, and there is now a third function to
>> update: print_insn_for_graph(). Could you please rebase the patch?
> 
> sure.. I was over perf tree, I'll check on bpf tree

Just to be sure, it should be bpf-next. bpf is for fixes only.

Thanks,
Daniel
diff mbox series

Patch

diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c
index e549e329be82..108001d974ee 100644
--- a/tools/bpf/bpftool/prog.c
+++ b/tools/bpf/bpftool/prog.c
@@ -489,7 +489,7 @@  static struct kernel_sym *kernel_syms_search(struct dump_data *dd,
 		       sizeof(*dd->sym_mapping), kernel_syms_cmp) : NULL;
 }
 
-static void print_insn(struct bpf_verifier_env *env, const char *fmt, ...)
+static void print_insn(void *private_data, const char *fmt, ...)
 {
 	va_list args;
 
@@ -576,7 +576,7 @@  static void dump_xlated_plain(struct dump_data *dd, void *buf,
 		double_insn = insn[i].code == (BPF_LD | BPF_IMM | BPF_DW);
 
 		printf("% 4d: ", i);
-		print_bpf_insn(&cbs, NULL, insn + i, true);
+		print_bpf_insn(&cbs, insn + i, true);
 
 		if (opcodes) {
 			printf("       ");
@@ -590,7 +590,7 @@  static void dump_xlated_plain(struct dump_data *dd, void *buf,
 	}
 }
 
-static void print_insn_json(struct bpf_verifier_env *env, const char *fmt, ...)
+static void print_insn_json(void *private_data, const char *fmt, ...)
 {
 	unsigned int l = strlen(fmt);
 	char chomped_fmt[l];
@@ -628,7 +628,7 @@  static void dump_xlated_json(struct dump_data *dd, void *buf,
 
 		jsonw_start_object(json_wtr);
 		jsonw_name(json_wtr, "disasm");
-		print_bpf_insn(&cbs, NULL, insn + i, true);
+		print_bpf_insn(&cbs, insn + i, true);
 
 		if (opcodes) {
 			jsonw_name(json_wtr, "opcodes");