[PATCH 13/22] remote generator, daemon: Handle functions with multiple return values

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

 



Once again rename members in the XDR definitions to avoid special case
code in the generator.
---
 daemon/remote.c                 |  334 ---------------------------------------
 daemon/remote_dispatch_bodies.c |  322 ++++++++++++++++++++++++++++++++++++-
 daemon/remote_generator.pl      |   80 ++++++++--
 src/remote/remote_driver.c      |    6 +-
 src/remote/remote_protocol.c    |    6 +-
 src/remote/remote_protocol.h    |    6 +-
 src/remote/remote_protocol.x    |    6 +-
 src/remote_protocol-structs     |    6 +-
 8 files changed, 397 insertions(+), 369 deletions(-)

diff --git a/daemon/remote.c b/daemon/remote.c
index f70c445..e0fb1f8 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -494,43 +494,6 @@ cleanup:
 }
 
 static int
-remoteDispatchNodeGetInfo(struct qemud_server *server ATTRIBUTE_UNUSED,
-                          struct qemud_client *client ATTRIBUTE_UNUSED,
-                          virConnectPtr conn,
-                          remote_message_header *hdr ATTRIBUTE_UNUSED,
-                          remote_error *rerr,
-                          void *args ATTRIBUTE_UNUSED,
-                          remote_node_get_info_ret *ret)
-{
-    virNodeInfo info;
-    int rv = -1;
-
-    if (!conn) {
-        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
-        goto cleanup;
-    }
-
-    if (virNodeGetInfo(conn, &info) < 0)
-        goto cleanup;
-
-    memcpy(ret->model, info.model, sizeof ret->model);
-    ret->memory = info.memory;
-    ret->cpus = info.cpus;
-    ret->mhz = info.mhz;
-    ret->nodes = info.nodes;
-    ret->sockets = info.sockets;
-    ret->cores = info.cores;
-    ret->threads = info.threads;
-
-    rv = 0;
-
-cleanup:
-    if (rv < 0)
-        remoteDispatchError(rerr);
-    return rv;
-}
-
-static int
 remoteDispatchDomainGetSchedulerType(struct qemud_server *server ATTRIBUTE_UNUSED,
                                      struct qemud_client *client ATTRIBUTE_UNUSED,
                                      virConnectPtr conn,
@@ -722,93 +685,6 @@ cleanup:
 }
 
 static int
-remoteDispatchDomainBlockStats(struct qemud_server *server ATTRIBUTE_UNUSED,
-                               struct qemud_client *client ATTRIBUTE_UNUSED,
-                               virConnectPtr conn,
-                               remote_message_header *hdr ATTRIBUTE_UNUSED,
-                               remote_error *rerr,
-                               remote_domain_block_stats_args *args,
-                               remote_domain_block_stats_ret *ret)
-{
-    virDomainPtr dom = NULL;
-    char *path;
-    struct _virDomainBlockStats stats;
-    int rv = -1;
-
-    if (!conn) {
-        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
-        goto cleanup;
-    }
-
-    if (!(dom = get_nonnull_domain(conn, args->dom)))
-        goto cleanup;
-    path = args->path;
-
-    if (virDomainBlockStats(dom, path, &stats, sizeof stats) < 0)
-        goto cleanup;
-
-    ret->rd_req = stats.rd_req;
-    ret->rd_bytes = stats.rd_bytes;
-    ret->wr_req = stats.wr_req;
-    ret->wr_bytes = stats.wr_bytes;
-    ret->errs = stats.errs;
-
-    rv = 0;
-
-cleanup:
-    if (rv < 0)
-        remoteDispatchError(rerr);
-    if (dom)
-        virDomainFree(dom);
-    return rv;
-}
-
-static int
-remoteDispatchDomainInterfaceStats(struct qemud_server *server ATTRIBUTE_UNUSED,
-                                   struct qemud_client *client ATTRIBUTE_UNUSED,
-                                   virConnectPtr conn,
-                                   remote_message_header *hdr ATTRIBUTE_UNUSED,
-                                   remote_error *rerr,
-                                   remote_domain_interface_stats_args *args,
-                                   remote_domain_interface_stats_ret *ret)
-{
-    virDomainPtr dom = NULL;
-    char *path;
-    struct _virDomainInterfaceStats stats;
-    int rv = -1;
-
-    if (!conn) {
-        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
-        goto cleanup;
-    }
-
-    if (!(dom = get_nonnull_domain(conn, args->dom)))
-        goto cleanup;
-    path = args->path;
-
-    if (virDomainInterfaceStats(dom, path, &stats, sizeof stats) < 0)
-        goto cleanup;
-
-    ret->rx_bytes = stats.rx_bytes;
-    ret->rx_packets = stats.rx_packets;
-    ret->rx_errs = stats.rx_errs;
-    ret->rx_drop = stats.rx_drop;
-    ret->tx_bytes = stats.tx_bytes;
-    ret->tx_packets = stats.tx_packets;
-    ret->tx_errs = stats.tx_errs;
-    ret->tx_drop = stats.tx_drop;
-
-    rv = 0;
-
-cleanup:
-    if (rv < 0)
-        remoteDispatchError(rerr);
-    if (dom)
-        virDomainFree(dom);
-    return rv;
-}
-
-static int
 remoteDispatchDomainMemoryStats(struct qemud_server *server ATTRIBUTE_UNUSED,
                                 struct qemud_client *client ATTRIBUTE_UNUSED,
                                 virConnectPtr conn,
@@ -1012,46 +888,6 @@ cleanup:
 }
 
 static int
