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

[libvirt] [libvirt-glib 2/5] Implement gvir_config_domain_timer_[gs]et_tick_policy



---
 libvirt-gconfig/libvirt-gconfig-domain-timer.c |   26 ++++++++++++++++++++++++
 libvirt-gconfig/libvirt-gconfig-domain-timer.h |    9 ++++++++
 libvirt-gconfig/libvirt-gconfig.sym            |    3 +++
 3 files changed, 38 insertions(+)

diff --git a/libvirt-gconfig/libvirt-gconfig-domain-timer.c b/libvirt-gconfig/libvirt-gconfig-domain-timer.c
index 67a1812..07cbf47 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-timer.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-timer.c
@@ -23,6 +23,7 @@
 #include <config.h>
 
 #include "libvirt-gconfig/libvirt-gconfig.h"
+#include "libvirt-gconfig/libvirt-gconfig-private.h"
 
 #define GVIR_CONFIG_DOMAIN_TIMER_GET_PRIVATE(obj)                         \
         (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_CONFIG_TYPE_DOMAIN_TIMER, GVirConfigDomainTimerPrivate))
@@ -47,3 +48,28 @@ static void gvir_config_domain_timer_init(GVirConfigDomainTimer *timer)
 
     timer->priv = GVIR_CONFIG_DOMAIN_TIMER_GET_PRIVATE(timer);
 }
+
+void gvir_config_domain_timer_set_tick_policy(GVirConfigDomainTimer *timer,
+                                              GVirConfigDomainTimerTickPolicy policy)
+{
+    g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_TIMER(timer));
+
+    gvir_config_object_set_attribute_with_type(GVIR_CONFIG_OBJECT(timer),
+                                               "tickpolicy",
+                                               GVIR_CONFIG_TYPE_DOMAIN_TIMER_TICK_POLICY,
+                                               policy,
+                                               NULL);
+}
+
+GVirConfigDomainTimerTickPolicy
+gvir_config_domain_timer_get_tick_policy(GVirConfigDomainTimer *timer)
+{
+    g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_TIMER(timer),
+                         GVIR_CONFIG_DOMAIN_TIMER_TICK_POLICY_DELAY);
+
+    return gvir_config_object_get_attribute_genum(GVIR_CONFIG_OBJECT(timer),
+                                                  NULL,
+                                                  "tickpolicy",
+                                                  GVIR_CONFIG_TYPE_DOMAIN_TIMER_TICK_POLICY,
+                                                  GVIR_CONFIG_DOMAIN_TIMER_TICK_POLICY_DELAY);
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-timer.h b/libvirt-gconfig/libvirt-gconfig-domain-timer.h
index a7b4332..84ea7e1 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-timer.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain-timer.h
@@ -56,9 +56,18 @@ struct _GVirConfigDomainTimerClass
     gpointer padding[20];
 };
 
+typedef enum {
+    GVIR_CONFIG_DOMAIN_TIMER_TICK_POLICY_DELAY,
+    GVIR_CONFIG_DOMAIN_TIMER_TICK_POLICY_CATCHUP,
+    GVIR_CONFIG_DOMAIN_TIMER_TICK_POLICY_MERGE,
+    GVIR_CONFIG_DOMAIN_TIMER_TICK_POLICY_DISCARD
+} GVirConfigDomainTimerTickPolicy;
 
 GType gvir_config_domain_timer_get_type(void);
 
+GVirConfigDomainTimerTickPolicy gvir_config_domain_timer_get_tick_policy(GVirConfigDomainTimer *timer);
+void gvir_config_domain_timer_set_tick_policy(GVirConfigDomainTimer *timer, GVirConfigDomainTimerTickPolicy policy);
+
 G_END_DECLS
 
 #endif /* __LIBVIRT_GCONFIG_DOMAIN_TIMER_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index 77d0a45..386597b 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -227,6 +227,9 @@ LIBVIRT_GCONFIG_0.0.7 {
 	gvir_config_domain_sound_set_model;
 
 	gvir_config_domain_timer_get_type;
+	gvir_config_domain_timer_tick_policy_get_type;
+	gvir_config_domain_timer_get_tick_policy;
+	gvir_config_domain_timer_set_tick_policy;
 
 	gvir_config_domain_video_get_type;
 	gvir_config_domain_video_model_get_type;
-- 
1.7.10


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