[DTrace-devel] [PATCH] bpf: use initializer for dtrace_difo_t *dp

Eugene Loh eugene.loh at oracle.com
Fri Jan 16 20:28:59 UTC 2026


Reviewed-by: Eugene Loh <eugene.loh at oracle.com>

On 1/9/26 16:10, Kris Van Hees via DTrace-devel wrote:
> Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
> ---
>   libdtrace/dt_bpf.c | 10 ++--------
>   1 file changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/libdtrace/dt_bpf.c b/libdtrace/dt_bpf.c
> index 82a73414..20365855 100644
> --- a/libdtrace/dt_bpf.c
> +++ b/libdtrace/dt_bpf.c
> @@ -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)



More information about the DTrace-devel mailing list