[PATCH 1/5] remote generator, client: Handle functions that return an optional string

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

 



---
 daemon/remote_generator.pl   |    5 +++++
 src/remote/remote_driver.c   |   26 --------------------------
 src/remote/remote_protocol.x |    2 +-
 3 files changed, 6 insertions(+), 27 deletions(-)

diff --git a/daemon/remote_generator.pl b/daemon/remote_generator.pl
index c53ebc8..dd5d482 100755
--- a/daemon/remote_generator.pl
+++ b/daemon/remote_generator.pl
@@ -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;
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 1847577..c2edaa2 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -2967,32 +2967,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)
 {
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
index e115f39..571f273 100644
--- a/src/remote/remote_protocol.x
+++ b/src/remote/remote_protocol.x
@@ -2091,7 +2091,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 */
-- 
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]