Re: [libvirt-glib 4/4] Add GVirConfigDomainTimerHpet

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

 



On Fri, Jan 17, 2014 at 2:11 PM, Christophe Fergeau <cfergeau@xxxxxxxxxx> wrote:
> This will be needed in order to solve
> https://bugzilla.gnome.org/show_bug.cgi?id=722293
> ---
>  libvirt-gconfig/Makefile.am                        |  2 +
>  .../libvirt-gconfig-domain-timer-hpet.c            | 75 ++++++++++++++++++++++
>  .../libvirt-gconfig-domain-timer-hpet.h            | 67 +++++++++++++++++++
>  libvirt-gconfig/libvirt-gconfig.h                  |  3 +-
>  libvirt-gconfig/libvirt-gconfig.sym                |  5 ++
>  libvirt-gconfig/tests/test-domain-create.c         |  7 ++
>  6 files changed, 158 insertions(+), 1 deletion(-)
>  create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-timer-hpet.c
>  create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-timer-hpet.h
>
> diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
> index 70b4d81..8fb333e 100644
> --- a/libvirt-gconfig/Makefile.am
> +++ b/libvirt-gconfig/Makefile.am
> @@ -68,6 +68,7 @@ GCONFIG_HEADER_FILES = \
>                         libvirt-gconfig-domain-snapshot-disk.h \
>                         libvirt-gconfig-domain-sound.h \
>                         libvirt-gconfig-domain-timer.h \
> +                       libvirt-gconfig-domain-timer-hpet.h \
>                         libvirt-gconfig-domain-timer-pit.h \
>                         libvirt-gconfig-domain-timer-rtc.h \
>                         libvirt-gconfig-domain-video.h \
> @@ -154,6 +155,7 @@ GCONFIG_SOURCE_FILES = \
>                         libvirt-gconfig-domain-snapshot-disk.c \
>                         libvirt-gconfig-domain-sound.c \
>                         libvirt-gconfig-domain-timer.c \
> +                       libvirt-gconfig-domain-timer-hpet.c \
>                         libvirt-gconfig-domain-timer-pit.c \
>                         libvirt-gconfig-domain-timer-rtc.c \
>                         libvirt-gconfig-domain-video.c \
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain-timer-hpet.c b/libvirt-gconfig/libvirt-gconfig-domain-timer-hpet.c
> new file mode 100644
> index 0000000..1734428
> --- /dev/null
> +++ b/libvirt-gconfig/libvirt-gconfig-domain-timer-hpet.c
> @@ -0,0 +1,75 @@
> +/*
> + * libvirt-gconfig-domain-timer-hpet.c: libvirt domain HPET timer configuration
> + *
> + * Copyright (C) 2012, 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/>.
> + *
> + * Author: Christophe Fergeau <cfergeau@xxxxxxxxxx>
> + */
> +
> +#include <config.h>
> +
> +#include "libvirt-gconfig/libvirt-gconfig.h"
> +#include "libvirt-gconfig/libvirt-gconfig-private.h"
> +
> +#define GVIR_CONFIG_DOMAIN_TIMER_HPET_GET_PRIVATE(obj)                         \
> +        (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_CONFIG_TYPE_DOMAIN_TIMER_HPET, GVirConfigDomainTimerHpetPrivate))
> +
> +struct _GVirConfigDomainTimerHpetPrivate
> +{
> +    gboolean unused;
> +};
> +
> +G_DEFINE_TYPE(GVirConfigDomainTimerHpet, gvir_config_domain_timer_hpet, GVIR_CONFIG_TYPE_DOMAIN_TIMER);
> +
> +
> +static void gvir_config_domain_timer_hpet_class_init(GVirConfigDomainTimerHpetClass *klass)
> +{
> +    g_type_class_add_private(klass, sizeof(GVirConfigDomainTimerHpetPrivate));
> +}
> +
> +
> +static void gvir_config_domain_timer_hpet_init(GVirConfigDomainTimerHpet *timer)
> +{
> +    g_debug("Init GVirConfigDomainTimerHpet=%p", timer);
> +
> +    timer->priv = GVIR_CONFIG_DOMAIN_TIMER_HPET_GET_PRIVATE(timer);
> +}
> +
> +
> +GVirConfigDomainTimerHpet *gvir_config_domain_timer_hpet_new(void)
> +{
> +    GVirConfigObject *object;
> +
> +    object = gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_TIMER_HPET,
> +                                    "timer", NULL);
> +    gvir_config_object_set_attribute(object, "name", "hpet", NULL);
> +    return GVIR_CONFIG_DOMAIN_TIMER_HPET(object);
> +}
> +
> +GVirConfigDomainTimerHpet *gvir_config_domain_timer_hpet_new_from_xml(const gchar *xml,
> +                                                GError **error)
> +{
> +    GVirConfigObject *object;
> +
> +    object = gvir_config_object_new_from_xml(GVIR_CONFIG_TYPE_DOMAIN_TIMER_HPET,
> +                                             "timer", NULL, xml, error);
> +    if (g_strcmp0(gvir_config_object_get_attribute(object, NULL, "type"), "hpet") != 0) {
> +        g_object_unref(G_OBJECT(object));
> +        g_return_val_if_reached(NULL);
> +    }
> +    return GVIR_CONFIG_DOMAIN_TIMER_HPET(object);
> +}
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain-timer-hpet.h b/libvirt-gconfig/libvirt-gconfig-domain-timer-hpet.h
> new file mode 100644
> index 0000000..8721f37
> --- /dev/null
> +++ b/libvirt-gconfig/libvirt-gconfig-domain-timer-hpet.h
> @@ -0,0 +1,67 @@
> +/*
> + * libvirt-gconfig-domain-timer-hpet.h: libvirt domain HPET timer configuration
> + *
> + * Copyright (C) 2012, 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/>.
> + *
> + * Author: Christophe Fergeau <cfergeau@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_TIMER_HPET_H__
> +#define __LIBVIRT_GCONFIG_DOMAIN_TIMER_HPET_H__
> +
> +G_BEGIN_DECLS
> +
> +#define GVIR_CONFIG_TYPE_DOMAIN_TIMER_HPET            (gvir_config_domain_timer_hpet_get_type ())
> +#define GVIR_CONFIG_DOMAIN_TIMER_HPET(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_CONFIG_TYPE_DOMAIN_TIMER_HPET, GVirConfigDomainTimerHpet))
> +#define GVIR_CONFIG_DOMAIN_TIMER_HPET_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_CONFIG_TYPE_DOMAIN_TIMER_HPET, GVirConfigDomainTimerHpetClass))
> +#define GVIR_CONFIG_IS_DOMAIN_TIMER_HPET(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_CONFIG_TYPE_DOMAIN_TIMER_HPET))
> +#define GVIR_CONFIG_IS_DOMAIN_TIMER_HPET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_CONFIG_TYPE_DOMAIN_TIMER_HPET))
> +#define GVIR_CONFIG_DOMAIN_TIMER_HPET_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_CONFIG_TYPE_DOMAIN_TIMER_HPET, GVirConfigDomainTimerHpetClass))
> +
> +typedef struct _GVirConfigDomainTimerHpet GVirConfigDomainTimerHpet;
> +typedef struct _GVirConfigDomainTimerHpetPrivate GVirConfigDomainTimerHpetPrivate;
> +typedef struct _GVirConfigDomainTimerHpetClass GVirConfigDomainTimerHpetClass;
> +
> +struct _GVirConfigDomainTimerHpet
> +{
> +    GVirConfigObject parent;

Shouldn't this be GVirConfigDomainTimer?


-- 
Regards,

Zeeshan Ali (Khattak)
FSF member#5124

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




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