From f72e081fbf3897cda90cf10463a1e4f25d52e257 Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Mon, 8 Jul 2024 19:59:08 -0500 Subject: [PATCH] FreeBSD: Use a statement expression to implement SET_ERROR() (#16284) This way we can avoid making assumptions about the SDT probe implementation. No functional change intended. Signed-off-by: Mark Johnston Reviewed-by: Alexander Motin Reviewed-by: Allan Jude Reviewed-by: Rob Norris Reviewed-by: Tino Reichardt Reviewed-by: Tony Hutter --- include/os/freebsd/spl/sys/sdt.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/include/os/freebsd/spl/sys/sdt.h b/include/os/freebsd/spl/sys/sdt.h index 2daa6de1a..e2c4830cb 100644 --- a/include/os/freebsd/spl/sys/sdt.h +++ b/include/os/freebsd/spl/sys/sdt.h @@ -31,13 +31,14 @@ #include_next #ifdef KDTRACE_HOOKS -/* CSTYLED */ +/* BEGIN CSTYLED */ SDT_PROBE_DECLARE(sdt, , , set__error); -#define SET_ERROR(err) \ - ((sdt_sdt___set__error->id ? \ - (*sdt_probe_func)(sdt_sdt___set__error->id, \ - (uintptr_t)err, 0, 0, 0, 0) : 0), err) +#define SET_ERROR(err) ({ \ + SDT_PROBE1(sdt, , , set__error, (uintptr_t)err); \ + err; \ +}) +/* END CSTYLED */ #else #define SET_ERROR(err) (err) #endif