-remoteDispatchDomainGetInfo(struct qemud_server *server ATTRIBUTE_UNUSED,
-                            struct qemud_client *client ATTRIBUTE_UNUSED,
-                            virConnectPtr conn,
-                            remote_message_header *hdr ATTRIBUTE_UNUSED,
-                            remote_error *rerr,
-                            remote_domain_get_info_args *args,
-                            remote_domain_get_info_ret *ret)
-{
-    virDomainPtr dom = NULL;
-    virDomainInfo info;
-    int rv = -1;
-
-    if (!conn) {
-        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
-        goto cleanup;
-    }
-
-    if (!(dom = get_nonnull_domain(conn, args->dom)))
-        goto cleanup;
-
-    if (virDomainGetInfo(dom, &info) < 0)
-        goto cleanup;
-
-    ret->state = info.state;
-    ret->max_mem = info.maxMem;
-    ret->memory = info.memory;
-    ret->nr_virt_cpu = info.nrVirtCpu;
-    ret->cpu_time = info.cpuTime;
-
-    rv = 0;
-
-cleanup:
-    if (rv < 0)
-        remoteDispatchError(rerr);
-    if (dom)
-        virDomainFree(dom);
-    return rv;
-}
-
-static int
 remoteDispatchDomainGetSecurityLabel(struct qemud_server *server ATTRIBUTE_UNUSED,
                                      struct qemud_client *client ATTRIBUTE_UNUSED,
                                      virConnectPtr conn,
@@ -2651,91 +2487,6 @@ remoteDispatchAuthPolkit(struct qemud_server *server ATTRIBUTE_UNUSED,
 
 
 /***************************************************************
- *     STORAGE POOL APIS
- ***************************************************************/
-
-static int
-remoteDispatchStoragePoolGetInfo(struct qemud_server *server ATTRIBUTE_UNUSED,
-                                 struct qemud_client *client ATTRIBUTE_UNUSED,
-                                 virConnectPtr conn,
-                                 remote_message_header *hdr ATTRIBUTE_UNUSED,
-                                 remote_error *rerr,
-                                 remote_storage_pool_get_info_args *args,
-                                 remote_storage_pool_get_info_ret *ret)
-{
-    virStoragePoolPtr pool = NULL;
-    virStoragePoolInfo info;
-    int rv = -1;
-
-    if (!conn) {
-        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
-        goto cleanup;
-    }
-
-    if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
-        goto cleanup;
-
-    if (virStoragePoolGetInfo(pool, &info) < 0)
-        goto cleanup;
-
-    ret->state = info.state;
-    ret->capacity = info.capacity;
-    ret->allocation = info.allocation;
-    ret->available = info.available;
-
-    rv = 0;
-
-cleanup:
-    if (rv < 0)
-        remoteDispatchError(rerr);
-    if (pool)
-        virStoragePoolFree(pool);
-    return rv;
-}
-
-/***************************************************************
- *     STORAGE VOL APIS
- ***************************************************************/
-
-static int
-remoteDispatchStorageVolGetInfo(struct qemud_server *server ATTRIBUTE_UNUSED,
-                                struct qemud_client *client ATTRIBUTE_UNUSED,
-                                virConnectPtr conn,
-                                remote_message_header *hdr ATTRIBUTE_UNUSED,
-                                remote_error *rerr,
-                                remote_storage_vol_get_info_args *args,
-                                remote_storage_vol_get_info_ret *ret)
-{
-    virStorageVolPtr vol = NULL;
-    virStorageVolInfo info;
-    int rv = -1;
-
-    if (!conn) {
-        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
-        goto cleanup;
-    }
-
-    if (!(vol = get_nonnull_storage_vol(conn, args->vol)))
-        goto cleanup;
-
-    if (virStorageVolGetInfo(vol, &info) < 0)
-        goto cleanup;
-
-    ret->type = info.type;
-    ret->capacity = info.capacity;
-    ret->allocation = info.allocation;
-
-    rv = 0;
-
-cleanup:
-    if (rv < 0)
-        remoteDispatchError(rerr);
-    if (vol)
-        virStorageVolFree(vol);
-    return rv;
-}
-
-/***************************************************************
  *     NODE INFO APIS
  **************************************************************/
 
@@ -3059,53 +2810,6 @@ cleanup:
 }
 
 static int
-remoteDispatchDomainGetJobInfo(struct qemud_server *server ATTRIBUTE_UNUSED,
-                               struct qemud_client *client ATTRIBUTE_UNUSED,
-                               virConnectPtr conn,
-                               remote_message_header *hdr ATTRIBUTE_UNUSED,
-                               remote_error *rerr,
-                               remote_domain_get_job_info_args *args,
-                               remote_domain_get_job_info_ret *ret)
-{
-    virDomainPtr dom = NULL;
-    virDomainJobInfo info;
-    int rv = -1;
-
-    if (!conn) {
-        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
-        goto cleanup;
-    }
-
-    if (!(dom = get_nonnull_domain(conn, args->dom)))
-        goto cleanup;
-
-    if (virDomainGetJobInfo(dom, &info) < 0)
-        goto cleanup;
-
-    ret->type = info.type;
-    ret->timeElapsed = info.timeElapsed;
-    ret->timeRemaining = info.timeRemaining;
-    ret->dataTotal = info.dataTotal;
-    ret->dataProcessed = info.dataProcessed;
-    ret->dataRemaining = info.dataRemaining;
-    ret->memTotal = info.memTotal;
-    ret->memProcessed = info.memProcessed;
-    ret->memRemaining = info.memRemaining;
-    ret->fileTotal = info.fileTotal;
-    ret->fileProcessed = info.fileProcessed;
-    ret->fileRemaining = info.fileRemaining;
-
-    rv = 0;
-
-cleanup:
-    if (rv < 0)
-        remoteDispatchError(rerr);
-    if (dom)
-        virDomainFree(dom);
-    return rv;
-}
-
-static int
 remoteDispatchDomainEventsRegisterAny(struct qemud_server *server ATTRIBUTE_UNUSED,
                                       struct qemud_client *client ATTRIBUTE_UNUSED,
                                       virConnectPtr conn,
@@ -3192,44 +2896,6 @@ cleanup:
 }
 
 static int
-remoteDispatchDomainGetBlockInfo(struct qemud_server *server ATTRIBUTE_UNUSED,
-                                 struct qemud_client *client ATTRIBUTE_UNUSED,
-                                 virConnectPtr conn,
-                                 remote_message_header *hdr ATTRIBUTE_UNUSED,
-                                 remote_error *rerr,
-                                 remote_domain_get_block_info_args *args,
-                                 remote_domain_get_block_info_ret *ret)
-{
-    virDomainPtr dom = NULL;
-    virDomainBlockInfo info;
-    int rv = -1;
-
-    if (!conn) {
-        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
-        goto cleanup;
-    }
-
-    if (!(dom = get_nonnull_domain(conn, args->dom)))
-        goto cleanup;
-
-    if (virDomainGetBlockInfo(dom, args->path, &info, args->flags) < 0)
-        goto cleanup;
-
-    ret->capacity = info.capacity;
-    ret->allocation = info.allocation;
-    ret->physical = info.physical;
-
-    rv = 0;
-
-cleanup:
-    if (rv < 0)
-        remoteDispatchError(rerr);
-    if (dom)
-        virDomainFree(dom);
-    return rv;
-}
-
-static int
 qemuDispatchMonitorCommand(struct qemud_server *server ATTRIBUTE_UNUSED,
                            struct qemud_client *client ATTRIBUTE_UNUSED,
                            virConnectPtr conn,
diff --git a/daemon/remote_dispatch_bodies.c b/daemon/remote_dispatch_bodies.c
index 50432f9..43bfc6d 100644
--- a/daemon/remote_dispatch_bodies.c
+++ b/daemon/remote_dispatch_bodies.c
@@ -178,7 +178,45 @@ cleanup:
 
 /* remoteDispatchDomainBlockPeek has to be implemented manually */
 
-/* remoteDispatchDomainBlockStats has to be implemented manually */
+static int
+remoteDispatchDomainBlockStats(
+    struct qemud_server *server ATTRIBUTE_UNUSED,
+    struct qemud_client *client ATTRIBUTE_UNUSED,
+    virConnectPtr conn,
+    remote_message_header *hdr ATTRIBUTE_UNUSED,
+    remote_error *rerr,
+    remote_domain_block_stats_args *args,
+    remote_domain_block_stats_ret *ret)
+{
+    int rv = -1;
+    virDomainPtr dom = NULL;
+    virDomainBlockStatsStruct tmp;
+
+    if (!conn) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+        goto cleanup;
+    }
+
+    if (!(dom = get_nonnull_domain(conn, args->dom)))
+        goto cleanup;
+
+    if (virDomainBlockStats(dom, args->path, &tmp, sizeof tmp) < 0)
+        goto cleanup;
+
+    ret->rd_req = tmp.rd_req;
+    ret->rd_bytes = tmp.rd_bytes;
+    ret->wr_req = tmp.wr_req;
+    ret->wr_bytes = tmp.wr_bytes;
+    ret->errs = tmp.errs;
+    rv = 0;
+
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    if (dom)
+        virDomainFree(dom);
+    return rv;
+}
 
 static int
 remoteDispatchDomainCoreDump(
@@ -498,11 +536,130 @@ cleanup:
 
 /* remoteDispatchDomainGetBlkioParameters has to be implemented manually */
 
-/* remoteDispatchDomainGetBlockInfo has to be implemented manually */
+static int
+remoteDispatchDomainGetBlockInfo(
+    struct qemud_server *server ATTRIBUTE_UNUSED,
+    struct qemud_client *client ATTRIBUTE_UNUSED,
+    virConnectPtr conn,
+    remote_message_header *hdr ATTRIBUTE_UNUSED,
+    remote_error *rerr,
+    remote_domain_get_block_info_args *args,
+    remote_domain_get_block_info_ret *ret)
+{
+    int rv = -1;
+    virDomainPtr dom = NULL;
+    virDomainBlockInfo tmp;
+
+    if (!conn) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+        goto cleanup;
+    }
+
+    if (!(dom = get_nonnull_domain(conn, args->dom)))
+        goto cleanup;
+
+    if (virDomainGetBlockInfo(dom, args->path, &tmp, args->flags) < 0)
+        goto cleanup;
+
+    ret->allocation = tmp.allocation;
+    ret->capacity = tmp.capacity;
+    ret->physical = tmp.physical;
+    rv = 0;
+
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    if (dom)
+        virDomainFree(dom);
+    return rv;
+}
+
+static int
+remoteDispatchDomainGetInfo(
+    struct qemud_server *server ATTRIBUTE_UNUSED,
+    struct qemud_client *client ATTRIBUTE_UNUSED,
+    virConnectPtr conn,
+    remote_message_header *hdr ATTRIBUTE_UNUSED,
+    remote_error *rerr,
+    remote_domain_get_info_args *args,
+    remote_domain_get_info_ret *ret)
+{
+    int rv = -1;
+    virDomainPtr dom = NULL;
+    virDomainInfo tmp;
 
-/* remoteDispatchDomainGetInfo has to be implemented manually */
+    if (!conn) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+        goto cleanup;
+    }
 
-/* remoteDispatchDomainGetJobInfo has to be implemented manually */
+    if (!(dom = get_nonnull_domain(conn, args->dom)))
+        goto cleanup;
+
+    if (virDomainGetInfo(dom, &tmp) < 0)
+        goto cleanup;
+
+    ret->state = tmp.state;
+    ret->maxMem = tmp.maxMem;
+    ret->memory = tmp.memory;
+    ret->nrVirtCpu = tmp.nrVirtCpu;
+    ret->cpuTime = tmp.cpuTime;
+    rv = 0;
+
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    if (dom)
+        virDomainFree(dom);
+    return rv;
+}
+
+static int
+remoteDispatchDomainGetJobInfo(
+    struct qemud_server *server ATTRIBUTE_UNUSED,
+    struct qemud_client *client ATTRIBUTE_UNUSED,
+    virConnectPtr conn,
+    remote_message_header *hdr ATTRIBUTE_UNUSED,
+    remote_error *rerr,
+    remote_domain_get_job_info_args *args,
+    remote_domain_get_job_info_ret *ret)
+{
+    int rv = -1;
+    virDomainPtr dom = NULL;
+    virDomainJobInfo tmp;
+
+    if (!conn) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+        goto cleanup;
+    }
+
+    if (!(dom = get_nonnull_domain(conn, args->dom)))
+        goto cleanup;
+
+    if (virDomainGetJobInfo(dom, &tmp) < 0)
+        goto cleanup;
+
+    ret->type = tmp.type;
+    ret->timeElapsed = tmp.timeElapsed;
+    ret->timeRemaining = tmp.timeRemaining;
+    ret->dataTotal = tmp.dataTotal;
+    ret->dataProcessed = tmp.dataProcessed;
+    ret->dataRemaining = tmp.dataRemaining;
+    ret->memTotal = tmp.memTotal;
+    ret->memProcessed = tmp.memProcessed;
+    ret->memRemaining = tmp.memRemaining;
+    ret->fileTotal = tmp.fileTotal;
+    ret->fileProcessed = tmp.fileProcessed;
+    ret->fileRemaining = tmp.fileRemaining;
+    rv = 0;
+
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    if (dom)
+        virDomainFree(dom);
+    return rv;
+}
 
 static int
 remoteDispatchDomainGetMaxMemory(
@@ -730,7 +887,48 @@ cleanup:
     return rv;
 }
 
