* [PATCH] bpf: use initializer for dtrace_difo_t *dp
@ 2026-01-09 21:10 Kris Van Hees
2026-01-16 20:28 ` [DTrace-devel] " Eugene Loh
0 siblings, 1 reply; 2+ messages in thread
From: Kris Van Hees @ 2026-01-09 21:10 UTC (permalink / raw)
To: dtrace, dtrace-devel
Signed-off-by: Kris Van Hees <kris.van.hees@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)
--
2.51.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [DTrace-devel] [PATCH] bpf: use initializer for dtrace_difo_t *dp
2026-01-09 21:10 [PATCH] bpf: use initializer for dtrace_difo_t *dp Kris Van Hees
@ 2026-01-16 20:28 ` Eugene Loh
0 siblings, 0 replies; 2+ messages in thread
From: Eugene Loh @ 2026-01-16 20:28 UTC (permalink / raw)
To: Kris Van Hees, dtrace, dtrace-devel
Reviewed-by: Eugene Loh <eugene.loh@oracle.com>
On 1/9/26 16:10, Kris Van Hees via DTrace-devel wrote:
> Signed-off-by: Kris Van Hees <kris.van.hees@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)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-01-16 20:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-09 21:10 [PATCH] bpf: use initializer for dtrace_difo_t *dp Kris Van Hees
2026-01-16 20:28 ` [DTrace-devel] " Eugene Loh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox