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

[libvirt] [libvirt-glib 11/37] Implement gvir_config_os_set_os_type



---
 libvirt-gconfig/libvirt-gconfig-os.c |   14 ++++++++++++++
 libvirt-gconfig/libvirt-gconfig-os.h |    6 ++++++
 libvirt-gconfig/libvirt-gconfig.sym  |    1 +
 3 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/libvirt-gconfig/libvirt-gconfig-os.c b/libvirt-gconfig/libvirt-gconfig-os.c
index b47e859..d4a04ae 100644
--- a/libvirt-gconfig/libvirt-gconfig-os.c
+++ b/libvirt-gconfig/libvirt-gconfig-os.c
@@ -27,6 +27,7 @@
 #include <libxml/tree.h>
 
 #include "libvirt-gconfig/libvirt-gconfig.h"
+#include "libvirt-gconfig/libvirt-gconfig-helpers-private.h"
 
 extern gboolean debugFlag;
 
@@ -78,3 +79,16 @@ GVirConfigOs *gvir_config_os_new_from_xml(const gchar *xml, GError **error)
                                              NULL, xml, error);
     return GVIR_CONFIG_OS(object);
 }
+
+void gvir_config_os_set_os_type(GVirConfigOs *os, GVirConfigOsType type)
+{
+    xmlNodePtr node;
+    const char *type_str;
+
+    node = gvir_config_object_new_child(GVIR_CONFIG_OBJECT(os), "type");
+    if (node == NULL)
+        return;
+    type_str = gvir_config_genum_get_nick(GVIR_TYPE_CONFIG_OS_TYPE, type);
+    if (type_str != NULL)
+        xmlNodeSetContent(node, (xmlChar*)type_str);
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-os.h b/libvirt-gconfig/libvirt-gconfig-os.h
index 716f588..c6498ad 100644
--- a/libvirt-gconfig/libvirt-gconfig-os.h
+++ b/libvirt-gconfig/libvirt-gconfig-os.h
@@ -56,12 +56,18 @@ struct _GVirConfigOsClass
     gpointer padding[20];
 };
 
+typedef enum {
+    GVIR_CONFIG_OS_TYPE_HVM,
+    GVIR_CONFIG_OS_TYPE_LINUX
+} GVirConfigOsType;
 
 GType gvir_config_os_get_type(void);
 
 GVirConfigOs *gvir_config_os_new(void);
 GVirConfigOs *gvir_config_os_new_from_xml(const gchar *xml, GError **error);
 
+void gvir_config_os_set_os_type(GVirConfigOs *os, GVirConfigOsType type);
+
 G_END_DECLS
 
 #endif /* __LIBVIRT_GCONFIG_OS_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index b1dcb81..176a2e2 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -52,6 +52,7 @@ LIBVIRT_GOBJECT_0.0.1 {
 	gvir_config_object_validate;
 
 	gvir_config_os_get_type;
+	gvir_config_os_type_get_type;
 	gvir_config_os_new;
 	gvir_config_os_new_from_xml;
 
-- 
1.7.7


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