-/* remoteDispatchDomainInterfaceStats has to be implemented manually */
+static int
+remoteDispatchDomainInterfaceStats(
+    struct qemud_server *server ATTRIBUTE_UNUSED,
+    struct qemud_client *client ATTRIBUTE_UNUSED,
+    virConnectPtr conn,
+    remote_message_header *hdr ATTRIBUTE_UNUSED,
+    remote_error *rerr,
+    remote_domain_interface_stats_args *args,
+    remote_domain_interface_stats_ret *ret)
+{
+    int rv = -1;
+    virDomainPtr dom = NULL;
+    virDomainInterfaceStatsStruct tmp;
+
+    if (!conn) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+        goto cleanup;
+    }
+
+    if (!(dom = get_nonnull_domain(conn, args->dom)))
+        goto cleanup;
+
+    if (virDomainInterfaceStats(dom, args->path, &tmp, sizeof tmp) < 0)
+        goto cleanup;
+
+    ret->rx_bytes = tmp.rx_bytes;
+    ret->rx_packets = tmp.rx_packets;
+    ret->rx_errs = tmp.rx_errs;
+    ret->rx_drop = tmp.rx_drop;
+    ret->tx_bytes = tmp.tx_bytes;
+    ret->tx_packets = tmp.tx_packets;
+    ret->tx_errs = tmp.tx_errs;
+    ret->tx_drop = tmp.tx_drop;
+    rv = 0;
+
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    if (dom)
+        virDomainFree(dom);
+    return rv;
+}
 
 static int
 remoteDispatchDomainIsActive(
@@ -3875,7 +4073,42 @@ cleanup:
     return rv;
 }
 
