[PATCH 1/4] xen: cleanup callback struct

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

 



Using C99 initializers and xen-specific prefixes will make it
so that future patches are less likely to add callback members
to the xenUnifiedDriver struct, since the goal is to get rid
of the callback struct in the first place.

* src/xen/xen_driver.h (xenUnifiedDriver): Rename all struct
members, to make it obvious which ones are still in use.
* src/xen/xen_driver.c: Update all callers.
* src/xen/xen_hypervisor.c (xenHypervisorDriver): Rewrite with C99
initializers.
* src/xen/xend_internal.c (xenDaemonDriver): Likewise.
* src/xen/xs_internal.c (xenStoreDriver): Likewise.
* src/xen/xm_internal.c (xenXMDriver): Likewise.
* src/xen/xen_inotify.c (xenInotifyDriver): Likewise.
---
 src/xen/xen_driver.c     |  152 +++++++++++++++++++++++-----------------------
 src/xen/xen_driver.h     |   76 ++++++++++++------------
 src/xen/xen_hypervisor.c |   56 ++++++------------
 src/xen/xen_inotify.c    |   40 +------------
 src/xen/xend_internal.c  |   73 +++++++++++------------
 src/xen/xm_internal.c    |   52 ++++------------
 src/xen/xs_internal.c    |   47 +++------------
 7 files changed, 192 insertions(+), 304 deletions(-)

diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index e256c33..afa5d59 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -351,7 +351,7 @@ xenUnifiedOpen (virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags)
     /* Hypervisor is only run with privilege & required to succeed */
     if (xenHavePrivilege()) {
         VIR_DEBUG("Trying hypervisor sub-driver");
-        if (drivers[XEN_UNIFIED_HYPERVISOR_OFFSET]->open(conn, auth, flags) ==
+        if (drivers[XEN_UNIFIED_HYPERVISOR_OFFSET]->xenOpen(conn, auth, flags) ==
             VIR_DRV_OPEN_SUCCESS) {
             VIR_DEBUG("Activated hypervisor sub-driver");
             priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET] = 1;
@@ -360,7 +360,7 @@ xenUnifiedOpen (virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags)

     /* XenD is required to succeed if privileged */
     VIR_DEBUG("Trying XenD sub-driver");
-    if (drivers[XEN_UNIFIED_XEND_OFFSET]->open(conn, auth, flags) ==
+    if (drivers[XEN_UNIFIED_XEND_OFFSET]->xenOpen(conn, auth, flags) ==
         VIR_DRV_OPEN_SUCCESS) {
         VIR_DEBUG("Activated XenD sub-driver");
         priv->opened[XEN_UNIFIED_XEND_OFFSET] = 1;
@@ -369,14 +369,14 @@ xenUnifiedOpen (virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags)
          * succeed if root, optional otherwise */
         if (priv->xendConfigVersion <= 2) {
             VIR_DEBUG("Trying XM sub-driver");
-            if (drivers[XEN_UNIFIED_XM_OFFSET]->open(conn, auth, flags) ==
+            if (drivers[XEN_UNIFIED_XM_OFFSET]->xenOpen(conn, auth, flags) ==
                 VIR_DRV_OPEN_SUCCESS) {
                 VIR_DEBUG("Activated XM sub-driver");
                 priv->opened[XEN_UNIFIED_XM_OFFSET] = 1;
             }
         }
         VIR_DEBUG("Trying XS sub-driver");
-        if (drivers[XEN_UNIFIED_XS_OFFSET]->open(conn, auth, flags) ==
+        if (drivers[XEN_UNIFIED_XS_OFFSET]->xenOpen(conn, auth, flags) ==
             VIR_DRV_OPEN_SUCCESS) {
             VIR_DEBUG("Activated XS sub-driver");
             priv->opened[XEN_UNIFIED_XS_OFFSET] = 1;
@@ -404,7 +404,7 @@ xenUnifiedOpen (virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags)
 #if WITH_XEN_INOTIFY
     if (xenHavePrivilege()) {
         VIR_DEBUG("Trying Xen inotify sub-driver");
-        if (drivers[XEN_UNIFIED_INOTIFY_OFFSET]->open(conn, auth, flags) ==
+        if (drivers[XEN_UNIFIED_INOTIFY_OFFSET]->xenOpen(conn, auth, flags) ==
             VIR_DRV_OPEN_SUCCESS) {
             VIR_DEBUG("Activated Xen inotify sub-driver");
             priv->opened[XEN_UNIFIED_INOTIFY_OFFSET] = 1;
@@ -419,7 +419,7 @@ fail:
 clean:
     VIR_DEBUG("Failed to activate a mandatory sub-driver");
     for (i = 0 ; i < XEN_UNIFIED_NR_DRIVERS ; i++)
-        if (priv->opened[i]) drivers[i]->close(conn);
+        if (priv->opened[i]) drivers[i]->xenClose(conn);
     virMutexDestroy(&priv->lock);
     VIR_FREE(priv);
     conn->privateData = NULL;
@@ -439,8 +439,8 @@ xenUnifiedClose (virConnectPtr conn)
     virDomainEventCallbackListFree(priv->domainEventCallbacks);

     for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
-        if (priv->opened[i] && drivers[i]->close)
-            (void) drivers[i]->close (conn);
+        if (priv->opened[i] && drivers[i]->xenClose)
+            (void) drivers[i]->xenClose (conn);

     virMutexDestroy(&priv->lock);
     VIR_FREE(conn->privateData);
@@ -493,8 +493,8 @@ xenUnifiedGetVersion (virConnectPtr conn, unsigned long *hvVer)

     for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
         if (priv->opened[i] &&
-            drivers[i]->version &&
-            drivers[i]->version (conn, hvVer) == 0)
+            drivers[i]->xenVersion &&
+            drivers[i]->xenVersion (conn, hvVer) == 0)
             return 0;

     return -1;
@@ -546,8 +546,8 @@ xenUnifiedNodeGetInfo (virConnectPtr conn, virNodeInfoPtr info)

     for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
         if (priv->opened[i] &&
-            drivers[i]->nodeGetInfo &&
-            drivers[i]->nodeGetInfo (conn, info) == 0)
+            drivers[i]->xenNodeGetInfo &&
+            drivers[i]->xenNodeGetInfo (conn, info) == 0)
             return 0;

     return -1;
@@ -630,8 +630,8 @@ xenUnifiedDomainCreateXML (virConnectPtr conn,
     virDomainPtr ret;

     for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
-        if (priv->opened[i] && drivers[i]->domainCreateXML) {
-            ret = drivers[i]->domainCreateXML (conn, xmlDesc, flags);
+        if (priv->opened[i] && drivers[i]->xenDomainCreateXML) {
+            ret = drivers[i]->xenDomainCreateXML (conn, xmlDesc, flags);
             if (ret) return ret;
         }

@@ -835,13 +835,13 @@ xenUnifiedDomainSuspend (virDomainPtr dom)
     for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
         if (i != XEN_UNIFIED_HYPERVISOR_OFFSET &&
             priv->opened[i] &&
-            drivers[i]->domainSuspend &&
-            drivers[i]->domainSuspend (dom) == 0)
+            drivers[i]->xenDomainSuspend &&
+            drivers[i]->xenDomainSuspend (dom) == 0)
             return 0;

     if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET] &&
-        drivers[XEN_UNIFIED_HYPERVISOR_OFFSET]->domainSuspend &&
-        drivers[XEN_UNIFIED_HYPERVISOR_OFFSET]->domainSuspend (dom) == 0)
+        drivers[XEN_UNIFIED_HYPERVISOR_OFFSET]->xenDomainSuspend &&
+        drivers[XEN_UNIFIED_HYPERVISOR_OFFSET]->xenDomainSuspend (dom) == 0)
         return 0;

     return -1;
@@ -859,13 +859,13 @@ xenUnifiedDomainResume (virDomainPtr dom)
     for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
         if (i != XEN_UNIFIED_HYPERVISOR_OFFSET &&
             priv->opened[i] &&
-            drivers[i]->domainResume &&
-            drivers[i]->domainResume (dom) == 0)
+            drivers[i]->xenDomainResume &&
+            drivers[i]->xenDomainResume (dom) == 0)
             return 0;

     if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET] &&
-        drivers[XEN_UNIFIED_HYPERVISOR_OFFSET]->domainResume &&
-        drivers[XEN_UNIFIED_HYPERVISOR_OFFSET]->domainResume (dom) == 0)
+        drivers[XEN_UNIFIED_HYPERVISOR_OFFSET]->xenDomainResume &&
+        drivers[XEN_UNIFIED_HYPERVISOR_OFFSET]->xenDomainResume (dom) == 0)
         return 0;

     return -1;
@@ -879,8 +879,8 @@ xenUnifiedDomainShutdown (virDomainPtr dom)

     for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
         if (priv->opened[i] &&
-            drivers[i]->domainShutdown &&
-            drivers[i]->domainShutdown (dom) == 0)
+            drivers[i]->xenDomainShutdown &&
+            drivers[i]->xenDomainShutdown (dom) == 0)
             return 0;

     return -1;
@@ -894,8 +894,8 @@ xenUnifiedDomainReboot (virDomainPtr dom, unsigned int flags)

     for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
         if (priv->opened[i] &&
-            drivers[i]->domainReboot &&
-            drivers[i]->domainReboot (dom, flags) == 0)
+            drivers[i]->xenDomainReboot &&
+            drivers[i]->xenDomainReboot (dom, flags) == 0)
             return 0;

     return -1;
