[dbus PATCH v2 3/5] Implement virtDBusUtilVirNetworkFromBusPath helper function.

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

 



Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx>
---
 src/util.c | 13 +++++++++++++
 src/util.h |  5 +++++
 2 files changed, 18 insertions(+)

diff --git a/src/util.c b/src/util.c
index fe40a96..03a0f10 100644
--- a/src/util.c
+++ b/src/util.c
@@ -152,6 +152,19 @@ virtDBusUtilEnumFromString(const gchar *const *types,
     return -1;
 }
 
+virNetworkPtr
+virtDBusUtilVirNetworkFromBusPath(virConnectPtr connection,
+                                 const gchar *path,
+                                 const gchar *networkPath)
+{
+    g_autofree gchar *name = NULL;
+    gsize prefixLen = strlen(networkPath) + 1;
+
+    name = virtDBusUtilDecodeUUID(path+prefixLen);
+
+    return virNetworkLookupByUUIDString(connection, name);
+}
+
 gchar *
 virtDBusUtilBusPathForVirNetwork(virNetworkPtr network,
                                  const gchar *networkPath)
diff --git a/src/util.h b/src/util.h
index fac080c..7bb4ad6 100644
--- a/src/util.h
+++ b/src/util.h
@@ -66,6 +66,11 @@ virtDBusUtilEnumToString(const gchar *const *types,
     const gchar *name ##TypeToString(gint type) G_GNUC_PURE; \
     gint name ##TypeFromString(const gchar *type) G_GNUC_PURE;
 
+virNetworkPtr
+virtDBusUtilVirNetworkFromBusPath(virConnectPtr connection,
+                                 const gchar *path,
+                                 const gchar *networkPath);
+
 gchar *
 virtDBusUtilBusPathForVirNetwork(virNetworkPtr network,
                                  const gchar *networkPath);
-- 
2.15.0

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