Add an abstract GVirConfigDomainChardev object for <console>, <serial>, ... devices and a GVirConfigDomainConsole implementation. This needs to be completed with a separate GVirConfigDomainChardevSource inheritance tree which will be specialized to GVirConfigDomainChardevSourcePty, ... and GVirConfigDomainChardev will offer a helper function to attach a GVirConfigDomainChardevSource to a GVirConfigDomainChardev --- libvirt-gconfig/Makefile.am | 4 + libvirt-gconfig/libvirt-gconfig-domain-chardev.c | 48 +++++++++++++++ libvirt-gconfig/libvirt-gconfig-domain-chardev.h | 64 ++++++++++++++++++++ libvirt-gconfig/libvirt-gconfig-domain-console.c | 70 ++++++++++++++++++++++ libvirt-gconfig/libvirt-gconfig-domain-console.h | 67 +++++++++++++++++++++ libvirt-gconfig/libvirt-gconfig.h | 2 + libvirt-gconfig/libvirt-gconfig.sym | 6 ++ 7 files changed, 261 insertions(+), 0 deletions(-) create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-chardev.c create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-chardev.h create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-console.c create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-console.h diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am index ddae5fa..4b1cbb3 100644 --- a/libvirt-gconfig/Makefile.am +++ b/libvirt-gconfig/Makefile.am @@ -13,7 +13,9 @@ GCONFIG_HEADER_FILES = \ libvirt-gconfig-object.h \ libvirt-gconfig-capabilities.h \ libvirt-gconfig-domain.h \ + libvirt-gconfig-domain-chardev.h \ libvirt-gconfig-domain-clock.h \ + libvirt-gconfig-domain-console.h \ libvirt-gconfig-domain-device.h \ libvirt-gconfig-domain-disk.h \ libvirt-gconfig-domain-filesys.h \ @@ -46,7 +48,9 @@ GCONFIG_SOURCE_FILES = \ libvirt-gconfig-main.c \ libvirt-gconfig-capabilities.c \ libvirt-gconfig-domain.c \ + libvirt-gconfig-domain-chardev.c \ libvirt-gconfig-domain-clock.c \ + libvirt-gconfig-domain-console.c \ libvirt-gconfig-domain-device.c \ libvirt-gconfig-domain-disk.c \ libvirt-gconfig-domain-filesys.c \ diff --git a/libvirt-gconfig/libvirt-gconfig-domain-chardev.c b/libvirt-gconfig/libvirt-gconfig-domain-chardev.c new file mode 100644 index 0000000..525fc2b --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-domain-chardev.c @@ -0,0 +1,48 @@ +/* + * libvirt-gconfig-domain-chardev.c: libvirt domain chardev configuration + * + * Copyright (C) 2011 Red Hat + * + * 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, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Christophe Fergeau <cfergeau@xxxxxxxxxx> + */ + +#include <config.h> + +#include "libvirt-gconfig/libvirt-gconfig.h" + +#define GVIR_CONFIG_DOMAIN_CHARDEV_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_DOMAIN_CHARDEV, GVirConfigDomainChardevPrivate)) + +struct _GVirConfigDomainChardevPrivate +{ + gboolean unused; +}; + +G_DEFINE_ABSTRACT_TYPE(GVirConfigDomainChardev, gvir_config_domain_chardev, GVIR_TYPE_CONFIG_DOMAIN_DEVICE) + +static void gvir_config_domain_chardev_class_init(GVirConfigDomainChardevClass *klass) +{ + g_type_class_add_private(klass, sizeof(GVirConfigDomainChardevPrivate)); +} + + +static void gvir_config_domain_chardev_init(GVirConfigDomainChardev *chardev) +{ + g_debug("Init GVirConfigDomainChardev=%p", chardev); + + chardev->priv = GVIR_CONFIG_DOMAIN_CHARDEV_GET_PRIVATE(chardev); +} diff --git a/libvirt-gconfig/libvirt-gconfig-domain-chardev.h b/libvirt-gconfig/libvirt-gconfig-domain-chardev.h new file mode 100644 index 0000000..91b7f4e --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-domain-chardev.h @@ -0,0 +1,64 @@ +/* + * libvirt-gconfig-domain-chardev.h: libvirt domain chardev configuration + * + * Copyright (C) 2011 Red Hat + * + * 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, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Daniel P. Berrange <berrange@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_CHARDEV_H__ +#define __LIBVIRT_GCONFIG_DOMAIN_CHARDEV_H__ + +G_BEGIN_DECLS + +#define GVIR_TYPE_CONFIG_DOMAIN_CHARDEV (gvir_config_domain_chardev_get_type ()) +#define GVIR_CONFIG_DOMAIN_CHARDEV(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_TYPE_CONFIG_DOMAIN_CHARDEV, GVirConfigDomainChardev)) +#define GVIR_CONFIG_DOMAIN_CHARDEV_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_TYPE_CONFIG_DOMAIN_CHARDEV, GVirConfigDomainChardevClass)) +#define GVIR_IS_CONFIG_DOMAIN_CHARDEV(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_TYPE_CONFIG_DOMAIN_CHARDEV)) +#define GVIR_IS_CONFIG_DOMAIN_CHARDEV_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_TYPE_CONFIG_DOMAIN_CHARDEV)) +#define GVIR_CONFIG_DOMAIN_CHARDEV_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_TYPE_CONFIG_DOMAIN_CHARDEV, GVirConfigDomainChardevClass)) + +typedef struct _GVirConfigDomainChardev GVirConfigDomainChardev; +typedef struct _GVirConfigDomainChardevPrivate GVirConfigDomainChardevPrivate; +typedef struct _GVirConfigDomainChardevClass GVirConfigDomainChardevClass; + +struct _GVirConfigDomainChardev +{ + GVirConfigDomainDevice parent; + + GVirConfigDomainChardevPrivate *priv; + + /* Do not add fields to this struct */ +}; + +struct _GVirConfigDomainChardevClass +{ + GVirConfigDomainDeviceClass parent_class; + + gpointer padding[20]; +}; + + +GType gvir_config_domain_chardev_get_type(void); + +G_END_DECLS + +#endif /* __LIBVIRT_GCONFIG_DOMAIN_CHARDEV_H__ */ diff --git a/libvirt-gconfig/libvirt-gconfig-domain-console.c b/libvirt-gconfig/libvirt-gconfig-domain-console.c new file mode 100644 index 0000000..d85cc3e --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-domain-console.c @@ -0,0 +1,70 @@ +/* + * libvirt-gconfig-domain-console.c: libvirt domain console configuration + * + * Copyright (C) 2011 Red Hat + * + * 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, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Daniel P. Berrange <berrange@xxxxxxxxxx> + */ + +#include <config.h> + +#include "libvirt-gconfig/libvirt-gconfig.h" + +#define GVIR_CONFIG_DOMAIN_CONSOLE_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_DOMAIN_CONSOLE, GVirConfigDomainConsolePrivate)) + +struct _GVirConfigDomainConsolePrivate +{ + gboolean unused; +}; + +G_DEFINE_TYPE(GVirConfigDomainConsole, gvir_config_domain_console, GVIR_TYPE_CONFIG_DOMAIN_CHARDEV); + + +static void gvir_config_domain_console_class_init(GVirConfigDomainConsoleClass *klass) +{ + g_type_class_add_private(klass, sizeof(GVirConfigDomainConsolePrivate)); +} + + +static void gvir_config_domain_console_init(GVirConfigDomainConsole *console) +{ + g_debug("Init GVirConfigDomainConsole=%p", console); + + console->priv = GVIR_CONFIG_DOMAIN_CONSOLE_GET_PRIVATE(console); +} + +GVirConfigDomainConsole *gvir_config_domain_console_new(void) +{ + GVirConfigObject *object; + + object = gvir_config_object_new(GVIR_TYPE_CONFIG_DOMAIN_CONSOLE, + "console", NULL); + return GVIR_CONFIG_DOMAIN_CONSOLE(object); +} + +GVirConfigDomainConsole *gvir_config_domain_console_new_from_xml(const gchar *xml, + GError **error) +{ + GVirConfigObject *object; + + object = gvir_config_object_new_from_xml(GVIR_TYPE_CONFIG_DOMAIN_CONSOLE, + "console", NULL, xml, error); + if (object == NULL) + return NULL; + return GVIR_CONFIG_DOMAIN_CONSOLE(object); +} diff --git a/libvirt-gconfig/libvirt-gconfig-domain-console.h b/libvirt-gconfig/libvirt-gconfig-domain-console.h new file mode 100644 index 0000000..6243ecf --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-domain-console.h @@ -0,0 +1,67 @@ +/* + * libvirt-gconfig-domain-console.h: libvirt domain console configuration + * + * Copyright (C) 2011 Red Hat + * + * 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, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Daniel P. Berrange <berrange@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_CONSOLE_H__ +#define __LIBVIRT_GCONFIG_DOMAIN_CONSOLE_H__ + +G_BEGIN_DECLS + +#define GVIR_TYPE_CONFIG_DOMAIN_CONSOLE (gvir_config_domain_console_get_type ()) +#define GVIR_CONFIG_DOMAIN_CONSOLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_TYPE_CONFIG_DOMAIN_CONSOLE, GVirConfigDomainConsole)) +#define GVIR_CONFIG_DOMAIN_CONSOLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_TYPE_CONFIG_DOMAIN_CONSOLE, GVirConfigDomainConsoleClass)) +#define GVIR_IS_CONFIG_DOMAIN_CONSOLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_TYPE_CONFIG_DOMAIN_CONSOLE)) +#define GVIR_IS_CONFIG_DOMAIN_CONSOLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_TYPE_CONFIG_DOMAIN_CONSOLE)) +#define GVIR_CONFIG_DOMAIN_CONSOLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_TYPE_CONFIG_DOMAIN_CONSOLE, GVirConfigDomainConsoleClass)) + +typedef struct _GVirConfigDomainConsole GVirConfigDomainConsole; +typedef struct _GVirConfigDomainConsolePrivate GVirConfigDomainConsolePrivate; +typedef struct _GVirConfigDomainConsoleClass GVirConfigDomainConsoleClass; + +struct _GVirConfigDomainConsole +{ + GVirConfigDomainChardev parent; + + GVirConfigDomainConsolePrivate *priv; + + /* Do not add fields to this struct */ +}; + +struct _GVirConfigDomainConsoleClass +{ + GVirConfigDomainChardevClass parent_class; + + gpointer padding[20]; +}; + + +GType gvir_config_domain_console_get_type(void); +GVirConfigDomainConsole *gvir_config_domain_console_new(void); +GVirConfigDomainConsole *gvir_config_domain_console_new_from_xml(const gchar *xml, + GError **error); + +G_END_DECLS + +#endif /* __LIBVIRT_GCONFIG_DOMAIN_CONSOLE_H__ */ diff --git a/libvirt-gconfig/libvirt-gconfig.h b/libvirt-gconfig/libvirt-gconfig.h index be4b4dd..df97e9c 100644 --- a/libvirt-gconfig/libvirt-gconfig.h +++ b/libvirt-gconfig/libvirt-gconfig.h @@ -30,7 +30,9 @@ #include <libvirt-gconfig/libvirt-gconfig-object.h> #include <libvirt-gconfig/libvirt-gconfig-capabilities.h> #include <libvirt-gconfig/libvirt-gconfig-domain.h> +#include <libvirt-gconfig/libvirt-gconfig-domain-chardev.h> #include <libvirt-gconfig/libvirt-gconfig-domain-clock.h> +#include <libvirt-gconfig/libvirt-gconfig-domain-console.h> #include <libvirt-gconfig/libvirt-gconfig-domain-device.h> #include <libvirt-gconfig/libvirt-gconfig-domain-disk.h> #include <libvirt-gconfig/libvirt-gconfig-domain-filesys.h> diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym index 6f3593d..9ba6be2 100644 --- a/libvirt-gconfig/libvirt-gconfig.sym +++ b/libvirt-gconfig/libvirt-gconfig.sym @@ -26,6 +26,8 @@ LIBVIRT_GCONFIG_0.0.1 { gvir_config_domain_set_virt_type; gvir_config_domain_virt_type_get_type; + gvir_config_domain_chardev_get_type; + gvir_config_domain_clock_get_type; gvir_config_domain_clock_offset_get_type; gvir_config_domain_clock_new; @@ -34,6 +36,10 @@ LIBVIRT_GCONFIG_0.0.1 { gvir_config_domain_clock_set_timezone; gvir_config_domain_clock_set_variable_offset; + gvir_config_domain_console_get_type; + gvir_config_domain_console_new; + gvir_config_domain_console_new_from_xml; + gvir_config_domain_device_get_type; gvir_config_domain_disk_get_type; -- 1.7.7.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list