bpf: use initializer for dtrace_difo_t *dp
PATCH 1/1 bpf: use initializer for dtrace_difo_t *dp
Signed-off-by Kris Van Hees <[email protected]>
--- libdtrace/dt_bpf.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
libdtrace/dt_bpf.c +2 -8
@@ -422,12 +422,9 @@ have_helper(uint32_t func_id)BPF_CALL_HELPER (func_id), BPF_RETURN() }; -dtrace_difo_t dp; +dtrace_difo_t dp = { insns,NULL ,NULL ,ARRAY_SIZE (insns) };int fd; - dp.dtdo_buf = insns; - dp.dtdo_len =ARRAY_SIZE (insns); -/* If the program loads, we can use the helper. */ fd =dt_bpf_prog_attach (BPF_PROG_TYPE_KPROBE ,0 ,0 ,0 , &dp,1 , log,DT_BPF_LOG_SIZE_SMALL );
@@ -486,12 +483,9 @@ have_attach_type(enum bpf_prog_type ptype, enum bpf_attach_type atype,BPF_MOV_IMM (BPF_REG_0 ,0 ), BPF_RETURN() }; -dtrace_difo_t dp; +dtrace_difo_t dp = { insns,NULL ,NULL ,ARRAY_SIZE (insns) };int pfd, tfd =-1 ; - dp.dtdo_buf = insns; - dp.dtdo_len =ARRAY_SIZE (insns); - pfd =dt_bpf_prog_attach (ptype, atype,0 , btf_id, &dp,0 ,NULL ,0 );/* If the program load fails, we cannot iuse the attach type. */ if (pfd <0 )
Signature · 1 line
2.51.0
Reviewed-by Eugene Loh <[email protected]>
Quoted 37 lines · Kris Van Hees via DTrace-devel
Signed-off-by Kris Van Hees <[email protected]>--- libdtrace/dt_bpf.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)libdtrace/dt_bpf.c +2
-8@@ -422,12 +422,9 @@ have_helper(uint32_t func_id)BPF_CALL_HELPER (func_id), BPF_RETURN() }; -dtrace_difo_t dp; +dtrace_difo_t dp = { insns,NULL ,NULL ,ARRAY_SIZE (insns) };int fd; - dp.dtdo_buf = insns; - dp.dtdo_len =ARRAY_SIZE (insns); -/* If the program loads, we can use the helper. */ fd =dt_bpf_prog_attach (BPF_PROG_TYPE_KPROBE ,0 ,0 ,0 , &dp,1 , log,DT_BPF_LOG_SIZE_SMALL );@@ -486,12 +483,9 @@ have_attach_type(enum bpf_prog_type ptype, enum bpf_attach_type atype,BPF_MOV_IMM (BPF_REG_0 ,0 ), BPF_RETURN() }; -dtrace_difo_t dp; +dtrace_difo_t dp = { insns,NULL ,NULL ,ARRAY_SIZE (insns) };int pfd, tfd =-1 ; - dp.dtdo_buf = insns; - dp.dtdo_len =ARRAY_SIZE (insns); - pfd =dt_bpf_prog_attach (ptype, atype,0 , btf_id, &dp,0 ,NULL ,0 );/* If the program load fails, we cannot iuse the attach type. */ if (pfd <0 )