git: e5a7890dc00a - main - zfs: Use a statement expression to implement SET_ERROR()

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Wed, 19 Jun 2024 20:58:10 UTC
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=e5a7890dc00ac0b158498db92008f7c0b5970eac

commit e5a7890dc00ac0b158498db92008f7c0b5970eac
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-06-19 16:01:54 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-06-19 20:57:30 +0000

    zfs: Use a statement expression to implement SET_ERROR()
    
    This way we can avoid making assumptions about the SDT probe
    implementation.  No functional change intended.
    
    This was submitted upstream as https://github.com/openzfs/zfs/pull/16284
    
    MFC after:      1 week
---
 sys/contrib/openzfs/include/os/freebsd/spl/sys/sdt.h | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/sys/contrib/openzfs/include/os/freebsd/spl/sys/sdt.h b/sys/contrib/openzfs/include/os/freebsd/spl/sys/sdt.h
index 2daa6de1af08..74e03fd5b956 100644
--- a/sys/contrib/openzfs/include/os/freebsd/spl/sys/sdt.h
+++ b/sys/contrib/openzfs/include/os/freebsd/spl/sys/sdt.h
@@ -31,13 +31,14 @@
 
 #include_next <sys/sdt.h>
 #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