-/* remoteDispatchNodeGetInfo has to be implemented manually */
+static int
+remoteDispatchNodeGetInfo(
+    struct qemud_server *server ATTRIBUTE_UNUSED,
+    struct qemud_client *client ATTRIBUTE_UNUSED,
+    virConnectPtr conn,
+    remote_message_header *hdr ATTRIBUTE_UNUSED,
+    remote_error *rerr,
+    void *args ATTRIBUTE_UNUSED,
+    remote_node_get_info_ret *ret)
+{
+    int rv = -1;
+    virNodeInfo tmp;
+
+    if (!conn) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+        goto cleanup;
+    }
+
+    if (virNodeGetInfo(conn, &tmp) < 0)
+        goto cleanup;
+
+    memcpy(ret->model, tmp.model, sizeof ret->model);
+    ret->memory = tmp.memory;
+    ret->cpus = tmp.cpus;
+    ret->mhz = tmp.mhz;
+    ret->nodes = tmp.nodes;
+    ret->sockets = tmp.sockets;
+    ret->cores = tmp.cores;
+    ret->threads = tmp.threads;
+    rv = 0;
+
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    return rv;
+}
 
 /* remoteDispatchNodeGetSecurityModel has to be implemented manually */
 
@@ -4901,7 +5134,44 @@ cleanup:
     return rv;
 }
 
