The branch main has been updated by kib:

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

commit 7746b51dae12b09266d02f02f8d3b772282ddaf1
Author:     Konstantin Belousov <[email protected]>
AuthorDate: 2025-10-25 09:12:33 +0000
Commit:     Konstantin Belousov <[email protected]>
CommitDate: 2025-11-04 04:11:12 +0000

    exterror(9): add SETEXTERROR_KE() macro
    
    It fills the extended error data into explicitly passed pointer to the
    struct kexterr instead of td_kexterr for current thread.
    
    Reviewed by:    mckusick
    Sponsored by:   The FreeBSD Foundation
    Differential revision:  https://reviews.freebsd.org/D53351
---
 sys/sys/exterrvar.h | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/sys/sys/exterrvar.h b/sys/sys/exterrvar.h
index 6783a0d2d84f..5fce8ae7ffbe 100644
--- a/sys/sys/exterrvar.h
+++ b/sys/sys/exterrvar.h
@@ -37,6 +37,26 @@
 #define        SET_ERROR_MSG(mmsg)     NULL
 #endif
 
+#define        _SET_ERROR2_KE(kep, eerror, mmsg, pp1, pp2)     ({              
\
+       (kep)->error = (eerror);                                        \
+       (kep)->cat = EXTERR_CATEGORY;                                   \
+       (kep)->msg = SET_ERROR_MSG(mmsg);                               \
+       (kep)->p1 = (pp1);                                              \
+       (kep)->p2 = (pp2);                                              \
+       (kep)->src_line = __LINE__;                                     \
+       (kep)->error;                                                   \
+})
+#define        _SET_ERROR0_KE(kep, eerror, mmsg)                               
\
+       _SET_ERROR2_KE(kep, eerror, mmsg, 0, 0)
+#define        _SET_ERROR1_KE(kep, eerror, mmsg, pp1)                          
\
+       _SET_ERROR2_KE(kep, eerror, mmsg, pp1, 0)
+
+#define        _EXTERROR_MACRO_KE(kep, eerror, mmsg, _1, _2, NAME, ...)        
\
+       NAME
+#define        EXTERROR_KE(...)                                                
\
+       _EXTERROR_MACRO_KE(__VA_ARGS__, _SET_ERROR2_KE, _SET_ERROR1_KE, \
+           _SET_ERROR0_KE)(__VA_ARGS__)
+
 #define        _SET_ERROR2(eerror, mmsg, pp1, pp2)                             
\
        exterr_set(eerror, EXTERR_CATEGORY, SET_ERROR_MSG(mmsg),        \
            (uintptr_t)(pp1), (uintptr_t)(pp2), __LINE__)

Reply via email to