[libvirt-gconfig PATCHv2 02/14] Implement gvir_config_domain_controller_[gs]et_index

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

 



---
 .../libvirt-gconfig-domain-controller.c            |   29 ++++++++++++++++++++
 .../libvirt-gconfig-domain-controller.h            |    4 +++
 libvirt-gconfig/libvirt-gconfig.sym                |    2 ++
 3 files changed, 35 insertions(+)

diff --git a/libvirt-gconfig/libvirt-gconfig-domain-controller.c b/libvirt-gconfig/libvirt-gconfig-domain-controller.c
index 3aea5ba..d8d9ffb 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-controller.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-controller.c
@@ -48,3 +48,32 @@ static void gvir_config_domain_controller_init(GVirConfigDomainController *contr
 
     controller->priv = GVIR_CONFIG_DOMAIN_CONTROLLER_GET_PRIVATE(controller);
 }
+
+void gvir_config_domain_controller_set_index(GVirConfigDomainController *controller,
+                                             guint index)
+{
+    g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_CONTROLLER(controller));
+
+    gvir_config_object_set_attribute_with_type(GVIR_CONFIG_OBJECT(controller),
+                                               "index", G_TYPE_UINT,
+                                               index, NULL);
+}
+
+guint gvir_config_domain_controller_get_index(GVirConfigDomainController *controller)
+{
+    const char *index_str;
+    char *end;
+    guint index;
+
+    g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_CONTROLLER(controller), 0);
+
+    index_str = gvir_config_object_get_attribute(GVIR_CONFIG_OBJECT(controller),
+                                                 NULL, "index");
+    if (index_str == 0)
+        return 0;
+
+    index = strtoul(index_str, &end, 0);
+    g_return_val_if_fail(*end == '\0', 0);
+
+    return index;
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-controller.h b/libvirt-gconfig/libvirt-gconfig-domain-controller.h
index 41847c3..7cdabe2 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-controller.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain-controller.h
@@ -58,6 +58,10 @@ struct _GVirConfigDomainControllerClass
 
 GType gvir_config_domain_controller_get_type(void);
 
+void gvir_config_domain_controller_set_index(GVirConfigDomainController *controller,
+                                             guint index);
+guint gvir_config_domain_controller_get_index(GVirConfigDomainController *controller);
+
 G_END_DECLS
 
 #endif /* __LIBVIRT_GCONFIG_DOMAIN_CONTROLLER_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index 7b590ff..a7d2c19 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -70,6 +70,8 @@ LIBVIRT_GCONFIG_0.0.4 {
 	gvir_config_domain_console_target_type_get_type;
 
 	gvir_config_domain_controller_get_type;
+	gvir_config_domain_controller_get_index;
+	gvir_config_domain_controller_set_index;
 
 	gvir_config_domain_device_get_type;
 
-- 
1.7.10

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