-/* remoteDispatchStoragePoolGetInfo has to be implemented manually */
+static int
+remoteDispatchStoragePoolGetInfo(
+    struct qemud_server *server ATTRIBUTE_UNUSED,
+    struct qemud_client *client ATTRIBUTE_UNUSED,
+    virConnectPtr conn,
+    remote_message_header *hdr ATTRIBUTE_UNUSED,
+    remote_error *rerr,
+    remote_storage_pool_get_info_args *args,
+    remote_storage_pool_get_info_ret *ret)
+{
+    int rv = -1;
+    virStoragePoolPtr pool = NULL;
+    virStoragePoolInfo tmp;
+
+    if (!conn) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+        goto cleanup;
+    }
+
+    if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
+        goto cleanup;
+
+    if (virStoragePoolGetInfo(pool, &tmp) < 0)
+        goto cleanup;
+
+    ret->state = tmp.state;
+    ret->capacity = tmp.capacity;
+    ret->allocation = tmp.allocation;
+    ret->available = tmp.available;
+    rv = 0;
+
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    if (pool)
+        virStoragePoolFree(pool);
+    return rv;
+}
 
 static int
 remoteDispatchStoragePoolIsActive(
@@ -5419,7 +5689,43 @@ cleanup:
     return rv;
 }
 
