[PATCH v2 06/11] conf: Extend virDomainDeviceDefPostParse for parseOpaque

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

 



Just like virDomainDefPostParseCallback has gained new
parseOpaque argument, we need to follow the logic with
virDomainDeviceDefPostParse.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/bhyve/bhyve_domain.c   |  3 ++-
 src/conf/domain_conf.c     | 13 +++++++++----
 src/conf/domain_conf.h     |  8 ++++++--
 src/libxl/libxl_domain.c   |  3 ++-
 src/lxc/lxc_domain.c       |  3 ++-
 src/openvz/openvz_driver.c |  3 ++-
 src/phyp/phyp_driver.c     |  3 ++-
 src/qemu/qemu_domain.c     |  3 ++-
 src/uml/uml_driver.c       |  3 ++-
 src/vbox/vbox_common.c     |  3 ++-
 src/vmware/vmware_driver.c |  3 ++-
 src/vmx/vmx.c              |  3 ++-
 src/vz/vz_driver.c         |  3 ++-
 src/xen/xen_driver.c       |  3 ++-
 src/xenapi/xenapi_driver.c |  3 ++-
 15 files changed, 41 insertions(+), 19 deletions(-)

diff --git a/src/bhyve/bhyve_domain.c b/src/bhyve/bhyve_domain.c
index 3273462..e2a20ce 100644
--- a/src/bhyve/bhyve_domain.c
+++ b/src/bhyve/bhyve_domain.c
@@ -77,7 +77,8 @@ bhyveDomainDeviceDefPostParse(virDomainDeviceDefPtr dev ATTRIBUTE_UNUSED,
                               const virDomainDef *def ATTRIBUTE_UNUSED,
                               virCapsPtr caps ATTRIBUTE_UNUSED,
                               unsigned int parseFlags ATTRIBUTE_UNUSED,
-                              void *opaque ATTRIBUTE_UNUSED)
+                              void *opaque ATTRIBUTE_UNUSED,
+                              void *parseOpaque ATTRIBUTE_UNUSED)
 {
     return 0;
 }
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 1d8d7c1..d205222 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -4423,13 +4423,15 @@ virDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
                             const virDomainDef *def,
                             virCapsPtr caps,
                             unsigned int flags,
-                            virDomainXMLOptionPtr xmlopt)
+                            virDomainXMLOptionPtr xmlopt,
+                            void *parseOpaque)
 {
     int ret;
 
     if (xmlopt->config.devicesPostParseCallback) {
         ret = xmlopt->config.devicesPostParseCallback(dev, def, caps, flags,
-                                                      xmlopt->config.priv);
+                                                      xmlopt->config.priv,
+                                                      parseOpaque);
         if (ret < 0)
             return ret;
     }
@@ -4447,6 +4449,7 @@ virDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
 struct virDomainDefPostParseDeviceIteratorData {
     virCapsPtr caps;
     virDomainXMLOptionPtr xmlopt;
+    void *parseOpaque;
     unsigned int parseFlags;
 };
 
@@ -4459,7 +4462,8 @@ virDomainDefPostParseDeviceIterator(virDomainDefPtr def,
 {
     struct virDomainDefPostParseDeviceIteratorData *data = opaque;
     return virDomainDeviceDefPostParse(dev, def, data->caps,
-                                       data->parseFlags, data->xmlopt);
+                                       data->parseFlags, data->xmlopt,
+                                       data->parseOpaque);
 }
 
 
@@ -4570,6 +4574,7 @@ virDomainDefPostParse(virDomainDefPtr def,
         .caps = caps,
         .xmlopt = xmlopt,
         .parseFlags = parseFlags,
+        .parseOpaque = parseOpaque,
     };
 
     /* this must be done before the hypervisor-specific callback,
@@ -13559,7 +13564,7 @@ virDomainDeviceDefParse(const char *xmlStr,
     }
 
     /* callback to fill driver specific device aspects */