@@ -916,13 +916,13 @@ xenUnifiedDomainDestroyFlags(virDomainPtr dom,
     for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
         if (i != XEN_UNIFIED_HYPERVISOR_OFFSET &&
             priv->opened[i] &&
-            drivers[i]->domainDestroyFlags &&
-            drivers[i]->domainDestroyFlags(dom, flags) == 0)
+            drivers[i]->xenDomainDestroyFlags &&
+            drivers[i]->xenDomainDestroyFlags(dom, flags) == 0)
             return 0;

     if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET] &&
-        drivers[XEN_UNIFIED_HYPERVISOR_OFFSET]->domainDestroyFlags&&
-        drivers[XEN_UNIFIED_HYPERVISOR_OFFSET]->domainDestroyFlags(dom,
+        drivers[XEN_UNIFIED_HYPERVISOR_OFFSET]->xenDomainDestroyFlags&&
+        drivers[XEN_UNIFIED_HYPERVISOR_OFFSET]->xenDomainDestroyFlags(dom,
                                                                    flags) == 0)
         return 0;

@@ -943,8 +943,8 @@ xenUnifiedDomainGetOSType (virDomainPtr dom)
     char *ret;

     for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
-        if (priv->opened[i] && drivers[i]->domainGetOSType) {
-            ret = drivers[i]->domainGetOSType (dom);
+        if (priv->opened[i] && drivers[i]->xenDomainGetOSType) {
+            ret = drivers[i]->xenDomainGetOSType (dom);
             if (ret) return ret;
         }

@@ -959,8 +959,8 @@ xenUnifiedDomainGetMaxMemory (virDomainPtr dom)
     unsigned long ret;

     for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
-        if (priv->opened[i] && drivers[i]->domainGetMaxMemory) {
-            ret = drivers[i]->domainGetMaxMemory (dom);
+        if (priv->opened[i] && drivers[i]->xenDomainGetMaxMemory) {
+            ret = drivers[i]->xenDomainGetMaxMemory (dom);
             if (ret != 0) return ret;
         }

@@ -982,8 +982,8 @@ xenUnifiedDomainSetMaxMemory (virDomainPtr dom, unsigned long memory)
     for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
         if (i != XEN_UNIFIED_XEND_OFFSET &&
             priv->opened[i] &&
-            drivers[i]->domainSetMaxMemory &&
-            drivers[i]->domainSetMaxMemory (dom, memory) == 0)
+            drivers[i]->xenDomainSetMaxMemory &&
+            drivers[i]->xenDomainSetMaxMemory (dom, memory) == 0)
             return 0;

     return -1;
@@ -997,8 +997,8 @@ xenUnifiedDomainSetMemory (virDomainPtr dom, unsigned long memory)

     for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
         if (priv->opened[i] &&
-            drivers[i]->domainSetMemory &&
-            drivers[i]->domainSetMemory (dom, memory) == 0)
+            drivers[i]->xenDomainSetMemory &&
+            drivers[i]->xenDomainSetMemory (dom, memory) == 0)
             return 0;

     return -1;