-/* remoteDispatchStorageVolGetInfo has to be implemented manually */
+static int
+remoteDispatchStorageVolGetInfo(
+    struct qemud_server *server ATTRIBUTE_UNUSED,
+    struct qemud_client *client ATTRIBUTE_UNUSED,
+    virConnectPtr conn,
+    remote_message_header *hdr ATTRIBUTE_UNUSED,
+    remote_error *rerr,
+    remote_storage_vol_get_info_args *args,
+    remote_storage_vol_get_info_ret *ret)
+{
+    int rv = -1;
+    virStorageVolPtr vol = NULL;
+    virStorageVolInfo tmp;
+
+    if (!conn) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+        goto cleanup;
+    }
+
+    if (!(vol = get_nonnull_storage_vol(conn, args->vol)))
+        goto cleanup;
+
+    if (virStorageVolGetInfo(vol, &tmp) < 0)
+        goto cleanup;
+
+    ret->type = tmp.type;
+    ret->capacity = tmp.capacity;
+    ret->allocation = tmp.allocation;
+    rv = 0;
+
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    if (vol)
+        virStorageVolFree(vol);
+    return rv;
+}
 
 static int
 remoteDispatchStorageVolGetPath(
diff --git a/daemon/remote_generator.pl b/daemon/remote_generator.pl
index 1fd4627..1aaeaae 100755
--- a/daemon/remote_generator.pl
+++ b/daemon/remote_generator.pl
@@ -259,31 +259,23 @@ elsif ($opt_b) {
                           "AuthPolkit",
 
                           "DomainBlockPeek",
-                          "DomainBlockStats",
                           "DomainCreateWithFlags",
                           "DomainEventsDeregister",
                           "DomainEventsRegister",
                           "DomainGetBlkioParameters",
-                          "DomainGetBlockInfo",
-                          "DomainGetInfo",
-                          "DomainGetJobInfo",
                           "DomainGetMemoryParameters",
                           "DomainGetSchedulerParameters",
                           "DomainGetSchedulerType",
                           "DomainGetSecurityLabel",
                           "DomainGetVcpus",
-                          "DomainInterfaceStats",
                           "DomainMemoryPeek",
                           "DomainMemoryStats",
                           "DomainMigratePrepare",
                           "DomainMigratePrepare2",
                           "GetType",
                           "NodeDeviceGetParent",
-                          "NodeGetInfo",
                           "NodeGetSecurityModel",
-                          "SecretGetValue",
-                          "StoragePoolGetInfo",
-                          "StorageVolGetInfo");
+                          "SecretGetValue");
     } elsif ($structprefix eq "qemu") {
         @ungeneratable = ("MonitorCommand");
     }
