Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Apr 2024 14:05:25 GMT
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 21aa4bf198da - stable/14 - sdt: Use designated initializers for various definitions
Message-ID:  <202404151405.43FE5Pix069755@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by markj:

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

commit 21aa4bf198da60abf584210c5cbca2bcb3621147
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-04-03 18:41:29 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-04-15 14:05:13 +0000

    sdt: Use designated initializers for various definitions
    
    No functional change intended.
    
    MFC after:      1 week
    
    (cherry picked from commit 3b795e641db7c1759d72aab9a77db8f87c8fbc45)
---
 sys/sys/sdt.h | 46 ++++++++++++++++++++++++++++------------------
 1 file changed, 28 insertions(+), 18 deletions(-)

diff --git a/sys/sys/sdt.h b/sys/sys/sdt.h
index e059921b0e9e..ba3dcfa15762 100644
--- a/sys/sys/sdt.h
+++ b/sys/sys/sdt.h
@@ -147,22 +147,26 @@ SET_DECLARE(sdt_providers_set, struct sdt_provider);
 SET_DECLARE(sdt_probes_set, struct sdt_probe);
 SET_DECLARE(sdt_argtypes_set, struct sdt_argtype);
 
-#define SDT_PROVIDER_DEFINE(prov)						\
-	struct sdt_provider sdt_provider_##prov[1] = {				\
-		{ #prov, { NULL, NULL }, 0, 0 }					\
-	};									\
-	DATA_SET(sdt_providers_set, sdt_provider_##prov);
+#define SDT_PROVIDER_DEFINE(_prov)					\
+	struct sdt_provider sdt_provider_##_prov[1] = {			\
+		[0] = { .name = #_prov },				\
+	};								\
+	DATA_SET(sdt_providers_set, sdt_provider_##_prov);
 
 #define SDT_PROVIDER_DECLARE(prov)						\
 	extern struct sdt_provider sdt_provider_##prov[1]
 
-#define SDT_PROBE_DEFINE(prov, mod, func, name)					\
-	struct sdt_probe sdt_##prov##_##mod##_##func##_##name[1] = {		\
-		{ sizeof(struct sdt_probe), sdt_provider_##prov,		\
-		    { NULL, NULL }, { NULL, NULL }, #mod, #func, #name, 0, 0,	\
-		    NULL }							\
-	};									\
-	DATA_SET(sdt_probes_set, sdt_##prov##_##mod##_##func##_##name);
+#define SDT_PROBE_DEFINE(_prov, _mod, _func, _name)			\
+	struct sdt_probe sdt_##_prov##_##_mod##_##_func##_##_name[1] = {\
+		[0] = {							\
+		    .version = sizeof(struct sdt_probe),		\
+		    .prov = sdt_provider_##_prov,			\
+		    .mod = #_mod,					\
+		    .func = #_func,					\
+		    .name = #_name,					\
+		},							\
+	};								\
+	DATA_SET(sdt_probes_set, sdt_##_prov##_##_mod##_##_func##_##_name)
 
 #define SDT_PROBE_DECLARE(prov, mod, func, name)				\
 	extern struct sdt_probe sdt_##prov##_##mod##_##func##_##name[1]
@@ -178,12 +182,18 @@ SET_DECLARE(sdt_argtypes_set, struct sdt_argtype);
 	} \
 } while (0)
 
-#define SDT_PROBE_ARGTYPE(prov, mod, func, name, num, type, xtype)		\
-	static struct sdt_argtype sdta_##prov##_##mod##_##func##_##name##num[1]	\
-	    = { { num, type, xtype, { NULL, NULL },				\
-	    sdt_##prov##_##mod##_##func##_##name }				\
-	};									\
-	DATA_SET(sdt_argtypes_set, sdta_##prov##_##mod##_##func##_##name##num);
+#define SDT_PROBE_ARGTYPE(_prov, _mod, _func, _name, _num, _type, _xtype) \
+	static struct sdt_argtype					\
+	    sdta_##_prov##_##_mod##_##_func##_##_name##_num[1] = {	\
+		[0] = {							\
+		    .ndx = _num,					\
+		    .type = _type,					\
+		    .xtype = _xtype,					\
+		    .probe = sdt_##_prov##_##_mod##_##_func##_##_name,	\
+		},							\
+	};								\
+	DATA_SET(sdt_argtypes_set,					\
+	    sdta_##_prov##_##_mod##_##_func##_##_name##_num);
 
 #define	SDT_PROBE_DEFINE0(prov, mod, func, name)			\
 	SDT_PROBE_DEFINE(prov, mod, func, name)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202404151405.43FE5Pix069755>