[libvirt] [libvirt-glib PATCH] Add filterref and filterref parameter support.
by Ian Main
This patch adds support for setting filterref's on interfaces. Also
supported are parameters to the filterref's.
Signed-off-by: Ian Main <imain(a)redhat.com>
---
examples/config-demo.py | 9 +-
libvirt-gconfig/Makefile.am | 4 +
...-gconfig-domain-interface-filterref-parameter.c | 101 ++++++++++++++
...-gconfig-domain-interface-filterref-parameter.h | 75 ++++++++++
.../libvirt-gconfig-domain-interface-filterref.c | 155 +++++++++++++++++++++
.../libvirt-gconfig-domain-interface-filterref.h | 76 ++++++++++
libvirt-gconfig/libvirt-gconfig-domain-interface.c | 41 ++++++
libvirt-gconfig/libvirt-gconfig-domain-interface.h | 5 +
libvirt-gconfig/libvirt-gconfig.h | 2 +
libvirt-gconfig/libvirt-gconfig.sym | 18 +++
10 files changed, 485 insertions(+), 1 deletion(-)
create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-interface-filterref-parameter.c
create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-interface-filterref-parameter.h
create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-interface-filterref.c
create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-interface-filterref.h
diff --git a/examples/config-demo.py b/examples/config-demo.py
index 09b9e89..0566d66 100644
--- a/examples/config-demo.py
+++ b/examples/config-demo.py
@@ -28,13 +28,20 @@ disk.set_type(LibvirtGConfig.DomainDiskType.FILE)
disk.set_guest_device_type(LibvirtGConfig.DomainDiskGuestDeviceType.DISK)
disk.set_source("/tmp/foo/bar")
disk.set_driver_name("qemu")
-disk.set_driver_format(LibvirtGConfig.DriverType.QCOW2)
+disk.set_driver_format(LibvirtGConfig.DomainDiskFormat.QCOW2)
disk.set_target_bus(LibvirtGConfig.DomainDiskBus.IDE)
disk.set_target_dev("hda")
domain.add_device(disk)
interface = LibvirtGConfig.DomainInterfaceNetwork.new()
interface.set_source("default")
+filterref = LibvirtGConfig.DomainInterfaceFilterref.new()
+filterref.set_filter("clean-traffic")
+parameter = LibvirtGConfig.DomainInterfaceFilterrefParameter.new()
+parameter.set_name("IP")
+parameter.set_value("205.23.12.40")
+filterref.add_parameter(parameter)
+interface.set_filterref(filterref)
domain.add_device(interface)
interface = LibvirtGConfig.DomainInterfaceUser.new()
diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
index 35dc978..48f0547 100644
--- a/libvirt-gconfig/Makefile.am
+++ b/libvirt-gconfig/Makefile.am
@@ -49,6 +49,8 @@ GCONFIG_HEADER_FILES = \
libvirt-gconfig-domain-interface-bridge.h \
libvirt-gconfig-domain-interface-network.h \
libvirt-gconfig-domain-interface-user.h \
+ libvirt-gconfig-domain-interface-filterref.h \
+ libvirt-gconfig-domain-interface-filterref-parameter.h \
libvirt-gconfig-domain-memballoon.h \
libvirt-gconfig-domain-os.h \
libvirt-gconfig-domain-parallel.h \
@@ -131,6 +133,8 @@ GCONFIG_SOURCE_FILES = \
libvirt-gconfig-domain-interface-bridge.c \
libvirt-gconfig-domain-interface-network.c \
libvirt-gconfig-domain-interface-user.c \
+ libvirt-gconfig-domain-interface-filterref.c \
+ libvirt-gconfig-domain-interface-filterref-parameter.c \
libvirt-gconfig-domain-memballoon.c \
libvirt-gconfig-domain-os.c \
libvirt-gconfig-domain-parallel.c \
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-interface-filterref-parameter.c b/libvirt-gconfig/libvirt-gconfig-domain-interface-filterref-parameter.c
new file mode 100644
index 0000000..e697e86
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-interface-filterref-parameter.c
@@ -0,0 +1,101 @@
+/*
+ * libvirt-gconfig-domain-interface-filterref-parameter.c:
+ * libvirt filterref parameters
+ *
+ * Copyright (C) 2013 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: Ian Main <imain(a)redhat.com>
+ * Daniel P. Berrange <berrange(a)redhat.com>
+ */
+
+#include <config.h>
+
+#include "libvirt-gconfig/libvirt-gconfig.h"
+#include "libvirt-gconfig/libvirt-gconfig-private.h"
+
+#define GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF_PARAMETER_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF_PARAMETER, GVirConfigDomainInterfaceFilterrefParameterPrivate))
+
+struct _GVirConfigDomainInterfaceFilterrefParameterPrivate
+{
+ gboolean unused;
+};
+
+G_DEFINE_TYPE(GVirConfigDomainInterfaceFilterrefParameter, gvir_config_domain_interface_filterref_parameter, GVIR_CONFIG_TYPE_OBJECT);
+
+static void gvir_config_domain_interface_filterref_parameter_class_init(GVirConfigDomainInterfaceFilterrefParameterClass *klass)
+{
+ g_type_class_add_private(klass, sizeof(GVirConfigDomainInterfaceFilterrefParameterPrivate));
+}
+
+static void gvir_config_domain_interface_filterref_parameter_init(GVirConfigDomainInterfaceFilterrefParameter *parameter)
+{
+ g_debug("Init GVirConfigDomainInterfaceFilterrefParameter=%p", parameter);
+
+ parameter->priv = GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF_PARAMETER_GET_PRIVATE(parameter);
+}
+
+GVirConfigDomainInterfaceFilterrefParameter *gvir_config_domain_interface_filterref_parameter_new(void)
+{
+ GVirConfigObject *object;
+
+ object = gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF_PARAMETER,
+ "parameter", NULL);
+ return GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF_PARAMETER(object);
+}
+
+GVirConfigDomainInterfaceFilterrefParameter *
+gvir_config_domain_interface_filterref_parameter_new_from_xml(const gchar *xml, GError **error)
+{
+ GVirConfigObject *object;
+
+ object = gvir_config_object_new_from_xml(GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF_PARAMETER,
+ "parameter",
+ NULL,
+ xml,
+ error);
+
+ return GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF_PARAMETER(object);
+}
+
+void gvir_config_domain_interface_filterref_parameter_set_name(GVirConfigDomainInterfaceFilterrefParameter *parameter, const gchar *name)
+{
+ g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_INTERFACE_FILTERREF_PARAMETER(parameter));
+ gvir_config_object_set_attribute(GVIR_CONFIG_OBJECT(parameter),
+ "name", name, NULL);
+}
+
+void gvir_config_domain_interface_filterref_parameter_set_value(GVirConfigDomainInterfaceFilterrefParameter *parameter, const gchar *value)
+{
+ g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_INTERFACE_FILTERREF_PARAMETER(parameter));
+ gvir_config_object_set_attribute(GVIR_CONFIG_OBJECT(parameter),
+ "value", value, NULL);
+}
+
+const gchar *gvir_config_domain_interface_filterref_parameter_get_name(GVirConfigDomainInterfaceFilterrefParameter *parameter)
+{
+ return gvir_config_object_get_attribute(GVIR_CONFIG_OBJECT(parameter),
+ NULL,
+ "name");
+}
+const gchar *gvir_config_domain_interface_filterref_parameter_get_value(GVirConfigDomainInterfaceFilterrefParameter *parameter)
+{
+ return gvir_config_object_get_attribute(GVIR_CONFIG_OBJECT(parameter),
+ NULL,
+ "value");
+}
+
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-interface-filterref-parameter.h b/libvirt-gconfig/libvirt-gconfig-domain-interface-filterref-parameter.h
new file mode 100644
index 0000000..a768c84
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-interface-filterref-parameter.h
@@ -0,0 +1,75 @@
+/*
+ * libvirt-gconfig-domain-interface-filterref-parameter.h:
+ * libvirt filterref parameters
+ *
+ * Copyright (C) 2013 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: Ian Main <imain(a)redhat.com>
+ * Daniel P. Berrange <berrange(a)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_INTERFACE_FILTERREF_PARAMETER_H__
+#define __LIBVIRT_GCONFIG_DOMAIN_INTERFACE_FILTERREF_PARAMETER_H__
+
+G_BEGIN_DECLS
+
+#define GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF_PARAMETER (gvir_config_domain_interface_filterref_parameter_get_type ())
+#define GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF_PARAMETER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF_PARAMETER, GVirConfigDomainInterfaceFilterrefParameter))
+#define GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF_PARAMETER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF_PARAMETER, GVirConfigDomainInterfaceFilterrefParameterClass))
+#define GVIR_CONFIG_IS_DOMAIN_INTERFACE_FILTERREF_PARAMETER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF_PARAMETER))
+#define GVIR_CONFIG_IS_DOMAIN_INTERFACE_FILTERREF_PARAMETER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF_PARAMETER))
+#define GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF_PARAMETER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF_PARAMETER, GVirConfigDomainInterfaceFilterrefParameterClass))
+
+typedef struct _GVirConfigDomainInterfaceFilterrefParameter GVirConfigDomainInterfaceFilterrefParameter;
+typedef struct _GVirConfigDomainInterfaceFilterrefParameterPrivate GVirConfigDomainInterfaceFilterrefParameterPrivate;
+typedef struct _GVirConfigDomainInterfaceFilterrefParameterClass GVirConfigDomainInterfaceFilterrefParameterClass;
+
+struct _GVirConfigDomainInterfaceFilterrefParameter
+{
+ GVirConfigObject parent;
+
+ GVirConfigDomainInterfaceFilterrefParameterPrivate *priv;
+
+ /* Do not add fields to this struct */
+};
+
+struct _GVirConfigDomainInterfaceFilterrefParameterClass
+{
+ GVirConfigObjectClass parent_class;
+
+ gpointer padding[20];
+};
+
+GType gvir_config_domain_interface_filterref_parameter_get_type(void);
+
+GVirConfigDomainInterfaceFilterrefParameter *gvir_config_domain_interface_filterref_parameter_new(void);
+
+GVirConfigDomainInterfaceFilterrefParameter *
+gvir_config_domain_interface_filterref_parameter_new_from_xml(const gchar *xml, GError **error);
+
+void gvir_config_domain_interface_filterref_parameter_set_name(GVirConfigDomainInterfaceFilterrefParameter *parameter, const gchar *name);
+void gvir_config_domain_interface_filterref_parameter_set_value(GVirConfigDomainInterfaceFilterrefParameter *parameter, const gchar *value);
+const gchar *gvir_config_domain_interface_filterref_parameter_get_name(GVirConfigDomainInterfaceFilterrefParameter *parameter);
+const gchar *gvir_config_domain_interface_filterref_parameter_get_value(GVirConfigDomainInterfaceFilterrefParameter *parameter);
+
+G_END_DECLS
+
+#endif /* __LIBVIRT_GCONFIG_DOMAIN_INTERFACE_FILTERREF_PARAMETER_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-interface-filterref.c b/libvirt-gconfig/libvirt-gconfig-domain-interface-filterref.c
new file mode 100644
index 0000000..cc8b246
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-interface-filterref.c
@@ -0,0 +1,155 @@
+/*
+ * libvirt-gconfig-domain-interface-network-filterref.c:
+ * libvirt filter reference config.
+ *
+ * Copyright (C) 2013 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: Ian Main <imain(a)redhat.com>
+ */
+
+#include <config.h>
+
+#include "libvirt-gconfig/libvirt-gconfig.h"
+#include "libvirt-gconfig/libvirt-gconfig-private.h"
+
+#define GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF, GVirConfigDomainInterfaceFilterrefPrivate))
+
+struct _GVirConfigDomainInterfaceFilterrefPrivate
+{
+ gboolean unused;
+};
+
+G_DEFINE_TYPE(GVirConfigDomainInterfaceFilterref, gvir_config_domain_interface_filterref, GVIR_CONFIG_TYPE_OBJECT);
+
+static void gvir_config_domain_interface_filterref_class_init(GVirConfigDomainInterfaceFilterrefClass *klass)
+{
+ g_type_class_add_private(klass, sizeof(GVirConfigDomainInterfaceFilterrefPrivate));
+}
+
+static void gvir_config_domain_interface_filterref_init(GVirConfigDomainInterfaceFilterref *filterref)
+{
+ g_debug("Init GVirConfigDomainInterfaceFilterref=%p", filterref);
+
+ filterref->priv = GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF_GET_PRIVATE(filterref);
+}
+
+
+GVirConfigDomainInterfaceFilterref *gvir_config_domain_interface_filterref_new(void)
+{
+ GVirConfigObject *object;
+
+ object = gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF,
+ "filterref", NULL);
+ return GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF(object);
+}
+
+GVirConfigDomainInterfaceFilterref *gvir_config_domain_interface_filterref_new_from_xml(const gchar *xml,
+ GError **error)
+{
+ GVirConfigObject *object;
+
+ object = gvir_config_object_new_from_xml(GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF,
+ "filterref", NULL, xml, error);
+ if (g_strcmp0(gvir_config_object_get_attribute(object, NULL, "type"), "filterref") != 0) {
+ g_object_unref(G_OBJECT(object));
+ return NULL;
+ }
+ return GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF(object);
+}
+
+void gvir_config_domain_interface_filterref_set_filter(GVirConfigDomainInterfaceFilterref *filterref,
+ const char *filter)
+{
+ g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_INTERFACE_FILTERREF(filterref));
+
+ gvir_config_object_set_attribute(GVIR_CONFIG_OBJECT(filterref),
+ "filter", filter, NULL);
+}
+
+const char *gvir_config_domain_interface_filterref_get_filter(GVirConfigDomainInterfaceFilterref *filterref)
+{
+ return gvir_config_object_get_attribute(GVIR_CONFIG_OBJECT(filterref),
+ NULL,
+ "filter");
+}
+
+void gvir_config_domain_interface_filterref_add_parameter(GVirConfigDomainInterfaceFilterref *filterref,
+ GVirConfigDomainInterfaceFilterrefParameter *parameter)
+{
+ g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_INTERFACE_FILTERREF(filterref));
+ g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_INTERFACE_FILTERREF_PARAMETER(parameter));
+
+ gvir_config_object_attach_add(GVIR_CONFIG_OBJECT(filterref),
+ GVIR_CONFIG_OBJECT(parameter));
+}
+
+struct GetParameterData {
+ GVirConfigXmlDoc *doc;
+ GList *parameters;
+};
+
+
+static gboolean add_filterref_parameter(xmlNodePtr node, gpointer opaque)
+{
+ struct GetParameterData* data = (struct GetParameterData*)opaque;
+ GVirConfigObject *parameter;
+
+ if (g_strcmp0((const gchar *)node->name, "parameter") != 0)
+ return TRUE;
+
+ parameter = gvir_config_object_new_from_tree(GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF_PARAMETER,
+ if (parameter != NULL)
+ data->parameters = g_list_append(data->parameters, parameter);
+ else
+ g_debug("Failed to parse %s node", node->name);
+
+ return TRUE;
+}
+
+/**
+ * gvir_config_domain_interface_filterref_get_parameters:
+ * @filterref: a #GVirConfigDomainInterfaceFilterref
+ *
+ * Gets the list of parameters attached to @filterref. The returned list should be
+ * freed with g_list_free(), after its elements have been unreffed with
+ * g_object_unref().
+ *
+ * Returns: (element-type LibvirtGConfig.DomainInterfaceFilterrefParameter) (transfer full):
+ * a newly allocated #GList of #GVirConfigDomainInterfaceFilterrefParameter.
+ */
+GList *gvir_config_domain_interface_filterref_get_parameters(GVirConfigDomainInterfaceFilterref *filterref)
+{
+ struct GetParameterData data;
+
+ g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_INTERFACE_FILTERREF(filterref), NULL);
+
+ g_object_get(G_OBJECT(filterref), "doc", &data.doc, NULL);
+ data.parameters = NULL;
+
+ gvir_config_object_foreach_child(GVIR_CONFIG_OBJECT(filterref),
+ NULL,
+ add_filterref_parameter,
+ &data);
+
+ if (data.doc != NULL) {
+ g_object_unref(G_OBJECT(data.doc));
+ }
+
+ return data.parameters;
+}
+
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-interface-filterref.h b/libvirt-gconfig/libvirt-gconfig-domain-interface-filterref.h
new file mode 100644
index 0000000..ee785c2
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-interface-filterref.h
@@ -0,0 +1,76 @@
+/*
+ * libvirt-gconfig-domain-interface-network-filterref.h: libvirt filter reference config
+ *
+ * Copyright (C) 2013 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: Ian Main <imain(a)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_INTERFACE_FILTERREF_H__
+#define __LIBVIRT_GCONFIG_DOMAIN_INTERFACE_FILTERREF_H__
+
+G_BEGIN_DECLS
+
+#define GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF (gvir_config_domain_interface_filterref_get_type ())
+#define GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF, GVirConfigDomainInterfaceFilterref))
+#define GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF, GVirConfigDomainInterfaceFilterrefClass))
+#define GVIR_CONFIG_IS_DOMAIN_INTERFACE_FILTERREF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF))
+#define GVIR_CONFIG_IS_DOMAIN_INTERFACE_FILTERREF_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF))
+#define GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF, GVirConfigDomainInterfaceFilterrefClass))
+
+typedef struct _GVirConfigDomainInterfaceFilterref GVirConfigDomainInterfaceFilterref;
+typedef struct _GVirConfigDomainInterfaceFilterrefPrivate GVirConfigDomainInterfaceFilterrefPrivate;
+typedef struct _GVirConfigDomainInterfaceFilterrefClass GVirConfigDomainInterfaceFilterrefClass;
+
+struct _GVirConfigDomainInterfaceFilterref
+{
+ GVirConfigObject parent;
+
+ GVirConfigDomainInterfaceFilterrefPrivate *priv;
+
+ /* Do not add fields to this struct */
+};
+
+struct _GVirConfigDomainInterfaceFilterrefClass
+{
+ GVirConfigObjectClass parent_class;
+
+ gpointer padding[20];
+};
+
+GType gvir_config_domain_interface_filterref_get_type(void);
+
+GVirConfigDomainInterfaceFilterref *gvir_config_domain_interface_filterref_new(void);
+
+GVirConfigDomainInterfaceFilterref *
+gvir_config_domain_interface_filterref_new_from_xml(const gchar *xml, GError **error);
+
+void gvir_config_domain_interface_filterref_set_filter(GVirConfigDomainInterfaceFilterref *filterref,
+ const char *filter);
+const char *gvir_config_domain_interface_filterref_get_filter(GVirConfigDomainInterfaceFilterref *filterref);
+
+void gvir_config_domain_interface_filterref_add_parameter(GVirConfigDomainInterfaceFilterref *filterref,
+ GVirConfigDomainInterfaceFilterrefParameter *parameter);
+GList *gvir_config_domain_interface_filterref_get_parameters(GVirConfigDomainInterfaceFilterref *filterref);
+
+G_END_DECLS
+
+#endif /* __LIBVIRT_GCONFIG_DOMAIN_INTERFACE_FILTERREF_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-interface.c b/libvirt-gconfig/libvirt-gconfig-domain-interface.c
index 86a0c34..ce1b3f0 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-interface.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-interface.c
@@ -131,6 +131,47 @@ const char *gvir_config_domain_interface_get_model(GVirConfigDomainInterface *in
"model", "type");
}
+/**
+ * gvir_config_domain_interface_set_filterref:
+ * @interface: a #GVirConfigDomainInterface
+ * @filterref: (allow-none): the filterref to set
+ */
+void gvir_config_domain_interface_set_filterref(GVirConfigDomainInterface *interface,
+ GVirConfigDomainInterfaceFilterref *filterref)
+{
+ g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_INTERFACE(interface));
+ g_return_if_fail(filterref == NULL || GVIR_CONFIG_IS_DOMAIN_INTERFACE_FILTERREF(filterref));
+
+ gvir_config_object_attach_replace(GVIR_CONFIG_OBJECT(interface),
+ "filterref",
+ GVIR_CONFIG_OBJECT(filterref));
+}
+
+/**
+ * gvir_config_domain_interface_get_filterref:
+ * @interface: a #GVirConfigDomainInterface
+ *
+ * Gets the filterref associated with the @interface
+ *
+ * Returns: (transfer full): A #GVirConfigDomainInterfaceFilterref. The returned
+ * object should be unreffed with g_object_unref() when no longer needed.
+ */
+
+GVirConfigDomainInterfaceFilterref *gvir_config_domain_interface_get_filterref(GVirConfigDomainInterface *interface)
+{
+ GVirConfigObject *object;
+
+ g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_INTERFACE(interface), NULL);
+
+ object = gvir_config_object_get_child_with_type
+ (GVIR_CONFIG_OBJECT(interface),
+ "filterref",
+ GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF);
+
+ return GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF(object);
+}
+
+
G_GNUC_INTERNAL GVirConfigDomainDevice *
gvir_config_domain_interface_new_from_tree(GVirConfigXmlDoc *doc,
xmlNodePtr tree)
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-interface.h b/libvirt-gconfig/libvirt-gconfig-domain-interface.h
index 65c5d0b..2b0c22f 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-interface.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain-interface.h
@@ -27,6 +27,8 @@
#ifndef __LIBVIRT_GCONFIG_DOMAIN_INTERFACE_H__
#define __LIBVIRT_GCONFIG_DOMAIN_INTERFACE_H__
+#include <libvirt-gconfig/libvirt-gconfig-domain-interface-filterref.h>
+
G_BEGIN_DECLS
#define GVIR_CONFIG_TYPE_DOMAIN_INTERFACE (gvir_config_domain_interface_get_type ())
@@ -76,6 +78,9 @@ const char *gvir_config_domain_interface_get_ifname(GVirConfigDomainInterface *i
GVirConfigDomainInterfaceLinkState gvir_config_domain_interface_get_link_state(GVirConfigDomainInterface *interface);
const char *gvir_config_domain_interface_get_mac(GVirConfigDomainInterface *interface);
const char *gvir_config_domain_interface_get_model(GVirConfigDomainInterface *interface);
+void gvir_config_domain_interface_set_filterref(GVirConfigDomainInterface *interface,
+ GVirConfigDomainInterfaceFilterref *filterref);
+GVirConfigDomainInterfaceFilterref *gvir_config_domain_interface_get_filterref(GVirConfigDomainInterface *interface);
G_END_DECLS
diff --git a/libvirt-gconfig/libvirt-gconfig.h b/libvirt-gconfig/libvirt-gconfig.h
index 03e8ce7..14386b9 100644
--- a/libvirt-gconfig/libvirt-gconfig.h
+++ b/libvirt-gconfig/libvirt-gconfig.h
@@ -62,6 +62,8 @@
#include <libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h>
#include <libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h>
#include <libvirt-gconfig/libvirt-gconfig-domain-input.h>
+#include <libvirt-gconfig/libvirt-gconfig-domain-interface-filterref-parameter.h>
+#include <libvirt-gconfig/libvirt-gconfig-domain-interface-filterref.h>
#include <libvirt-gconfig/libvirt-gconfig-domain-interface.h>
#include <libvirt-gconfig/libvirt-gconfig-domain-interface-bridge.h>
#include <libvirt-gconfig/libvirt-gconfig-domain-interface-network.h>
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index 72eafc1..5065047 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -608,6 +608,24 @@ global:
gvir_config_domain_graphics_rdp_set_replace_user;
gvir_config_object_new_from_xml;
+
+ gvir_config_domain_interface_set_filterref;
+ gvir_config_domain_interface_get_filterref;
+
+ gvir_config_domain_interface_filterref_get_type;
+ gvir_config_domain_interface_filterref_new;
+ gvir_config_domain_interface_filterref_new_from_xml;
+ gvir_config_domain_interface_filterref_set_filter;
+ gvir_config_domain_interface_filterref_get_filter;
+ gvir_config_domain_interface_filterref_add_parameter;
+ gvir_config_domain_interface_filterref_get_parameters;
+ gvir_config_domain_interface_filterref_parameter_get_type;
+ gvir_config_domain_interface_filterref_parameter_new;
+ gvir_config_domain_interface_filterref_parameter_new_from_xml;
+ gvir_config_domain_interface_filterref_parameter_set_name;
+ gvir_config_domain_interface_filterref_parameter_set_value;
+ gvir_config_domain_interface_filterref_parameter_get_name;
+ gvir_config_domain_interface_filterref_parameter_get_value;
} LIBVIRT_GCONFIG_0.1.7;
# .... define new API here using predicted next version number ....
--
1.8.1.4
11 years, 1 month
[libvirt] [PATCH] build: fix build of virt-login-shell on systems with older gnutls
by Jim Fehlig
On systems where gnutls uses libgcrypt, I'm seeing the following
build failure
libvirt.c:314: error: variable 'virTLSThreadImpl' has initializer but incomplete type
libvirt.c:319: error: 'GCRY_THREAD_OPTION_PTHREAD' undeclared here (not in a function)
...
Fix by undefining WITH_GNUTLS_GCRYPT in config-post.h
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
Although I'm more confident in this fix vs the previously reported
virt-login-shell build failure, I'd still prefer an ACK before pushing.
config-post.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/config-post.h b/config-post.h
index d371e8c..8367200 100644
--- a/config-post.h
+++ b/config-post.h
@@ -34,6 +34,7 @@
# undef WITH_CURL
# undef WITH_DTRACE_PROBES
# undef WITH_GNUTLS
+# undef WITH_GNUTLS_GCRYPT
# undef WITH_MACVTAP
# undef WITH_NUMACTL
# undef WITH_SASL
--
1.8.1.4
11 years, 1 month
[libvirt] [PATCH] python: Fix Create*WithFiles filefd passing
by Martin Kletzander
From: Marian Neagul <marian(a)info.uvt.ro>
Commit d76227be added functions virDomainCreateWithFiles and
virDomainCreateXMLWithFiles, but there was a little piece missing in
python bindings. This patch fixes proper passing of file descriptors
in the overwrites of these functions.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
Notes:
I checked that Marian's patch works as expected and that it really
fixes the issue.
python/libvirt-override.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/python/libvirt-override.c b/python/libvirt-override.c
index 4800d1d..2e58bf9 100644
--- a/python/libvirt-override.c
+++ b/python/libvirt-override.c
@@ -7157,6 +7157,8 @@ libvirt_virDomainCreateWithFiles(PyObject *self ATTRIBUTE_UNUSED, PyObject *args
if (libvirt_intUnwrap(pyfd, &fd) < 0)
goto cleanup;
+
+ files[i] = fd;
}
LIBVIRT_BEGIN_ALLOW_THREADS;
@@ -7201,6 +7203,8 @@ libvirt_virDomainCreateXMLWithFiles(PyObject *self ATTRIBUTE_UNUSED, PyObject *a
if (libvirt_intUnwrap(pyfd, &fd) < 0)
goto cleanup;
+
+ files[i] = fd;
}
LIBVIRT_BEGIN_ALLOW_THREADS;
--
1.8.4
11 years, 1 month
[libvirt] [PATCH] maint: typo fixes
by Eric Blake
* ChangeLog-old: s/guarentee/guarantee/
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
Pushing as trivial.
ChangeLog-old | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ChangeLog-old b/ChangeLog-old
index e07b11c..ba738c4 100644
--- a/ChangeLog-old
+++ b/ChangeLog-old
@@ -13920,7 +13920,7 @@ Tue Feb 27 10:20:43 EST 2007 Daniel P. Berrange <berrange(a)redhat.com>
* src/xend_internal.c: Only hardcode port = 5900+domid if
running against old XenD < 3.0.3, because in newer XenD
- port is guarenteed to be available in XenStore if the VNC
+ port is guaranteed to be available in XenStore if the VNC
server is running.
Mon Feb 26 15:33:08 IST 2007 Mark McLoughlin <markmc(a)redhat.com>
@@ -15228,7 +15228,7 @@ Sun Sep 3 12:34:23 EDT 2006 Daniel Berrange <berrange(a)redhat.com>
iterating over list of ids/names, because it is not neccessarily
the same as the value returned by virConnectNumOfDomains. Use qsort
to sort active domains by Id, and inactive domains by name, since
- there is no guarenteed sort ordering when listing domains. For inactive
+ there is no guaranteed sort ordering when listing domains. For inactive
domains display a '-' instead of '-1' to make it clear they have no
sensible ID number.
--
1.8.3.1
11 years, 1 month
[libvirt] [PATCH] rpc: Retrieve peer PID via new getsockopt() for Mac
by Doug Goldstein
While LOCAL_PEERCRED on the BSDs does not return the pid information of
the peer, Mac OS X 10.8 added LOCAL_PEERPID to retrieve the pid so we
should use that when its available to get that information.
---
v3:
* Consider EOPNOTSUPP as non-fatal in case they've built on 10.8
but run the binary on 10.6 as that's the error you'll get back
in that case.
v2:
* Make LOCAL_PEERPID call non-fatal in case the user built the binary on
a system that supports it but then runs it on a kernel that does not
support it
---
src/rpc/virnetsocket.c | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
index b2ebefe..f73bc50 100644
--- a/src/rpc/virnetsocket.c
+++ b/src/rpc/virnetsocket.c
@@ -1197,12 +1197,36 @@ int virNetSocketGetUNIXIdentity(virNetSocketPtr sock,
goto cleanup;
}
- /* PID and process creation time are not supported on BSDs */
+ /* PID and process creation time are not supported on BSDs by
+ * LOCAL_PEERCRED.
+ */
*pid = -1;
*timestamp = -1;
*uid = cr.cr_uid;
*gid = cr.cr_gid;
+# ifdef LOCAL_PEERPID
+ /* Exists on Mac OS X 10.8 for retrieving the peer's PID */
+ cr_len = sizeof(*pid);
+
+ if (getsockopt(sock->fd, VIR_SOL_PEERCRED, LOCAL_PEERPID, pid, &cr_len) < 0) {
+ /* Ensure this is set to something sane as there are no guarentees
+ * as to what its set to now.
+ */
+ *pid = -1;
+
+ /* If this was built on a system with LOCAL_PEERPID defined but
+ * the kernel doesn't support it we'll get back EOPNOTSUPP so
+ * treat all errors but EOPNOTSUPP as fatal
+ */
+ if (errno != EOPNOTSUPP) {
+ virReportSystemError(errno, "%s",
+ _("Failed to get client socket PID"));
+ goto cleanup;
+ }
+ }
+# endif
+
ret = 0;
cleanup:
--
1.8.1.5
11 years, 1 month
[libvirt] [PATCH] nodeinfo: fix physical memory size on Mac OS X
by Ryota Ozaki
HW_PHYSMEM is available on Mac OS X as well as FreeBSD, however,
its resulting value for Mac OS X is 32 bits. Mac OS X provides
HW_MEMSIZE that is 64 bits version of HW_PHYSMEM. We have to use it.
I tested the patch on Mac OS X 10.6.8, 10.7.4, 10.8.5 and FreeBSD 9.2.
Signed-off-by: Ryota Ozaki <ozaki.ryota(a)gmail.com>
---
src/nodeinfo.c | 38 ++++++++++++++++++++++++++++----------
1 file changed, 28 insertions(+), 10 deletions(-)
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index 70814c2..a0fdfe7 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -73,6 +73,33 @@ appleFreebsdNodeGetCPUCount(void)
return ncpu;
}
+
+/* VIR_HW_PHYSMEM - the resulting value of HW_PHYSMEM of FreeBSD
+ * is 64 bits while that of Mac OS X is still 32 bits.
+ * Mac OS X provides HW_MEMSIZE for 64 bits version of HW_PHYSMEM
+ * since 10.6.8 (Snow Leopard) at least.
+ */
+# ifdef HW_MEMSIZE
+# define VIR_HW_PHYSMEM HW_MEMSIZE
+# else
+# define VIR_HW_PHYSMEM HW_PHYSMEM
+# endif
+static int
+appleFreebsdNodeGetMemorySize(unsigned long *memory)
+{
+ int mib[2] = { CTL_HW, VIR_HW_PHYSMEM };
+ unsigned long physmem;
+ size_t len = sizeof(physmem);
+
+ if (sysctl(mib, 2, &physmem, &len, NULL, 0) == -1) {
+ virReportSystemError(errno, "%s", _("cannot obtain memory size"));
+ return -1;
+ }
+
+ *memory = (unsigned long)(physmem / 1024);
+
+ return 0;
+}
#endif
#ifdef __linux__
@@ -914,17 +941,8 @@ cleanup:
nodeinfo->mhz = cpu_freq / 1000000;
# endif
- /* get memory information */
- int mib[2] = { CTL_HW, HW_PHYSMEM };
- unsigned long physmem;
- size_t len = sizeof(physmem);
-
- if (sysctl(mib, 2, &physmem, &len, NULL, 0) == -1) {
- virReportSystemError(errno, "%s", _("cannot obtain memory size"));
+ if (appleFreebsdNodeGetMemorySize(&nodeinfo->memory) < 0)
return -1;
- }
-
- nodeinfo->memory = (unsigned long)(physmem / 1024);
return 0;
}
--
1.8.4
11 years, 1 month
[libvirt] [PATCH] xenapi: fix the coding stype in xenapi_driver.c
by Hongwei Bi
Signed-off-by: Hongwei Bi <hwbi2008(a)gmail.com>
---
src/xenapi/xenapi_driver.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
index 4b522c0..82af6f8 100644
--- a/src/xenapi/xenapi_driver.c
+++ b/src/xenapi/xenapi_driver.c
@@ -437,7 +437,8 @@ xenapiConnectGetCapabilities(virConnectPtr conn)
virCapsPtr caps = ((struct _xenapiPrivate *)(conn->privateData))->caps;
if (caps) {
char *xml = virCapabilitiesFormatXML(caps);
- if (!xml) goto cleanup;
+ if (!xml)
+ goto cleanup;
return xml;
}
cleanup:
--
1.8.1.2
11 years, 1 month
[libvirt] [PATCH] virsh: Fix job watching when STDIN is not a tty
by Peter Krempa
In commit b46c4787dde79b015dad67dedda4ccf6ff1a3082 I changed the code to
watch long running jobs in virsh. Unfortunately I didn't take into
account that poll may get a hangup if the terminal is not a TTY and will
be closed.
This patch avoids polling the STDIN fd when there's no TTY.
---
tools/virsh-domain.c | 7 ++++++-
tools/virsh.c | 7 +++++++
tools/virsh.h | 2 ++
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index b75f331..5aabccd 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -3529,6 +3529,7 @@ vshWatchJob(vshControl *ctl,
bool functionReturn = false;
sigset_t sigmask, oldsigmask;
bool jobStarted = false;
+ nfds_t npollfd = 2;
sigemptyset(&sigmask);
sigaddset(&sigmask, SIGINT);
@@ -3539,9 +3540,13 @@ vshWatchJob(vshControl *ctl,
sigemptyset(&sig_action.sa_mask);
sigaction(SIGINT, &sig_action, &old_sig_action);
+ /* don't poll on STDIN if we are not using a terminal */
+ if (!vshTTYAvailable(ctl))
+ npollfd = 1;
+
GETTIMEOFDAY(&start);
while (1) {
- ret = poll((struct pollfd *)&pollfd, 2, 500);
+ ret = poll((struct pollfd *)&pollfd, npollfd, 500);
if (ret > 0) {
if (pollfd[1].revents & POLLIN &&
saferead(STDIN_FILENO, &retchar, sizeof(retchar)) > 0) {
diff --git a/tools/virsh.c b/tools/virsh.c
index a76229a..8425f53 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -2226,6 +2226,13 @@ vshTTYIsInterruptCharacter(vshControl *ctl ATTRIBUTE_UNUSED,
}
+bool
+vshTTYAvailable(vshControl *ctl)
+{
+ return ctl->istty;
+}
+
+
int
vshTTYDisableInterrupt(vshControl *ctl ATTRIBUTE_UNUSED)
{
diff --git a/tools/virsh.h b/tools/virsh.h
index f978d94..b843788 100644
--- a/tools/virsh.h
+++ b/tools/virsh.h
@@ -365,6 +365,8 @@ bool vshTTYIsInterruptCharacter(vshControl *ctl, const char chr);
int vshTTYDisableInterrupt(vshControl *ctl);
int vshTTYRestore(vshControl *ctl);
int vshTTYMakeRaw(vshControl *ctl, bool report_errors);
+bool vshTTYAvailable(vshControl *ctl);
+
/* allocation wrappers */
void *_vshMalloc(vshControl *ctl, size_t sz, const char *filename, int line);
--
1.8.3.2
11 years, 1 month
[libvirt] [PATCH] Also undef WITH_GNUTLS_GCRYPT
by Guido Günther
If we disallow gnutls we need to disallow gcrypt to since
WITH_GNUTLS_GCRYPT only works with WITH_GNUTLS per configure.ac.
Othwise we fail to build .libs/libvirt_setuid_rpc_client_la-libvirt.o
like:
libvirt.c:314:15: error: variable 'virTLSThreadImpl' has initializer but incomplete type
static struct gcry_thread_cbs virTLSThreadImpl = {
^
libvirt.c:319:5: error: 'GCRY_THREAD_OPTION_PTHREAD' undeclared here (not in a function)
GCRY_THREAD_OPTION_PTHREAD,
^
...and so on. See:
http://honk.sigxcpu.org:8001/job/libvirt-build/1769/console
---
config-post.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/config-post.h b/config-post.h
index d371e8c..8367200 100644
--- a/config-post.h
+++ b/config-post.h
@@ -34,6 +34,7 @@
# undef WITH_CURL
# undef WITH_DTRACE_PROBES
# undef WITH_GNUTLS
+# undef WITH_GNUTLS_GCRYPT
# undef WITH_MACVTAP
# undef WITH_NUMACTL
# undef WITH_SASL
--
1.8.4.rc3
11 years, 1 month
[libvirt] [PATCH] Get rid of shadowed booleans
by Michal Privoznik
There are still two places where we are using 1bit width unsigned
integer to store a boolean. There's no real need for this and these
occurrences can be replaced with 'bool'.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/conf/interface_conf.h | 4 ++--
src/rpc/virnetserver.c | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/conf/interface_conf.h b/src/conf/interface_conf.h
index 4857822..0e22575 100644
--- a/src/conf/interface_conf.h
+++ b/src/conf/interface_conf.h
@@ -164,7 +164,7 @@ typedef virInterfaceObj *virInterfaceObjPtr;
struct _virInterfaceObj {
virMutex lock;
- unsigned int active:1; /* 1 if interface is active (up) */
+ bool active; /* true if interface is active (up) */
virInterfaceDefPtr def; /* The interface definition */
};
@@ -175,7 +175,7 @@ struct _virInterfaceObjList {
virInterfaceObjPtr *objs;
};
-static inline int
+static inline bool
virInterfaceObjIsActive(const virInterfaceObj *iface)
{
return iface->active;
diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c
index 2306e10..8907768 100644
--- a/src/rpc/virnetserver.c
+++ b/src/rpc/virnetserver.c
@@ -95,7 +95,7 @@ struct _virNetServer {
unsigned int keepaliveCount;
bool keepaliveRequired;
- unsigned int quit :1;
+ bool quit;
#ifdef WITH_GNUTLS
virNetTLSContextPtr tls;
@@ -1035,7 +1035,7 @@ static void virNetServerAutoShutdownTimer(int timerid ATTRIBUTE_UNUSED,
if (!srv->autoShutdownInhibitions) {
VIR_DEBUG("Automatic shutdown triggered");
- srv->quit = 1;
+ srv->quit = true;
}
virObjectUnlock(srv);
@@ -1074,7 +1074,7 @@ void virNetServerRun(virNetServerPtr srv)
virNetServerMDNSStart(srv->mdns) < 0)
goto cleanup;
- srv->quit = 0;
+ srv->quit = false;
if (srv->autoShutdownTimeout &&
(timerid = virEventAddTimeout(-1,
@@ -1162,7 +1162,7 @@ void virNetServerQuit(virNetServerPtr srv)
virObjectLock(srv);
VIR_DEBUG("Quit requested %p", srv);
- srv->quit = 1;
+ srv->quit = true;
virObjectUnlock(srv);
}
--
1.8.1.5
11 years, 1 month