From: "Zeeshan Ali (Khattak)" <zeeshanak(a)gnome.org>
Another internal libvirt-gconfig helper to get unint64 XML attributes.
---
libvirt-gconfig/libvirt-gconfig-object-private.h | 4 ++++
libvirt-gconfig/libvirt-gconfig-object.c | 15 +++++++++++++++
2 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/libvirt-gconfig/libvirt-gconfig-object-private.h
b/libvirt-gconfig/libvirt-gconfig-object-private.h
index b3798c0..830517c 100644
--- a/libvirt-gconfig/libvirt-gconfig-object-private.h
+++ b/libvirt-gconfig/libvirt-gconfig-object-private.h
@@ -42,6 +42,10 @@ gint gvir_config_object_get_node_content_genum(GVirConfigObject
*object,
const char *gvir_config_object_get_attribute(GVirConfigObject *object,
const char *node_name,
const char *attr_name);
+guint64 gvir_config_object_get_attribute_uint64(GVirConfigObject *object,
+ const char *node_name,
+ const char *attr_name,
+ guint64 default_value);
gint gvir_config_object_get_attribute_genum(GVirConfigObject *object,
const char *node_name,
const char *attr_name,
diff --git a/libvirt-gconfig/libvirt-gconfig-object.c
b/libvirt-gconfig/libvirt-gconfig-object.c
index 1474393..a7352a5 100644
--- a/libvirt-gconfig/libvirt-gconfig-object.c
+++ b/libvirt-gconfig/libvirt-gconfig-object.c
@@ -644,6 +644,21 @@ gvir_config_object_get_attribute_genum(GVirConfigObject *object,
return value;
}
+G_GNUC_INTERNAL guint64
+gvir_config_object_get_attribute_uint64(GVirConfigObject *object,
+ const char *node_name,
+ const char *attr_name,
+ guint64 default_value)
+{
+ const char *str;
+
+ str = gvir_config_object_get_attribute(object, node_name, attr_name);
+ if (str == NULL)
+ return default_value;
+
+ return g_ascii_strtoull(str, NULL, 0);
+}
+
GVirConfigObject *gvir_config_object_new_from_xml(GType type,
const char *root_name,
const char *schema,
--
1.7.7.6
--
libvir-list mailing list
libvir-list(a)redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list