On Mon, 2014-06-16 at 11:18 +0200, Christophe Fergeau wrote:
Hey,
Looks good to me, one addition below:
On Thu, Jun 05, 2014 at 08:42:24AM +0200, Cédric Bosdonnat wrote:
> diff --git a/libvirt-gconfig/libvirt-gconfig-capabilities-host.c
b/libvirt-gconfig/libvirt-gconfig-capabilities-host.c
> index 6a15206..46d2bc1 100644
> --- a/libvirt-gconfig/libvirt-gconfig-capabilities-host.c
> +++ b/libvirt-gconfig/libvirt-gconfig-capabilities-host.c
> @@ -77,3 +77,54 @@ gvir_config_capabilities_host_get_cpu(GVirConfigCapabilitiesHost
*host)
>
> return GVIR_CONFIG_CAPABILITIES_CPU(object);
> }
> +
> +struct GetSecModelData {
> + GVirConfigXmlDoc *doc;
> + const gchar *schema;
> + GList *secmodels;
> + GType type;
> +};
> +
> +static gboolean add_secmodel(xmlNodePtr node, gpointer opaque)
> +{
> + struct GetSecModelData* data = (struct GetSecModelData*)opaque;
> + GVirConfigObject *secmodel;
> +
> + if (g_strcmp0((const gchar *)node->name, "secmodel") != 0)
> + return TRUE;
> +
> + secmodel = gvir_config_object_new_from_tree
> + (data->type,
> + data->doc,
> + data->schema,
> + node);
> + if (secmodel != NULL)
> + data->secmodels = g_list_append(data->secmodels, secmodel);
> + else
> + g_debug("Failed to parse %s node", node->name);
> +
> + return TRUE;
> +}
> +
For good introspection, you will need something like this here:
diff --git a/libvirt-gconfig/libvirt-gconfig-capabilities-host.c
b/libvirt-gconfig/libvirt-gconfig-capabilities-host.c
index 07719d0..a5d58e8 100644
--- a/libvirt-gconfig/libvirt-gconfig-capabilities-host.c
+++ b/libvirt-gconfig/libvirt-gconfig-capabilities-host.c
@@ -106,6 +106,15 @@ static gboolean add_secmodel(xmlNodePtr node, gpointer opaque)
return TRUE;
}
+/**
+ * gvir_config_capabilities_host_get_secmodels:
+ * @host: a #GVirConfigCapabilitiesHost
+ *
+ * Get the security models listed in @host capabilities.
+ *
+ * Returns: (element-type LibvirtGConfig.CapabilitiesHostSecModel) (transfer full):
+ * a newly allocated #GList of #GVirConfigCapabilitiesHostSecModel.
+ */
GList *
gvir_config_capabilities_host_get_secmodels(GVirConfigCapabilitiesHost *host)
{
ACK with this (or a variant of this if you want to improve the
documentation text) squashed in.
The comment looks good to me... and I don't have commit rights, so feel
free to push for me if not already done ;)
--
Cedric