@@ -1012,8 +1012,8 @@ xenUnifiedDomainGetInfo (virDomainPtr dom, virDomainInfoPtr info)

     for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
         if (priv->opened[i] &&
-            drivers[i]->domainGetInfo &&
-            drivers[i]->domainGetInfo (dom, info) == 0)
+            drivers[i]->xenDomainGetInfo &&
+            drivers[i]->xenDomainGetInfo (dom, info) == 0)
             return 0;

     return -1;
@@ -1068,8 +1068,8 @@ xenUnifiedDomainSave (virDomainPtr dom, const char *to)

     for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
         if (priv->opened[i] &&
-            drivers[i]->domainSave &&
-            drivers[i]->domainSave (dom, to) == 0)
+            drivers[i]->xenDomainSave &&
+            drivers[i]->xenDomainSave (dom, to) == 0)
             return 0;

     return -1;
@@ -1083,8 +1083,8 @@ xenUnifiedDomainRestore (virConnectPtr conn, const char *from)

     for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
         if (priv->opened[i] &&
-            drivers[i]->domainRestore &&
-            drivers[i]->domainRestore (conn, from) == 0)
+            drivers[i]->xenDomainRestore &&
+            drivers[i]->xenDomainRestore (conn, from) == 0)
             return 0;

     return -1;
@@ -1098,8 +1098,8 @@ xenUnifiedDomainCoreDump (virDomainPtr dom, const char *to, unsigned int flags)

     for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
         if (priv->opened[i] &&
-            drivers[i]->domainCoreDump &&
-            drivers[i]->domainCoreDump (dom, to, flags) == 0)
+            drivers[i]->xenDomainCoreDump &&
+            drivers[i]->xenDomainCoreDump (dom, to, flags) == 0)
             return 0;

     return -1;
@@ -1177,8 +1177,8 @@ xenUnifiedDomainPinVcpu (virDomainPtr dom, unsigned int vcpu,

     for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
         if (priv->opened[i] &&
-            drivers[i]->domainPinVcpu &&
-            drivers[i]->domainPinVcpu (dom, vcpu, cpumap, maplen) == 0)
+            drivers[i]->xenDomainPinVcpu &&
+            drivers[i]->xenDomainPinVcpu (dom, vcpu, cpumap, maplen) == 0)
             return 0;

     return -1;
@@ -1193,8 +1193,8 @@ xenUnifiedDomainGetVcpus (virDomainPtr dom,
     int i, ret;

     for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
-        if (priv->opened[i] && drivers[i]->domainGetVcpus) {
-            ret = drivers[i]->domainGetVcpus (dom, info, maxinfo, cpumaps, maplen);
+        if (priv->opened[i] && drivers[i]->xenDomainGetVcpus) {
+            ret = drivers[i]->xenDomainGetVcpus (dom, info, maxinfo, cpumaps, maplen);
             if (ret > 0)
                 return ret;
         }
@@ -1474,8 +1474,8 @@ xenUnifiedListDefinedDomains (virConnectPtr conn, char **const names,
     int ret;

     for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
-        if (priv->opened[i] && drivers[i]->listDefinedDomains) {
-            ret = drivers[i]->listDefinedDomains (conn, names, maxnames);
+        if (priv->opened[i] && drivers[i]->xenListDefinedDomains) {
+            ret = drivers[i]->xenListDefinedDomains (conn, names, maxnames);
             if (ret >= 0) return ret;
         }

@@ -1490,8 +1490,8 @@ xenUnifiedNumOfDefinedDomains (virConnectPtr conn)
     int ret;

     for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
-        if (priv->opened[i] && drivers[i]->numOfDefinedDomains) {
-            ret = drivers[i]->numOfDefinedDomains (conn);
+        if (priv->opened[i] && drivers[i]->xenNumOfDefinedDomains) {
+            ret = drivers[i]->xenNumOfDefinedDomains (conn);
             if (ret >= 0) return ret;
         }

@@ -1507,8 +1507,8 @@ xenUnifiedDomainCreateWithFlags (virDomainPtr dom, unsigned int flags)
     virCheckFlags(0, -1);

     for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
-        if (priv->opened[i] && drivers[i]->domainCreate &&
-            drivers[i]->domainCreate (dom) == 0)
+        if (priv->opened[i] && drivers[i]->xenDomainCreate &&
+            drivers[i]->xenDomainCreate (dom) == 0)
             return 0;

     return -1;
@@ -1528,8 +1528,8 @@ xenUnifiedDomainDefineXML (virConnectPtr conn, const char *xml)
     virDomainPtr ret;

     for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
-        if (priv->opened[i] && drivers[i]->domainDefineXML) {
-            ret = drivers[i]->domainDefineXML (conn, xml);
+        if (priv->opened[i] && drivers[i]->xenDomainDefineXML) {
+            ret = drivers[i]->xenDomainDefineXML (conn, xml);
             if (ret) return ret;
         }

@@ -1544,8 +1544,8 @@ xenUnifiedDomainUndefineFlags (virDomainPtr dom, unsigned int flags)

     virCheckFlags(0, -1);
     for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
-        if (priv->opened[i] && drivers[i]->domainUndefine &&
-            drivers[i]->domainUndefine (dom) == 0)
+        if (priv->opened[i] && drivers[i]->xenDomainUndefine &&
+            drivers[i]->xenDomainUndefine (dom) == 0)
             return 0;

     return -1;
@@ -1573,8 +1573,8 @@ xenUnifiedDomainAttachDevice (virDomainPtr dom, const char *xml)
         flags |= VIR_DOMAIN_DEVICE_MODIFY_CONFIG;

     for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
-        if (priv->opened[i] && drivers[i]->domainAttachDeviceFlags &&
-            drivers[i]->domainAttachDeviceFlags(dom, xml, flags) == 0)
+        if (priv->opened[i] && drivers[i]->xenDomainAttachDeviceFlags &&
+            drivers[i]->xenDomainAttachDeviceFlags(dom, xml, flags) == 0)
             return 0;

     return -1;
@@ -1588,8 +1588,8 @@ xenUnifiedDomainAttachDeviceFlags (virDomainPtr dom, const char *xml,
     int i;

     for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
-        if (priv->opened[i] && drivers[i]->domainAttachDeviceFlags &&
-            drivers[i]->domainAttachDeviceFlags(dom, xml, flags) == 0)
+        if (priv->opened[i] && drivers[i]->xenDomainAttachDeviceFlags &&
+            drivers[i]->xenDomainAttachDeviceFlags(dom, xml, flags) == 0)
             return 0;

     return -1;
@@ -1612,8 +1612,8 @@ xenUnifiedDomainDetachDevice (virDomainPtr dom, const char *xml)
         flags |= VIR_DOMAIN_DEVICE_MODIFY_CONFIG;

     for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
-        if (priv->opened[i] && drivers[i]->domainDetachDeviceFlags &&
-            drivers[i]->domainDetachDeviceFlags(dom, xml, flags) == 0)
+        if (priv->opened[i] && drivers[i]->xenDomainDetachDeviceFlags &&
+            drivers[i]->xenDomainDetachDeviceFlags(dom, xml, flags) == 0)
             return 0;

     return -1;
@@ -1627,8 +1627,8 @@ xenUnifiedDomainDetachDeviceFlags (virDomainPtr dom, const char *xml,
     int i;

     for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
-        if (priv->opened[i] && drivers[i]->domainDetachDeviceFlags &&
-            drivers[i]->domainDetachDeviceFlags(dom, xml, flags) == 0)
+        if (priv->opened[i] && drivers[i]->xenDomainDetachDeviceFlags &&
+            drivers[i]->xenDomainDetachDeviceFlags(dom, xml, flags) == 0)
             return 0;

     return -1;
@@ -1642,8 +1642,8 @@ xenUnifiedDomainUpdateDeviceFlags (virDomainPtr dom, const char *xml,
     int i;

     for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
-        if (priv->opened[i] && drivers[i]->domainUpdateDeviceFlags &&
-            drivers[i]->domainUpdateDeviceFlags(dom, xml, flags) == 0)
+        if (priv->opened[i] && drivers[i]->xenDomainUpdateDeviceFlags &&
+            drivers[i]->xenDomainUpdateDeviceFlags(dom, xml, flags) == 0)
             return 0;

     return -1;
@@ -1691,8 +1691,8 @@ xenUnifiedDomainGetSchedulerType (virDomainPtr dom, int *nparams)
     char *schedulertype;

     for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; i++) {
-        if (priv->opened[i] && drivers[i]->domainGetSchedulerType) {
-            schedulertype = drivers[i]->domainGetSchedulerType (dom, nparams);
+        if (priv->opened[i] && drivers[i]->xenDomainGetSchedulerType) {
+            schedulertype = drivers[i]->xenDomainGetSchedulerType (dom, nparams);
             if (schedulertype != NULL)
                 return(schedulertype);
         }
@@ -1712,8 +1712,8 @@ xenUnifiedDomainGetSchedulerParametersFlags(virDomainPtr dom,
     virCheckFlags(0, -1);

     for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i) {
-        if (priv->opened[i] && drivers[i]->domainGetSchedulerParameters) {
-           ret = drivers[i]->domainGetSchedulerParameters(dom, params, nparams);
+        if (priv->opened[i] && drivers[i]->xenDomainGetSchedulerParameters) {
+           ret = drivers[i]->xenDomainGetSchedulerParameters(dom, params, nparams);
            if (ret == 0)
                return(0);
         }
@@ -1743,8 +1743,8 @@ xenUnifiedDomainSetSchedulerParametersFlags(virDomainPtr dom,

     /* do the hypervisor call last to get better error */
     for (i = XEN_UNIFIED_NR_DRIVERS - 1; i >= 0; i--) {
-        if (priv->opened[i] && drivers[i]->domainSetSchedulerParameters) {
-           ret = drivers[i]->domainSetSchedulerParameters(dom, params, nparams);
+        if (priv->opened[i] && drivers[i]->xenDomainSetSchedulerParameters) {
+           ret = drivers[i]->xenDomainSetSchedulerParameters(dom, params, nparams);
            if (ret == 0)
                return 0;
         }
diff --git a/src/xen/xen_driver.h b/src/xen/xen_driver.h
index 039aea3..256d148 100644
--- a/src/xen/xen_driver.h
+++ b/src/xen/xen_driver.h
@@ -81,44 +81,44 @@ extern int xenRegister (void);
  * structure with direct calls in xen_unified.c.
  */
 struct xenUnifiedDriver {
-        virDrvOpen			open;
-        virDrvClose			close;
-        virDrvGetVersion		version;
-    virDrvGetHostname       getHostname;
-        virDrvNodeGetInfo		nodeGetInfo;
-        virDrvGetCapabilities		getCapabilities;
-        virDrvListDomains		listDomains;
-        virDrvNumOfDomains		numOfDomains;
-        virDrvDomainCreateXML		domainCreateXML;
-        virDrvDomainSuspend		domainSuspend;
-        virDrvDomainResume		domainResume;
-        virDrvDomainShutdown		domainShutdown;
-        virDrvDomainReboot		domainReboot;
-        virDrvDomainDestroyFlags        domainDestroyFlags;
-        virDrvDomainGetOSType		domainGetOSType;
-        virDrvDomainGetMaxMemory	domainGetMaxMemory;
-        virDrvDomainSetMaxMemory	domainSetMaxMemory;
-        virDrvDomainSetMemory		domainSetMemory;
-        virDrvDomainGetInfo		domainGetInfo;
-        virDrvDomainSave		domainSave;
-        virDrvDomainRestore		domainRestore;
-        virDrvDomainCoreDump		domainCoreDump;
-        virDrvDomainScreenshot      domainScreenshot;
-        virDrvDomainPinVcpu		domainPinVcpu;
-        virDrvDomainGetVcpus		domainGetVcpus;
-        virDrvListDefinedDomains	listDefinedDomains;
-        virDrvNumOfDefinedDomains	numOfDefinedDomains;
-        virDrvDomainCreate		domainCreate;
-        virDrvDomainDefineXML           domainDefineXML;
-        virDrvDomainUndefine            domainUndefine;
-        virDrvDomainAttachDeviceFlags	domainAttachDeviceFlags;
-        virDrvDomainDetachDeviceFlags	domainDetachDeviceFlags;
-        virDrvDomainUpdateDeviceFlags	domainUpdateDeviceFlags;
-        virDrvDomainGetAutostart	domainGetAutostart;
-        virDrvDomainSetAutostart	domainSetAutostart;
-        virDrvDomainGetSchedulerType	domainGetSchedulerType;
-        virDrvDomainGetSchedulerParameters domainGetSchedulerParameters;
-        virDrvDomainSetSchedulerParameters domainSetSchedulerParameters;
+    virDrvOpen xenOpen;
+    virDrvClose xenClose;
+    virDrvGetVersion  xenVersion;
+    virDrvGetHostname xenGetHostname;
+    virDrvNodeGetInfo xenNodeGetInfo;
+    virDrvGetCapabilities xenGetCapabilities;
+    virDrvListDomains xenListDomains;
+    virDrvNumOfDomains xenNumOfDomains;
+    virDrvDomainCreateXML xenDomainCreateXML;
+    virDrvDomainSuspend xenDomainSuspend;
+    virDrvDomainResume xenDomainResume;
+    virDrvDomainShutdown xenDomainShutdown;
+    virDrvDomainReboot xenDomainReboot;
+    virDrvDomainDestroyFlags xenDomainDestroyFlags;
+    virDrvDomainGetOSType xenDomainGetOSType;
+    virDrvDomainGetMaxMemory xenDomainGetMaxMemory;
+    virDrvDomainSetMaxMemory xenDomainSetMaxMemory;
+    virDrvDomainSetMemory xenDomainSetMemory;
+    virDrvDomainGetInfo xenDomainGetInfo;
+    virDrvDomainSave xenDomainSave;
+    virDrvDomainRestore xenDomainRestore;
+    virDrvDomainCoreDump xenDomainCoreDump;
+    virDrvDomainScreenshot xenDomainScreenshot;
+    virDrvDomainPinVcpu xenDomainPinVcpu;
+    virDrvDomainGetVcpus xenDomainGetVcpus;
+    virDrvListDefinedDomains xenListDefinedDomains;
+    virDrvNumOfDefinedDomains xenNumOfDefinedDomains;
+    virDrvDomainCreate xenDomainCreate;
+    virDrvDomainDefineXML xenDomainDefineXML;
+    virDrvDomainUndefine xenDomainUndefine;
+    virDrvDomainAttachDeviceFlags xenDomainAttachDeviceFlags;
+    virDrvDomainDetachDeviceFlags xenDomainDetachDeviceFlags;
+    virDrvDomainUpdateDeviceFlags xenDomainUpdateDeviceFlags;
+    virDrvDomainGetAutostart xenDomainGetAutostart;
+    virDrvDomainSetAutostart xenDomainSetAutostart;
+    virDrvDomainGetSchedulerType xenDomainGetSchedulerType;
+    virDrvDomainGetSchedulerParameters xenDomainGetSchedulerParameters;
+    virDrvDomainSetSchedulerParameters xenDomainSetSchedulerParameters;
 };

 typedef struct xenXMConfCache *xenXMConfCachePtr;
diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
index 0309d8a..1304e28 100644
--- a/src/xen/xen_hypervisor.c
+++ b/src/xen/xen_hypervisor.c
@@ -802,44 +802,24 @@ typedef struct xen_op_v2_dom xen_op_v2_dom;
 static unsigned long xenHypervisorGetMaxMemory(virDomainPtr domain);

 struct xenUnifiedDriver xenHypervisorDriver = {
-    xenHypervisorOpen, /* open */
-    xenHypervisorClose, /* close */
-    xenHypervisorGetVersion, /* version */
-    NULL, /* hostname */
-    NULL, /* nodeGetInfo */
-    xenHypervisorGetCapabilities, /* getCapabilities */
-    xenHypervisorListDomains, /* listDomains */
-    xenHypervisorNumOfDomains, /* numOfDomains */
-    NULL, /* domainCreateXML */
-    xenHypervisorPauseDomain, /* domainSuspend */
-    xenHypervisorResumeDomain, /* domainResume */
-    NULL, /* domainShutdown */
-    NULL, /* domainReboot */
-    xenHypervisorDestroyDomainFlags, /* domainDestroyFlags */
-    xenHypervisorDomainGetOSType, /* domainGetOSType */
-    xenHypervisorGetMaxMemory, /* domainGetMaxMemory */
-    xenHypervisorSetMaxMemory, /* domainSetMaxMemory */
-    NULL, /* domainSetMemory */
-    xenHypervisorGetDomainInfo, /* domainGetInfo */
-    NULL, /* domainSave */
-    NULL, /* domainRestore */
-    NULL, /* domainCoreDump */
-    NULL, /* domainScreenshot */
-    xenHypervisorPinVcpu, /* domainPinVcpu */
-    xenHypervisorGetVcpus, /* domainGetVcpus */
-    NULL, /* listDefinedDomains */
-    NULL, /* numOfDefinedDomains */
-    NULL, /* domainCreate */
-    NULL, /* domainDefineXML */
-    NULL, /* domainUndefine */
-    NULL, /* domainAttachDeviceFlags */
-    NULL, /* domainDetachDeviceFlags */
-    NULL, /* domainUpdateDeviceFlags */
-    NULL, /* domainGetAutostart */
-    NULL, /* domainSetAutostart */
-    xenHypervisorGetSchedulerType, /* domainGetSchedulerType */
-    xenHypervisorGetSchedulerParameters, /* domainGetSchedulerParameters */
-    xenHypervisorSetSchedulerParameters, /* domainSetSchedulerParameters */
+    .xenOpen = xenHypervisorOpen,
+    .xenClose = xenHypervisorClose,
+    .xenVersion = xenHypervisorGetVersion,
+    .xenGetCapabilities = xenHypervisorGetCapabilities,
+    .xenListDomains = xenHypervisorListDomains,
+    .xenNumOfDomains = xenHypervisorNumOfDomains,
+    .xenDomainSuspend = xenHypervisorPauseDomain,
+    .xenDomainResume = xenHypervisorResumeDomain,
+    .xenDomainDestroyFlags = xenHypervisorDestroyDomainFlags,
+    .xenDomainGetOSType = xenHypervisorDomainGetOSType,
+    .xenDomainGetMaxMemory = xenHypervisorGetMaxMemory,
+    .xenDomainSetMaxMemory = xenHypervisorSetMaxMemory,
+    .xenDomainGetInfo = xenHypervisorGetDomainInfo,
+    .xenDomainPinVcpu = xenHypervisorPinVcpu,
+    .xenDomainGetVcpus = xenHypervisorGetVcpus,
+    .xenDomainGetSchedulerType = xenHypervisorGetSchedulerType,
+    .xenDomainGetSchedulerParameters = xenHypervisorGetSchedulerParameters,
+    .xenDomainSetSchedulerParameters = xenHypervisorSetSchedulerParameters,
 };

 #define virXenError(code, ...)                                             \
diff --git a/src/xen/xen_inotify.c b/src/xen/xen_inotify.c
index 1496330..73384fe 100644
--- a/src/xen/xen_inotify.c
+++ b/src/xen/xen_inotify.c
@@ -49,44 +49,8 @@
                              __FUNCTION__, __LINE__, __VA_ARGS__)

 struct xenUnifiedDriver xenInotifyDriver = {
-    xenInotifyOpen, /* open */
-    xenInotifyClose, /* close */
-    NULL, /* version */
-    NULL, /* hostname */
-    NULL, /* nodeGetInfo */
-    NULL, /* getCapabilities */
-    NULL, /* listDomains */
-    NULL, /* numOfDomains */
-    NULL, /* domainCreateLinux */
-    NULL, /* domainSuspend */
-    NULL, /* domainResume */
-    NULL, /* domainShutdown */
-    NULL, /* domainReboot */
-    NULL, /* domainDestroyFlags */
-    NULL, /* domainGetOSType */
-    NULL, /* domainGetMaxMemory */
-    NULL, /* domainSetMaxMemory */
-    NULL, /* domainSetMemory */
-    NULL, /* domainGetInfo */
-    NULL, /* domainSave */
-    NULL, /* domainRestore */
-    NULL, /* domainCoreDump */
-    NULL, /* domainScreenshot */
-    NULL, /* domainPinVcpu */
-    NULL, /* domainGetVcpus */
-    NULL, /* listDefinedDomains */
-    NULL, /* numOfDefinedDomains */
-    NULL, /* domainCreate */
-    NULL, /* domainDefineXML */
-    NULL, /* domainUndefine */
-    NULL, /* domainAttachDeviceFlags */
-    NULL, /* domainDetachDeviceFlags */
-    NULL, /* domainUpdateDeviceFlags */
-    NULL, /* domainGetAutostart */
-    NULL, /* domainSetAutostart */
-    NULL, /* domainGetSchedulerType */
-    NULL, /* domainGetSchedulerParameters */
-    NULL, /* domainSetSchedulerParameters */
+    .xenOpen = xenInotifyOpen,
+    .xenClose = xenInotifyClose,
 };

 static int
diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index cec2e01..bd64167 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -3934,44 +3934,41 @@ xenDaemonDomainBlockPeek (virDomainPtr domain, const char *path,
 }

 struct xenUnifiedDriver xenDaemonDriver = {
-    xenDaemonOpen,               /* open */
-    xenDaemonClose,              /* close */
-    xenDaemonGetVersion,         /* version */
-    NULL,                        /* hostname */
-    xenDaemonNodeGetInfo,        /* nodeGetInfo */
-    NULL,                        /* getCapabilities */
-    xenDaemonListDomains,        /* listDomains */
-    xenDaemonNumOfDomains,       /* numOfDomains */
-    xenDaemonCreateXML,          /* domainCreateXML */
-    xenDaemonDomainSuspend,      /* domainSuspend */
-    xenDaemonDomainResume,       /* domainResume */
-    xenDaemonDomainShutdown,     /* domainShutdown */
-    xenDaemonDomainReboot,       /* domainReboot */
-    xenDaemonDomainDestroyFlags, /* domainDestroyFlags */
-    xenDaemonDomainGetOSType,    /* domainGetOSType */
-    xenDaemonDomainGetMaxMemory, /* domainGetMaxMemory */
-    xenDaemonDomainSetMaxMemory, /* domainSetMaxMemory */
-    xenDaemonDomainSetMemory,    /* domainMaxMemory */
-    xenDaemonDomainGetInfo,      /* domainGetInfo */
-    xenDaemonDomainSave,         /* domainSave */
-    xenDaemonDomainRestore,      /* domainRestore */
-    xenDaemonDomainCoreDump,     /* domainCoreDump */
-    NULL,                        /* domainScreenshot */
-    xenDaemonDomainPinVcpu,      /* domainPinVcpu */
-    xenDaemonDomainGetVcpus,     /* domainGetVcpus */
-    xenDaemonListDefinedDomains, /* listDefinedDomains */
-    xenDaemonNumOfDefinedDomains,/* numOfDefinedDomains */
-    xenDaemonDomainCreate,       /* domainCreate */
-    xenDaemonDomainDefineXML,    /* domainDefineXML */
-    xenDaemonDomainUndefine,     /* domainUndefine */
-    xenDaemonAttachDeviceFlags,       /* domainAttachDeviceFlags */
-    xenDaemonDetachDeviceFlags,       /* domainDetachDeviceFlags */
-    xenDaemonUpdateDeviceFlags,       /* domainUpdateDeviceFlags */
-    xenDaemonDomainGetAutostart, /* domainGetAutostart */
-    xenDaemonDomainSetAutostart, /* domainSetAutostart */
-    xenDaemonGetSchedulerType,   /* domainGetSchedulerType */
-    xenDaemonGetSchedulerParameters, /* domainGetSchedulerParameters */
-    xenDaemonSetSchedulerParameters, /* domainSetSchedulerParameters */
+    .xenOpen = xenDaemonOpen,
+    .xenClose = xenDaemonClose,
+    .xenVersion = xenDaemonGetVersion,
+    .xenNodeGetInfo = xenDaemonNodeGetInfo,
+    .xenListDomains = xenDaemonListDomains,
+    .xenNumOfDomains = xenDaemonNumOfDomains,
+    .xenDomainCreateXML = xenDaemonCreateXML,
+    .xenDomainSuspend = xenDaemonDomainSuspend,
+    .xenDomainResume = xenDaemonDomainResume,
+    .xenDomainShutdown = xenDaemonDomainShutdown,
+    .xenDomainReboot = xenDaemonDomainReboot,
+    .xenDomainDestroyFlags = xenDaemonDomainDestroyFlags,
+    .xenDomainGetOSType = xenDaemonDomainGetOSType,
+    .xenDomainGetMaxMemory = xenDaemonDomainGetMaxMemory,
+    .xenDomainSetMaxMemory = xenDaemonDomainSetMaxMemory,
+    .xenDomainSetMemory = xenDaemonDomainSetMemory,
+    .xenDomainGetInfo = xenDaemonDomainGetInfo,
+    .xenDomainSave = xenDaemonDomainSave,
+    .xenDomainRestore = xenDaemonDomainRestore,
+    .xenDomainCoreDump = xenDaemonDomainCoreDump,
+    .xenDomainPinVcpu = xenDaemonDomainPinVcpu,
+    .xenDomainGetVcpus = xenDaemonDomainGetVcpus,
+    .xenListDefinedDomains = xenDaemonListDefinedDomains,
+    .xenNumOfDefinedDomains = xenDaemonNumOfDefinedDomains,
+    .xenDomainCreate = xenDaemonDomainCreate,
+    .xenDomainDefineXML = xenDaemonDomainDefineXML,
+    .xenDomainUndefine = xenDaemonDomainUndefine,
+    .xenDomainAttachDeviceFlags = xenDaemonAttachDeviceFlags,
+    .xenDomainDetachDeviceFlags = xenDaemonDetachDeviceFlags,
+    .xenDomainUpdateDeviceFlags = xenDaemonUpdateDeviceFlags,
+    .xenDomainGetAutostart = xenDaemonDomainGetAutostart,
+    .xenDomainSetAutostart = xenDaemonDomainSetAutostart,
+    .xenDomainGetSchedulerType = xenDaemonGetSchedulerType,
+    .xenDomainGetSchedulerParameters = xenDaemonGetSchedulerParameters,
+    .xenDomainSetSchedulerParameters = xenDaemonSetSchedulerParameters,
 };


diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
index 185303b..cfb2754 100644
--- a/src/xen/xm_internal.c
+++ b/src/xen/xm_internal.c
@@ -81,44 +81,20 @@ static int xenXMDomainDetachDeviceFlags(virDomainPtr domain, const char *xml,
 #define XM_XML_ERROR "Invalid xml"

 struct xenUnifiedDriver xenXMDriver = {
-    xenXMOpen, /* open */
-    xenXMClose, /* close */
-    NULL, /* version */
-    NULL, /* hostname */
-    NULL, /* nodeGetInfo */
-    NULL, /* getCapabilities */
-    NULL, /* listDomains */
-    NULL, /* numOfDomains */
-    NULL, /* domainCreateXML */
-    NULL, /* domainSuspend */
-    NULL, /* domainResume */
-    NULL, /* domainShutdown */
-    NULL, /* domainReboot */
-    NULL, /* domainDestroyFlags */
-    NULL, /* domainGetOSType */
-    xenXMDomainGetMaxMemory, /* domainGetMaxMemory */
-    xenXMDomainSetMaxMemory, /* domainSetMaxMemory */
-    xenXMDomainSetMemory, /* domainMaxMemory */
-    xenXMDomainGetInfo, /* domainGetInfo */
-    NULL, /* domainSave */
-    NULL, /* domainRestore */
-    NULL, /* domainCoreDump */
-    NULL, /* domainScreenshot */
-    xenXMDomainPinVcpu, /* domainPinVcpu */
-    NULL, /* domainGetVcpus */
-    xenXMListDefinedDomains, /* listDefinedDomains */
-    xenXMNumOfDefinedDomains, /* numOfDefinedDomains */
-    xenXMDomainCreate, /* domainCreate */
-    xenXMDomainDefineXML, /* domainDefineXML */
-    xenXMDomainUndefine, /* domainUndefine */
-    xenXMDomainAttachDeviceFlags, /* domainAttachDeviceFlags */
-    xenXMDomainDetachDeviceFlags, /* domainDetachDeviceFlags */
-    NULL, /* domainUpdateDeviceFlags */
-    NULL, /* domainGetAutostart */
-    NULL, /* domainSetAutostart */
-    NULL, /* domainGetSchedulerType */
-    NULL, /* domainGetSchedulerParameters */
-    NULL, /* domainSetSchedulerParameters */
+    .xenOpen = xenXMOpen,
+    .xenClose = xenXMClose,
+    .xenDomainGetMaxMemory = xenXMDomainGetMaxMemory,
+    .xenDomainSetMaxMemory = xenXMDomainSetMaxMemory,
+    .xenDomainSetMemory = xenXMDomainSetMemory,
+    .xenDomainGetInfo = xenXMDomainGetInfo,
+    .xenDomainPinVcpu = xenXMDomainPinVcpu,
+    .xenListDefinedDomains = xenXMListDefinedDomains,
+    .xenNumOfDefinedDomains = xenXMNumOfDefinedDomains,
+    .xenDomainCreate = xenXMDomainCreate,
+    .xenDomainDefineXML = xenXMDomainDefineXML,
+    .xenDomainUndefine = xenXMDomainUndefine,
+    .xenDomainAttachDeviceFlags = xenXMDomainAttachDeviceFlags,
+    .xenDomainDetachDeviceFlags = xenXMDomainDetachDeviceFlags,
 };

 #define xenXMError(code, ...)                                              \
diff --git a/src/xen/xs_internal.c b/src/xen/xs_internal.c
index c1b00e5..0856498 100644
--- a/src/xen/xs_internal.c
+++ b/src/xen/xs_internal.c
@@ -42,44 +42,15 @@ static void xenStoreWatchEvent(int watch, int fd, int events, void *data);
 static void xenStoreWatchListFree(xenStoreWatchListPtr list);

 struct xenUnifiedDriver xenStoreDriver = {
-    xenStoreOpen, /* open */
-    xenStoreClose, /* close */
-    NULL, /* version */
-    NULL, /* hostname */
-    NULL, /* nodeGetInfo */
-    NULL, /* getCapabilities */
-    xenStoreListDomains, /* listDomains */
-    NULL, /* numOfDomains */
-    NULL, /* domainCreateXML */
-    NULL, /* domainSuspend */
-    NULL, /* domainResume */
-    xenStoreDomainShutdown, /* domainShutdown */
-    xenStoreDomainReboot, /* domainReboot */
-    NULL, /* domainDestroyFlags */
-    xenStoreDomainGetOSType, /* domainGetOSType */
-    xenStoreDomainGetMaxMemory, /* domainGetMaxMemory */
-    NULL, /* domainSetMaxMemory */
-    xenStoreDomainSetMemory, /* domainSetMemory */
-    xenStoreGetDomainInfo, /* domainGetInfo */
-    NULL, /* domainSave */
-    NULL, /* domainRestore */
-    NULL, /* domainCoreDump */
-    NULL, /* domainScreenshot */
-    NULL, /* domainPinVcpu */
-    NULL, /* domainGetVcpus */
-    NULL, /* listDefinedDomains */
-    NULL, /* numOfDefinedDomains */
-    NULL, /* domainCreate */
-    NULL, /* domainDefineXML */
-    NULL, /* domainUndefine */
-    NULL, /* domainAttachDeviceFlags */
-    NULL, /* domainDetachDeviceFlags */
-    NULL, /* domainUpdateDeviceFlags */
-    NULL, /* domainGetAutostart */
-    NULL, /* domainSetAutostart */
-    NULL, /* domainGetSchedulerType */
-    NULL, /* domainGetSchedulerParameters */
-    NULL, /* domainSetSchedulerParameters */
+    .xenOpen = xenStoreOpen,
+    .xenClose = xenStoreClose,
+    .xenListDomains = xenStoreListDomains,
+    .xenDomainShutdown = xenStoreDomainShutdown,
+    .xenDomainReboot = xenStoreDomainReboot,
+    .xenDomainGetOSType = xenStoreDomainGetOSType,
+    .xenDomainGetMaxMemory = xenStoreDomainGetMaxMemory,
+    .xenDomainSetMemory = xenStoreDomainSetMemory,
+    .xenDomainGetInfo = xenStoreGetDomainInfo,
 };

 #define virXenStoreError(code, ...)                                  \
-- 
1.7.4.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]