-    if (virDomainDeviceDefPostParse(dev, def, caps, flags, xmlopt) < 0)
+    if (virDomainDeviceDefPostParse(dev, def, caps, flags, xmlopt, NULL) < 0)
         goto error;
 
     /* validate the configuration */
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index a6554f5..37ed6f5 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2371,12 +2371,16 @@ typedef int (*virDomainDefPostParseCallback)(virDomainDefPtr def,
                                              void *opaque,
                                              void *parseOpaque);
 /* Called once per device, for adjusting per-device settings while
- * leaving the overall domain otherwise unchanged.  */
+ * leaving the overall domain otherwise unchanged.
+ * @parseOpaque is opaque data passed by virDomainDefParse* caller,
+ * @opqaue is opaque data set by driver (usually pointer to driver
+ * private data). */
 typedef int (*virDomainDeviceDefPostParseCallback)(virDomainDeviceDefPtr dev,
                                                    const virDomainDef *def,
                                                    virCapsPtr caps,
                                                    unsigned int parseFlags,
-                                                   void *opaque);
+                                                   void *opaque,
+                                                   void *parseOpaque);
 /* Drive callback for assigning device addresses, called at the end
  * of parsing, after all defaults and implicit devices have been added.  */
 typedef int (*virDomainDefAssignAddressesCallback)(virDomainDef *def,
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index fb63a03..bd04a05 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -285,7 +285,8 @@ libxlDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
                               const virDomainDef *def,
                               virCapsPtr caps ATTRIBUTE_UNUSED,
                               unsigned int parseFlags ATTRIBUTE_UNUSED,
-                              void *opaque ATTRIBUTE_UNUSED)
+                              void *opaque ATTRIBUTE_UNUSED,
+                              void *parseOpaque ATTRIBUTE_UNUSED)
 {
     if (dev->type == VIR_DOMAIN_DEVICE_CHR &&
         dev->data.chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE &&
diff --git a/src/lxc/lxc_domain.c b/src/lxc/lxc_domain.c
index c2e362a..9027c25 100644
--- a/src/lxc/lxc_domain.c
+++ b/src/lxc/lxc_domain.c
@@ -381,7 +381,8 @@ virLXCDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
                                const virDomainDef *def ATTRIBUTE_UNUSED,
                                virCapsPtr caps ATTRIBUTE_UNUSED,
                                unsigned int parseFlags ATTRIBUTE_UNUSED,
-                               void *opaque ATTRIBUTE_UNUSED)
+                               void *opaque ATTRIBUTE_UNUSED,
+                               void *parseOpaque ATTRIBUTE_UNUSED)
 {
     if (dev->type == VIR_DOMAIN_DEVICE_CHR &&
         dev->data.chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE &&
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index 376c741..38a562e 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -110,7 +110,8 @@ openvzDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
                                const virDomainDef *def ATTRIBUTE_UNUSED,
                                virCapsPtr caps ATTRIBUTE_UNUSED,
                                unsigned int parseFlags ATTRIBUTE_UNUSED,
-                               void *opaque ATTRIBUTE_UNUSED)
+                               void *opaque ATTRIBUTE_UNUSED,
+                               void *parseOpaque ATTRIBUTE_UNUSED)
 {
     if (dev->type == VIR_DOMAIN_DEVICE_CHR &&
         dev->data.chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE &&
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index b62a2c4..7a5df3f 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -1109,7 +1109,8 @@ phypDomainDeviceDefPostParse(virDomainDeviceDefPtr dev ATTRIBUTE_UNUSED,
                              const virDomainDef *def ATTRIBUTE_UNUSED,
                              virCapsPtr caps ATTRIBUTE_UNUSED,
                              unsigned int parseFlags ATTRIBUTE_UNUSED,
-                             void *opaque ATTRIBUTE_UNUSED)
+                             void *opaque ATTRIBUTE_UNUSED,
+                             void *parseOpaque ATTRIBUTE_UNUSED)
 {
     return 0;
 }
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index ea88f5e..1f5ef92 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2561,7 +2561,8 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
                              const virDomainDef *def,
                              virCapsPtr caps,
                              unsigned int parseFlags,
-                             void *opaque)
+                             void *opaque,
+                             void *parseOpaque ATTRIBUTE_UNUSED)
 {
     virQEMUDriverPtr driver = opaque;
     virQEMUCapsPtr qemuCaps = NULL;
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index 7c0ebba..95acb22 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -410,7 +410,8 @@ umlDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
                             const virDomainDef *def ATTRIBUTE_UNUSED,
                             virCapsPtr caps ATTRIBUTE_UNUSED,
                             unsigned int parseFlags ATTRIBUTE_UNUSED,
-                            void *opaque ATTRIBUTE_UNUSED)
+                            void *opaque ATTRIBUTE_UNUSED,
+                            void *parseOpaque ATTRIBUTE_UNUSED)
 {
     if (dev->type == VIR_DOMAIN_DEVICE_CHR &&
         dev->data.chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE &&
diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
index b46be4b..1472639 100644
--- a/src/vbox/vbox_common.c
+++ b/src/vbox/vbox_common.c
@@ -266,7 +266,8 @@ vboxDomainDeviceDefPostParse(virDomainDeviceDefPtr dev ATTRIBUTE_UNUSED,
                              const virDomainDef *def ATTRIBUTE_UNUSED,
                              virCapsPtr caps ATTRIBUTE_UNUSED,
                              unsigned int parseFlags ATTRIBUTE_UNUSED,
-                             void *opaque ATTRIBUTE_UNUSED)
+                             void *opaque ATTRIBUTE_UNUSED,
+                             void *parseOpaque ATTRIBUTE_UNUSED)
 {
     return 0;
 }
diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c
index b0cc47b..9a53b8d 100644
--- a/src/vmware/vmware_driver.c
+++ b/src/vmware/vmware_driver.c
@@ -97,7 +97,8 @@ vmwareDomainDeviceDefPostParse(virDomainDeviceDefPtr dev ATTRIBUTE_UNUSED,
                                const virDomainDef *def ATTRIBUTE_UNUSED,
                                virCapsPtr caps ATTRIBUTE_UNUSED,
                                unsigned int parseFlags ATTRIBUTE_UNUSED,
-                               void *opaque ATTRIBUTE_UNUSED)
+                               void *opaque ATTRIBUTE_UNUSED,
+                               void *parseOpaque ATTRIBUTE_UNUSED)
 {
     return 0;
 }
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index 3ae4b73..fc4347f 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -539,7 +539,8 @@ virVMXDomainDevicesDefPostParse(virDomainDeviceDefPtr dev ATTRIBUTE_UNUSED,
                                 const virDomainDef *def ATTRIBUTE_UNUSED,
                                 virCapsPtr caps ATTRIBUTE_UNUSED,
                                 unsigned int parseFlags ATTRIBUTE_UNUSED,
-                                void *opaque ATTRIBUTE_UNUSED)
+                                void *opaque ATTRIBUTE_UNUSED,
+                                void *parseOpaque ATTRIBUTE_UNUSED)
 {
     return 0;
 }
diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
index f3f5eac..c8841e4 100644
--- a/src/vz/vz_driver.c
+++ b/src/vz/vz_driver.c
@@ -288,7 +288,8 @@ vzDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
                            const virDomainDef *def,
                            virCapsPtr caps ATTRIBUTE_UNUSED,
                            unsigned int parseFlags ATTRIBUTE_UNUSED,
-                           void *opaque ATTRIBUTE_UNUSED)
+                           void *opaque ATTRIBUTE_UNUSED,
+                           void *parseOpaque ATTRIBUTE_UNUSED)
 {
     if (dev->type == VIR_DOMAIN_DEVICE_NET &&
         (dev->data.net->type == VIR_DOMAIN_NET_TYPE_NETWORK ||
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index ed3acf7..8b41974 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -325,7 +325,8 @@ xenDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
                             const virDomainDef *def,
                             virCapsPtr caps ATTRIBUTE_UNUSED,
                             unsigned int parseFlags ATTRIBUTE_UNUSED,
-                            void *opaque ATTRIBUTE_UNUSED)
+                            void *opaque ATTRIBUTE_UNUSED,
+                            void *parseOpaque ATTRIBUTE_UNUSED)
 {
     if (dev->type == VIR_DOMAIN_DEVICE_CHR &&
         dev->data.chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE &&
diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
index 9ec083f..dcb79aa 100644
--- a/src/xenapi/xenapi_driver.c
+++ b/src/xenapi/xenapi_driver.c
@@ -49,7 +49,8 @@ xenapiDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
                                const virDomainDef *def,
                                virCapsPtr caps ATTRIBUTE_UNUSED,
                                unsigned int parseFlags ATTRIBUTE_UNUSED,
-                               void *opaque ATTRIBUTE_UNUSED)
+                               void *opaque ATTRIBUTE_UNUSED,
+                               void *parseOpaque ATTRIBUTE_UNUSED)
 {
     if (dev->type == VIR_DOMAIN_DEVICE_CHR &&
         dev->data.chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE &&
-- 
2.8.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]