]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
testutilsqemu: Create a typedef for struct testQemuInfo
authorPeter Krempa <pkrempa@redhat.com>
Mon, 4 Dec 2023 21:28:10 +0000 (22:28 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 17 Jan 2024 15:39:50 +0000 (16:39 +0100)
The typedef will come in handy to create an autoptr cleaning function
later on.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
tests/qemuxml2argvtest.c
tests/qemuxml2xmltest.c
tests/qemuxmlactivetest.c
tests/testutilsqemu.c
tests/testutilsqemu.h

index 1be138bb0f23210ee48b428ba803cbfb9bb222d5..3e6c59cd91335012f9c83d6fa9e64bd42bf31b45 100644 (file)
@@ -384,7 +384,7 @@ static virCommand *
 testCompareXMLToArgvCreateArgs(virQEMUDriver *drv,
                                virDomainObj *vm,
                                const char *migrateURI,
-                               struct testQemuInfo *info,
+                               testQemuInfo *info,
                                unsigned int flags)
 {
     qemuDomainObjPrivate *priv = vm->privateData;
@@ -561,7 +561,7 @@ testCompareXMLToArgvValidateSchemaCommand(GStrv args,
 
 static int
 testCompareXMLToArgvValidateSchema(virCommand *cmd,
-                                   struct testQemuInfo *info)
+                                   testQemuInfo *info)
 {
     g_auto(GStrv) args = NULL;
 
@@ -579,7 +579,7 @@ testCompareXMLToArgvValidateSchema(virCommand *cmd,
 
 
 static int
-testInfoCheckDuplicate(struct testQemuInfo *info)
+testInfoCheckDuplicate(testQemuInfo *info)
 {
     const char *path = info->outfile;
 
@@ -603,7 +603,7 @@ testInfoCheckDuplicate(struct testQemuInfo *info)
 static int
 testCompareXMLToArgv(const void *data)
 {
-    struct testQemuInfo *info = (void *) data;
+    testQemuInfo *info = (void *) data;
     g_autofree char *migrateURI = NULL;
     g_auto(virBuffer) actualBuf = VIR_BUFFER_INITIALIZER;
     g_autofree char *actualargv = NULL;
@@ -626,7 +626,7 @@ testCompareXMLToArgv(const void *data)
     /* mark test case as used */
     ignore_value(g_hash_table_remove(info->conf->existingTestCases, info->infile));
 
-    if (testQemuInfoInitArgs((struct testQemuInfo *) info) < 0)
+    if (testQemuInfoInitArgs((testQemuInfo *) info) < 0)
         goto cleanup;
 
     if (testInfoCheckDuplicate(info) < 0)
@@ -812,7 +812,7 @@ testCompareXMLToArgv(const void *data)
 }
 
 static void
-testInfoSetPaths(struct testQemuInfo *info,
+testInfoSetPaths(testQemuInfo *info,
                  const char *suffix)
 {
     info->infile = g_strdup_printf("%s/qemuxml2argvdata/%s.xml",
@@ -941,7 +941,7 @@ mymain(void)
  */
 # define DO_TEST_FULL(_name, _suffix, ...) \
     do { \
-        static struct testQemuInfo info = { \
+        static testQemuInfo info = { \
             .name = _name, \
         }; \
         testQemuInfoSetArgs(&info, &testConf, __VA_ARGS__); \
index 5ec91e192c6f3f86544a509cc6d0f683a544dd14..4376a975199f517e7c2e41ca9c296fa43e50dac3 100644 (file)
@@ -20,9 +20,9 @@
 static virQEMUDriver driver;
 
 static int
-testXML2XMLCommon(const struct testQemuInfo *info)
+testXML2XMLCommon(const testQemuInfo *info)
 {
-    if (testQemuInfoInitArgs((struct testQemuInfo *) info) < 0)
+    if (testQemuInfoInitArgs((testQemuInfo *) info) < 0)
         return -1;
 
     virFileCacheClear(driver.qemuCapsCache);
@@ -37,7 +37,7 @@ testXML2XMLCommon(const struct testQemuInfo *info)
 static int
 testXML2XMLActive(const void *opaque)
 {
-    const struct testQemuInfo *info = opaque;
+    const testQemuInfo *info = opaque;
 
     if (info->flags & FLAG_SKIP_CONFIG_ACTIVE)
         return EXIT_AM_SKIP;
@@ -57,7 +57,7 @@ testXML2XMLActive(const void *opaque)
 static int
 testXML2XMLInactive(const void *opaque)
 {
-    const struct testQemuInfo *info = opaque;
+    const testQemuInfo *info = opaque;
 
     if (testXML2XMLCommon(info) < 0 ||
         testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt,
@@ -84,7 +84,7 @@ testXML2XMLInactive(const void *opaque)
  * both the "active" and "inactive" versions are the same.
  */
 static void
-testInfoSetPaths(struct testQemuInfo *info,
+testInfoSetPaths(testQemuInfo *info,
                  const char *suffix,
                  const char *statesuffix)
 {
@@ -148,7 +148,7 @@ mymain(void)
 
 #define DO_TEST_CAPS_INTERNAL(_name, arch, ver, ...) \
     do { \
-        static struct testQemuInfo info = { \
+        static testQemuInfo info = { \
             .name = _name, \
         }; \
         testQemuInfoSetArgs(&info, &testConf, \
index f60378c6916058b320b43cd13ae07a9605200c54..9224bd5d05d5b108e806575dc4fb39111f03525f 100644 (file)
@@ -18,7 +18,7 @@ static virQEMUDriver driver;
 static int
 testCompareStatusXMLToXMLFiles(const void *opaque)
 {
-    const struct testQemuInfo *data = opaque;
+    const testQemuInfo *data = opaque;
     virDomainObj *obj = NULL;
     g_autofree char *actual = NULL;
     int ret = -1;
@@ -61,7 +61,7 @@ testCompareStatusXMLToXMLFiles(const void *opaque)
 static const char *statusPath = abs_srcdir "/qemustatusxml2xmldata/";
 
 static void
-testInfoSetStatusPaths(struct testQemuInfo *info)
+testInfoSetStatusPaths(testQemuInfo *info)
 {
     info->infile = g_strdup_printf("%s%s-in.xml", statusPath, info->name);
     info->outfile = g_strdup_printf("%s%s-out.xml", statusPath, info->name);
@@ -90,7 +90,7 @@ mymain(void)
 
 #define DO_TEST_STATUS(_name) \
     do { \
-        static struct testQemuInfo info = { \
+        static testQemuInfo info = { \
             .name = _name, \
         }; \
         testQemuInfoSetArgs(&info, &testConf, ARG_END); \
index 1e9512d47802f181d3ebfea9b79229d590913017..cf4ef3a3178b55cef708e0097e2b7ae295d5caec 100644 (file)
@@ -623,7 +623,7 @@ testQemuCapsIterate(const char *suffix,
 
 
 void
-testQemuInfoSetArgs(struct testQemuInfo *info,
+testQemuInfoSetArgs(testQemuInfo *info,
                     struct testQemuConf *conf, ...)
 {
     va_list argptr;
@@ -900,7 +900,7 @@ testQemuInsertRealCaps(virFileCache *cache,
 
 
 int
-testQemuInfoInitArgs(struct testQemuInfo *info)
+testQemuInfoInitArgs(testQemuInfo *info)
 {
     ssize_t cap;
 
@@ -959,7 +959,7 @@ testQemuInfoInitArgs(struct testQemuInfo *info)
 
 
 void
-testQemuInfoClear(struct testQemuInfo *info)
+testQemuInfoClear(testQemuInfo *info)
 {
     VIR_FREE(info->infile);
     VIR_FREE(info->outfile);
index 0d570ec31ef90c66ff28d652ab6637a25faaed0f..c9c36d24c60147bd008a979b06fe7304c05b78ce 100644 (file)
@@ -96,7 +96,7 @@ struct testQemuArgs {
     bool invalidarg;
 };
 
-struct testQemuInfo {
+struct _testQemuInfo {
     const char *name;
     char *infile;
     char *outfile;
@@ -114,6 +114,8 @@ struct testQemuInfo {
     struct testQemuConf *conf;
 };
 
+typedef struct _testQemuInfo testQemuInfo;
+
 virDomainXMLOption *testQemuXMLConfInit(void);
 
 
@@ -150,11 +152,11 @@ int testQemuCapsIterate(const char *suffix,
                         testQemuCapsIterateCallback callback,
                         void *opaque);
 
-void testQemuInfoSetArgs(struct testQemuInfo *info,
+void testQemuInfoSetArgs(testQemuInfo *info,
                          struct testQemuConf *conf,
                          ...);
-int testQemuInfoInitArgs(struct testQemuInfo *info);
-void testQemuInfoClear(struct testQemuInfo *info);
+int testQemuInfoInitArgs(testQemuInfo *info);
+void testQemuInfoClear(testQemuInfo *info);
 
 int testQemuPrepareHostBackendChardevOne(virDomainDeviceDef *dev,
                                          virDomainChrSourceDef *chardev,