On 03.07.2013 15:51, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange(a)redhat.com>
Add gvir_config_domain_device_get_alias to read the
<alias name="foo"/> XML in each device.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
libvirt-gconfig/libvirt-gconfig-domain-device.c | 9 +++++++++
libvirt-gconfig/libvirt-gconfig-domain-device.h | 2 ++
libvirt-gconfig/libvirt-gconfig.sym | 2 ++
3 files changed, 13 insertions(+)
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-device.c
b/libvirt-gconfig/libvirt-gconfig-domain-device.c
index 81e8765..7c97a0f 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-device.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-device.c
@@ -109,3 +109,12 @@ unimplemented:
g_debug("Parsing of '%s' device nodes is unimplemented",
tree->name);
return NULL;
}
+
+
+const gchar *gvir_config_domain_device_get_alias(GVirConfigDomainDevice *dev)
+{
+ g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_DEVICE(dev), NULL);
+
+ return gvir_config_object_get_attribute(GVIR_CONFIG_OBJECT(dev),
+ "alias", "name");
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-device.h
b/libvirt-gconfig/libvirt-gconfig-domain-device.h
index de4c3f7..2344ebe 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-device.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain-device.h
@@ -59,6 +59,8 @@ struct _GVirConfigDomainDeviceClass
GType gvir_config_domain_device_get_type(void);
+const gchar *gvir_config_domain_device_get_alias(GVirConfigDomainDevice *dev);
+
G_END_DECLS
#endif /* __LIBVIRT_GCONFIG_DOMAIN_DEVICE_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index 2847570..32f57d9 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -560,6 +560,8 @@ LIBVIRT_GCONFIG_0.1.7 {
gvir_config_domain_chardev_source_pty_get_path;
gvir_config_domain_chardev_get_source;
+
+ gvir_config_domain_device_get_alias;
} LIBVIRT_GCONFIG_0.1.6;
# .... define new API here using predicted next version number ....
ACK
Michal