[PATCH v2 1/2] Add gvir_config_object_replace_child_with_attribute_enum()

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

 



From: "Zeeshan Ali (Khattak)" <zeeshanak@xxxxxxxxx>

Internal libvirt-gconfig helper to replace enum XML attributes.
---
 libvirt-gconfig/libvirt-gconfig-object-private.h |  5 +++++
 libvirt-gconfig/libvirt-gconfig-object.c         | 14 ++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/libvirt-gconfig/libvirt-gconfig-object-private.h b/libvirt-gconfig/libvirt-gconfig-object-private.h
index 830517c..91355fb 100644
--- a/libvirt-gconfig/libvirt-gconfig-object-private.h
+++ b/libvirt-gconfig/libvirt-gconfig-object-private.h
@@ -74,6 +74,11 @@ void gvir_config_object_replace_child_with_attribute(GVirConfigObject *object,
                                                      const char *child_name,
                                                      const char *attr_name,
                                                      const char *attr_value);
+void gvir_config_object_replace_child_with_attribute_enum(GVirConfigObject *object,
+                                                         const char *child_name,
+                                                         const char *attr_name,
+                                                         GType attr_type,
+                                                         unsigned int attr_value);
 void gvir_config_object_delete_child(GVirConfigObject *object,
                                      const char *child_name,
                                      const char *ns_href);
diff --git a/libvirt-gconfig/libvirt-gconfig-object.c b/libvirt-gconfig/libvirt-gconfig-object.c
index ac0545c..c4e4271 100644
--- a/libvirt-gconfig/libvirt-gconfig-object.c
+++ b/libvirt-gconfig/libvirt-gconfig-object.c
@@ -459,6 +459,20 @@ gvir_config_object_replace_child_with_attribute(GVirConfigObject *object,
     g_object_unref(G_OBJECT(child));
 }
 
+G_GNUC_INTERNAL void
+gvir_config_object_replace_child_with_attribute_enum(GVirConfigObject *object,
+                                                     const char *child_name,
+                                                     const char *attr_name,
+                                                     GType attr_type,
+                                                     unsigned int attr_value)
+{
+    GVirConfigObject *child;
+
+    child = gvir_config_object_replace_child(object, child_name);
+    gvir_config_object_set_attribute_with_type(child, attr_name, attr_type, attr_value, NULL);
+    g_object_unref(G_OBJECT(child));
+}
+
 struct NodeMatch {
     const char *name;
     const char *ns;
-- 
1.8.1.4

_______________________________________________
Libosinfo mailing list
Libosinfo@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libosinfo


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux