remote generator, daemon: Handle functions with multiple return values

Once again rename members in the XDR definitions to avoid special case
code in the generator.
This commit is contained in:
Matthias Bolte 2011-04-23 09:36:33 +02:00
parent 38982f18f2
commit 6384104bcc
8 changed files with 397 additions and 369 deletions

View File

@ -493,43 +493,6 @@ cleanup:
return rv;
}
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,
@ -723,93 +686,6 @@ cleanup:
return rv;
}
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,
@ -1013,46 +889,6 @@ cleanup:
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)
{
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,
@ -2656,91 +2492,6 @@ remoteDispatchAuthPolkit(struct qemud_server *server ATTRIBUTE_UNUSED,
#endif /* HAVE_POLKIT1 */
/***************************************************************
* 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
**************************************************************/
@ -3064,53 +2815,6 @@ cleanup:
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)
{
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,
@ -3197,44 +2901,6 @@ cleanup:
return rv;
}
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,

View File

@ -179,7 +179,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(
@ -499,11 +537,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;
/* 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 (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;
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, &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(
@ -731,7 +888,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(
@ -3876,7 +4074,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 */
@ -4902,7 +5135,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(
@ -5420,7 +5690,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(

View File

@ -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");
}
@ -409,6 +401,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";
}
}
}
@ -420,10 +416,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);");
@ -531,10 +544,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";
}
@ -575,7 +617,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};
@ -631,7 +673,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";
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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;

View File

@ -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 {

View File

@ -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;