[PATCH 1/3] qemu: parse: Use virControllerDefNew

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Rather than reimplement it. This will be needed in upcoming patches
---
 src/conf/domain_conf.c        | 2 +-
 src/conf/domain_conf.h        | 2 ++
 src/libvirt_private.syms      | 1 +
 src/qemu/qemu_parse_command.c | 8 +++-----
 4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b46cd2a..04817bd 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1637,7 +1637,7 @@ virDomainDiskSetFormat(virDomainDiskDefPtr def, int format)
 }
 
 
-static virDomainControllerDefPtr
+virDomainControllerDefPtr
 virDomainControllerDefNew(virDomainControllerType type)
 {
     virDomainControllerDefPtr def;
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index ee66e6d..d98f052 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2558,6 +2558,8 @@ virDomainDiskDefPtr virDomainDiskFindByBusAndDst(virDomainDefPtr def,
                                                  int bus,
                                                  char *dst);
 void virDomainControllerDefFree(virDomainControllerDefPtr def);
+virDomainControllerDefPtr
+virDomainControllerDefNew(virDomainControllerType type);
 void virDomainFSDefFree(virDomainFSDefPtr def);
 void virDomainActualNetDefFree(virDomainActualNetDefPtr def);
 void virDomainNetDefFree(virDomainNetDefPtr def);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 0de35ef..4d09dae 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -186,6 +186,7 @@ virDomainClockOffsetTypeToString;
 virDomainConfigFile;
 virDomainControllerAliasFind;
 virDomainControllerDefFree;
+virDomainControllerDefNew;
 virDomainControllerFind;
 virDomainControllerFindByType;
 virDomainControllerInsert;
diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c
index 79f5b92..455d515 100644
--- a/src/qemu/qemu_parse_command.c
+++ b/src/qemu/qemu_parse_command.c
@@ -2351,13 +2351,11 @@ qemuParseCommandLine(virCapsPtr caps,
             /* ignore, generted on the fly */
         } else if (STREQ(arg, "-usb")) {
             virDomainControllerDefPtr ctldef;
-            if (VIR_ALLOC(ctldef) < 0)
+            ctldef = virDomainControllerDefNew(VIR_DOMAIN_CONTROLLER_TYPE_USB);
+            if (!ctldef)
                 goto error;
-            ctldef->type = VIR_DOMAIN_CONTROLLER_TYPE_USB;
-            ctldef->idx = 0;
-            ctldef->model = -1;
             if (virDomainControllerInsert(def, ctldef) < 0) {
-                VIR_FREE(ctldef);
+                virDomainControllerDefFree(ctldef);
                 goto error;
             }
         } else if (STREQ(arg, "-pidfile")) {
-- 
2.7.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]