[libvirt-glib 1/5] gobject: Add gvir_interface_get_mac()

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

 



Add a wrapper for virInterfaceGetMACString().
---
 libvirt-gobject/libvirt-gobject-interface.c | 13 +++++++++++++
 libvirt-gobject/libvirt-gobject-interface.h |  1 +
 libvirt-gobject/libvirt-gobject.sym         |  5 +++++
 3 files changed, 19 insertions(+)

diff --git a/libvirt-gobject/libvirt-gobject-interface.c b/libvirt-gobject/libvirt-gobject-interface.c
index 1fc6656..6b2df59 100644
--- a/libvirt-gobject/libvirt-gobject-interface.c
+++ b/libvirt-gobject/libvirt-gobject-interface.c
@@ -171,6 +171,19 @@ const gchar *gvir_interface_get_name(GVirInterface *iface)
     return name;
 }
 
+const gchar *gvir_interface_get_mac(GVirInterface *iface)
+{
+    const char *mac;
+
+    g_return_val_if_fail(GVIR_IS_INTERFACE(iface), NULL);
+
+    if (!(mac = virInterfaceGetMACString(iface->priv->handle))) {
+        gvir_warning("Failed to get interface mac on %p", iface->priv->handle);
+        return NULL;
+    }
+
+    return mac;
+}
 
 /**
  * gvir_interface_get_config:
diff --git a/libvirt-gobject/libvirt-gobject-interface.h b/libvirt-gobject/libvirt-gobject-interface.h
index f437bc7..a8776e5 100644
--- a/libvirt-gobject/libvirt-gobject-interface.h
+++ b/libvirt-gobject/libvirt-gobject-interface.h
@@ -63,6 +63,7 @@ GType gvir_interface_get_type(void);
 GType gvir_interface_handle_get_type(void);
 
 const gchar *gvir_interface_get_name(GVirInterface *iface);
+const gchar *gvir_interface_get_mac(GVirInterface *iface);
 
 GVirConfigInterface *gvir_interface_get_config(GVirInterface *iface,
                                                guint flags,
diff --git a/libvirt-gobject/libvirt-gobject.sym b/libvirt-gobject/libvirt-gobject.sym
index dcda675..29c4349 100644
--- a/libvirt-gobject/libvirt-gobject.sym
+++ b/libvirt-gobject/libvirt-gobject.sym
@@ -271,4 +271,9 @@ LIBVIRT_GOBJECT_0.2.1 {
 	gvir_storage_pool_set_autostart;
 } LIBVIRT_GOBJECT_0.2.0;
 
+LIBVIRT_GOBJECT_0.2.2 {
+  global:
+	gvir_interface_get_mac;
+} LIBVIRT_GOBJECT_0.2.1;
+
 # .... define new API here using predicted next version number ....
-- 
2.4.2

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