[LTP] [PATCH v2 1/2] Add TST_KCONFIG_INIT() helper macro
    Martin Doucha 
    mdoucha@suse.cz
       
    Mon Nov 13 16:06:31 CET 2023
    
    
  
Add helper macro for initializing the tst_kconfig_var structure
to simplify kernel config checks during test runtime.
Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
Changes since v1: New patch
 include/tst_kconfig.h | 8 ++++++++
 1 file changed, 8 insertions(+)
diff --git a/include/tst_kconfig.h b/include/tst_kconfig.h
index cc0908ea8..8b24a8380 100644
--- a/include/tst_kconfig.h
+++ b/include/tst_kconfig.h
@@ -6,6 +6,14 @@
 #ifndef TST_KCONFIG_H__
 #define TST_KCONFIG_H__
 
+/**
+ * Initialization helper macro for struct tst_kconfig_var. Requires <string.h>
+ */
+#define TST_KCONFIG_INIT(confname) { \
+	.id = confname, \
+	.id_len = strlen(confname) \
+}
+
 struct tst_kconfig_var {
 	char id[64];
 	unsigned int id_len;
-- 
2.42.0
    
    
More information about the ltp
mailing list