[libvirt] [libvirt-glib 2/3] Add GVirConfigDomainCpuModel class
Christophe Fergeau
cfergeau at redhat.com
Mon Jul 7 11:06:11 UTC 2014
On Fri, Jul 04, 2014 at 02:51:27PM +0100, Zeeshan Ali (Khattak) wrote:
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain-cpu-model.c b/libvirt-gconfig/libvirt-gconfig-domain-cpu-model.c
> new file mode 100644
> index 0000000..514a2e3
> --- /dev/null
> +++ b/libvirt-gconfig/libvirt-gconfig-domain-cpu-model.c
> @@ -0,0 +1,94 @@
> +/*
> + * libvirt-gconfig-domain-cpu-model.c: libvirt domain CPU model
> + *
> + * Copyright (C) 2014 Red Hat, Inc.
> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * This library is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this library. If not, see
> + * <http://www.gnu.org/licenses/>.
> + *
> + * Authors: Zeeshan Ali <zeenix at redhat.com>
> + */
> +
> +#include <config.h>
> +
> +#include "libvirt-gconfig/libvirt-gconfig.h"
> +#include "libvirt-gconfig/libvirt-gconfig-private.h"
> +
> +#define GVIR_CONFIG_DOMAIN_CPU_MODEL_GET_PRIVATE(obj) \
> + (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_CONFIG_TYPE_DOMAIN_CPU_MODEL, GVirConfigDomainCpuModelPrivate))
> +
> +struct _GVirConfigDomainCpuModelPrivate
> +{
> + gboolean unused;
> +};
> +
> +G_DEFINE_TYPE(GVirConfigDomainCpuModel, gvir_config_domain_cpu_model, GVIR_CONFIG_TYPE_OBJECT);
Here this inherits from GVirConfigObject...
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain-cpu-model.h b/libvirt-gconfig/libvirt-gconfig-domain-cpu-model.h
> new file mode 100644
> index 0000000..5ae9d14
> --- /dev/null
> +++ b/libvirt-gconfig/libvirt-gconfig-domain-cpu-model.h
> @@ -0,0 +1,72 @@
> +/*
> + * libvirt-gconfig-domain-cpu-model.h: libvirt domain CPU model
> + *
> + * Copyright (C) 2014 Red Hat, Inc.
> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * This library is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this library. If not, see
> + * <http://www.gnu.org/licenses/>.
> + *
> + * Authors: Zeeshan Ali <zeenix at redhat.com>
> + */
> +
> +#if !defined(__LIBVIRT_GCONFIG_H__) && !defined(LIBVIRT_GCONFIG_BUILD)
> +#error "Only <libvirt-gconfig/libvirt-gconfig.h> can be included directly."
> +#endif
> +
> +#ifndef __LIBVIRT_GCONFIG_DOMAIN_CPU_MODEL_H__
> +#define __LIBVIRT_GCONFIG_DOMAIN_CPU_MODEL_H__
> +
> +G_BEGIN_DECLS
> +
> +#define GVIR_CONFIG_TYPE_DOMAIN_CPU_MODEL (gvir_config_domain_cpu_model_get_type ())
> +#define GVIR_CONFIG_DOMAIN_CPU_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_CONFIG_TYPE_DOMAIN_CPU_MODEL, GVirConfigDomainCpuModel))
> +#define GVIR_CONFIG_DOMAIN_CPU_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_CONFIG_TYPE_DOMAIN_CPU_MODEL, GVirConfigDomainCpuModelClass))
> +#define GVIR_CONFIG_IS_DOMAIN_CPU_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_CONFIG_TYPE_DOMAIN_CPU_MODEL))
> +#define GVIR_CONFIG_IS_DOMAIN_CPU_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_CONFIG_TYPE_DOMAIN_CPU_MODEL))
> +#define GVIR_CONFIG_DOMAIN_CPU_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_CONFIG_TYPE_DOMAIN_CPU_MODEL, GVirConfigDomainCpuModelClass))
> +
> +typedef struct _GVirConfigDomainCpuModel GVirConfigDomainCpuModel;
> +typedef struct _GVirConfigDomainCpuModelPrivate GVirConfigDomainCpuModelPrivate;
> +typedef struct _GVirConfigDomainCpuModelClass GVirConfigDomainCpuModelClass;
> +
> +struct _GVirConfigDomainCpuModel
> +{
> + GVirConfigCapabilitiesCpu parent;
... and here from GVirConfigCapabilitiesCpu.
> +
> + GVirConfigDomainCpuModelPrivate *priv;
> +
> + /* Do not add fields to this struct */
> +};
> +
> +struct _GVirConfigDomainCpuModelClass
> +{
> + GVirConfigCapabilitiesCpuClass parent_class;
(here too)
> +
> + gpointer padding[20];
> +};
> +
> +GType gvir_config_domain_cpu_model_get_type(void);
> +GVirConfigDomainCpuModel *gvir_config_domain_cpu_model_new(void);
> +GVirConfigDomainCpuModel *
> +gvir_config_domain_cpu_model_new_from_xml(const gchar *xml, GError **error);
> +
> +void
> +gvir_config_domain_cpu_model_set_name(GVirConfigDomainCpuModel *model,
> + const gchar *name);
> +const gchar *
> +gvir_config_domain_cpu_model_get_name(GVirConfigDomainCpuModel *model);
> +
> +G_END_DECLS
> +
> +#endif /* __LIBVIRT_GCONFIG_DOMAIN_CPU_MODEL_H__ */
> diff --git a/libvirt-gconfig/libvirt-gconfig.h b/libvirt-gconfig/libvirt-gconfig.h
> index b494154..b845976 100644
> --- a/libvirt-gconfig/libvirt-gconfig.h
> +++ b/libvirt-gconfig/libvirt-gconfig.h
> @@ -54,6 +54,7 @@
> #include <libvirt-gconfig/libvirt-gconfig-domain-controller-usb.h>
> #include <libvirt-gconfig/libvirt-gconfig-domain-cpu.h>
> #include <libvirt-gconfig/libvirt-gconfig-domain-cpu-feature.h>
> +#include <libvirt-gconfig/libvirt-gconfig-domain-cpu-model.h>
> #include <libvirt-gconfig/libvirt-gconfig-domain-device.h>
> #include <libvirt-gconfig/libvirt-gconfig-domain-disk.h>
> #include <libvirt-gconfig/libvirt-gconfig-domain-disk-driver.h>
> diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
> index 86dada6..1ad7e18 100644
> --- a/libvirt-gconfig/libvirt-gconfig.sym
> +++ b/libvirt-gconfig/libvirt-gconfig.sym
> @@ -702,6 +702,11 @@ global:
> gvir_config_domain_chardev_source_spiceport_new;
> gvir_config_domain_chardev_source_spiceport_new_from_xml;
> gvir_config_domain_chardev_source_spiceport_set_channel;
> +
> + gvir_config_domain_cpu_model_get_type;
> + gvir_config_domain_cpu_model_new;
> + gvir_config_domain_cpu_model_get_name;
> + gvir_config_domain_cpu_model_set_name;
I believe this breaks make syntax-check (which is already broken because
of https://www.redhat.com/archives/libvir-list/2014-June/msg00115.html
but this is a different issue).
Rest of the patch looks good.
Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140707/a23d67b7/attachment-0001.sig>
More information about the libvir-list
mailing list