[libvirt] [PATCH] maint: formatting cleanups in buf.c
by Eric Blake
* src/util/buf.c: Use consistent formatting.
---
Pushing under the trivial rule.
src/util/buf.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/util/buf.c b/src/util/buf.c
index e5a6ab7..e5406da 100644
--- a/src/util/buf.c
+++ b/src/util/buf.c
@@ -106,8 +106,8 @@ virBufferGetIndent(const virBufferPtr buf, bool dynamic)
/**
* virBufferGrow:
- * @buf: the buffer
- * @len: the minimum free size to allocate on top of existing used space
+ * @buf: the buffer
+ * @len: the minimum free size to allocate on top of existing used space
*
* Grow the available space of a buffer to at least @len bytes.
*
@@ -282,8 +282,8 @@ virBufferUse(const virBufferPtr buf)
/**
* virBufferAsprintf:
* @buf: the buffer to append to
- * @format: the format
- * @...: the variable list of arguments
+ * @format: the format
+ * @...: the variable list of arguments
*
* Do a formatted print to an XML buffer. Auto indentation may be applied.
*/
@@ -299,8 +299,8 @@ virBufferAsprintf(virBufferPtr buf, const char *format, ...)
/**
* virBufferVasprintf:
* @buf: the buffer to append to
- * @format: the format
- * @argptr: the variable list of arguments
+ * @format: the format
+ * @argptr: the variable list of arguments
*
* Do a formatted print to an XML buffer. Auto indentation may be applied.
*/
@@ -458,7 +458,7 @@ virBufferEscapeSexpr(virBufferPtr buf,
virBufferEscape(buf, '\\', "\\'", format, str);
}
-/* Work around spurious strchr() diagnostics given by -Wlogical-op *
+/* Work around spurious strchr() diagnostics given by -Wlogical-op
* for gcc < 4.6. Doing it via a local pragma keeps the damage
* smaller than disabling it on the package level. Unfortunately, the
* affected GCCs don't allow diagnostic push/pop which would have
@@ -522,7 +522,7 @@ virBufferEscape(virBufferPtr buf, char escape, const char *toescape,
/**
* virBufferURIEncodeString:
* @buf: the buffer to append to
- * @str: the string argument which will be URI-encoded
+ * @str: the string argument which will be URI-encoded
*
* Append the string to the buffer. The string will be URI-encoded
* during the append (ie any non alpha-numeric characters are replaced
@@ -630,7 +630,7 @@ virBufferEscapeShell(virBufferPtr buf, const char *str)
/**
* virBufferStrcat:
* @buf: the buffer to append to
- * @...: the variable list of strings, the last argument must be NULL
+ * @...: the variable list of strings, the last argument must be NULL
*
* Concatenate strings to an XML buffer. Auto indentation may be applied
* after each string argument.
--
1.8.0.2
12 years
[libvirt] [PATCH] build: make broken -Wlogical-op test be gcc-only
by Eric Blake
Commit 8b8fcdea introduced a check for broken gcc -Wlogical-op,
but did not guard the check against non-gcc compilers, which might
lead to spurious failures when another compiler encounters an
unknown pragma. Additionally, all of our compiler warning logic
should belong in a single file, and use cache variables to allow
overriding the decision at configure time if necessary.
* configure.ac (BROKEN_GCC_WLOGICALOP): Move...
* m4/virt-compile-warnings.m4 (LIBVIRT_COMPILE_WARNINGS): ...here,
and update to modern autoconf idioms.
---
Fixes the issues mentioned here:
https://www.redhat.com/archives/libvir-list/2012-December/msg01197.html
https://www.redhat.com/archives/libvir-list/2012-December/msg01211.html
configure.ac | 23 -----------------------
m4/virt-compile-warnings.m4 | 22 ++++++++++++++++++++++
2 files changed, 22 insertions(+), 23 deletions(-)
diff --git a/configure.ac b/configure.ac
index 20caa92..3c97e4f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -255,29 +255,6 @@ AC_CHECK_TYPE([struct ifreq],
#include <net/if.h>
]])
-dnl Check whether strchr(s, char variable) causes a bogus compile warning
-dnl which is the case with a certain range of GCC versions
-AC_MSG_CHECKING([whether GCC -Wlogical-op is broken])
-
-save_CFLAGS="$CFLAGS"
-CFLAGS="-O2 -Wlogical-op -Werror"
-
-AC_TRY_COMPILE([#include <string.h>],
- [const char *haystack;
- char needle;
- return strchr(haystack, needle) == haystack;],
- [gcc_false_strchr_warning=no],
- [gcc_false_strchr_warning=yes])
-
-CFLAGS="$save_CFLAGS"
-
-if test "x$gcc_false_strchr_warning" = xyes; then
- AC_DEFINE_UNQUOTED([BROKEN_GCC_WLOGICALOP], 1,
- [GCC -Wlogical-op is reporting false positive on strchr])
-fi
-
-AC_MSG_RESULT([$gcc_false_strchr_warning])
-
dnl Our only use of libtasn1.h is in the testsuite, and can be skipped
dnl if the header is not present. Assume -ltasn1 is present if the
dnl header could be found.
diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4
index 4a0f289..a08fcac 100644
--- a/m4/virt-compile-warnings.m4
+++ b/m4/virt-compile-warnings.m4
@@ -95,6 +95,22 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
dontwarn="$dontwarn -Wmissing-declarations"
fi
+ dnl Check whether strchr(s, char variable) causes a bogus compile
+ dnl warning, which is the case with GCC < 4.6 on some glibc
+ AC_CACHE_CHECK([whether GCC -Wlogical-op gives bogus warnings],
+ [lv_cv_gcc_wlogical_op_broken], [
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="-O2 -Wlogical-op -Werror"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ #include <string.h>
+ ]], [[
+ const char *haystack;
+ char needle;
+ return strchr(haystack, needle) == haystack;]])],
+ [lv_cv_gcc_wlogical_op_broken=no],
+ [lv_cv_gcc_wlogical_op_broken=yes])
+ CFLAGS="$save_CFLAGS"])
+
# We might fundamentally need some of these disabled forever, but
# ideally we'd turn many of them on
dontwarn="$dontwarn -Wfloat-equal"
@@ -196,4 +212,10 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
WARN_PYTHON_CFLAGS=$WARN_CFLAGS
AC_SUBST(WARN_PYTHON_CFLAGS)
WARN_CFLAGS=$save_WARN_CFLAGS
+
+ if test "$gl_cv_warn_c__Wlogical_op" = yes &&
+ test "$lv_cv_gcc_wlogical_op_broken" = yes; then
+ AC_DEFINE_UNQUOTED([BROKEN_GCC_WLOGICALOP], 1,
+ [Define to 1 if gcc -Wlogical-op reports false positives on strchr])
+ fi
])
--
1.8.0.2
12 years
[libvirt] [PATCH] build: use strchr now that we can work around broken gcc
by Eric Blake
Revert the complex workaround of commit 39d91e9, now that we have
a nicer framework for shutting up broken gcc.
* src/util/buf.c (virBufferEscape): Simplify.
---
src/util/buf.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/util/buf.c b/src/util/buf.c
index 030dc97..e5a6ab7 100644
--- a/src/util/buf.c
+++ b/src/util/buf.c
@@ -458,2 +458,2 @@ virBufferEscapeSexpr(virBufferPtr buf,
virBufferEscape(buf, '\\', "\\'", format, str);
}
+/* Work around spurious strchr() diagnostics given by -Wlogical-op
+ * for gcc < 4.6. Doing it via a local pragma keeps the damage
+ * smaller than disabling it on the package level. Unfortunately, the
+ * affected GCCs don't allow diagnostic push/pop which would have
+ * further reduced the impact. */
+#if BROKEN_GCC_WLOGICALOP
+# pragma GCC diagnostic ignored "-Wlogical-op"
+#endif
+
/**
* virBufferEscape:
* @buf: the buffer to append to
@@ -499,11 +508,7 @@ virBufferEscape(virBufferPtr buf, char escape, const char *toescape,
cur = str;
out = escaped;
while (*cur != 0) {
- /* strchr work-around for gcc 4.3 & 4.4 bug with -Wlogical-op
- * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36513
- */
- char needle[2] = { *cur, 0 };
- if (strstr(toescape, needle))
+ if (strchr(toescape, *cur))
*out++ = escape;
*out++ = *cur;
cur++;
--
1.8.0.2
12 years
[libvirt] [PATCH] build: Check for broken GCC -Wlogical-op was too optimistic
by Viktor Mihajlovski
The check for a broken GCC -Wlogical-op implemententation
was written under the wrong assumption that unknown warning
options would be gracefully ignored.
Thanks to Eric Blake and Daniel Berrange for pointing that
out.
Signed-off-by: Viktor Mihajlovski <mihajlov(a)linux.vnet.ibm.com>
---
configure.ac | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 20caa92..828ae01 100644
--- a/configure.ac
+++ b/configure.ac
@@ -260,7 +260,13 @@ dnl which is the case with a certain range of GCC versions
AC_MSG_CHECKING([whether GCC -Wlogical-op is broken])
save_CFLAGS="$CFLAGS"
-CFLAGS="-O2 -Wlogical-op -Werror"
+for w_opt in $WARN_CFLAGS; do
+ case $w_opt in
+ "-Wlogical-op" | "-Werror" )
+ CFLAGS="$CFLAGS $w_opt"
+ ;;
+ esac
+done
AC_TRY_COMPILE([#include <string.h>],
[const char *haystack;
--
1.7.9.5
12 years
[libvirt] virtulazation error
by Gangadahr Jena
hi every one when i am start windows os using virtual macine manager on redhat
6 os it showing this type of error-Error starting domain: unsupported
configuration: Only PCI device addresses with function=0 are supported with this
QEMU binary
12 years
[libvirt] [PATCH 0/2] FreeBSD: nodeinfo support and CPU affinity stubs
by Roman Bogorodskiy
With this set of changes it's now possible to connect
to libvirtd using virsh and start/shutdown domains with
the obvious limitation that networking is not supported at
this point.
CPU affinity most likely could be implemented using
cpu_setaffinity(2) and cpu_getaffinity(2) on FreeBSD,
but networking support looks more important now.
Roman Bogorodskiy (2):
FreeBSD: add nodeinfo support.
FreeBSD: stub out CPU affinity functions.
src/nodeinfo.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++-
src/util/processinfo.c | 22 +++++++++++++++
2 files changed, 96 insertions(+), 1 deletion(-)
--
1.8.0
12 years
[libvirt] [PATCHv3 0/3] sysinfo: s390 bug fix and tests
by Viktor Mihajlovski
Primarily this fixes a memory issue in virSysinfoRead on s390.
As a side effect it became necessary to work around a GCC
bug.
Finally I have followed Daniel Berrange's suggestion to provide
tests for sysinfo.
V2:
Turned single patch into series
V3:
Fixed -Werror induced build break with current GCC
Viktor Mihajlovski (3):
build: Check for broken GCC -Wlogical-op in configure
S390: Fix virSysinfoRead memory corruption
tests: Add tests for sysinfo
cfg.mk | 2 +-
configure.ac | 23 ++++
src/libvirt_private.syms | 1 +
src/util/sysinfo.c | 195 +++++++++++++++++----------------
tests/Makefile.am | 6 +
tests/sysinfodata/dmidecode.sh | 3 +
tests/sysinfodata/s390cpuinfo.data | 12 ++
tests/sysinfodata/s390sysinfo.data | 114 +++++++++++++++++++
tests/sysinfodata/s390sysinfo.expect | 25 +++++
tests/sysinfodata/x86sysinfo.data | 83 ++++++++++++++
tests/sysinfodata/x86sysinfo.expect | 53 +++++++++
tests/sysinfotest.c | 200 ++++++++++++++++++++++++++++++++++
12 files changed, 622 insertions(+), 95 deletions(-)
create mode 100755 tests/sysinfodata/dmidecode.sh
create mode 100644 tests/sysinfodata/s390cpuinfo.data
create mode 100644 tests/sysinfodata/s390sysinfo.data
create mode 100644 tests/sysinfodata/s390sysinfo.expect
create mode 100644 tests/sysinfodata/x86sysinfo.data
create mode 100644 tests/sysinfodata/x86sysinfo.expect
create mode 100644 tests/sysinfotest.c
--
1.7.9.5
12 years
[libvirt] [RFC] Support for qemu's virtio-rng
by Peter Krempa
Commit 16c915ba42b45df7a64a6908287f03bfa3764bed in the qemu.git tree
introduced support for emulating a virtio-rng device used to pass-through
entropy to the guests.
Qemu provides two backends to gather entropy from:
1) Default chardev backend
This backend supports reading non-blocking character devices that provide
entropy such as /dev/random (by default) or others according to
configuration.
This backend also supports basic rate limiting of the entropy read from
the source. Unfortunately as the rate limiting is done just on a per-guest
basis this cannot protect the host from being starved of entropy by
multiple guests although their individual rates are limited.
2) EGD backend
This backend uses the EGD protocol to communicate with a daemon that
servers entropy.
The EGD protocol is a simple protocol that was introduced by the entropy
gathering daemon (a substitute for /dev/random on machines that don't
support it). This protocol can be used for centralized management of
entropy allocation to the hosts.
This by itself isn't really useful as implementations of EGD daemons are
trying to create the entropy instead of using available sources and
multiplexing/rate-limiting them. For this functionality we will (probably)
need a separate server to serve the entropy to the guests but more on this
topic later.
To represent the configuration of the virtio-rng device to the guest I propose
the following domain XML snipped to be used:
For the first use case I propose:
<domain>
[...]
<devices>
[...]
<rng model='virtio'>
<rate bytes='1024' period='1000'/>
<source type='char'>/dev/urandom</source>
-- or --
<source type='char'/>
-- for the default source --
</rng>
</devices>
</domain>
For the EGD backend used manually (without any managed server) I propose:
<rng model='virtio'>
<rate bytes='1024' period='1000'/>
<source type='egd'>
<remote type='unix'>/path/to/socket</remote>
-- or --
<remote type='tcp' port='12345'>host.addr</remote>
-- optionally or even more options, but they don't seem useful
</source>
</rng>
Now these solutions are mere envelopes on top of the qemu functionality and
don't really let us do any advanced configuration or management and they don't
protect the host or guests by themselves from starving others from entropy.
The solution for the problem described above is to have a central point where
guests can request entropy and this central point will do all the rate
limiting. To do this we will need to add a daemon that will talk the EGD
protocol. This daemon will need to read entropy on request from the kernel
software entropy device (/dev/random) or possibly a hardware RNG and
distribute it to the hosts.
To enable concurrent access and avoid starvation the daemon will implement a
"shaping protocol" based on the hierarchical token bucket approach used to
rate-limit network flows. For implementation details on this one I'll send a
separate RFC.
To allow configuration of the groups and sources I propose to create a
separate driver with infrastructure similar to the network driver. This will
allow to start multiple entropy distribution daemons with different sources
and define the hierarchical classes to allow guest grouping.
With this infrastructure you will be able to specify the rng device as
follows:
<rng model='virtio'>
<source type='pool' pool='default'>classname</source>
</rng>
This will auto-configure all parameters according to the configuration of the
pool and ensure that te guest gets classified correctly.
As the start I'll implement the two basic options and then I'll propose
another RFC how I will approach the second part more closely.
Peter
12 years
[libvirt] [PATCH] Add smartcard support to libvirt-gconfig
by alexl@redhat.com
From: Alexander Larsson <alexl(a)redhat.com>
This handles <smartcard> devices.
---
libvirt-gconfig/Makefile.am | 8 ++
.../libvirt-gconfig-domain-device-private.h | 3 +
libvirt-gconfig/libvirt-gconfig-domain-device.c | 2 +-
...rt-gconfig-domain-smartcard-host-certificates.c | 124 +++++++++++++++++++++
...rt-gconfig-domain-smartcard-host-certificates.h | 74 ++++++++++++
.../libvirt-gconfig-domain-smartcard-host.c | 75 +++++++++++++
.../libvirt-gconfig-domain-smartcard-host.h | 67 +++++++++++
.../libvirt-gconfig-domain-smartcard-passthrough.c | 116 +++++++++++++++++++
.../libvirt-gconfig-domain-smartcard-passthrough.h | 70 ++++++++++++
libvirt-gconfig/libvirt-gconfig-domain-smartcard.c | 90 +++++++++++++++
libvirt-gconfig/libvirt-gconfig-domain-smartcard.h | 67 +++++++++++
libvirt-gconfig/libvirt-gconfig.h | 4 +
libvirt-gconfig/libvirt-gconfig.sym | 21 ++++
13 files changed, 720 insertions(+), 1 deletion(-)
create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-smartcard-host-certificates.c
create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-smartcard-host-certificates.h
create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-smartcard-host.c
create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-smartcard-host.h
create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-smartcard-passthrough.c
create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-smartcard-passthrough.h
create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-smartcard.c
create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-smartcard.h
diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
index 507e733..6b3b2cb 100644
--- a/libvirt-gconfig/Makefile.am
+++ b/libvirt-gconfig/Makefile.am
@@ -54,6 +54,10 @@ GCONFIG_HEADER_FILES = \
libvirt-gconfig-domain-redirdev.h \
libvirt-gconfig-domain-seclabel.h \
libvirt-gconfig-domain-serial.h \
+ libvirt-gconfig-domain-smartcard.h \
+ libvirt-gconfig-domain-smartcard-host.h \
+ libvirt-gconfig-domain-smartcard-host-certificates.h \
+ libvirt-gconfig-domain-smartcard-passthrough.h \
libvirt-gconfig-domain-snapshot.h \
libvirt-gconfig-domain-sound.h \
libvirt-gconfig-domain-timer.h \
@@ -127,6 +131,10 @@ GCONFIG_SOURCE_FILES = \
libvirt-gconfig-domain-redirdev.c \
libvirt-gconfig-domain-seclabel.c \
libvirt-gconfig-domain-serial.c \
+ libvirt-gconfig-domain-smartcard.c \
+ libvirt-gconfig-domain-smartcard-host.c \
+ libvirt-gconfig-domain-smartcard-host-certificates.c \
+ libvirt-gconfig-domain-smartcard-passthrough.c \
libvirt-gconfig-domain-snapshot.c \
libvirt-gconfig-domain-sound.c \
libvirt-gconfig-domain-timer.c \
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-device-private.h b/libvirt-gconfig/libvirt-gconfig-domain-device-private.h
index 3ec83c3..d8ac47f 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-device-private.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain-device-private.h
@@ -45,6 +45,9 @@ gvir_config_domain_graphics_new_from_tree(GVirConfigXmlDoc *doc,
GVirConfigDomainDevice *
gvir_config_domain_interface_new_from_tree(GVirConfigXmlDoc *doc,
xmlNodePtr tree);
+GVirConfigDomainDevice *
+gvir_config_domain_smartcard_new_from_tree(GVirConfigXmlDoc *doc,
+ xmlNodePtr tree);
G_END_DECLS
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-device.c b/libvirt-gconfig/libvirt-gconfig-domain-device.c
index 60d6bcc..e3dbe8d 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-device.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-device.c
@@ -72,7 +72,7 @@ gvir_config_domain_device_new_from_tree(GVirConfigXmlDoc *doc,
} else if (xmlStrEqual(tree->name, (xmlChar*)"redirdev")) {
type = GVIR_CONFIG_TYPE_DOMAIN_REDIRDEV;
} else if (xmlStrEqual(tree->name, (xmlChar*)"smartcard")) {
- goto unimplemented;
+ return gvir_config_domain_smartcard_new_from_tree(doc, tree);
} else if (xmlStrEqual(tree->name, (xmlChar*)"interface")) {
return gvir_config_domain_interface_new_from_tree(doc, tree);
} else if (xmlStrEqual(tree->name, (xmlChar*)"input")) {
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-smartcard-host-certificates.c b/libvirt-gconfig/libvirt-gconfig-domain-smartcard-host-certificates.c
new file mode 100644
index 0000000..c013be7
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-smartcard-host-certificates.c
@@ -0,0 +1,124 @@
+/*
+ * libvirt-gconfig-domain-smartcard-host-certificates.c: libvirt domain smartcard host-certificates configuration
+ *
+ * Copyright (C) 2012 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Alexander Larsson <alexl(a)redhat.com>
+ */
+
+#include <config.h>
+
+#include "libvirt-gconfig/libvirt-gconfig.h"
+#include "libvirt-gconfig/libvirt-gconfig-private.h"
+
+#define GVIR_CONFIG_DOMAIN_SMARTCARD_HOST_CERTIFICATES_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_CONFIG_TYPE_DOMAIN_SMARTCARD_HOST_CERTIFICATES, GVirConfigDomainSmartcardHostCertificatesPrivate))
+
+struct _GVirConfigDomainSmartcardHostCertificatesPrivate
+{
+ gboolean unused;
+};
+
+G_DEFINE_TYPE(GVirConfigDomainSmartcardHostCertificates, gvir_config_domain_smartcard_host_certificates, GVIR_CONFIG_TYPE_DOMAIN_SMARTCARD);
+
+
+static void gvir_config_domain_smartcard_host_certificates_class_init(GVirConfigDomainSmartcardHostCertificatesClass *klass)
+{
+ g_type_class_add_private(klass, sizeof(GVirConfigDomainSmartcardHostCertificatesPrivate));
+}
+
+
+static void gvir_config_domain_smartcard_host_certificates_init(GVirConfigDomainSmartcardHostCertificates *smartcard)
+{
+ g_debug("Init GVirConfigDomainSmartcardHostCertificates=%p", smartcard);
+
+ smartcard->priv = GVIR_CONFIG_DOMAIN_SMARTCARD_HOST_CERTIFICATES_GET_PRIVATE(smartcard);
+}
+
+
+GVirConfigDomainSmartcardHostCertificates *gvir_config_domain_smartcard_host_certificates_new(void)
+{
+ GVirConfigObject *object;
+
+ object = gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_SMARTCARD_HOST_CERTIFICATES,
+ "smartcard", NULL);
+ gvir_config_object_set_attribute(object, "mode", "host-certificates", NULL);
+ return GVIR_CONFIG_DOMAIN_SMARTCARD_HOST_CERTIFICATES(object);
+}
+
+GVirConfigDomainSmartcardHostCertificates *gvir_config_domain_smartcard_host_certificates_new_from_xml(const gchar *xml,
+ GError **error)
+{
+ GVirConfigObject *object;
+
+ object = gvir_config_object_new_from_xml(GVIR_CONFIG_TYPE_DOMAIN_SMARTCARD_HOST_CERTIFICATES,
+ "smartcard", NULL, xml, error);
+ if (g_strcmp0(gvir_config_object_get_attribute(object, NULL, "mode"), "host-certificates") != 0) {
+ g_object_unref(G_OBJECT(object));
+ return NULL;
+ }
+ return GVIR_CONFIG_DOMAIN_SMARTCARD_HOST_CERTIFICATES(object);
+}
+
+/**
+ * gvir_config_domain_smartcard_host_certificates_set_database:
+ * @path: (allow-none):
+ */
+void
+gvir_config_domain_smartcard_host_certificates_set_database (GVirConfigDomainSmartcardHostCertificates *smartcard,
+ const char *path)
+{
+ g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_SMARTCARD_HOST_CERTIFICATES(smartcard));
+
+ gvir_config_object_set_node_content(GVIR_CONFIG_OBJECT(smartcard),
+ "database", path);
+}
+
+/**
+ * gvir_config_domain_smartcard_host_certificates_set_certificates:
+ * @cert1: (allow-none):
+ * @cert2: (allow-none):
+ * @cert3: (allow-none):
+ */
+void
+gvir_config_domain_smartcard_host_certificates_set_certificates (GVirConfigDomainSmartcardHostCertificates *smartcard,
+ const char *cert1,
+ const char *cert2,
+ const char *cert3)
+{
+ GVirConfigObject *child;
+
+ g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_SMARTCARD_HOST_CERTIFICATES(smartcard));
+
+ gvir_config_object_delete_children(GVIR_CONFIG_OBJECT(smartcard),
+ "certificate", NULL);
+
+ if (cert1 == NULL)
+ return;
+
+ child = gvir_config_object_add_child(GVIR_CONFIG_OBJECT(smartcard), "certificate");
+ gvir_config_object_set_node_content(GVIR_CONFIG_OBJECT(smartcard), NULL, cert1);
+ g_object_unref(G_OBJECT(child));
+
+ child = gvir_config_object_add_child(GVIR_CONFIG_OBJECT(smartcard), "certificate");
+ gvir_config_object_set_node_content(GVIR_CONFIG_OBJECT(smartcard), NULL, cert2);
+ g_object_unref(G_OBJECT(child));
+
+ child = gvir_config_object_add_child(GVIR_CONFIG_OBJECT(smartcard), "certificate");
+ gvir_config_object_set_node_content(GVIR_CONFIG_OBJECT(smartcard), NULL, cert3);
+ g_object_unref(G_OBJECT(child));
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-smartcard-host-certificates.h b/libvirt-gconfig/libvirt-gconfig-domain-smartcard-host-certificates.h
new file mode 100644
index 0000000..3d370e3
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-smartcard-host-certificates.h
@@ -0,0 +1,74 @@
+/*
+ * libvirt-gconfig-domain-smartcard-host-certificates.h: libvirt domain smartcard host-certificates configuration
+ *
+ * Copyright (C) 2012 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Alexander Larsson <alexl(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_SMARTCARD_HOST_CERTIFICATES_H__
+#define __LIBVIRT_GCONFIG_DOMAIN_SMARTCARD_HOST_CERTIFICATES_H__
+
+G_BEGIN_DECLS
+
+#define GVIR_CONFIG_TYPE_DOMAIN_SMARTCARD_HOST_CERTIFICATES (gvir_config_domain_smartcard_host_certificates_get_type ())
+#define GVIR_CONFIG_DOMAIN_SMARTCARD_HOST_CERTIFICATES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_CONFIG_TYPE_DOMAIN_SMARTCARD_HOST_CERTIFICATES, GVirConfigDomainSmartcardHostCertificates))
+#define GVIR_CONFIG_DOMAIN_SMARTCARD_HOST_CERTIFICATES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_CONFIG_TYPE_DOMAIN_SMARTCARD_HOST_CERTIFICATES, GVirConfigDomainSmartcardHostCertificatesClass))
+#define GVIR_CONFIG_IS_DOMAIN_SMARTCARD_HOST_CERTIFICATES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_CONFIG_TYPE_DOMAIN_SMARTCARD_HOST_CERTIFICATES))
+#define GVIR_CONFIG_IS_DOMAIN_SMARTCARD_HOST_CERTIFICATES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_CONFIG_TYPE_DOMAIN_SMARTCARD_HOST_CERTIFICATES))
+#define GVIR_CONFIG_DOMAIN_SMARTCARD_HOST_CERTIFICATES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_CONFIG_TYPE_DOMAIN_SMARTCARD_HOST_CERTIFICATES, GVirConfigDomainSmartcardHostCertificatesClass))
+
+typedef struct _GVirConfigDomainSmartcardHostCertificates GVirConfigDomainSmartcardHostCertificates;
+typedef struct _GVirConfigDomainSmartcardHostCertificatesPrivate GVirConfigDomainSmartcardHostCertificatesPrivate;
+typedef struct _GVirConfigDomainSmartcardHostCertificatesClass GVirConfigDomainSmartcardHostCertificatesClass;
+
+struct _GVirConfigDomainSmartcardHostCertificates
+{
+ GVirConfigDomainSmartcard parent;
+
+ GVirConfigDomainSmartcardHostCertificatesPrivate *priv;
+
+ /* Do not add fields to this struct */
+};
+
+struct _GVirConfigDomainSmartcardHostCertificatesClass
+{
+ GVirConfigDomainSmartcardClass parent_class;
+
+ gpointer padding[20];
+};
+
+GType gvir_config_domain_smartcard_host_certificates_get_type(void);
+
+GVirConfigDomainSmartcardHostCertificates *gvir_config_domain_smartcard_host_certificates_new(void);
+GVirConfigDomainSmartcardHostCertificates *gvir_config_domain_smartcard_host_certificates_new_from_xml(const gchar *xml,
+ GError **error);
+
+void gvir_config_domain_smartcard_host_certificates_set_database (GVirConfigDomainSmartcardHostCertificates *smartcard,
+ const char *path);
+void gvir_config_domain_smartcard_host_certificates_set_certificates (GVirConfigDomainSmartcardHostCertificates *smartcard,
+ const char *cert1,
+ const char *cert2,
+ const char *cert3);
+
+G_END_DECLS
+
+#endif /* __LIBVIRT_GCONFIG_DOMAIN_SMARTCARD_HOST_CERTIFICATES_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-smartcard-host.c b/libvirt-gconfig/libvirt-gconfig-domain-smartcard-host.c
new file mode 100644
index 0000000..035c291
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-smartcard-host.c
@@ -0,0 +1,75 @@
+/*
+ * libvirt-gconfig-domain-smartcard-host.c: libvirt domain smartcard host configuration
+ *
+ * Copyright (C) 2012 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Alexander Larsson <alexl(a)redhat.com>
+ */
+
+#include <config.h>
+
+#include "libvirt-gconfig/libvirt-gconfig.h"
+#include "libvirt-gconfig/libvirt-gconfig-private.h"
+
+#define GVIR_CONFIG_DOMAIN_SMARTCARD_HOST_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_CONFIG_TYPE_DOMAIN_SMARTCARD_HOST, GVirConfigDomainSmartcardHostPrivate))
+
+struct _GVirConfigDomainSmartcardHostPrivate
+{
+ gboolean unused;
+};
+
+G_DEFINE_TYPE(GVirConfigDomainSmartcardHost, gvir_config_domain_smartcard_host, GVIR_CONFIG_TYPE_DOMAIN_SMARTCARD);
+
+
+static void gvir_config_domain_smartcard_host_class_init(GVirConfigDomainSmartcardHostClass *klass)
+{
+ g_type_class_add_private(klass, sizeof(GVirConfigDomainSmartcardHostPrivate));
+}
+
+
+static void gvir_config_domain_smartcard_host_init(GVirConfigDomainSmartcardHost *smartcard)
+{
+ g_debug("Init GVirConfigDomainSmartcardHost=%p", smartcard);
+
+ smartcard->priv = GVIR_CONFIG_DOMAIN_SMARTCARD_HOST_GET_PRIVATE(smartcard);
+}
+
+
+GVirConfigDomainSmartcardHost *gvir_config_domain_smartcard_host_new(void)
+{
+ GVirConfigObject *object;
+
+ object = gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_SMARTCARD_HOST,
+ "smartcard", NULL);
+ gvir_config_object_set_attribute(object, "mode", "host", NULL);
+ return GVIR_CONFIG_DOMAIN_SMARTCARD_HOST(object);
+}
+
+GVirConfigDomainSmartcardHost *gvir_config_domain_smartcard_host_new_from_xml(const gchar *xml,
+ GError **error)
+{
+ GVirConfigObject *object;
+
+ object = gvir_config_object_new_from_xml(GVIR_CONFIG_TYPE_DOMAIN_SMARTCARD_HOST,
+ "smartcard", NULL, xml, error);
+ if (g_strcmp0(gvir_config_object_get_attribute(object, NULL, "mode"), "host") != 0) {
+ g_object_unref(G_OBJECT(object));
+ return NULL;
+ }
+ return GVIR_CONFIG_DOMAIN_SMARTCARD_HOST(object);
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-smartcard-host.h b/libvirt-gconfig/libvirt-gconfig-domain-smartcard-host.h
new file mode 100644
index 0000000..f1dcba2
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-smartcard-host.h
@@ -0,0 +1,67 @@
+/*
+ * libvirt-gconfig-domain-smartcard-host.h: libvirt domain smartcard host configuration
+ *
+ * Copyright (C) 2012 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Alexander Larsson <alexl(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_SMARTCARD_HOST_H__
+#define __LIBVIRT_GCONFIG_DOMAIN_SMARTCARD_HOST_H__
+
+G_BEGIN_DECLS
+
+#define GVIR_CONFIG_TYPE_DOMAIN_SMARTCARD_HOST (gvir_config_domain_smartcard_host_get_type ())
+#define GVIR_CONFIG_DOMAIN_SMARTCARD_HOST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_CONFIG_TYPE_DOMAIN_SMARTCARD_HOST, GVirConfigDomainSmartcardHost))
+#define GVIR_CONFIG_DOMAIN_SMARTCARD_HOST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_CONFIG_TYPE_DOMAIN_SMARTCARD_HOST, GVirConfigDomainSmartcardHostClass))
+#define GVIR_CONFIG_IS_DOMAIN_SMARTCARD_HOST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_CONFIG_TYPE_DOMAIN_SMARTCARD_HOST))
+#define GVIR_CONFIG_IS_DOMAIN_SMARTCARD_HOST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_CONFIG_TYPE_DOMAIN_SMARTCARD_HOST))
+#define GVIR_CONFIG_DOMAIN_SMARTCARD_HOST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_CONFIG_TYPE_DOMAIN_SMARTCARD_HOST, GVirConfigDomainSmartcardHostClass))
+
+typedef struct _GVirConfigDomainSmartcardHost GVirConfigDomainSmartcardHost;
+typedef struct _GVirConfigDomainSmartcardHostPrivate GVirConfigDomainSmartcardHostPrivate;
+typedef struct _GVirConfigDomainSmartcardHostClass GVirConfigDomainSmartcardHostClass;
+
+struct _GVirConfigDomainSmartcardHost
+{
+ GVirConfigDomainSmartcard parent;
+
+ GVirConfigDomainSmartcardHostPrivate *priv;
+
+ /* Do not add fields to this struct */
+};
+
+struct _GVirConfigDomainSmartcardHostClass
+{
+ GVirConfigDomainSmartcardClass parent_class;
+
+ gpointer padding[20];
+};
+
+GType gvir_config_domain_smartcard_host_get_type(void);
+
+GVirConfigDomainSmartcardHost *gvir_config_domain_smartcard_host_new(void);
+GVirConfigDomainSmartcardHost *gvir_config_domain_smartcard_host_new_from_xml(const gchar *xml,
+ GError **error);
+
+G_END_DECLS
+
+#endif /* __LIBVIRT_GCONFIG_DOMAIN_SMARTCARD_HOST_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-smartcard-passthrough.c b/libvirt-gconfig/libvirt-gconfig-domain-smartcard-passthrough.c
new file mode 100644
index 0000000..10fd460
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-smartcard-passthrough.c
@@ -0,0 +1,116 @@
+/*
+ * libvirt-gconfig-domain-smartcard-passthrough.c: libvirt domain smartcard passthrough configuration
+ *
+ * Copyright (C) 2012 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Alexander Larsson <alexl(a)redhat.com>
+ */
+
+#include <config.h>
+
+#include "libvirt-gconfig/libvirt-gconfig.h"
+#include "libvirt-gconfig/libvirt-gconfig-private.h"
+
+#define GVIR_CONFIG_DOMAIN_SMARTCARD_PASSTHROUGH_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_CONFIG_TYPE_DOMAIN_SMARTCARD_PASSTHROUGH, GVirConfigDomainSmartcardPassthroughPrivate))
+
+struct _GVirConfigDomainSmartcardPassthroughPrivate
+{
+ gboolean unused;
+};
+
+G_DEFINE_TYPE(GVirConfigDomainSmartcardPassthrough, gvir_config_domain_smartcard_passthrough, GVIR_CONFIG_TYPE_DOMAIN_SMARTCARD);
+
+
+static void gvir_config_domain_smartcard_passthrough_class_init(GVirConfigDomainSmartcardPassthroughClass *klass)
+{
+ g_type_class_add_private(klass, sizeof(GVirConfigDomainSmartcardPassthroughPrivate));
+}
+
+
+static void gvir_config_domain_smartcard_passthrough_init(GVirConfigDomainSmartcardPassthrough *smartcard)
+{
+ g_debug("Init GVirConfigDomainSmartcardPassthrough=%p", smartcard);
+
+ smartcard->priv = GVIR_CONFIG_DOMAIN_SMARTCARD_PASSTHROUGH_GET_PRIVATE(smartcard);
+}
+
+
+GVirConfigDomainSmartcardPassthrough *gvir_config_domain_smartcard_passthrough_new(void)
+{
+ GVirConfigObject *object;
+
+ object = gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_SMARTCARD_PASSTHROUGH,
+ "smartcard", NULL);
+ gvir_config_object_set_attribute(object, "mode", "passthrough", NULL);
+ return GVIR_CONFIG_DOMAIN_SMARTCARD_PASSTHROUGH(object);
+}
+
+GVirConfigDomainSmartcardPassthrough *gvir_config_domain_smartcard_passthrough_new_from_xml(const gchar *xml,
+ GError **error)
+{
+ GVirConfigObject *object;
+
+ object = gvir_config_object_new_from_xml(GVIR_CONFIG_TYPE_DOMAIN_SMARTCARD_PASSTHROUGH,
+ "smartcard", NULL, xml, error);
+ if (g_strcmp0(gvir_config_object_get_attribute(object, NULL, "mode"), "passthrough") != 0) {
+ g_object_unref(G_OBJECT(object));
+ return NULL;
+ }
+ return GVIR_CONFIG_DOMAIN_SMARTCARD_PASSTHROUGH(object);
+}
+
+
+static void prepend_prop(xmlNodePtr node, xmlAttrPtr prop)
+{
+ if (node->properties == NULL) {
+ node->properties = prop;
+ } else {
+ prop->next = node->properties;
+ node->properties->prev = prop;
+ node->properties = prop;
+ }
+}
+
+void
+gvir_config_domain_smartcard_passthrough_set_source(GVirConfigDomainSmartcardPassthrough *smartcard,
+ GVirConfigDomainChardevSource *source)
+{
+ xmlNodePtr smartcard_node;
+ xmlNodePtr source_node;
+ xmlNodePtr child;
+ xmlAttrPtr attr;
+
+ g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_SMARTCARD_PASSTHROUGH(smartcard));
+ g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_CHARDEV_SOURCE(source));
+
+ smartcard_node = gvir_config_object_get_xml_node(GVIR_CONFIG_OBJECT(smartcard));
+ source_node = gvir_config_object_get_xml_node(GVIR_CONFIG_OBJECT(source));
+
+ g_return_if_fail((smartcard_node != NULL) && (source_node != NULL));
+
+ for (child = source_node->children; child != NULL; child = child->next) {
+ xmlUnlinkNode(child);
+ xmlAddChild(smartcard_node, child);
+ }
+
+ for (attr = source_node->properties; attr != NULL; attr = attr->next) {
+ xmlAttrPtr new_attr;
+ new_attr = xmlCopyProp(smartcard_node, attr);
+ prepend_prop(smartcard_node, new_attr);
+ }
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-smartcard-passthrough.h b/libvirt-gconfig/libvirt-gconfig-domain-smartcard-passthrough.h
new file mode 100644
index 0000000..c2bd50c
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-smartcard-passthrough.h
@@ -0,0 +1,70 @@
+/*
+ * libvirt-gconfig-domain-smartcard-passthrough.h: libvirt domain smartcard passthrough configuration
+ *
+ * Copyright (C) 2012 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Alexander Larsson <alexl(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_SMARTCARD_PASSTHROUGH_H__
+#define __LIBVIRT_GCONFIG_DOMAIN_SMARTCARD_PASSTHROUGH_H__
+
+G_BEGIN_DECLS
+
+#define GVIR_CONFIG_TYPE_DOMAIN_SMARTCARD_PASSTHROUGH (gvir_config_domain_smartcard_passthrough_get_type ())
+#define GVIR_CONFIG_DOMAIN_SMARTCARD_PASSTHROUGH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_CONFIG_TYPE_DOMAIN_SMARTCARD_PASSTHROUGH, GVirConfigDomainSmartcardPassthrough))
+#define GVIR_CONFIG_DOMAIN_SMARTCARD_PASSTHROUGH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_CONFIG_TYPE_DOMAIN_SMARTCARD_PASSTHROUGH, GVirConfigDomainSmartcardPassthroughClass))
+#define GVIR_CONFIG_IS_DOMAIN_SMARTCARD_PASSTHROUGH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_CONFIG_TYPE_DOMAIN_SMARTCARD_PASSTHROUGH))
+#define GVIR_CONFIG_IS_DOMAIN_SMARTCARD_PASSTHROUGH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_CONFIG_TYPE_DOMAIN_SMARTCARD_PASSTHROUGH))
+#define GVIR_CONFIG_DOMAIN_SMARTCARD_PASSTHROUGH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_CONFIG_TYPE_DOMAIN_SMARTCARD_PASSTHROUGH, GVirConfigDomainSmartcardPassthroughClass))
+
+typedef struct _GVirConfigDomainSmartcardPassthrough GVirConfigDomainSmartcardPassthrough;
+typedef struct _GVirConfigDomainSmartcardPassthroughPrivate GVirConfigDomainSmartcardPassthroughPrivate;
+typedef struct _GVirConfigDomainSmartcardPassthroughClass GVirConfigDomainSmartcardPassthroughClass;
+
+struct _GVirConfigDomainSmartcardPassthrough
+{
+ GVirConfigDomainSmartcard parent;
+
+ GVirConfigDomainSmartcardPassthroughPrivate *priv;
+
+ /* Do not add fields to this struct */
+};
+
+struct _GVirConfigDomainSmartcardPassthroughClass
+{
+ GVirConfigDomainSmartcardClass parent_class;
+
+ gpointer padding[20];
+};
+
+GType gvir_config_domain_smartcard_passthrough_get_type(void);
+
+GVirConfigDomainSmartcardPassthrough *gvir_config_domain_smartcard_passthrough_new(void);
+GVirConfigDomainSmartcardPassthrough *gvir_config_domain_smartcard_passthrough_new_from_xml(const gchar *xml,
+ GError **error);
+void gvir_config_domain_smartcard_passthrough_set_source(GVirConfigDomainSmartcardPassthrough *smartcard,
+ GVirConfigDomainChardevSource *source);
+
+
+G_END_DECLS
+
+#endif /* __LIBVIRT_GCONFIG_DOMAIN_SMARTCARD_PASSTHROUGH_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-smartcard.c b/libvirt-gconfig/libvirt-gconfig-domain-smartcard.c
new file mode 100644
index 0000000..73ea867
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-smartcard.c
@@ -0,0 +1,90 @@
+/*
+ * libvirt-gconfig-domain-smartcard.c: libvirt domain smartcard configuration
+ *
+ * Copyright (C) 2012 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Alexander Larsson <alexl(a)redhat.com>
+ */
+
+#include <config.h>
+
+#include "libvirt-gconfig/libvirt-gconfig.h"
+#include "libvirt-gconfig/libvirt-gconfig-private.h"
+
+#define GVIR_CONFIG_DOMAIN_SMARTCARD_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_CONFIG_TYPE_DOMAIN_SMARTCARD, GVirConfigDomainSmartcardPrivate))
+
+struct _GVirConfigDomainSmartcardPrivate
+{
+ gboolean unused;
+};
+
+G_DEFINE_ABSTRACT_TYPE(GVirConfigDomainSmartcard, gvir_config_domain_smartcard, GVIR_CONFIG_TYPE_DOMAIN_DEVICE);
+
+
+static void gvir_config_domain_smartcard_class_init(GVirConfigDomainSmartcardClass *klass)
+{
+ g_type_class_add_private(klass, sizeof(GVirConfigDomainSmartcardPrivate));
+}
+
+
+static void gvir_config_domain_smartcard_init(GVirConfigDomainSmartcard *smartcard)
+{
+ g_debug("Init GVirConfigDomainSmartcard=%p", smartcard);
+
+ smartcard->priv = GVIR_CONFIG_DOMAIN_SMARTCARD_GET_PRIVATE(smartcard);
+}
+
+/**
+ * gvir_config_domain_smartcard_set_address:
+ * @address: (allow-none):
+ */
+void gvir_config_domain_smartcard_set_address(GVirConfigDomainRedirdev *redirdev,
+ GVirConfigDomainAddress *address)
+{
+ g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_REDIRDEV(redirdev));
+ g_return_if_fail(address == NULL || GVIR_CONFIG_IS_DOMAIN_ADDRESS(address));
+
+ gvir_config_object_attach_replace(GVIR_CONFIG_OBJECT(redirdev),
+ "address",
+ GVIR_CONFIG_OBJECT(address));
+}
+
+G_GNUC_INTERNAL GVirConfigDomainDevice *
+gvir_config_domain_smartcard_new_from_tree(GVirConfigXmlDoc *doc,
+ xmlNodePtr tree)
+{
+ const char *mode;
+ GType gtype;
+
+ mode = gvir_config_xml_get_attribute_content(tree, "mode");
+ if (mode == NULL)
+ return NULL;
+
+ if (g_str_equal(mode, "host")) {
+ gtype = GVIR_CONFIG_TYPE_DOMAIN_SMARTCARD_HOST;
+ } else if (g_str_equal(mode, "host-certificates")) {
+ gtype = GVIR_CONFIG_TYPE_DOMAIN_SMARTCARD_HOST_CERTIFICATES;
+ } else if (g_str_equal(mode, "passthrough")) {
+ gtype = GVIR_CONFIG_TYPE_DOMAIN_SMARTCARD_PASSTHROUGH;
+ } else {
+ g_debug("Unknown domain smartcard node: %s", mode);
+ return NULL;
+ }
+
+ return GVIR_CONFIG_DOMAIN_DEVICE(gvir_config_object_new_from_tree(gtype, doc, NULL, tree));
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-smartcard.h b/libvirt-gconfig/libvirt-gconfig-domain-smartcard.h
new file mode 100644
index 0000000..5136b02
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-smartcard.h
@@ -0,0 +1,67 @@
+/*
+ * libvirt-gconfig-domain-smartcard.h: libvirt domain smartcard configuration
+ *
+ * Copyright (C) 2012 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Alexander Larsson <alexl(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_SMARTCARD_H__
+#define __LIBVIRT_GCONFIG_DOMAIN_SMARTCARD_H__
+
+G_BEGIN_DECLS
+
+#define GVIR_CONFIG_TYPE_DOMAIN_SMARTCARD (gvir_config_domain_smartcard_get_type ())
+#define GVIR_CONFIG_DOMAIN_SMARTCARD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_CONFIG_TYPE_DOMAIN_SMARTCARD, GVirConfigDomainSmartcard))
+#define GVIR_CONFIG_DOMAIN_SMARTCARD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_CONFIG_TYPE_DOMAIN_SMARTCARD, GVirConfigDomainSmartcardClass))
+#define GVIR_CONFIG_IS_DOMAIN_SMARTCARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_CONFIG_TYPE_DOMAIN_SMARTCARD))
+#define GVIR_CONFIG_IS_DOMAIN_SMARTCARD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_CONFIG_TYPE_DOMAIN_SMARTCARD))
+#define GVIR_CONFIG_DOMAIN_SMARTCARD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_CONFIG_TYPE_DOMAIN_SMARTCARD, GVirConfigDomainSmartcardClass))
+
+typedef struct _GVirConfigDomainSmartcard GVirConfigDomainSmartcard;
+typedef struct _GVirConfigDomainSmartcardPrivate GVirConfigDomainSmartcardPrivate;
+typedef struct _GVirConfigDomainSmartcardClass GVirConfigDomainSmartcardClass;
+
+struct _GVirConfigDomainSmartcard
+{
+ GVirConfigDomainDevice parent;
+
+ GVirConfigDomainSmartcardPrivate *priv;
+
+ /* Do not add fields to this struct */
+};
+
+struct _GVirConfigDomainSmartcardClass
+{
+ GVirConfigDomainDeviceClass parent_class;
+
+ gpointer padding[20];
+};
+
+
+GType gvir_config_domain_smartcard_get_type(void);
+
+void gvir_config_domain_smartcard_set_address(GVirConfigDomainRedirdev *redirdev,
+ GVirConfigDomainAddress *address);
+
+G_END_DECLS
+
+#endif /* __LIBVIRT_GCONFIG_DOMAIN_SMARTCARD_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig.h b/libvirt-gconfig/libvirt-gconfig.h
index 0428259..9feaba2 100644
--- a/libvirt-gconfig/libvirt-gconfig.h
+++ b/libvirt-gconfig/libvirt-gconfig.h
@@ -71,6 +71,10 @@
#include <libvirt-gconfig/libvirt-gconfig-domain-redirdev.h>
#include <libvirt-gconfig/libvirt-gconfig-domain-seclabel.h>
#include <libvirt-gconfig/libvirt-gconfig-domain-serial.h>
+#include <libvirt-gconfig/libvirt-gconfig-domain-smartcard.h>
+#include <libvirt-gconfig/libvirt-gconfig-domain-smartcard-host.h>
+#include <libvirt-gconfig/libvirt-gconfig-domain-smartcard-host-certificates.h>
+#include <libvirt-gconfig/libvirt-gconfig-domain-smartcard-passthrough.h>
#include <libvirt-gconfig/libvirt-gconfig-domain-snapshot.h>
#include <libvirt-gconfig/libvirt-gconfig-domain-sound.h>
#include <libvirt-gconfig/libvirt-gconfig-domain-timer.h>
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index 622e0f2..d9cff90 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -483,4 +483,25 @@ LIBVIRT_GCONFIG_0.1.4 {
gvir_config_domain_set_power_management;
} LIBVIRT_GCONFIG_0.1.3;
+LIBVIRT_GCONFIG_0.1.5 {
+ global:
+ gvir_config_domain_smartcard_get_type;
+ gvir_config_domain_smartcard_set_address;
+
+ gvir_config_domain_smartcard_host_get_type;
+ gvir_config_domain_smartcard_host_new;
+ gvir_config_domain_smartcard_host_new_from_xml;
+
+ gvir_config_domain_smartcard_host_certificates_get_type;
+ gvir_config_domain_smartcard_host_certificates_new;
+ gvir_config_domain_smartcard_host_certificates_new_from_xml;
+ gvir_config_domain_smartcard_host_certificates_set_database;
+ gvir_config_domain_smartcard_host_certificates_set_certificates;
+
+ gvir_config_domain_smartcard_passthrough_get_type;
+ gvir_config_domain_smartcard_passthrough_new;
+ gvir_config_domain_smartcard_passthrough_new_from_xml;
+ gvir_config_domain_smartcard_passthrough_set_source;
+} LIBVIRT_GCONFIG_0.1.4;
+
# .... define new API here using predicted next version number ....
--
1.8.0.1
12 years
[libvirt] [PATCH] Fix arch datatype in vahControl in virt-aa-helper.c
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
When changing to virArch, the virt-aa-helper.c file was not
completely changed. The vahControl struct was left with a
char *arch field, instead of virArch arch field.
Pushed as a build breaker fix
---
src/security/virt-aa-helper.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index c07e69d..16ce7f3 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -72,7 +72,7 @@ typedef struct {
virDomainDefPtr def; /* VM definition */
virCapsPtr caps; /* VM capabilities */
char *hvm; /* type of hypervisor (eg hvm, xen) */
- char *arch; /* machine architecture */
+ virArch arch; /* machine architecture */
char *newfile; /* newly added file */
bool append; /* append to .files instead of rewrite */
} vahControl;
@@ -87,7 +87,6 @@ vahDeinit(vahControl * ctl)
virCapabilitiesFree(ctl->caps);
VIR_FREE(ctl->files);
VIR_FREE(ctl->hvm);
- VIR_FREE(ctl->arch);
VIR_FREE(ctl->newfile);
return 0;
--
1.7.11.7
12 years