--- libvirt-gconfig/Makefile.am | 2 + .../libvirt-gconfig-domain-chardev-source-pty.c | 94 ++++++++++++++++++++ .../libvirt-gconfig-domain-chardev-source-pty.h | 70 +++++++++++++++ libvirt-gconfig/libvirt-gconfig.h | 1 + libvirt-gconfig/libvirt-gconfig.sym | 5 + 5 files changed, 172 insertions(+), 0 deletions(-) create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-chardev-source-pty.c create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-chardev-source-pty.h diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am index f017848..d9f3096 100644 --- a/libvirt-gconfig/Makefile.am +++ b/libvirt-gconfig/Makefile.am @@ -15,6 +15,7 @@ GCONFIG_HEADER_FILES = \ libvirt-gconfig-domain.h \ libvirt-gconfig-domain-chardev.h \ libvirt-gconfig-domain-chardev-source.h \ + libvirt-gconfig-domain-chardev-source-pty.h \ libvirt-gconfig-domain-clock.h \ libvirt-gconfig-domain-console.h \ libvirt-gconfig-domain-device.h \ @@ -52,6 +53,7 @@ GCONFIG_SOURCE_FILES = \ libvirt-gconfig-domain.c \ libvirt-gconfig-domain-chardev.c \ libvirt-gconfig-domain-chardev-source.c \ + libvirt-gconfig-domain-chardev-source-pty.c \ libvirt-gconfig-domain-clock.c \ libvirt-gconfig-domain-console.c \ libvirt-gconfig-domain-device.c \ diff --git a/libvirt-gconfig/libvirt-gconfig-domain-chardev-source-pty.c b/libvirt-gconfig/libvirt-gconfig-domain-chardev-source-pty.c new file mode 100644 index 0000000..70e553f --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-domain-chardev-source-pty.c @@ -0,0 +1,94 @@ +/* + * libvirt-gconfig-domain-chardev-source-pty.c: libvirt domain chardev pty 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" +#include "libvirt-gconfig/libvirt-gconfig-object-private.h" + +#define GVIR_CONFIG_DOMAIN_CHARDEV_SOURCE_PTY_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_DOMAIN_CHARDEV_SOURCE_PTY, GVirConfigDomainChardevSourcePtyPrivate)) + +struct _GVirConfigDomainChardevSourcePtyPrivate +{ + gboolean unused; +}; + +G_DEFINE_TYPE(GVirConfigDomainChardevSourcePty, gvir_config_domain_chardev_source_pty, GVIR_TYPE_CONFIG_DOMAIN_CHARDEV_SOURCE); + + +static void gvir_config_domain_chardev_source_pty_class_init(GVirConfigDomainChardevSourcePtyClass *klass) +{ + g_type_class_add_private(klass, sizeof(GVirConfigDomainChardevSourcePtyPrivate)); +} + + +static void gvir_config_domain_chardev_source_pty_init(GVirConfigDomainChardevSourcePty *source) +{ + g_debug("Init GVirConfigDomainChardevSourcePty=%p", source); + + source->priv = GVIR_CONFIG_DOMAIN_CHARDEV_SOURCE_PTY_GET_PRIVATE(source); +} + + +GVirConfigDomainChardevSourcePty *gvir_config_domain_chardev_source_pty_new(void) +{ + GVirConfigObject *object; + + /* the name of the root node is just a placeholder, it will be + * overwritten when the GVirConfigDomainChardevSourcePty is attached to a + * GVirConfigDomainChardevSourcePty + */ + object = gvir_config_object_new(GVIR_TYPE_CONFIG_DOMAIN_CHARDEV_SOURCE_PTY, "dummy", NULL); + gvir_config_object_set_attribute(object, "type", "pty", NULL); + return GVIR_CONFIG_DOMAIN_CHARDEV_SOURCE_PTY(object); +} + + +GVirConfigDomainChardevSourcePty *gvir_config_domain_chardev_source_pty_new_from_xml(const gchar *xml, + GError **error) +{ + GVirConfigObject *object; + + /* the name of the root node is just a placeholder, it will be + * overwritten when the GVirConfigDomainChardevSourcePty is attached to a + * GVirConfigDomainChardevSourcePty + */ + object = gvir_config_object_new_from_xml(GVIR_TYPE_CONFIG_DOMAIN_CHARDEV_SOURCE_PTY, + "dummy", NULL, xml, error); + gvir_config_object_set_attribute(object, "type", "pty", NULL); + return GVIR_CONFIG_DOMAIN_CHARDEV_SOURCE_PTY(object); +} + +void gvir_config_domain_source_pty_set_path(GVirConfigDomainChardevSourcePty *pty, + const char *path) +{ + GVirConfigObject *source; + g_return_if_fail(GVIR_IS_CONFIG_DOMAIN_CHARDEV_SOURCE_PTY(pty)); + + source = gvir_config_object_replace_child(GVIR_CONFIG_OBJECT(pty), + "source"); + g_return_if_fail(GVIR_IS_CONFIG_OBJECT(source)); + gvir_config_object_set_node_content(GVIR_CONFIG_OBJECT(source), + "path", path); + g_object_unref(G_OBJECT(source)); +} diff --git a/libvirt-gconfig/libvirt-gconfig-domain-chardev-source-pty.h b/libvirt-gconfig/libvirt-gconfig-domain-chardev-source-pty.h new file mode 100644 index 0000000..1c77671 --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-domain-chardev-source-pty.h @@ -0,0 +1,70 @@ +/* + * libvirt-gconfig-domain-chardev-source-pty.h: libvirt domain chardev pty 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> + */ + +#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_SOURCE_PTY_H__ +#define __LIBVIRT_GCONFIG_DOMAIN_CHARDEV_SOURCE_PTY_H__ + +G_BEGIN_DECLS + +#define GVIR_TYPE_CONFIG_DOMAIN_CHARDEV_SOURCE_PTY (gvir_config_domain_chardev_source_pty_get_type ()) +#define GVIR_CONFIG_DOMAIN_CHARDEV_SOURCE_PTY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_TYPE_CONFIG_DOMAIN_CHARDEV_SOURCE_PTY, GVirConfigDomainChardevSourcePty)) +#define GVIR_CONFIG_DOMAIN_CHARDEV_SOURCE_PTY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_TYPE_CONFIG_DOMAIN_CHARDEV_SOURCE_PTY, GVirConfigDomainChardevSourcePtyClass)) +#define GVIR_IS_CONFIG_DOMAIN_CHARDEV_SOURCE_PTY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_TYPE_CONFIG_DOMAIN_CHARDEV_SOURCE_PTY)) +#define GVIR_IS_CONFIG_DOMAIN_CHARDEV_SOURCE_PTY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_TYPE_CONFIG_DOMAIN_CHARDEV_SOURCE_PTY)) +#define GVIR_CONFIG_DOMAIN_CHARDEV_SOURCE_PTY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_TYPE_CONFIG_DOMAIN_CHARDEV_SOURCE_PTY, GVirConfigDomainChardevSourcePtyClass)) + +typedef struct _GVirConfigDomainChardevSourcePty GVirConfigDomainChardevSourcePty; +typedef struct _GVirConfigDomainChardevSourcePtyPrivate GVirConfigDomainChardevSourcePtyPrivate; +typedef struct _GVirConfigDomainChardevSourcePtyClass GVirConfigDomainChardevSourcePtyClass; + +struct _GVirConfigDomainChardevSourcePty +{ + GVirConfigDomainChardevSource parent; + + GVirConfigDomainChardevSourcePtyPrivate *priv; + + /* Do not add fields to this struct */ +}; + +struct _GVirConfigDomainChardevSourcePtyClass +{ + GVirConfigDomainChardevSourceClass parent_class; + + gpointer padding[20]; +}; + + +GType gvir_config_domain_chardev_source_pty_get_type(void); + +GVirConfigDomainChardevSourcePty *gvir_config_domain_chardev_source_pty_new(void); +GVirConfigDomainChardevSourcePty *gvir_config_domain_chardev_source_pty_new_from_xml(const gchar *xml, + GError **error); +void gvir_config_domain_source_pty_set_path(GVirConfigDomainChardevSourcePty *pty, + const char *path); + +G_END_DECLS + +#endif /* __LIBVIRT_GCONFIG_DOMAIN_CHARDEV_SOURCE_PTY_H__ */ diff --git a/libvirt-gconfig/libvirt-gconfig.h b/libvirt-gconfig/libvirt-gconfig.h index 549f00a..c60e221 100644 --- a/libvirt-gconfig/libvirt-gconfig.h +++ b/libvirt-gconfig/libvirt-gconfig.h @@ -32,6 +32,7 @@ #include <libvirt-gconfig/libvirt-gconfig-domain.h> #include <libvirt-gconfig/libvirt-gconfig-domain-chardev.h> #include <libvirt-gconfig/libvirt-gconfig-domain-chardev-source.h> +#include <libvirt-gconfig/libvirt-gconfig-domain-chardev-source-pty.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> diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym index 6249730..4ea2b1b 100644 --- a/libvirt-gconfig/libvirt-gconfig.sym +++ b/libvirt-gconfig/libvirt-gconfig.sym @@ -34,6 +34,11 @@ LIBVIRT_GCONFIG_0.0.1 { gvir_config_domain_chardev_source_get_type; + gvir_config_domain_chardev_source_pty_get_type; + gvir_config_domain_chardev_source_pty_new; + gvir_config_domain_chardev_source_pty_new_from_xml; + gvir_config_domain_source_pty_set_path; + gvir_config_domain_clock_get_type; gvir_config_domain_clock_offset_get_type; gvir_config_domain_clock_new; -- 1.7.7.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list