remote generator, client: Handle functions that return an optional string

This commit is contained in:
Matthias Bolte 2011-05-14 15:35:27 +02:00
parent 483ed20ae6
commit 0882f7a200
3 changed files with 6 additions and 27 deletions

View File

@ -953,6 +953,11 @@ elsif ($opt_k) {
push(@ret_list, "rv = ret.$1;");
$single_ret_var = "char *rv = NULL";
$single_ret_type = "char *";
} elsif ($ret_member =~ m/^remote_string (\S+);/) {
push(@ret_list, "rv = ret.$1 ? *ret.$1 : NULL;");
push(@ret_list, "VIR_FREE(ret.$1);");
$single_ret_var = "char *rv = NULL";
$single_ret_type = "char *";
} elsif ($ret_member =~ m/^remote_nonnull_(domain|network|storage_pool|storage_vol|node_device|interface|secret|nwfilter|domain_snapshot) (\S+);/) {
my $name = $1;
my $arg_name = $2;

View File

@ -3001,32 +3001,6 @@ remoteDevMonClose(virConnectPtr conn)
return remoteGenericClose(conn, &conn->devMonPrivateData);
}
static char *remoteNodeDeviceGetParent(virNodeDevicePtr dev)
{
char *rv = NULL;
remote_node_device_get_parent_args args;
remote_node_device_get_parent_ret ret;
struct private_data *priv = dev->conn->devMonPrivateData;
remoteDriverLock(priv);
args.name = dev->name;
memset (&ret, 0, sizeof ret);
if (call (dev->conn, priv, 0, REMOTE_PROC_NODE_DEVICE_GET_PARENT,
(xdrproc_t) xdr_remote_node_device_get_parent_args, (char *) &args,
(xdrproc_t) xdr_remote_node_device_get_parent_ret, (char *) &ret) == -1)
goto done;
/* Caller frees. */
rv = ret.parent ? *ret.parent : NULL;
VIR_FREE(ret.parent);
done:
remoteDriverUnlock(priv);
return rv;
}
static int
remoteNodeDeviceDettach (virNodeDevicePtr dev)
{

View File

@ -2171,7 +2171,7 @@ enum remote_procedure {
REMOTE_PROC_NODE_LIST_DEVICES = 112, /* autogen autogen */
REMOTE_PROC_NODE_DEVICE_LOOKUP_BY_NAME = 113, /* autogen autogen */
REMOTE_PROC_NODE_DEVICE_GET_XML_DESC = 114, /* autogen autogen */
REMOTE_PROC_NODE_DEVICE_GET_PARENT = 115, /* skipgen skipgen */
REMOTE_PROC_NODE_DEVICE_GET_PARENT = 115, /* skipgen autogen */
REMOTE_PROC_NODE_DEVICE_NUM_OF_CAPS = 116, /* autogen autogen */
REMOTE_PROC_NODE_DEVICE_LIST_CAPS = 117, /* autogen autogen */
REMOTE_PROC_NODE_DEVICE_DETTACH = 118, /* autogen skipgen */