Hey, Looks good, ACK. It would have been worth adding support for 'fallback' and 'vendor_id' while you were digging in that code, easier than having to come back dive in that code later when that's needed imo. Christophe On Tue, Jul 15, 2014 at 11:42:31PM +0100, Zeeshan Ali (Khattak) wrote: > Add a class to represent 'model' node under domain/cpu. > --- > libvirt-gconfig/Makefile.am | 2 + > libvirt-gconfig/libvirt-gconfig-domain-cpu-model.c | 75 ++++++++++++++++++++++ > libvirt-gconfig/libvirt-gconfig-domain-cpu-model.h | 68 ++++++++++++++++++++ > libvirt-gconfig/libvirt-gconfig.h | 1 + > libvirt-gconfig/libvirt-gconfig.sym | 3 + > 5 files changed, 149 insertions(+) > create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-cpu-model.c > create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-cpu-model.h > > diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am > index 02240d4..a9a6591 100644 > --- a/libvirt-gconfig/Makefile.am > +++ b/libvirt-gconfig/Makefile.am > @@ -38,6 +38,7 @@ GCONFIG_HEADER_FILES = \ > libvirt-gconfig-domain-controller-usb.h \ > libvirt-gconfig-domain-cpu.h \ > libvirt-gconfig-domain-cpu-feature.h \ > + libvirt-gconfig-domain-cpu-model.h \ > libvirt-gconfig-domain-device.h \ > libvirt-gconfig-domain-disk.h \ > libvirt-gconfig-domain-disk-driver.h \ > @@ -127,6 +128,7 @@ GCONFIG_SOURCE_FILES = \ > libvirt-gconfig-domain-controller-usb.c \ > libvirt-gconfig-domain-cpu.c \ > libvirt-gconfig-domain-cpu-feature.c \ > + libvirt-gconfig-domain-cpu-model.c \ > libvirt-gconfig-domain-device.c \ > libvirt-gconfig-domain-disk.c \ > libvirt-gconfig-domain-disk-driver.c \ > 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..03024a6 > --- /dev/null > +++ b/libvirt-gconfig/libvirt-gconfig-domain-cpu-model.c > @@ -0,0 +1,75 @@ > +/* > + * 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@xxxxxxxxxx> > + */ > + > +#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_CAPABILITIES_CPU_MODEL); > + > +static void gvir_config_domain_cpu_model_class_init(GVirConfigDomainCpuModelClass *klass) > +{ > + g_type_class_add_private(klass, sizeof(GVirConfigDomainCpuModelPrivate)); > +} > + > +static void gvir_config_domain_cpu_model_init(GVirConfigDomainCpuModel *model) > +{ > + g_debug("Init GVirConfigDomainCpuModel=%p", model); > + > + model->priv = GVIR_CONFIG_DOMAIN_CPU_MODEL_GET_PRIVATE(model); > +} > + > +GVirConfigDomainCpuModel *gvir_config_domain_cpu_model_new(void) > +{ > + GVirConfigObject *object; > + > + object = gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_CPU_MODEL, > + "model", > + NULL); > + > + return GVIR_CONFIG_DOMAIN_CPU_MODEL(object); > +} > + > +GVirConfigDomainCpuModel * > +gvir_config_domain_cpu_model_new_from_xml(const gchar *xml, GError **error) > +{ > + GVirConfigObject *object; > + > + object = gvir_config_object_new_from_xml(GVIR_CONFIG_TYPE_DOMAIN_CPU_MODEL, > + "model", > + NULL, > + xml, > + error); > + > + return GVIR_CONFIG_DOMAIN_CPU_MODEL(object); > +} > 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..c6cb36f > --- /dev/null > +++ b/libvirt-gconfig/libvirt-gconfig-domain-cpu-model.h > @@ -0,0 +1,68 @@ > +/* > + * 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@xxxxxxxxxx> > + */ > + > +#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__ > + > +#include "libvirt-gconfig-capabilities-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 > +{ > + GVirConfigCapabilitiesCpuModel parent; > + > + GVirConfigDomainCpuModelPrivate *priv; > + > + /* Do not add fields to this struct */ > +}; > + > +struct _GVirConfigDomainCpuModelClass > +{ > + GVirConfigCapabilitiesCpuModelClass parent_class; > + > + 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); > + > +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 7fed91d..afb9b7b 100644 > --- a/libvirt-gconfig/libvirt-gconfig.h > +++ b/libvirt-gconfig/libvirt-gconfig.h > @@ -55,6 +55,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 76b0d03..7b49126 100644 > --- a/libvirt-gconfig/libvirt-gconfig.sym > +++ b/libvirt-gconfig/libvirt-gconfig.sym > @@ -707,6 +707,9 @@ 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; > } LIBVIRT_GCONFIG_0.1.8; > > # .... define new API here using predicted next version number .... > -- > 1.9.3 > > -- > libvir-list mailing list > libvir-list@xxxxxxxxxx > https://www.redhat.com/mailman/listinfo/libvir-list
Attachment:
pgplIUb1Dgr6R.pgp
Description: PGP signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list