Re: [dbus PATCH 10/15] Implement StorageVolLookupByPath method for Connect Interface

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

 



On Tue, Jun 12, 2018 at 11:00:23AM +0200, Katerina Koukiou wrote:
Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx>
---
data/org.libvirt.Connect.xml |  6 ++++++
src/connect.c                | 29 +++++++++++++++++++++++++++++
tests/test_connect.py        |  1 +
3 files changed, 36 insertions(+)

diff --git a/src/connect.c b/src/connect.c
index c526808..157cdb3 100644
--- a/src/connect.c
+++ b/src/connect.c
@@ -1573,6 +1573,34 @@ virtDBusConnectStorageVolLookupByKey(GVariant *inArgs,
    *outArgs = g_variant_new("(o)", path);
}

+static void
+virtDBusConnectStorageVolLookupByPath(GVariant *inArgs,
+                                      GUnixFDList *inFDs G_GNUC_UNUSED,
+                                      const gchar *objectPath G_GNUC_UNUSED,
+                                      gpointer userData,
+                                      GVariant **outArgs,
+                                      GUnixFDList **outFDs G_GNUC_UNUSED,
+                                      GError **error)
+{
+    virtDBusConnect *connect = userData;
+    g_autoptr(virStorageVol) storageVol = NULL;
+    g_autofree gchar *path = NULL;
+
+    g_variant_get(inArgs, "(s)", &path);

I'd suggest using a different variable for the input parameter,
e.g.

const gchar *inPath and "(&s)" here, to save g_variant_get the trouble
of strdup-ing the path and us the trouble of freeing it before reusing
the variable for the storage volume object path.

Reviewed-by: Ján Tomko <jtomko@xxxxxxxxxx>

Jano

+
+    if (!virtDBusConnectOpen(connect, error))
+        return;
+
+    storageVol = virStorageVolLookupByPath(connect->connection, path);
+    if (!storageVol)
+        return virtDBusUtilSetLastVirtError(error);
+

Attachment: signature.asc
Description: Digital signature

--
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]

  Powered by Linux