@@ -408,6 +400,10 @@ elsif ($opt_b) {
                     } else {
                         push(@args_list, "args->$2");
                     }
+                } elsif ($args_member =~ m/^\/*/) {
+                    # ignore comments
+                } else {
+                    die "unhandled type for argument value: $args_member";
                 }
             }
         }
@@ -419,10 +415,27 @@ elsif ($opt_b) {
         my $single_ret_list_name = "undefined";
         my $single_ret_list_max_var = "undefined";
         my $single_ret_list_max_define = "undefined";
+        my $multi_ret = 0;
+
+        if ($calls{$_}->{ret} ne "void" and
+            scalar(@{$calls{$_}->{ret_members}}) > 1) {
+            $multi_ret = 1;
+        }
 
         if ($calls{$_}->{ret} ne "void") {
             foreach my $ret_member (@{$calls{$_}->{ret_members}}) {
-                if ($ret_member =~ m/remote_nonnull_string (\S+)<(\S+)>;/) {
+                if ($multi_ret) {
+                    if ($ret_member =~ m/(char|short|int|hyper) (\S+)\[\S+\];/) {
+                        push(@ret_list, "memcpy(ret->$2, tmp.$2, sizeof ret->$2);");
+                    } elsif ($ret_member =~ m/char (\S+);/ or
+                        $ret_member =~ m/short (\S+);/ or
+                        $ret_member =~ m/int (\S+);/ or
+                        $ret_member =~ m/hyper (\S+);/) {
+                        push(@ret_list, "ret->$1 = tmp.$1;");
+                    } else {
+                        die "unhandled type for multi-return-value: $ret_member";
+                    }
+                } elsif ($ret_member =~ m/remote_nonnull_string (\S+)<(\S+)>;/) {
                     push(@vars_list, "int len");
                     push(@ret_list, "ret->$1.$1_len = len;");
                     push(@free_list_on_error, "VIR_FREE(ret->$1.$1_val);");
@@ -530,10 +543,39 @@ elsif ($opt_b) {
                     } else {
                         $single_ret_by_ref = 1;
                     }
+                } else {
+                    die "unhandled type for return value: $ret_member";
                 }
             }
         }
 
+        if ($multi_ret) {
+            if (! @args_list) {
+                push(@args_list, "conn");
+            }
+
+            my $struct_name = $calls{$_}->{ProcName};
+            $struct_name =~ s/Get//;
+
+            if ($calls{$_}->{ProcName} eq "DomainGetBlockInfo") {
+                my $flags = pop(@args_list);
+                push(@args_list, "&tmp");
+                push(@args_list, $flags);
+            } elsif ($calls{$_}->{ProcName} eq "DomainBlockStats") {
+                $struct_name .= "Struct";
+                push(@args_list, "&tmp");
+                push(@args_list, "sizeof tmp");
+            } elsif ($calls{$_}->{ProcName} eq "DomainInterfaceStats") {
+                $struct_name .= "Struct";
+                push(@args_list, "&tmp");
+                push(@args_list, "sizeof tmp");
+            } else {
+                push(@args_list, "&tmp");
+            }
+
+            push(@vars_list, "vir$struct_name tmp");
+        }
+
         foreach my $var (@vars_list) {
             print "    $var;\n";
         }
@@ -574,7 +616,7 @@ elsif ($opt_b) {
             print ") < 0)\n";
             print "        goto cleanup;\n";
             print "\n";
-        } elsif (scalar(@{$calls{$_}->{ret_members}}) == 1) {
+        } elsif (!$multi_ret) {
             my $prefix = "";
             my $proc_name = $calls{$_}->{ProcName};
 
@@ -630,7 +672,21 @@ elsif ($opt_b) {
                 print "    ";
             }
 
-            print join("    \n", @ret_list);
+            print join("\n    ", @ret_list);
+            print "\n";
+        } else {
+            print "    if (vir$calls{$_}->{ProcName}(";
+            print join(', ', @args_list);
+            print ") < 0)\n";
+
+            print "        goto cleanup;\n";
+            print "\n";
+
+            if (@ret_list) {
+                print "    ";
+            }
+
+            print join("\n    ", @ret_list);
             print "\n";
         }
 
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 935f321..934fdda 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -2848,10 +2848,10 @@ remoteDomainGetInfo (virDomainPtr domain, virDomainInfoPtr info)
         goto done;
 
     info->state = ret.state;
-    info->maxMem = ret.max_mem;
+    info->maxMem = ret.maxMem;
     info->memory = ret.memory;
-    info->nrVirtCpu = ret.nr_virt_cpu;
-    info->cpuTime = ret.cpu_time;
+    info->nrVirtCpu = ret.nrVirtCpu;
+    info->cpuTime = ret.cpuTime;
 
     rv = 0;
 
diff --git a/src/remote/remote_protocol.c b/src/remote/remote_protocol.c
index 1bdd79e..301ffbf 100644
--- a/src/remote/remote_protocol.c
+++ b/src/remote/remote_protocol.c
@@ -1185,13 +1185,13 @@ xdr_remote_domain_get_info_ret (XDR *xdrs, remote_domain_get_info_ret *objp)
 
          if (!xdr_u_char (xdrs, &objp->state))
                  return FALSE;
-         if (!xdr_uint64_t (xdrs, &objp->max_mem))
+         if (!xdr_uint64_t (xdrs, &objp->maxMem))
                  return FALSE;
          if (!xdr_uint64_t (xdrs, &objp->memory))
                  return FALSE;
-         if (!xdr_u_short (xdrs, &objp->nr_virt_cpu))
+         if (!xdr_u_short (xdrs, &objp->nrVirtCpu))
                  return FALSE;
-         if (!xdr_uint64_t (xdrs, &objp->cpu_time))
+         if (!xdr_uint64_t (xdrs, &objp->cpuTime))
                  return FALSE;
         return TRUE;
 }
diff --git a/src/remote/remote_protocol.h b/src/remote/remote_protocol.h
index ff6903c..8942646 100644
--- a/src/remote/remote_protocol.h
+++ b/src/remote/remote_protocol.h
@@ -641,10 +641,10 @@ typedef struct remote_domain_get_info_args remote_domain_get_info_args;
 
 struct remote_domain_get_info_ret {
         u_char state;
-        uint64_t max_mem;
+        uint64_t maxMem;
         uint64_t memory;
-        u_short nr_virt_cpu;
-        uint64_t cpu_time;
+        u_short nrVirtCpu;
+        uint64_t cpuTime;
 };
 typedef struct remote_domain_get_info_ret remote_domain_get_info_ret;
 
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
index 0858096..c706c36 100644
--- a/src/remote/remote_protocol.x
+++ b/src/remote/remote_protocol.x
@@ -693,10 +693,10 @@ struct remote_domain_get_info_args {
 
 struct remote_domain_get_info_ret {
     unsigned char state;
-    unsigned hyper max_mem;
+    unsigned hyper maxMem;
     unsigned hyper memory;
-    unsigned short nr_virt_cpu;
-    unsigned hyper cpu_time;
+    unsigned short nrVirtCpu;
+    unsigned hyper cpuTime;
 };
 
 struct remote_domain_save_args {
diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs
index d433f6b..f904c4d 100644
--- a/src/remote_protocol-structs
+++ b/src/remote_protocol-structs
@@ -386,10 +386,10 @@ struct remote_domain_get_info_args {
 };
 struct remote_domain_get_info_ret {
         u_char                     state;
-        uint64_t                   max_mem;
+        uint64_t                   maxMem;
         uint64_t                   memory;
-        u_short                    nr_virt_cpu;
-        uint64_t                   cpu_time;
+        u_short                    nrVirtCpu;
+        uint64_t                   cpuTime;
 };
 struct remote_domain_save_args {
         remote_nonnull_domain      dom;
-- 
1.7.0.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]