mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
Remove backslash alignment attempts
Right-aligning backslashes when defining macros or using complex commands in Makefiles looks cute, but as soon as any changes is required to the code you end up with either distractingly broken alignment or unnecessarily big diffs where most of the changes are just pushing all backslashes a few characters to one side. Generated using $ git grep -El '[[:blank:]][[:blank:]]\\$' | \ grep -E '*\.([chx]|am|mk)$$' | \ while read f; do \ sed -Ei 's/[[:blank:]]*[[:blank:]]\\$/ \\/g' "$f"; \ done Signed-off-by: Andrea Bolognani <abologna@redhat.com>
This commit is contained in:
parent
a92c4f7537
commit
3e7db8d3e8
10
Makefile.am
10
Makefile.am
@ -97,11 +97,11 @@ dist-hook: gen-ChangeLog gen-AUTHORS
|
||||
gen_start_date = 2009-07-04
|
||||
.PHONY: gen-ChangeLog
|
||||
gen-ChangeLog:
|
||||
$(AM_V_GEN)if test -d .git; then \
|
||||
$(top_srcdir)/build-aux/gitlog-to-changelog \
|
||||
--since=$(gen_start_date) > $(distdir)/cl-t; \
|
||||
rm -f $(distdir)/ChangeLog; \
|
||||
mv $(distdir)/cl-t $(distdir)/ChangeLog; \
|
||||
$(AM_V_GEN)if test -d .git; then \
|
||||
$(top_srcdir)/build-aux/gitlog-to-changelog \
|
||||
--since=$(gen_start_date) > $(distdir)/cl-t; \
|
||||
rm -f $(distdir)/ChangeLog; \
|
||||
mv $(distdir)/cl-t $(distdir)/ChangeLog; \
|
||||
fi
|
||||
|
||||
.PHONY: gen-AUTHORS
|
||||
|
@ -17,7 +17,7 @@
|
||||
#
|
||||
# Generated by running the following on Fedora 26:
|
||||
#
|
||||
# nm -D --defined-only /lib64/libc.so.6 \
|
||||
# nm -D --defined-only /lib64/libc.so.6 \
|
||||
# | grep '_r$' \
|
||||
# | awk '{print $3}' \
|
||||
# | grep -v __ \
|
||||
|
@ -86,7 +86,7 @@
|
||||
* When __GNUC_PREREQ is not defined, gnulib defines it to 0, which breaks things.
|
||||
*/
|
||||
#ifndef __GNUC_PREREQ
|
||||
# define __GNUC_PREREQ(maj, min) \
|
||||
# define __GNUC_PREREQ(maj, min) \
|
||||
((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
|
||||
#endif
|
||||
|
||||
|
@ -33,17 +33,17 @@ CLEANFILES =
|
||||
|
||||
WARN_CFLAGS += $(STRICT_FRAME_LIMIT_CFLAGS)
|
||||
|
||||
DAEMON_GENERATED = \
|
||||
remote_dispatch.h \
|
||||
lxc_dispatch.h \
|
||||
qemu_dispatch.h \
|
||||
admin_dispatch.h \
|
||||
DAEMON_GENERATED = \
|
||||
remote_dispatch.h \
|
||||
lxc_dispatch.h \
|
||||
qemu_dispatch.h \
|
||||
admin_dispatch.h \
|
||||
$(NULL)
|
||||
|
||||
DAEMON_SOURCES = \
|
||||
libvirtd.c libvirtd.h \
|
||||
remote.c remote.h \
|
||||
stream.c stream.h \
|
||||
DAEMON_SOURCES = \
|
||||
libvirtd.c libvirtd.h \
|
||||
remote.c remote.h \
|
||||
stream.c stream.h \
|
||||
$(DAEMON_GENERATED)
|
||||
|
||||
LIBVIRTD_CONF_SOURCES = libvirtd-config.c libvirtd-config.h
|
||||
@ -57,33 +57,33 @@ MANINFILES = \
|
||||
$(NULL)
|
||||
|
||||
DISTCLEANFILES =
|
||||
EXTRA_DIST = \
|
||||
remote_dispatch.h \
|
||||
lxc_dispatch.h \
|
||||
qemu_dispatch.h \
|
||||
admin_dispatch.h \
|
||||
libvirtd.conf \
|
||||
libvirtd.init.in \
|
||||
libvirtd.upstart \
|
||||
libvirtd.policy.in \
|
||||
libvirt.rules \
|
||||
libvirtd.sasl \
|
||||
libvirtd.service.in \
|
||||
virt-guest-shutdown.target \
|
||||
libvirtd.sysconf \
|
||||
libvirtd.sysctl \
|
||||
libvirtd.aug \
|
||||
libvirtd.logrotate.in \
|
||||
libvirtd.qemu.logrotate.in \
|
||||
libvirtd.lxc.logrotate.in \
|
||||
libvirtd.libxl.logrotate.in \
|
||||
libvirtd.uml.logrotate.in \
|
||||
test_libvirtd.aug.in \
|
||||
THREADS.txt \
|
||||
$(PODFILES) \
|
||||
$(MANINFILES) \
|
||||
$(DAEMON_SOURCES) \
|
||||
$(LIBVIRTD_CONF_SOURCES) \
|
||||
EXTRA_DIST = \
|
||||
remote_dispatch.h \
|
||||
lxc_dispatch.h \
|
||||
qemu_dispatch.h \
|
||||
admin_dispatch.h \
|
||||
libvirtd.conf \
|
||||
libvirtd.init.in \
|
||||
libvirtd.upstart \
|
||||
libvirtd.policy.in \
|
||||
libvirt.rules \
|
||||
libvirtd.sasl \
|
||||
libvirtd.service.in \
|
||||
virt-guest-shutdown.target \
|
||||
libvirtd.sysconf \
|
||||
libvirtd.sysctl \
|
||||
libvirtd.aug \
|
||||
libvirtd.logrotate.in \
|
||||
libvirtd.qemu.logrotate.in \
|
||||
libvirtd.lxc.logrotate.in \
|
||||
libvirtd.libxl.logrotate.in \
|
||||
libvirtd.uml.logrotate.in \
|
||||
test_libvirtd.aug.in \
|
||||
THREADS.txt \
|
||||
$(PODFILES) \
|
||||
$(MANINFILES) \
|
||||
$(DAEMON_SOURCES) \
|
||||
$(LIBVIRTD_CONF_SOURCES) \
|
||||
$(NULL)
|
||||
|
||||
BUILT_SOURCES =
|
||||
@ -128,11 +128,11 @@ libvirtd_conf_la_CFLAGS = \
|
||||
$(WARN_CFLAGS) $(PIE_CFLAGS) \
|
||||
$(COVERAGE_CFLAGS) \
|
||||
$(NULL)
|
||||
libvirtd_conf_la_LDFLAGS = \
|
||||
$(RELRO_LDFLAGS) \
|
||||
$(PIE_LDFLAGS) \
|
||||
$(COVERAGE_LDFLAGS) \
|
||||
$(NO_INDIRECT_LDFLAGS) \
|
||||
libvirtd_conf_la_LDFLAGS = \
|
||||
$(RELRO_LDFLAGS) \
|
||||
$(PIE_LDFLAGS) \
|
||||
$(COVERAGE_LDFLAGS) \
|
||||
$(NO_INDIRECT_LDFLAGS) \
|
||||
$(NULL)
|
||||
libvirtd_conf_la_LIBADD = $(LIBXML_LIBS)
|
||||
|
||||
@ -141,20 +141,20 @@ libvirtd_admin_la_SOURCES = \
|
||||
admin.c admin.h admin_server.c admin_server.h
|
||||
|
||||
libvirtd_admin_la_CFLAGS = \
|
||||
$(AM_CFLAGS) \
|
||||
$(XDR_CFLAGS) \
|
||||
$(PIE_CFLAGS) \
|
||||
$(WARN_CFLAGS) \
|
||||
$(LIBXML_CFLAGS) \
|
||||
$(COVERAGE_CFLAGS) \
|
||||
$(AM_CFLAGS) \
|
||||
$(XDR_CFLAGS) \
|
||||
$(PIE_CFLAGS) \
|
||||
$(WARN_CFLAGS) \
|
||||
$(LIBXML_CFLAGS) \
|
||||
$(COVERAGE_CFLAGS) \
|
||||
$(NULL)
|
||||
libvirtd_admin_la_LDFLAGS = \
|
||||
$(PIE_LDFLAGS) \
|
||||
$(RELRO_LDFLAGS) \
|
||||
$(COVERAGE_LDFLAGS) \
|
||||
$(NO_INDIRECT_LDFLAGS) \
|
||||
$(PIE_LDFLAGS) \
|
||||
$(RELRO_LDFLAGS) \
|
||||
$(COVERAGE_LDFLAGS) \
|
||||
$(NO_INDIRECT_LDFLAGS) \
|
||||
$(NULL)
|
||||
libvirtd_admin_la_LIBADD = \
|
||||
libvirtd_admin_la_LIBADD = \
|
||||
../src/libvirt-admin.la
|
||||
|
||||
man8_MANS = libvirtd.8
|
||||
@ -182,18 +182,18 @@ libvirtd_CFLAGS = \
|
||||
$(COVERAGE_CFLAGS) \
|
||||
-DQEMUD_PID_FILE="\"$(QEMUD_PID_FILE)\""
|
||||
|
||||
libvirtd_LDFLAGS = \
|
||||
$(RELRO_LDFLAGS) \
|
||||
$(PIE_LDFLAGS) \
|
||||
$(COVERAGE_LDFLAGS) \
|
||||
$(NO_INDIRECT_LDFLAGS) \
|
||||
libvirtd_LDFLAGS = \
|
||||
$(RELRO_LDFLAGS) \
|
||||
$(PIE_LDFLAGS) \
|
||||
$(COVERAGE_LDFLAGS) \
|
||||
$(NO_INDIRECT_LDFLAGS) \
|
||||
$(NULL)
|
||||
|
||||
libvirtd_LDADD = \
|
||||
$(LIBXML_LIBS) \
|
||||
$(GNUTLS_LIBS) \
|
||||
$(SASL_LIBS) \
|
||||
$(DBUS_LIBS) \
|
||||
libvirtd_LDADD = \
|
||||
$(LIBXML_LIBS) \
|
||||
$(GNUTLS_LIBS) \
|
||||
$(SASL_LIBS) \
|
||||
$(DBUS_LIBS) \
|
||||
$(LIBNL_LIBS)
|
||||
|
||||
if WITH_DTRACE_PROBES
|
||||
@ -279,33 +279,33 @@ LOGROTATE_CONFS = libvirtd.qemu.logrotate libvirtd.lxc.logrotate \
|
||||
BUILT_SOURCES += $(LOGROTATE_CONFS)
|
||||
|
||||
libvirtd.logrotate: libvirtd.logrotate.in
|
||||
$(AM_V_GEN)sed \
|
||||
-e 's|[@]localstatedir[@]|$(localstatedir)|g' \
|
||||
$(AM_V_GEN)sed \
|
||||
-e 's|[@]localstatedir[@]|$(localstatedir)|g' \
|
||||
< $< > $@-t && \
|
||||
mv $@-t $@
|
||||
|
||||
libvirtd.qemu.logrotate: libvirtd.qemu.logrotate.in
|
||||
$(AM_V_GEN)sed \
|
||||
-e 's|[@]localstatedir[@]|$(localstatedir)|g' \
|
||||
$(AM_V_GEN)sed \
|
||||
-e 's|[@]localstatedir[@]|$(localstatedir)|g' \
|
||||
< $< > $@-t && \
|
||||
mv $@-t $@
|
||||
|
||||
libvirtd.lxc.logrotate: libvirtd.lxc.logrotate.in
|
||||
$(AM_V_GEN)sed \
|
||||
-e 's|[@]localstatedir[@]|$(localstatedir)|g' \
|
||||
< $< > $@-t && \
|
||||
$(AM_V_GEN)sed \
|
||||
-e 's|[@]localstatedir[@]|$(localstatedir)|g' \
|
||||
< $< > $@-t && \
|
||||
mv $@-t $@
|
||||
|
||||
libvirtd.libxl.logrotate: libvirtd.libxl.logrotate.in
|
||||
$(AM_V_GEN)sed \
|
||||
-e 's|[@]localstatedir[@]|$(localstatedir)|g' \
|
||||
< $< > $@-t && \
|
||||
$(AM_V_GEN)sed \
|
||||
-e 's|[@]localstatedir[@]|$(localstatedir)|g' \
|
||||
< $< > $@-t && \
|
||||
mv $@-t $@
|
||||
|
||||
libvirtd.uml.logrotate: libvirtd.uml.logrotate.in
|
||||
$(AM_V_GEN)sed \
|
||||
-e 's|[@]localstatedir[@]|$(localstatedir)|g' \
|
||||
< $< > $@-t && \
|
||||
$(AM_V_GEN)sed \
|
||||
-e 's|[@]localstatedir[@]|$(localstatedir)|g' \
|
||||
< $< > $@-t && \
|
||||
mv $@-t $@
|
||||
|
||||
install-logrotate: $(LOGROTATE_CONFS)
|
||||
@ -415,20 +415,20 @@ uninstall-init-systemd:
|
||||
endif ! LIBVIRT_INIT_SCRIPT_SYSTEMD
|
||||
|
||||
libvirtd.init: libvirtd.init.in $(top_builddir)/config.status
|
||||
$(AM_V_GEN)sed \
|
||||
-e 's|[@]localstatedir[@]|$(localstatedir)|g' \
|
||||
-e 's|[@]sbindir[@]|$(sbindir)|g' \
|
||||
-e 's|[@]sysconfdir[@]|$(sysconfdir)|g' \
|
||||
< $< > $@-t && \
|
||||
chmod a+x $@-t && \
|
||||
$(AM_V_GEN)sed \
|
||||
-e 's|[@]localstatedir[@]|$(localstatedir)|g' \
|
||||
-e 's|[@]sbindir[@]|$(sbindir)|g' \
|
||||
-e 's|[@]sysconfdir[@]|$(sysconfdir)|g' \
|
||||
< $< > $@-t && \
|
||||
chmod a+x $@-t && \
|
||||
mv $@-t $@
|
||||
|
||||
libvirtd.service: libvirtd.service.in $(top_builddir)/config.status
|
||||
$(AM_V_GEN)sed \
|
||||
-e 's|[@]localstatedir[@]|$(localstatedir)|g' \
|
||||
-e 's|[@]sbindir[@]|$(sbindir)|g' \
|
||||
-e 's|[@]sysconfdir[@]|$(sysconfdir)|g' \
|
||||
< $< > $@-t && \
|
||||
$(AM_V_GEN)sed \
|
||||
-e 's|[@]localstatedir[@]|$(localstatedir)|g' \
|
||||
-e 's|[@]sbindir[@]|$(sbindir)|g' \
|
||||
-e 's|[@]sysconfdir[@]|$(sysconfdir)|g' \
|
||||
< $< > $@-t && \
|
||||
mv $@-t $@
|
||||
|
||||
|
||||
|
@ -58,15 +58,15 @@
|
||||
VIR_LOG_INIT("daemon.remote");
|
||||
|
||||
#if SIZEOF_LONG < 8
|
||||
# define HYPER_TO_TYPE(_type, _to, _from) \
|
||||
do { \
|
||||
if ((_from) != (_type)(_from)) { \
|
||||
virReportError(VIR_ERR_OVERFLOW, \
|
||||
# define HYPER_TO_TYPE(_type, _to, _from) \
|
||||
do { \
|
||||
if ((_from) != (_type)(_from)) { \
|
||||
virReportError(VIR_ERR_OVERFLOW, \
|
||||
_("conversion from hyper to %s overflowed"), \
|
||||
#_type); \
|
||||
goto cleanup; \
|
||||
} \
|
||||
(_to) = (_from); \
|
||||
#_type); \
|
||||
goto cleanup; \
|
||||
} \
|
||||
(_to) = (_from); \
|
||||
} while (0)
|
||||
|
||||
# define HYPER_TO_LONG(_to, _from) HYPER_TO_TYPE(long, _to, _from)
|
||||
@ -1670,22 +1670,22 @@ void remoteRelayConnectionClosedEvent(virConnectPtr conn ATTRIBUTE_UNUSED, int r
|
||||
&msg);
|
||||
}
|
||||
|
||||
#define DEREG_CB(conn, eventCallbacks, neventCallbacks, deregFcn, name) \
|
||||
do { \
|
||||
size_t i; \
|
||||
for (i = 0; i < neventCallbacks; i++) { \
|
||||
int callbackID = eventCallbacks[i]->callbackID; \
|
||||
if (callbackID < 0) { \
|
||||
#define DEREG_CB(conn, eventCallbacks, neventCallbacks, deregFcn, name) \
|
||||
do { \
|
||||
size_t i; \
|
||||
for (i = 0; i < neventCallbacks; i++) { \
|
||||
int callbackID = eventCallbacks[i]->callbackID; \
|
||||
if (callbackID < 0) { \
|
||||
VIR_WARN("unexpected incomplete %s callback %zu", name, i); \
|
||||
continue; \
|
||||
} \
|
||||
VIR_DEBUG("Deregistering remote %s event relay %d", \
|
||||
name, callbackID); \
|
||||
eventCallbacks[i]->callbackID = -1; \
|
||||
if (deregFcn(conn, callbackID) < 0) \
|
||||
VIR_WARN("unexpected %s event deregister failure", name); \
|
||||
} \
|
||||
VIR_FREE(eventCallbacks); \
|
||||
continue; \
|
||||
} \
|
||||
VIR_DEBUG("Deregistering remote %s event relay %d", \
|
||||
name, callbackID); \
|
||||
eventCallbacks[i]->callbackID = -1; \
|
||||
if (deregFcn(conn, callbackID) < 0) \
|
||||
VIR_WARN("unexpected %s event deregister failure", name); \
|
||||
} \
|
||||
VIR_FREE(eventCallbacks); \
|
||||
} while (0);
|
||||
|
||||
/*
|
||||
|
@ -18,38 +18,38 @@
|
||||
|
||||
DEVHELP_DIR=$(datadir)/gtk-doc/html/libvirt
|
||||
|
||||
apihtml = \
|
||||
html/index.html \
|
||||
apihtml = \
|
||||
html/index.html \
|
||||
$(apihtml_generated)
|
||||
|
||||
apihtml_generated = \
|
||||
html/libvirt-libvirt-common.html \
|
||||
html/libvirt-libvirt-domain.html \
|
||||
html/libvirt-libvirt-domain-snapshot.html \
|
||||
html/libvirt-libvirt-event.html \
|
||||
html/libvirt-libvirt-host.html \
|
||||
html/libvirt-libvirt-interface.html \
|
||||
html/libvirt-libvirt-network.html \
|
||||
html/libvirt-libvirt-nodedev.html \
|
||||
html/libvirt-libvirt-nwfilter.html \
|
||||
html/libvirt-libvirt-secret.html \
|
||||
html/libvirt-libvirt-storage.html \
|
||||
html/libvirt-libvirt-stream.html \
|
||||
html/libvirt-libvirt-common.html \
|
||||
html/libvirt-libvirt-domain.html \
|
||||
html/libvirt-libvirt-domain-snapshot.html \
|
||||
html/libvirt-libvirt-event.html \
|
||||
html/libvirt-libvirt-host.html \
|
||||
html/libvirt-libvirt-interface.html \
|
||||
html/libvirt-libvirt-network.html \
|
||||
html/libvirt-libvirt-nodedev.html \
|
||||
html/libvirt-libvirt-nwfilter.html \
|
||||
html/libvirt-libvirt-secret.html \
|
||||
html/libvirt-libvirt-storage.html \
|
||||
html/libvirt-libvirt-stream.html \
|
||||
html/libvirt-virterror.html
|
||||
|
||||
apipng = \
|
||||
html/left.png \
|
||||
html/up.png \
|
||||
html/home.png \
|
||||
apipng = \
|
||||
html/left.png \
|
||||
html/up.png \
|
||||
html/home.png \
|
||||
html/right.png
|
||||
|
||||
devhelphtml = \
|
||||
devhelp/libvirt.devhelp \
|
||||
devhelp/index.html \
|
||||
devhelp/general.html \
|
||||
devhelphtml = \
|
||||
devhelp/libvirt.devhelp \
|
||||
devhelp/index.html \
|
||||
devhelp/general.html \
|
||||
devhelp/libvirt-virterror.html
|
||||
|
||||
css = \
|
||||
css = \
|
||||
generic.css \
|
||||
libvirt.css \
|
||||
mobile.css \
|
||||
@ -69,10 +69,10 @@ fonts = \
|
||||
fonts/overpass-mono-semibold.woff \
|
||||
fonts/overpass-regular.woff
|
||||
|
||||
devhelppng = \
|
||||
devhelp/home.png \
|
||||
devhelp/left.png \
|
||||
devhelp/right.png \
|
||||
devhelppng = \
|
||||
devhelp/home.png \
|
||||
devhelp/left.png \
|
||||
devhelp/right.png \
|
||||
devhelp/up.png
|
||||
|
||||
devhelpcss = devhelp/style.css
|
||||
@ -170,7 +170,7 @@ fig = \
|
||||
schemadir = $(pkgdatadir)/schemas
|
||||
schema_DATA = $(wildcard $(srcdir)/schemas/*.rng)
|
||||
|
||||
EXTRA_DIST= \
|
||||
EXTRA_DIST= \
|
||||
apibuild.py genaclperms.pl \
|
||||
site.xsl subsite.xsl newapi.xsl page.xsl \
|
||||
wrapstring.xsl \
|
||||
|
@ -52,7 +52,7 @@ domtop_domtop_SOURCES = domtop/domtop.c
|
||||
hellolibvirt_hellolibvirt_SOURCES = hellolibvirt/hellolibvirt.c
|
||||
|
||||
object_events_event_test_CFLAGS = \
|
||||
$(WARN_CFLAGS) \
|
||||
$(WARN_CFLAGS) \
|
||||
$(NULL)
|
||||
object_events_event_test_SOURCES = object-events/event-test.c
|
||||
|
||||
|
@ -39,7 +39,7 @@ static int debug;
|
||||
*
|
||||
* CC domtop.o
|
||||
*domtop.c:40:0: warning: "ERROR" redefined [enabled by default]
|
||||
* #define ERROR(...) \
|
||||
* #define ERROR(...) \
|
||||
* ^
|
||||
*In file included from /usr/i686-w64-mingw32/sys-root/mingw/include/windows.h:71:0,
|
||||
* from /usr/i686-w64-mingw32/sys-root/mingw/include/winsock2.h:23,
|
||||
@ -49,20 +49,20 @@ static int debug;
|
||||
* #define ERROR 0
|
||||
*/
|
||||
#undef ERROR
|
||||
#define ERROR(...) \
|
||||
do { \
|
||||
fprintf(stderr, "ERROR %s:%d : ", __FUNCTION__, __LINE__); \
|
||||
fprintf(stderr, __VA_ARGS__); \
|
||||
fprintf(stderr, "\n"); \
|
||||
#define ERROR(...) \
|
||||
do { \
|
||||
fprintf(stderr, "ERROR %s:%d : ", __FUNCTION__, __LINE__); \
|
||||
fprintf(stderr, __VA_ARGS__); \
|
||||
fprintf(stderr, "\n"); \
|
||||
} while (0)
|
||||
|
||||
#define DEBUG(...) \
|
||||
do { \
|
||||
if (!debug) \
|
||||
break; \
|
||||
fprintf(stderr, "DEBUG %s:%d : ", __FUNCTION__, __LINE__); \
|
||||
fprintf(stderr, __VA_ARGS__); \
|
||||
fprintf(stderr, "\n"); \
|
||||
#define DEBUG(...) \
|
||||
do { \
|
||||
if (!debug) \
|
||||
break; \
|
||||
fprintf(stderr, "DEBUG %s:%d : ", __FUNCTION__, __LINE__); \
|
||||
fprintf(stderr, __VA_ARGS__); \
|
||||
fprintf(stderr, "\n"); \
|
||||
} while (0)
|
||||
|
||||
static void
|
||||
|
@ -42,7 +42,7 @@ static bool run_top;
|
||||
*
|
||||
* CC domtop.o
|
||||
*domtop.c:40:0: warning: "ERROR" redefined [enabled by default]
|
||||
* #define ERROR(...) \
|
||||
* #define ERROR(...) \
|
||||
* ^
|
||||
*In file included from /usr/i686-w64-mingw32/sys-root/mingw/include/windows.h:71:0,
|
||||
* from /usr/i686-w64-mingw32/sys-root/mingw/include/winsock2.h:23,
|
||||
@ -52,20 +52,20 @@ static bool run_top;
|
||||
* #define ERROR 0
|
||||
*/
|
||||
#undef ERROR
|
||||
#define ERROR(...) \
|
||||
do { \
|
||||
fprintf(stderr, "ERROR %s:%d : ", __FUNCTION__, __LINE__); \
|
||||
fprintf(stderr, __VA_ARGS__); \
|
||||
fprintf(stderr, "\n"); \
|
||||
#define ERROR(...) \
|
||||
do { \
|
||||
fprintf(stderr, "ERROR %s:%d : ", __FUNCTION__, __LINE__); \
|
||||
fprintf(stderr, __VA_ARGS__); \
|
||||
fprintf(stderr, "\n"); \
|
||||
} while (0)
|
||||
|
||||
#define DEBUG(...) \
|
||||
do { \
|
||||
if (!debug) \
|
||||
break; \
|
||||
fprintf(stderr, "DEBUG %s:%d : ", __FUNCTION__, __LINE__); \
|
||||
fprintf(stderr, __VA_ARGS__); \
|
||||
fprintf(stderr, "\n"); \
|
||||
#define DEBUG(...) \
|
||||
do { \
|
||||
if (!debug) \
|
||||
break; \
|
||||
fprintf(stderr, "DEBUG %s:%d : ", __FUNCTION__, __LINE__); \
|
||||
fprintf(stderr, __VA_ARGS__); \
|
||||
fprintf(stderr, "\n"); \
|
||||
} while (0)
|
||||
|
||||
#define STREQ(a, b) (strcmp(a, b) == 0)
|
||||
|
@ -1053,7 +1053,7 @@ struct domainEventData {
|
||||
};
|
||||
|
||||
|
||||
#define DOMAIN_EVENT(event, callback) \
|
||||
#define DOMAIN_EVENT(event, callback) \
|
||||
{event, -1, VIR_DOMAIN_EVENT_CALLBACK(callback), #event}
|
||||
|
||||
struct domainEventData domainEvents[] = {
|
||||
@ -1091,7 +1091,7 @@ struct storagePoolEventData {
|
||||
const char *name;
|
||||
};
|
||||
|
||||
#define STORAGE_POOL_EVENT(event, callback) \
|
||||
#define STORAGE_POOL_EVENT(event, callback) \
|
||||
{event, -1, VIR_STORAGE_POOL_EVENT_CALLBACK(callback), #event}
|
||||
|
||||
struct storagePoolEventData storagePoolEvents[] = {
|
||||
@ -1106,7 +1106,7 @@ struct nodeDeviceEventData {
|
||||
const char *name;
|
||||
};
|
||||
|
||||
#define NODE_DEVICE_EVENT(event, callback) \
|
||||
#define NODE_DEVICE_EVENT(event, callback) \
|
||||
{event, -1, VIR_NODE_DEVICE_EVENT_CALLBACK(callback), #event}
|
||||
|
||||
struct nodeDeviceEventData nodeDeviceEvents[] = {
|
||||
@ -1121,7 +1121,7 @@ struct secretEventData {
|
||||
const char *name;
|
||||
};
|
||||
|
||||
#define SECRET_EVENT(event, callback) \
|
||||
#define SECRET_EVENT(event, callback) \
|
||||
{event, -1, VIR_SECRET_EVENT_CALLBACK(callback), #event}
|
||||
|
||||
struct secretEventData secretEvents[] = {
|
||||
|
1510
src/Makefile.am
1510
src/Makefile.am
File diff suppressed because it is too large
Load Diff
@ -33,8 +33,8 @@
|
||||
|
||||
VIR_LOG_INIT("access.accessdriverpolkit");
|
||||
|
||||
#define virAccessError(code, ...) \
|
||||
virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \
|
||||
#define virAccessError(code, ...) \
|
||||
virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \
|
||||
__FUNCTION__, __LINE__, __VA_ARGS__)
|
||||
|
||||
#define VIR_ACCESS_DRIVER_POLKIT_ACTION_PREFIX "org.libvirt.api"
|
||||
|
@ -36,8 +36,8 @@
|
||||
|
||||
VIR_LOG_INIT("access.accessmanager");
|
||||
|
||||
#define virAccessError(code, ...) \
|
||||
virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \
|
||||
#define virAccessError(code, ...) \
|
||||
virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \
|
||||
__FUNCTION__, __LINE__, __VA_ARGS__)
|
||||
|
||||
struct _virAccessManager {
|
||||
|
@ -847,8 +847,8 @@ virCPUDefIsEqual(virCPUDefPtr src,
|
||||
if (!src && !dst)
|
||||
return true;
|
||||
|
||||
#define MISMATCH(fmt, ...) \
|
||||
if (reportError) \
|
||||
#define MISMATCH(fmt, ...) \
|
||||
if (reportError) \
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, fmt, __VA_ARGS__)
|
||||
|
||||
if ((src && !dst) || (!src && dst)) {
|
||||
|
@ -363,26 +363,26 @@ virDomainCapsStringValuesFormat(virBufferPtr buf,
|
||||
}
|
||||
|
||||
|
||||
#define FORMAT_PROLOGUE(item) \
|
||||
do { \
|
||||
virBufferAsprintf(buf, "<" #item " supported='%s'%s\n", \
|
||||
item->supported ? "yes" : "no", \
|
||||
item->supported ? ">" : "/>"); \
|
||||
if (!item->supported) \
|
||||
return; \
|
||||
virBufferAdjustIndent(buf, 2); \
|
||||
#define FORMAT_PROLOGUE(item) \
|
||||
do { \
|
||||
virBufferAsprintf(buf, "<" #item " supported='%s'%s\n", \
|
||||
item->supported ? "yes" : "no", \
|
||||
item->supported ? ">" : "/>"); \
|
||||
if (!item->supported) \
|
||||
return; \
|
||||
virBufferAdjustIndent(buf, 2); \
|
||||
} while (0)
|
||||
|
||||
#define FORMAT_EPILOGUE(item) \
|
||||
do { \
|
||||
virBufferAdjustIndent(buf, -2); \
|
||||
virBufferAddLit(buf, "</" #item ">\n"); \
|
||||
#define FORMAT_EPILOGUE(item) \
|
||||
do { \
|
||||
virBufferAdjustIndent(buf, -2); \
|
||||
virBufferAddLit(buf, "</" #item ">\n"); \
|
||||
} while (0)
|
||||
|
||||
#define ENUM_PROCESS(master, capsEnum, valToStr) \
|
||||
do { \
|
||||
virDomainCapsEnumFormat(buf, &master->capsEnum, \
|
||||
#capsEnum, valToStr); \
|
||||
#define ENUM_PROCESS(master, capsEnum, valToStr) \
|
||||
do { \
|
||||
virDomainCapsEnumFormat(buf, &master->capsEnum, \
|
||||
#capsEnum, valToStr); \
|
||||
} while (0)
|
||||
|
||||
|
||||
|
@ -184,12 +184,12 @@ virDomainCapsCPUModelsGet(virDomainCapsCPUModelsPtr cpuModels,
|
||||
const char *name);
|
||||
|
||||
|
||||
# define VIR_DOMAIN_CAPS_ENUM_SET(capsEnum, ...) \
|
||||
do { \
|
||||
unsigned int __values[] = {__VA_ARGS__}; \
|
||||
size_t __nvalues = ARRAY_CARDINALITY(__values); \
|
||||
virDomainCapsEnumSet(&(capsEnum), #capsEnum, \
|
||||
__nvalues, __values); \
|
||||
# define VIR_DOMAIN_CAPS_ENUM_SET(capsEnum, ...) \
|
||||
do { \
|
||||
unsigned int __values[] = {__VA_ARGS__}; \
|
||||
size_t __nvalues = ARRAY_CARDINALITY(__values); \
|
||||
virDomainCapsEnumSet(&(capsEnum), #capsEnum, \
|
||||
__nvalues, __values); \
|
||||
} while (0)
|
||||
|
||||
int virDomainCapsEnumSet(virDomainCapsEnumPtr capsEnum,
|
||||
|
@ -85,9 +85,9 @@ struct _virDomainXMLOption {
|
||||
virSaveCookieCallbacks saveCookie;
|
||||
};
|
||||
|
||||
#define VIR_DOMAIN_DEF_FORMAT_COMMON_FLAGS \
|
||||
(VIR_DOMAIN_DEF_FORMAT_SECURE | \
|
||||
VIR_DOMAIN_DEF_FORMAT_INACTIVE | \
|
||||
#define VIR_DOMAIN_DEF_FORMAT_COMMON_FLAGS \
|
||||
(VIR_DOMAIN_DEF_FORMAT_SECURE | \
|
||||
VIR_DOMAIN_DEF_FORMAT_INACTIVE | \
|
||||
VIR_DOMAIN_DEF_FORMAT_MIGRATABLE)
|
||||
|
||||
VIR_ENUM_IMPL(virDomainTaint, VIR_DOMAIN_TAINT_LAST,
|
||||
@ -8604,12 +8604,12 @@ virDomainDiskBackingStoreParse(xmlXPathContextPtr ctxt,
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define PARSE_IOTUNE(val) \
|
||||
if (virXPathULongLong("string(./iotune/" #val ")", \
|
||||
ctxt, &def->blkdeviotune.val) == -2) { \
|
||||
virReportError(VIR_ERR_XML_ERROR, \
|
||||
_("disk iotune field '%s' must be an integer"), #val); \
|
||||
return -1; \
|
||||
#define PARSE_IOTUNE(val) \
|
||||
if (virXPathULongLong("string(./iotune/" #val ")", \
|
||||
ctxt, &def->blkdeviotune.val) == -2) { \
|
||||
virReportError(VIR_ERR_XML_ERROR, \
|
||||
_("disk iotune field '%s' must be an integer"), #val); \
|
||||
return -1; \
|
||||
}
|
||||
|
||||
static int
|
||||
@ -22348,10 +22348,10 @@ virDomainDiskBackingStoreFormat(virBufferPtr buf,
|
||||
}
|
||||
|
||||
|
||||
#define FORMAT_IOTUNE(val) \
|
||||
if (def->blkdeviotune.val) { \
|
||||
virBufferAsprintf(buf, "<" #val ">%llu</" #val ">\n", \
|
||||
def->blkdeviotune.val); \
|
||||
#define FORMAT_IOTUNE(val) \
|
||||
if (def->blkdeviotune.val) { \
|
||||
virBufferAsprintf(buf, "<" #val ">%llu</" #val ">\n", \
|
||||
def->blkdeviotune.val); \
|
||||
}
|
||||
|
||||
static int
|
||||
@ -27946,23 +27946,23 @@ virDomainGetBlkioParametersAssignFromDef(virDomainDefPtr def,
|
||||
char *data = NULL;
|
||||
size_t i;
|
||||
|
||||
#define VIR_BLKIO_ASSIGN(param, format, name) \
|
||||
if (*nparams < maxparams) { \
|
||||
for (i = 0; i < def->blkio.ndevices; i++) { \
|
||||
if (!def->blkio.devices[i].param) \
|
||||
continue; \
|
||||
virBufferAsprintf(&buf, "%s," format ",", \
|
||||
def->blkio.devices[i].path, \
|
||||
def->blkio.devices[i].param); \
|
||||
} \
|
||||
virBufferTrim(&buf, ",", -1); \
|
||||
if (virBufferCheckError(&buf) < 0) \
|
||||
goto error; \
|
||||
data = virBufferContentAndReset(&buf); \
|
||||
if (virTypedParameterAssign(&(params[(*nparams)++]), name, \
|
||||
VIR_TYPED_PARAM_STRING, data) < 0) \
|
||||
goto error; \
|
||||
data = NULL; \
|
||||
#define VIR_BLKIO_ASSIGN(param, format, name) \
|
||||
if (*nparams < maxparams) { \
|
||||
for (i = 0; i < def->blkio.ndevices; i++) { \
|
||||
if (!def->blkio.devices[i].param) \
|
||||
continue; \
|
||||
virBufferAsprintf(&buf, "%s," format ",", \
|
||||
def->blkio.devices[i].path, \
|
||||
def->blkio.devices[i].param); \
|
||||
} \
|
||||
virBufferTrim(&buf, ",", -1); \
|
||||
if (virBufferCheckError(&buf) < 0) \
|
||||
goto error; \
|
||||
data = virBufferContentAndReset(&buf); \
|
||||
if (virTypedParameterAssign(&(params[(*nparams)++]), name, \
|
||||
VIR_TYPED_PARAM_STRING, data) < 0) \
|
||||
goto error; \
|
||||
data = NULL; \
|
||||
}
|
||||
|
||||
/* blkiotune.device_weight */
|
||||
@ -28023,7 +28023,7 @@ virDomainDiskSetBlockIOTune(virDomainDiskDefPtr disk,
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define HOSTNAME_CHARS \
|
||||
#define HOSTNAME_CHARS \
|
||||
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-"
|
||||
|
||||
static void
|
||||
|
@ -177,7 +177,7 @@ virInterfaceDefParseNode(xmlDocPtr xml,
|
||||
char *
|
||||
virInterfaceDefFormat(const virInterfaceDef *def);
|
||||
|
||||
# define VIR_CONNECT_LIST_INTERFACES_FILTERS_ACTIVE \
|
||||
# define VIR_CONNECT_LIST_INTERFACES_FILTERS_ACTIVE \
|
||||
(VIR_CONNECT_LIST_INTERFACES_ACTIVE | \
|
||||
VIR_CONNECT_LIST_INTERFACES_INACTIVE)
|
||||
|
||||
|
@ -358,19 +358,19 @@ virNetworkSetBridgeMacAddr(virNetworkDefPtr def);
|
||||
|
||||
VIR_ENUM_DECL(virNetworkForward)
|
||||
|
||||
# define VIR_CONNECT_LIST_NETWORKS_FILTERS_ACTIVE \
|
||||
# define VIR_CONNECT_LIST_NETWORKS_FILTERS_ACTIVE \
|
||||
(VIR_CONNECT_LIST_NETWORKS_ACTIVE | \
|
||||
VIR_CONNECT_LIST_NETWORKS_INACTIVE)
|
||||
|
||||
# define VIR_CONNECT_LIST_NETWORKS_FILTERS_PERSISTENT \
|
||||
# define VIR_CONNECT_LIST_NETWORKS_FILTERS_PERSISTENT \
|
||||
(VIR_CONNECT_LIST_NETWORKS_PERSISTENT | \
|
||||
VIR_CONNECT_LIST_NETWORKS_TRANSIENT)
|
||||
|
||||
# define VIR_CONNECT_LIST_NETWORKS_FILTERS_AUTOSTART \
|
||||
(VIR_CONNECT_LIST_NETWORKS_AUTOSTART | \
|
||||
# define VIR_CONNECT_LIST_NETWORKS_FILTERS_AUTOSTART \
|
||||
(VIR_CONNECT_LIST_NETWORKS_AUTOSTART | \
|
||||
VIR_CONNECT_LIST_NETWORKS_NO_AUTOSTART)
|
||||
|
||||
# define VIR_CONNECT_LIST_NETWORKS_FILTERS_ALL \
|
||||
# define VIR_CONNECT_LIST_NETWORKS_FILTERS_ALL \
|
||||
(VIR_CONNECT_LIST_NETWORKS_FILTERS_ACTIVE | \
|
||||
VIR_CONNECT_LIST_NETWORKS_FILTERS_PERSISTENT | \
|
||||
VIR_CONNECT_LIST_NETWORKS_FILTERS_AUTOSTART)
|
||||
|
@ -42,15 +42,15 @@ virSecretDefPtr virSecretDefParseString(const char *xml);
|
||||
virSecretDefPtr virSecretDefParseFile(const char *filename);
|
||||
char *virSecretDefFormat(const virSecretDef *def);
|
||||
|
||||
# define VIR_CONNECT_LIST_SECRETS_FILTERS_EPHEMERAL \
|
||||
# define VIR_CONNECT_LIST_SECRETS_FILTERS_EPHEMERAL \
|
||||
(VIR_CONNECT_LIST_SECRETS_EPHEMERAL | \
|
||||
VIR_CONNECT_LIST_SECRETS_NO_EPHEMERAL)
|
||||
|
||||
# define VIR_CONNECT_LIST_SECRETS_FILTERS_PRIVATE \
|
||||
# define VIR_CONNECT_LIST_SECRETS_FILTERS_PRIVATE \
|
||||
(VIR_CONNECT_LIST_SECRETS_PRIVATE | \
|
||||
VIR_CONNECT_LIST_SECRETS_NO_PRIVATE)
|
||||
|
||||
# define VIR_CONNECT_LIST_SECRETS_FILTERS_ALL \
|
||||
# define VIR_CONNECT_LIST_SECRETS_FILTERS_ALL \
|
||||
(VIR_CONNECT_LIST_SECRETS_FILTERS_EPHEMERAL | \
|
||||
VIR_CONNECT_LIST_SECRETS_FILTERS_PRIVATE)
|
||||
|
||||
|
@ -148,24 +148,24 @@ int virDomainSnapshotForEachDescendant(virDomainSnapshotObjPtr snapshot,
|
||||
int virDomainSnapshotUpdateRelations(virDomainSnapshotObjListPtr snapshots);
|
||||
void virDomainSnapshotDropParent(virDomainSnapshotObjPtr snapshot);
|
||||
|
||||
# define VIR_DOMAIN_SNAPSHOT_FILTERS_METADATA \
|
||||
# define VIR_DOMAIN_SNAPSHOT_FILTERS_METADATA \
|
||||
(VIR_DOMAIN_SNAPSHOT_LIST_METADATA | \
|
||||
VIR_DOMAIN_SNAPSHOT_LIST_NO_METADATA)
|
||||
|
||||
# define VIR_DOMAIN_SNAPSHOT_FILTERS_LEAVES \
|
||||
# define VIR_DOMAIN_SNAPSHOT_FILTERS_LEAVES \
|
||||
(VIR_DOMAIN_SNAPSHOT_LIST_LEAVES | \
|
||||
VIR_DOMAIN_SNAPSHOT_LIST_NO_LEAVES)
|
||||
|
||||
# define VIR_DOMAIN_SNAPSHOT_FILTERS_STATUS \
|
||||
# define VIR_DOMAIN_SNAPSHOT_FILTERS_STATUS \
|
||||
(VIR_DOMAIN_SNAPSHOT_LIST_INACTIVE | \
|
||||
VIR_DOMAIN_SNAPSHOT_LIST_ACTIVE | \
|
||||
VIR_DOMAIN_SNAPSHOT_LIST_DISK_ONLY)
|
||||
|
||||
# define VIR_DOMAIN_SNAPSHOT_FILTERS_LOCATION \
|
||||
# define VIR_DOMAIN_SNAPSHOT_FILTERS_LOCATION \
|
||||
(VIR_DOMAIN_SNAPSHOT_LIST_INTERNAL | \
|
||||
VIR_DOMAIN_SNAPSHOT_LIST_EXTERNAL)
|
||||
|
||||
# define VIR_DOMAIN_SNAPSHOT_FILTERS_ALL \
|
||||
# define VIR_DOMAIN_SNAPSHOT_FILTERS_ALL \
|
||||
(VIR_DOMAIN_SNAPSHOT_FILTERS_METADATA | \
|
||||
VIR_DOMAIN_SNAPSHOT_FILTERS_LEAVES | \
|
||||
VIR_DOMAIN_SNAPSHOT_FILTERS_STATUS | \
|
||||
|
@ -410,19 +410,19 @@ typedef enum {
|
||||
} virStoragePartedFsType;
|
||||
VIR_ENUM_DECL(virStoragePartedFs)
|
||||
|
||||
# define VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_ACTIVE \
|
||||
# define VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_ACTIVE \
|
||||
(VIR_CONNECT_LIST_STORAGE_POOLS_ACTIVE | \
|
||||
VIR_CONNECT_LIST_STORAGE_POOLS_INACTIVE)
|
||||
|
||||
# define VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_PERSISTENT \
|
||||
# define VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_PERSISTENT \
|
||||
(VIR_CONNECT_LIST_STORAGE_POOLS_PERSISTENT | \
|
||||
VIR_CONNECT_LIST_STORAGE_POOLS_TRANSIENT)
|
||||
|
||||
# define VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_AUTOSTART \
|
||||
(VIR_CONNECT_LIST_STORAGE_POOLS_AUTOSTART | \
|
||||
# define VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_AUTOSTART \
|
||||
(VIR_CONNECT_LIST_STORAGE_POOLS_AUTOSTART | \
|
||||
VIR_CONNECT_LIST_STORAGE_POOLS_NO_AUTOSTART)
|
||||
|
||||
# define VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_POOL_TYPE \
|
||||
# define VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_POOL_TYPE \
|
||||
(VIR_CONNECT_LIST_STORAGE_POOLS_DIR | \
|
||||
VIR_CONNECT_LIST_STORAGE_POOLS_FS | \
|
||||
VIR_CONNECT_LIST_STORAGE_POOLS_NETFS | \
|
||||
@ -437,7 +437,7 @@ VIR_ENUM_DECL(virStoragePartedFs)
|
||||
VIR_CONNECT_LIST_STORAGE_POOLS_ZFS | \
|
||||
VIR_CONNECT_LIST_STORAGE_POOLS_VSTORAGE)
|
||||
|
||||
# define VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_ALL \
|
||||
# define VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_ALL \
|
||||
(VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_ACTIVE | \
|
||||
VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_PERSISTENT | \
|
||||
VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_AUTOSTART | \
|
||||
|
@ -101,33 +101,33 @@ int virDomainObjListForEach(virDomainObjListPtr doms,
|
||||
virDomainObjListIterator callback,
|
||||
void *opaque);
|
||||
|
||||
# define VIR_CONNECT_LIST_DOMAINS_FILTERS_ACTIVE \
|
||||
# define VIR_CONNECT_LIST_DOMAINS_FILTERS_ACTIVE \
|
||||
(VIR_CONNECT_LIST_DOMAINS_ACTIVE | \
|
||||
VIR_CONNECT_LIST_DOMAINS_INACTIVE)
|
||||
|
||||
# define VIR_CONNECT_LIST_DOMAINS_FILTERS_PERSISTENT \
|
||||
# define VIR_CONNECT_LIST_DOMAINS_FILTERS_PERSISTENT \
|
||||
(VIR_CONNECT_LIST_DOMAINS_PERSISTENT | \
|
||||
VIR_CONNECT_LIST_DOMAINS_TRANSIENT)
|
||||
|
||||
# define VIR_CONNECT_LIST_DOMAINS_FILTERS_STATE \
|
||||
# define VIR_CONNECT_LIST_DOMAINS_FILTERS_STATE \
|
||||
(VIR_CONNECT_LIST_DOMAINS_RUNNING | \
|
||||
VIR_CONNECT_LIST_DOMAINS_PAUSED | \
|
||||
VIR_CONNECT_LIST_DOMAINS_SHUTOFF | \
|
||||
VIR_CONNECT_LIST_DOMAINS_OTHER)
|
||||
|
||||
# define VIR_CONNECT_LIST_DOMAINS_FILTERS_MANAGEDSAVE \
|
||||
# define VIR_CONNECT_LIST_DOMAINS_FILTERS_MANAGEDSAVE \
|
||||
(VIR_CONNECT_LIST_DOMAINS_MANAGEDSAVE | \
|
||||
VIR_CONNECT_LIST_DOMAINS_NO_MANAGEDSAVE)
|
||||
|
||||
# define VIR_CONNECT_LIST_DOMAINS_FILTERS_AUTOSTART \
|
||||
# define VIR_CONNECT_LIST_DOMAINS_FILTERS_AUTOSTART \
|
||||
(VIR_CONNECT_LIST_DOMAINS_AUTOSTART | \
|
||||
VIR_CONNECT_LIST_DOMAINS_NO_AUTOSTART)
|
||||
|
||||
# define VIR_CONNECT_LIST_DOMAINS_FILTERS_SNAPSHOT \
|
||||
# define VIR_CONNECT_LIST_DOMAINS_FILTERS_SNAPSHOT \
|
||||
(VIR_CONNECT_LIST_DOMAINS_HAS_SNAPSHOT | \
|
||||
VIR_CONNECT_LIST_DOMAINS_NO_SNAPSHOT)
|
||||
|
||||
# define VIR_CONNECT_LIST_DOMAINS_FILTERS_ALL \
|
||||
# define VIR_CONNECT_LIST_DOMAINS_FILTERS_ALL \
|
||||
(VIR_CONNECT_LIST_DOMAINS_FILTERS_ACTIVE | \
|
||||
VIR_CONNECT_LIST_DOMAINS_FILTERS_PERSISTENT | \
|
||||
VIR_CONNECT_LIST_DOMAINS_FILTERS_STATE | \
|
||||
|
@ -60,18 +60,18 @@ struct _virCPUx86Feature {
|
||||
};
|
||||
|
||||
|
||||
#define KVM_FEATURE_DEF(Name, Eax_in, Eax) \
|
||||
static virCPUx86CPUID Name ## _cpuid[] = { \
|
||||
{ .eax_in = Eax_in, .eax = Eax }, \
|
||||
#define KVM_FEATURE_DEF(Name, Eax_in, Eax) \
|
||||
static virCPUx86CPUID Name ## _cpuid[] = { \
|
||||
{ .eax_in = Eax_in, .eax = Eax }, \
|
||||
}
|
||||
|
||||
#define KVM_FEATURE(Name) \
|
||||
{ \
|
||||
.name = (char *) Name, \
|
||||
.data = { \
|
||||
.len = ARRAY_CARDINALITY(Name ## _cpuid), \
|
||||
.data = Name ## _cpuid \
|
||||
} \
|
||||
#define KVM_FEATURE(Name) \
|
||||
{ \
|
||||
.name = (char *) Name, \
|
||||
.data = { \
|
||||
.len = ARRAY_CARDINALITY(Name ## _cpuid), \
|
||||
.data = Name ## _cpuid \
|
||||
} \
|
||||
}
|
||||
|
||||
KVM_FEATURE_DEF(VIR_CPU_x86_KVM_CLOCKSOURCE,
|
||||
@ -1497,21 +1497,21 @@ virCPUx86DataParse(xmlXPathContextPtr ctxt)
|
||||
*
|
||||
* This macro generates the error string outputs it into logs.
|
||||
*/
|
||||
#define virX86CpuIncompatible(MSG, CPU_DEF) \
|
||||
do { \
|
||||
char *flagsStr = NULL; \
|
||||
if (!(flagsStr = x86FeatureNames(map, ", ", (CPU_DEF)))) { \
|
||||
virReportOOMError(); \
|
||||
goto error; \
|
||||
} \
|
||||
if (message && \
|
||||
#define virX86CpuIncompatible(MSG, CPU_DEF) \
|
||||
do { \
|
||||
char *flagsStr = NULL; \
|
||||
if (!(flagsStr = x86FeatureNames(map, ", ", (CPU_DEF)))) { \
|
||||
virReportOOMError(); \
|
||||
goto error; \
|
||||
} \
|
||||
if (message && \
|
||||
virAsprintf(message, "%s: %s", _(MSG), flagsStr) < 0) { \
|
||||
VIR_FREE(flagsStr); \
|
||||
goto error; \
|
||||
} \
|
||||
VIR_DEBUG("%s: %s", MSG, flagsStr); \
|
||||
VIR_FREE(flagsStr); \
|
||||
ret = VIR_CPU_COMPARE_INCOMPATIBLE; \
|
||||
VIR_FREE(flagsStr); \
|
||||
goto error; \
|
||||
} \
|
||||
VIR_DEBUG("%s: %s", MSG, flagsStr); \
|
||||
VIR_FREE(flagsStr); \
|
||||
ret = VIR_CPU_COMPARE_INCOMPATIBLE; \
|
||||
} while (0)
|
||||
|
||||
|
||||
|
@ -73,15 +73,15 @@ static void virAdmClientDispose(void *obj);
|
||||
static int
|
||||
virDataTypesOnceInit(void)
|
||||
{
|
||||
#define DECLARE_CLASS_COMMON(basename, parent) \
|
||||
if (!(basename ## Class = virClassNew(parent, \
|
||||
#basename, \
|
||||
sizeof(basename), \
|
||||
#define DECLARE_CLASS_COMMON(basename, parent) \
|
||||
if (!(basename ## Class = virClassNew(parent, \
|
||||
#basename, \
|
||||
sizeof(basename), \
|
||||
basename ## Dispose))) \
|
||||
return -1;
|
||||
#define DECLARE_CLASS(basename) \
|
||||
#define DECLARE_CLASS(basename) \
|
||||
DECLARE_CLASS_COMMON(basename, virClassForObject())
|
||||
#define DECLARE_CLASS_LOCKABLE(basename) \
|
||||
#define DECLARE_CLASS_LOCKABLE(basename) \
|
||||
DECLARE_CLASS_COMMON(basename, virClassForObjectLockable())
|
||||
|
||||
DECLARE_CLASS_LOCKABLE(virConnect);
|
||||
|
590
src/datatypes.h
590
src/datatypes.h
@ -45,251 +45,251 @@ extern virClassPtr virAdmConnectClass;
|
||||
extern virClassPtr virAdmServerClass;
|
||||
extern virClassPtr virAdmClientClass;
|
||||
|
||||
# define virCheckConnectReturn(obj, retval) \
|
||||
do { \
|
||||
if (!virObjectIsClass(obj, virConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_INVALID_CONN, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
virDispatchError(NULL); \
|
||||
return retval; \
|
||||
} \
|
||||
# define virCheckConnectReturn(obj, retval) \
|
||||
do { \
|
||||
if (!virObjectIsClass(obj, virConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_INVALID_CONN, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
virDispatchError(NULL); \
|
||||
return retval; \
|
||||
} \
|
||||
} while (0)
|
||||
# define virCheckConnectGoto(obj, label) \
|
||||
do { \
|
||||
if (!virObjectIsClass(obj, virConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_INVALID_CONN, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
goto label; \
|
||||
} \
|
||||
# define virCheckConnectGoto(obj, label) \
|
||||
do { \
|
||||
if (!virObjectIsClass(obj, virConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_INVALID_CONN, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
goto label; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
# define virCheckDomainReturn(obj, retval) \
|
||||
do { \
|
||||
virDomainPtr _dom = (obj); \
|
||||
if (!virObjectIsClass(_dom, virDomainClass) || \
|
||||
!virObjectIsClass(_dom->conn, virConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_DOM, VIR_ERR_INVALID_DOMAIN, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
virDispatchError(NULL); \
|
||||
return retval; \
|
||||
} \
|
||||
# define virCheckDomainReturn(obj, retval) \
|
||||
do { \
|
||||
virDomainPtr _dom = (obj); \
|
||||
if (!virObjectIsClass(_dom, virDomainClass) || \
|
||||
!virObjectIsClass(_dom->conn, virConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_DOM, VIR_ERR_INVALID_DOMAIN, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
virDispatchError(NULL); \
|
||||
return retval; \
|
||||
} \
|
||||
} while (0)
|
||||
# define virCheckDomainGoto(obj, label) \
|
||||
do { \
|
||||
virDomainPtr _dom = (obj); \
|
||||
if (!virObjectIsClass(_dom, virDomainClass) || \
|
||||
!virObjectIsClass(_dom->conn, virConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_DOM, VIR_ERR_INVALID_DOMAIN, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
goto label; \
|
||||
} \
|
||||
# define virCheckDomainGoto(obj, label) \
|
||||
do { \
|
||||
virDomainPtr _dom = (obj); \
|
||||
if (!virObjectIsClass(_dom, virDomainClass) || \
|
||||
!virObjectIsClass(_dom->conn, virConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_DOM, VIR_ERR_INVALID_DOMAIN, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
goto label; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
# define virCheckNetworkReturn(obj, retval) \
|
||||
do { \
|
||||
virNetworkPtr _net = (obj); \
|
||||
if (!virObjectIsClass(_net, virNetworkClass) || \
|
||||
!virObjectIsClass(_net->conn, virConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_NETWORK, \
|
||||
VIR_ERR_INVALID_NETWORK, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
virDispatchError(NULL); \
|
||||
return retval; \
|
||||
} \
|
||||
# define virCheckNetworkReturn(obj, retval) \
|
||||
do { \
|
||||
virNetworkPtr _net = (obj); \
|
||||
if (!virObjectIsClass(_net, virNetworkClass) || \
|
||||
!virObjectIsClass(_net->conn, virConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_NETWORK, \
|
||||
VIR_ERR_INVALID_NETWORK, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
virDispatchError(NULL); \
|
||||
return retval; \
|
||||
} \
|
||||
} while (0)
|
||||
# define virCheckNetworkGoto(obj, label) \
|
||||
do { \
|
||||
virNetworkPtr _net = (obj); \
|
||||
if (!virObjectIsClass(_net, virNetworkClass) || \
|
||||
!virObjectIsClass(_net->conn, virConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_NETWORK, \
|
||||
VIR_ERR_INVALID_NETWORK, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
goto label; \
|
||||
} \
|
||||
# define virCheckNetworkGoto(obj, label) \
|
||||
do { \
|
||||
virNetworkPtr _net = (obj); \
|
||||
if (!virObjectIsClass(_net, virNetworkClass) || \
|
||||
!virObjectIsClass(_net->conn, virConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_NETWORK, \
|
||||
VIR_ERR_INVALID_NETWORK, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
goto label; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
# define virCheckInterfaceReturn(obj, retval) \
|
||||
do { \
|
||||
virInterfacePtr _iface = (obj); \
|
||||
if (!virObjectIsClass(_iface, virInterfaceClass) || \
|
||||
!virObjectIsClass(_iface->conn, virConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_INTERFACE, \
|
||||
VIR_ERR_INVALID_INTERFACE, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
virDispatchError(NULL); \
|
||||
return retval; \
|
||||
} \
|
||||
# define virCheckInterfaceReturn(obj, retval) \
|
||||
do { \
|
||||
virInterfacePtr _iface = (obj); \
|
||||
if (!virObjectIsClass(_iface, virInterfaceClass) || \
|
||||
!virObjectIsClass(_iface->conn, virConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_INTERFACE, \
|
||||
VIR_ERR_INVALID_INTERFACE, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
virDispatchError(NULL); \
|
||||
return retval; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
# define virCheckStoragePoolReturn(obj, retval) \
|
||||
do { \
|
||||
virStoragePoolPtr _pool = (obj); \
|
||||
if (!virObjectIsClass(_pool, virStoragePoolClass) || \
|
||||
!virObjectIsClass(_pool->conn, virConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_STORAGE, \
|
||||
VIR_ERR_INVALID_STORAGE_POOL, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
virDispatchError(NULL); \
|
||||
return retval; \
|
||||
} \
|
||||
# define virCheckStoragePoolReturn(obj, retval) \
|
||||
do { \
|
||||
virStoragePoolPtr _pool = (obj); \
|
||||
if (!virObjectIsClass(_pool, virStoragePoolClass) || \
|
||||
!virObjectIsClass(_pool->conn, virConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_STORAGE, \
|
||||
VIR_ERR_INVALID_STORAGE_POOL, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
virDispatchError(NULL); \
|
||||
return retval; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
# define virCheckStoragePoolGoto(obj, label) \
|
||||
do { \
|
||||
virStoragePoolPtr _pool= (obj); \
|
||||
if (!virObjectIsClass(_pool, virStoragePoolClass) || \
|
||||
!virObjectIsClass(_pool->conn, virConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_STORAGE, \
|
||||
VIR_ERR_INVALID_STORAGE_POOL, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
goto label; \
|
||||
} \
|
||||
# define virCheckStoragePoolGoto(obj, label) \
|
||||
do { \
|
||||
virStoragePoolPtr _pool= (obj); \
|
||||
if (!virObjectIsClass(_pool, virStoragePoolClass) || \
|
||||
!virObjectIsClass(_pool->conn, virConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_STORAGE, \
|
||||
VIR_ERR_INVALID_STORAGE_POOL, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
goto label; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
# define virCheckStorageVolReturn(obj, retval) \
|
||||
do { \
|
||||
virStorageVolPtr _vol = (obj); \
|
||||
if (!virObjectIsClass(_vol, virStorageVolClass) || \
|
||||
!virObjectIsClass(_vol->conn, virConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_STORAGE, \
|
||||
VIR_ERR_INVALID_STORAGE_VOL, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
virDispatchError(NULL); \
|
||||
return retval; \
|
||||
} \
|
||||
# define virCheckStorageVolReturn(obj, retval) \
|
||||
do { \
|
||||
virStorageVolPtr _vol = (obj); \
|
||||
if (!virObjectIsClass(_vol, virStorageVolClass) || \
|
||||
!virObjectIsClass(_vol->conn, virConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_STORAGE, \
|
||||
VIR_ERR_INVALID_STORAGE_VOL, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
virDispatchError(NULL); \
|
||||
return retval; \
|
||||
} \
|
||||
} while (0)
|
||||
# define virCheckStorageVolGoto(obj, label) \
|
||||
do { \
|
||||
virStorageVolPtr _vol = (obj); \
|
||||
if (!virObjectIsClass(_vol, virStorageVolClass) || \
|
||||
!virObjectIsClass(_vol->conn, virConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_STORAGE, \
|
||||
VIR_ERR_INVALID_STORAGE_VOL, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
goto label; \
|
||||
} \
|
||||
# define virCheckStorageVolGoto(obj, label) \
|
||||
do { \
|
||||
virStorageVolPtr _vol = (obj); \
|
||||
if (!virObjectIsClass(_vol, virStorageVolClass) || \
|
||||
!virObjectIsClass(_vol->conn, virConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_STORAGE, \
|
||||
VIR_ERR_INVALID_STORAGE_VOL, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
goto label; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
# define virCheckNodeDeviceReturn(obj, retval) \
|
||||
do { \
|
||||
virNodeDevicePtr _node = (obj); \
|
||||
if (!virObjectIsClass(_node, virNodeDeviceClass) || \
|
||||
!virObjectIsClass(_node->conn, virConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_NODEDEV, \
|
||||
VIR_ERR_INVALID_NODE_DEVICE, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
virDispatchError(NULL); \
|
||||
return retval; \
|
||||
} \
|
||||
# define virCheckNodeDeviceReturn(obj, retval) \
|
||||
do { \
|
||||
virNodeDevicePtr _node = (obj); \
|
||||
if (!virObjectIsClass(_node, virNodeDeviceClass) || \
|
||||
!virObjectIsClass(_node->conn, virConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_NODEDEV, \
|
||||
VIR_ERR_INVALID_NODE_DEVICE, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
virDispatchError(NULL); \
|
||||
return retval; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
# define virCheckNodeDeviceGoto(obj, label) \
|
||||
do { \
|
||||
virNodeDevicePtr _dev= (obj); \
|
||||
if (!virObjectIsClass(_dev, virNodeDeviceClass) || \
|
||||
!virObjectIsClass(_dev->conn, virConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_NODEDEV, \
|
||||
VIR_ERR_INVALID_NODE_DEVICE, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
goto label; \
|
||||
} \
|
||||
# define virCheckNodeDeviceGoto(obj, label) \
|
||||
do { \
|
||||
virNodeDevicePtr _dev= (obj); \
|
||||
if (!virObjectIsClass(_dev, virNodeDeviceClass) || \
|
||||
!virObjectIsClass(_dev->conn, virConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_NODEDEV, \
|
||||
VIR_ERR_INVALID_NODE_DEVICE, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
goto label; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
# define virCheckSecretReturn(obj, retval) \
|
||||
do { \
|
||||
virSecretPtr _secret = (obj); \
|
||||
if (!virObjectIsClass(_secret, virSecretClass) || \
|
||||
!virObjectIsClass(_secret->conn, virConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_SECRET, \
|
||||
VIR_ERR_INVALID_SECRET, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
virDispatchError(NULL); \
|
||||
return retval; \
|
||||
} \
|
||||
# define virCheckSecretReturn(obj, retval) \
|
||||
do { \
|
||||
virSecretPtr _secret = (obj); \
|
||||
if (!virObjectIsClass(_secret, virSecretClass) || \
|
||||
!virObjectIsClass(_secret->conn, virConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_SECRET, \
|
||||
VIR_ERR_INVALID_SECRET, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
virDispatchError(NULL); \
|
||||
return retval; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
# define virCheckSecretGoto(obj, label) \
|
||||
do { \
|
||||
virSecretPtr _secret = (obj); \
|
||||
if (!virObjectIsClass(_secret, virSecretClass) || \
|
||||
!virObjectIsClass(_secret->conn, virConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_SECRET, \
|
||||
VIR_ERR_INVALID_SECRET, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
virDispatchError(NULL); \
|
||||
goto label; \
|
||||
} \
|
||||
# define virCheckSecretGoto(obj, label) \
|
||||
do { \
|
||||
virSecretPtr _secret = (obj); \
|
||||
if (!virObjectIsClass(_secret, virSecretClass) || \
|
||||
!virObjectIsClass(_secret->conn, virConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_SECRET, \
|
||||
VIR_ERR_INVALID_SECRET, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
virDispatchError(NULL); \
|
||||
goto label; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
# define virCheckStreamReturn(obj, retval) \
|
||||
do { \
|
||||
virStreamPtr _st = (obj); \
|
||||
if (!virObjectIsClass(_st, virStreamClass) || \
|
||||
!virObjectIsClass(_st->conn, virConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_STREAMS, \
|
||||
VIR_ERR_INVALID_STREAM, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
virDispatchError(NULL); \
|
||||
return retval; \
|
||||
} \
|
||||
# define virCheckStreamReturn(obj, retval) \
|
||||
do { \
|
||||
virStreamPtr _st = (obj); \
|
||||
if (!virObjectIsClass(_st, virStreamClass) || \
|
||||
!virObjectIsClass(_st->conn, virConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_STREAMS, \
|
||||
VIR_ERR_INVALID_STREAM, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
virDispatchError(NULL); \
|
||||
return retval; \
|
||||
} \
|
||||
} while (0)
|
||||
# define virCheckStreamGoto(obj, label) \
|
||||
do { \
|
||||
virStreamPtr _st = (obj); \
|
||||
if (!virObjectIsClass(_st, virStreamClass) || \
|
||||
!virObjectIsClass(_st->conn, virConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_STREAMS, \
|
||||
VIR_ERR_INVALID_STREAM, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
goto label; \
|
||||
} \
|
||||
# define virCheckStreamGoto(obj, label) \
|
||||
do { \
|
||||
virStreamPtr _st = (obj); \
|
||||
if (!virObjectIsClass(_st, virStreamClass) || \
|
||||
!virObjectIsClass(_st->conn, virConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_STREAMS, \
|
||||
VIR_ERR_INVALID_STREAM, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
goto label; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
# define virCheckNWFilterReturn(obj, retval) \
|
||||
do { \
|
||||
virNWFilterPtr _nw = (obj); \
|
||||
if (!virObjectIsClass(_nw, virNWFilterClass) || \
|
||||
!virObjectIsClass(_nw->conn, virConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_NWFILTER, \
|
||||
VIR_ERR_INVALID_NWFILTER, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
virDispatchError(NULL); \
|
||||
return retval; \
|
||||
} \
|
||||
# define virCheckNWFilterReturn(obj, retval) \
|
||||
do { \
|
||||
virNWFilterPtr _nw = (obj); \
|
||||
if (!virObjectIsClass(_nw, virNWFilterClass) || \
|
||||
!virObjectIsClass(_nw->conn, virConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_NWFILTER, \
|
||||
VIR_ERR_INVALID_NWFILTER, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
virDispatchError(NULL); \
|
||||
return retval; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
# define virCheckDomainSnapshotReturn(obj, retval) \
|
||||
do { \
|
||||
virDomainSnapshotPtr _snap = (obj); \
|
||||
if (!virObjectIsClass(_snap, virDomainSnapshotClass) || \
|
||||
!virObjectIsClass(_snap->domain, virDomainClass) || \
|
||||
!virObjectIsClass(_snap->domain->conn, virConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_DOMAIN_SNAPSHOT, \
|
||||
VIR_ERR_INVALID_DOMAIN_SNAPSHOT, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
virDispatchError(NULL); \
|
||||
return retval; \
|
||||
} \
|
||||
# define virCheckDomainSnapshotReturn(obj, retval) \
|
||||
do { \
|
||||
virDomainSnapshotPtr _snap = (obj); \
|
||||
if (!virObjectIsClass(_snap, virDomainSnapshotClass) || \
|
||||
!virObjectIsClass(_snap->domain, virDomainClass) || \
|
||||
!virObjectIsClass(_snap->domain->conn, virConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_DOMAIN_SNAPSHOT, \
|
||||
VIR_ERR_INVALID_DOMAIN_SNAPSHOT, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
virDispatchError(NULL); \
|
||||
return retval; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
@ -309,104 +309,104 @@ extern virClassPtr virAdmClientClass;
|
||||
/* Form the name VIR_DOMAIN_DEBUG_[01], then call that macro,
|
||||
* according to how many arguments are present. Two-phase due to
|
||||
* macro expansion rules. */
|
||||
# define VIR_DOMAIN_DEBUG_EXPAND(a, b, ...) \
|
||||
# define VIR_DOMAIN_DEBUG_EXPAND(a, b, ...) \
|
||||
VIR_DOMAIN_DEBUG_PASTE(a, b, __VA_ARGS__)
|
||||
# define VIR_DOMAIN_DEBUG_PASTE(a, b, ...) \
|
||||
# define VIR_DOMAIN_DEBUG_PASTE(a, b, ...) \
|
||||
a##b(__VA_ARGS__)
|
||||
|
||||
/* Internal use only, when VIR_DOMAIN_DEBUG has one argument. */
|
||||
# define VIR_DOMAIN_DEBUG_0(dom) \
|
||||
# define VIR_DOMAIN_DEBUG_0(dom) \
|
||||
VIR_DOMAIN_DEBUG_2(dom, "%s", "")
|
||||
|
||||
/* Internal use only, when VIR_DOMAIN_DEBUG has three or more arguments. */
|
||||
# define VIR_DOMAIN_DEBUG_1(dom, fmt, ...) \
|
||||
# define VIR_DOMAIN_DEBUG_1(dom, fmt, ...) \
|
||||
VIR_DOMAIN_DEBUG_2(dom, ", " fmt, __VA_ARGS__)
|
||||
|
||||
/* Internal use only, with final format. */
|
||||
# define VIR_DOMAIN_DEBUG_2(dom, fmt, ...) \
|
||||
do { \
|
||||
char _uuidstr[VIR_UUID_STRING_BUFLEN]; \
|
||||
const char *_domname = NULL; \
|
||||
\
|
||||
if (!virObjectIsClass(dom, virDomainClass)) { \
|
||||
memset(_uuidstr, 0, sizeof(_uuidstr)); \
|
||||
} else { \
|
||||
virUUIDFormat((dom)->uuid, _uuidstr); \
|
||||
_domname = (dom)->name; \
|
||||
} \
|
||||
\
|
||||
VIR_DEBUG("dom=%p, (VM: name=%s, uuid=%s)" fmt, \
|
||||
dom, NULLSTR(_domname), _uuidstr, __VA_ARGS__); \
|
||||
# define VIR_DOMAIN_DEBUG_2(dom, fmt, ...) \
|
||||
do { \
|
||||
char _uuidstr[VIR_UUID_STRING_BUFLEN]; \
|
||||
const char *_domname = NULL; \
|
||||
\
|
||||
if (!virObjectIsClass(dom, virDomainClass)) { \
|
||||
memset(_uuidstr, 0, sizeof(_uuidstr)); \
|
||||
} else { \
|
||||
virUUIDFormat((dom)->uuid, _uuidstr); \
|
||||
_domname = (dom)->name; \
|
||||
} \
|
||||
\
|
||||
VIR_DEBUG("dom=%p, (VM: name=%s, uuid=%s)" fmt, \
|
||||
dom, NULLSTR(_domname), _uuidstr, __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
# define virCheckAdmConnectReturn(obj, retval) \
|
||||
do { \
|
||||
if (!virObjectIsClass(obj, virAdmConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_INVALID_CONN, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
virDispatchError(NULL); \
|
||||
return retval; \
|
||||
} \
|
||||
# define virCheckAdmConnectReturn(obj, retval) \
|
||||
do { \
|
||||
if (!virObjectIsClass(obj, virAdmConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_INVALID_CONN, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
virDispatchError(NULL); \
|
||||
return retval; \
|
||||
} \
|
||||
} while (0)
|
||||
# define virCheckAdmConnectGoto(obj, label) \
|
||||
do { \
|
||||
if (!virObjectIsClass(obj, virAdmConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_INVALID_CONN, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
goto label; \
|
||||
} \
|
||||
# define virCheckAdmConnectGoto(obj, label) \
|
||||
do { \
|
||||
if (!virObjectIsClass(obj, virAdmConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_INVALID_CONN, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
goto label; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
# define virCheckAdmServerReturn(obj, retval) \
|
||||
do { \
|
||||
virAdmServerPtr _srv = (obj); \
|
||||
if (!virObjectIsClass(_srv, virAdmServerClass) || \
|
||||
!virObjectIsClass(_srv->conn, virAdmConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_INVALID_CONN, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
virDispatchError(NULL); \
|
||||
return retval; \
|
||||
} \
|
||||
# define virCheckAdmServerReturn(obj, retval) \
|
||||
do { \
|
||||
virAdmServerPtr _srv = (obj); \
|
||||
if (!virObjectIsClass(_srv, virAdmServerClass) || \
|
||||
!virObjectIsClass(_srv->conn, virAdmConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_INVALID_CONN, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
virDispatchError(NULL); \
|
||||
return retval; \
|
||||
} \
|
||||
} while (0)
|
||||
# define virCheckAdmServerGoto(obj, label) \
|
||||
do { \
|
||||
virAdmServerPtr _srv = (obj); \
|
||||
if (!virObjectIsClass(_srv, virAdmServerClass) || \
|
||||
!virObjectIsClass(_srv->conn, virAdmConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_INVALID_CONN, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
goto label; \
|
||||
} \
|
||||
# define virCheckAdmServerGoto(obj, label) \
|
||||
do { \
|
||||
virAdmServerPtr _srv = (obj); \
|
||||
if (!virObjectIsClass(_srv, virAdmServerClass) || \
|
||||
!virObjectIsClass(_srv->conn, virAdmConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_INVALID_CONN, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
goto label; \
|
||||
} \
|
||||
} while (0);
|
||||
|
||||
# define virCheckAdmClientReturn(obj, retval) \
|
||||
do { \
|
||||
virAdmClientPtr _clt = (obj); \
|
||||
if (!virObjectIsClass(_clt, virAdmClientClass) || \
|
||||
!virObjectIsClass(_clt->srv, virAdmServerClass) || \
|
||||
!virObjectIsClass(_clt->srv->conn, virAdmConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_INVALID_CONN, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
virDispatchError(NULL); \
|
||||
return retval; \
|
||||
} \
|
||||
# define virCheckAdmClientReturn(obj, retval) \
|
||||
do { \
|
||||
virAdmClientPtr _clt = (obj); \
|
||||
if (!virObjectIsClass(_clt, virAdmClientClass) || \
|
||||
!virObjectIsClass(_clt->srv, virAdmServerClass) || \
|
||||
!virObjectIsClass(_clt->srv->conn, virAdmConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_INVALID_CONN, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
virDispatchError(NULL); \
|
||||
return retval; \
|
||||
} \
|
||||
} while (0)
|
||||
# define virCheckAdmClientGoto(obj, label) \
|
||||
do { \
|
||||
virAdmClientPtr _clt = (obj); \
|
||||
if (!virObjectIsClass(_clt, virAdmClientClass) || \
|
||||
!virObjectIsClass(_clt->srv, virAdmServerClass) || \
|
||||
!virObjectIsClass(_clt->srv->conn, virAdmConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_INVALID_CONN, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
goto label; \
|
||||
} \
|
||||
# define virCheckAdmClientGoto(obj, label) \
|
||||
do { \
|
||||
virAdmClientPtr _clt = (obj); \
|
||||
if (!virObjectIsClass(_clt, virAdmClientClass) || \
|
||||
!virObjectIsClass(_clt->srv, virAdmServerClass) || \
|
||||
!virObjectIsClass(_clt->srv->conn, virAdmConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_INVALID_CONN, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
goto label; \
|
||||
} \
|
||||
} while (0);
|
||||
|
||||
/**
|
||||
@ -415,8 +415,8 @@ extern virClassPtr virAdmClientClass;
|
||||
* @fmt: optional format for additional information
|
||||
* @...: optional arguments corresponding to @fmt.
|
||||
*/
|
||||
# define VIR_DOMAIN_DEBUG(...) \
|
||||
VIR_DOMAIN_DEBUG_EXPAND(VIR_DOMAIN_DEBUG_, \
|
||||
# define VIR_DOMAIN_DEBUG(...) \
|
||||
VIR_DOMAIN_DEBUG_EXPAND(VIR_DOMAIN_DEBUG_, \
|
||||
VIR_HAS_COMMA(__VA_ARGS__), \
|
||||
__VA_ARGS__)
|
||||
|
||||
|
@ -56,8 +56,8 @@ typedef enum {
|
||||
* != 0 Feature is supported.
|
||||
* 0 Feature is not supported.
|
||||
*/
|
||||
# define VIR_DRV_SUPPORTS_FEATURE(drv, conn, feature) \
|
||||
((drv)->connectSupportsFeature ? \
|
||||
# define VIR_DRV_SUPPORTS_FEATURE(drv, conn, feature) \
|
||||
((drv)->connectSupportsFeature ? \
|
||||
(drv)->connectSupportsFeature((conn), (feature)) > 0 : 0)
|
||||
|
||||
|
||||
|
@ -3779,10 +3779,10 @@ esxDomainSetSchedulerParameters(virDomainPtr domain,
|
||||
}
|
||||
|
||||
/* The subset of migration flags we are able to support. */
|
||||
#define ESX_MIGRATION_FLAGS \
|
||||
(VIR_MIGRATE_PERSIST_DEST | \
|
||||
VIR_MIGRATE_UNDEFINE_SOURCE | \
|
||||
VIR_MIGRATE_LIVE | \
|
||||
#define ESX_MIGRATION_FLAGS \
|
||||
(VIR_MIGRATE_PERSIST_DEST | \
|
||||
VIR_MIGRATE_UNDEFINE_SOURCE | \
|
||||
VIR_MIGRATE_LIVE | \
|
||||
VIR_MIGRATE_PAUSED)
|
||||
|
||||
static int
|
||||
|
258
src/esx/esx_vi.c
258
src/esx/esx_vi.c
@ -41,43 +41,43 @@
|
||||
|
||||
VIR_LOG_INIT("esx.esx_vi");
|
||||
|
||||
#define ESX_VI__SOAP__RESPONSE_XPATH(_type) \
|
||||
((char *)"/soapenv:Envelope/soapenv:Body/" \
|
||||
#define ESX_VI__SOAP__RESPONSE_XPATH(_type) \
|
||||
((char *)"/soapenv:Envelope/soapenv:Body/" \
|
||||
"vim:"_type"Response/vim:returnval")
|
||||
|
||||
|
||||
|
||||
#define ESX_VI__TEMPLATE__ALLOC(_type) \
|
||||
int \
|
||||
esxVI_##_type##_Alloc(esxVI_##_type **ptrptr) \
|
||||
{ \
|
||||
if (!ptrptr || *ptrptr) { \
|
||||
#define ESX_VI__TEMPLATE__ALLOC(_type) \
|
||||
int \
|
||||
esxVI_##_type##_Alloc(esxVI_##_type **ptrptr) \
|
||||
{ \
|
||||
if (!ptrptr || *ptrptr) { \
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); \
|
||||
return -1; \
|
||||
} \
|
||||
\
|
||||
if (VIR_ALLOC(*ptrptr) < 0) \
|
||||
return -1; \
|
||||
return 0; \
|
||||
return -1; \
|
||||
} \
|
||||
\
|
||||
if (VIR_ALLOC(*ptrptr) < 0) \
|
||||
return -1; \
|
||||
return 0; \
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define ESX_VI__TEMPLATE__FREE(_type, _body) \
|
||||
void \
|
||||
esxVI_##_type##_Free(esxVI_##_type **ptrptr) \
|
||||
{ \
|
||||
esxVI_##_type *item ATTRIBUTE_UNUSED; \
|
||||
\
|
||||
if (!ptrptr || !(*ptrptr)) { \
|
||||
return; \
|
||||
} \
|
||||
\
|
||||
item = *ptrptr; \
|
||||
\
|
||||
_body \
|
||||
\
|
||||
VIR_FREE(*ptrptr); \
|
||||
#define ESX_VI__TEMPLATE__FREE(_type, _body) \
|
||||
void \
|
||||
esxVI_##_type##_Free(esxVI_##_type **ptrptr) \
|
||||
{ \
|
||||
esxVI_##_type *item ATTRIBUTE_UNUSED; \
|
||||
\
|
||||
if (!ptrptr || !(*ptrptr)) { \
|
||||
return; \
|
||||
} \
|
||||
\
|
||||
item = *ptrptr; \
|
||||
\
|
||||
_body \
|
||||
\
|
||||
VIR_FREE(*ptrptr); \
|
||||
}
|
||||
|
||||
|
||||
@ -5154,126 +5154,126 @@ esxVI_LookupStoragePoolNameByScsiLunKey(esxVI_Context *ctx,
|
||||
|
||||
|
||||
|
||||
#define ESX_VI__TEMPLATE__PROPERTY__CAST_FROM_ANY_TYPE_IGNORE(_name) \
|
||||
if (STREQ(dynamicProperty->name, #_name)) { \
|
||||
continue; \
|
||||
#define ESX_VI__TEMPLATE__PROPERTY__CAST_FROM_ANY_TYPE_IGNORE(_name) \
|
||||
if (STREQ(dynamicProperty->name, #_name)) { \
|
||||
continue; \
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define ESX_VI__TEMPLATE__PROPERTY__CAST_FROM_ANY_TYPE(_type, _name) \
|
||||
if (STREQ(dynamicProperty->name, #_name)) { \
|
||||
if (esxVI_##_type##_CastFromAnyType(dynamicProperty->val, \
|
||||
&(*ptrptr)->_name) < 0) { \
|
||||
goto cleanup; \
|
||||
} \
|
||||
\
|
||||
continue; \
|
||||
#define ESX_VI__TEMPLATE__PROPERTY__CAST_FROM_ANY_TYPE(_type, _name) \
|
||||
if (STREQ(dynamicProperty->name, #_name)) { \
|
||||
if (esxVI_##_type##_CastFromAnyType(dynamicProperty->val, \
|
||||
&(*ptrptr)->_name) < 0) { \
|
||||
goto cleanup; \
|
||||
} \
|
||||
\
|
||||
continue; \
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define ESX_VI__TEMPLATE__PROPERTY__CAST_LIST_FROM_ANY_TYPE(_type, _name) \
|
||||
if (STREQ(dynamicProperty->name, #_name)) { \
|
||||
if (esxVI_##_type##_CastListFromAnyType(dynamicProperty->val, \
|
||||
&(*ptrptr)->_name) < 0) { \
|
||||
goto cleanup; \
|
||||
} \
|
||||
\
|
||||
continue; \
|
||||
#define ESX_VI__TEMPLATE__PROPERTY__CAST_LIST_FROM_ANY_TYPE(_type, _name) \
|
||||
if (STREQ(dynamicProperty->name, #_name)) { \
|
||||
if (esxVI_##_type##_CastListFromAnyType(dynamicProperty->val, \
|
||||
&(*ptrptr)->_name) < 0) { \
|
||||
goto cleanup; \
|
||||
} \
|
||||
\
|
||||
continue; \
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define ESX_VI__TEMPLATE__PROPERTY__CAST_VALUE_FROM_ANY_TYPE(_type, _name) \
|
||||
if (STREQ(dynamicProperty->name, #_name)) { \
|
||||
if (esxVI_##_type##_CastValueFromAnyType(dynamicProperty->val, \
|
||||
&(*ptrptr)->_name) < 0) { \
|
||||
goto cleanup; \
|
||||
} \
|
||||
\
|
||||
continue; \
|
||||
#define ESX_VI__TEMPLATE__PROPERTY__CAST_VALUE_FROM_ANY_TYPE(_type, _name) \
|
||||
if (STREQ(dynamicProperty->name, #_name)) { \
|
||||
if (esxVI_##_type##_CastValueFromAnyType(dynamicProperty->val, \
|
||||
&(*ptrptr)->_name) < 0) { \
|
||||
goto cleanup; \
|
||||
} \
|
||||
\
|
||||
continue; \
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define ESX_VI__TEMPLATE__LOOKUP(_type, _complete_properties, \
|
||||
_cast_from_anytype) \
|
||||
int \
|
||||
esxVI_Lookup##_type(esxVI_Context *ctx, const char* name /* optional */, \
|
||||
esxVI_ManagedObjectReference *root, \
|
||||
#define ESX_VI__TEMPLATE__LOOKUP(_type, _complete_properties, \
|
||||
_cast_from_anytype) \
|
||||
int \
|
||||
esxVI_Lookup##_type(esxVI_Context *ctx, const char* name /* optional */, \
|
||||
esxVI_ManagedObjectReference *root, \
|
||||
esxVI_String *selectedPropertyNameList /* optional */,\
|
||||
esxVI_##_type **ptrptr, esxVI_Occurrence occurrence) \
|
||||
{ \
|
||||
int result = -1; \
|
||||
const char *completePropertyNameValueList = _complete_properties; \
|
||||
esxVI_String *propertyNameList = NULL; \
|
||||
esxVI_ObjectContent *objectContent = NULL; \
|
||||
esxVI_ObjectContent *objectContentList = NULL; \
|
||||
esxVI_DynamicProperty *dynamicProperty = NULL; \
|
||||
\
|
||||
if (!ptrptr || *ptrptr) { \
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", \
|
||||
_("Invalid argument")); \
|
||||
return -1; \
|
||||
} \
|
||||
\
|
||||
propertyNameList = selectedPropertyNameList; \
|
||||
\
|
||||
if (!propertyNameList && \
|
||||
esxVI_String_AppendValueListToList \
|
||||
(&propertyNameList, completePropertyNameValueList) < 0) { \
|
||||
goto cleanup; \
|
||||
} \
|
||||
\
|
||||
if (esxVI_LookupManagedObjectHelper(ctx, name, root, #_type, \
|
||||
esxVI_##_type **ptrptr, esxVI_Occurrence occurrence) \
|
||||
{ \
|
||||
int result = -1; \
|
||||
const char *completePropertyNameValueList = _complete_properties; \
|
||||
esxVI_String *propertyNameList = NULL; \
|
||||
esxVI_ObjectContent *objectContent = NULL; \
|
||||
esxVI_ObjectContent *objectContentList = NULL; \
|
||||
esxVI_DynamicProperty *dynamicProperty = NULL; \
|
||||
\
|
||||
if (!ptrptr || *ptrptr) { \
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", \
|
||||
_("Invalid argument")); \
|
||||
return -1; \
|
||||
} \
|
||||
\
|
||||
propertyNameList = selectedPropertyNameList; \
|
||||
\
|
||||
if (!propertyNameList && \
|
||||
esxVI_String_AppendValueListToList \
|
||||
(&propertyNameList, completePropertyNameValueList) < 0) { \
|
||||
goto cleanup; \
|
||||
} \
|
||||
\
|
||||
if (esxVI_LookupManagedObjectHelper(ctx, name, root, #_type, \
|
||||
propertyNameList, &objectContent, \
|
||||
&objectContentList, \
|
||||
occurrence) < 0) { \
|
||||
goto cleanup; \
|
||||
} \
|
||||
\
|
||||
if (!objectContent) { \
|
||||
/* not found, exit early */ \
|
||||
result = 0; \
|
||||
goto cleanup; \
|
||||
} \
|
||||
\
|
||||
if (esxVI_##_type##_Alloc(ptrptr) < 0) { \
|
||||
goto cleanup; \
|
||||
} \
|
||||
\
|
||||
if (esxVI_ManagedObjectReference_DeepCopy(&(*ptrptr)->_reference, \
|
||||
objectContent->obj) < 0) { \
|
||||
goto cleanup; \
|
||||
} \
|
||||
\
|
||||
for (dynamicProperty = objectContent->propSet; \
|
||||
dynamicProperty; \
|
||||
dynamicProperty = dynamicProperty->_next) { \
|
||||
_cast_from_anytype \
|
||||
\
|
||||
VIR_WARN("Unexpected '%s' property", dynamicProperty->name); \
|
||||
} \
|
||||
\
|
||||
&objectContentList, \
|
||||
occurrence) < 0) { \
|
||||
goto cleanup; \
|
||||
} \
|
||||
\
|
||||
if (!objectContent) { \
|
||||
/* not found, exit early */ \
|
||||
result = 0; \
|
||||
goto cleanup; \
|
||||
} \
|
||||
\
|
||||
if (esxVI_##_type##_Alloc(ptrptr) < 0) { \
|
||||
goto cleanup; \
|
||||
} \
|
||||
\
|
||||
if (esxVI_ManagedObjectReference_DeepCopy(&(*ptrptr)->_reference, \
|
||||
objectContent->obj) < 0) { \
|
||||
goto cleanup; \
|
||||
} \
|
||||
\
|
||||
for (dynamicProperty = objectContent->propSet; \
|
||||
dynamicProperty; \
|
||||
dynamicProperty = dynamicProperty->_next) { \
|
||||
_cast_from_anytype \
|
||||
\
|
||||
VIR_WARN("Unexpected '%s' property", dynamicProperty->name); \
|
||||
} \
|
||||
\
|
||||
if (esxVI_##_type##_Validate(*ptrptr, selectedPropertyNameList) < 0) {\
|
||||
goto cleanup; \
|
||||
} \
|
||||
\
|
||||
result = 0; \
|
||||
\
|
||||
cleanup: \
|
||||
if (result < 0) { \
|
||||
esxVI_##_type##_Free(ptrptr); \
|
||||
} \
|
||||
\
|
||||
if (propertyNameList != selectedPropertyNameList) { \
|
||||
esxVI_String_Free(&propertyNameList); \
|
||||
} \
|
||||
\
|
||||
esxVI_ObjectContent_Free(&objectContentList); \
|
||||
\
|
||||
return result; \
|
||||
goto cleanup; \
|
||||
} \
|
||||
\
|
||||
result = 0; \
|
||||
\
|
||||
cleanup: \
|
||||
if (result < 0) { \
|
||||
esxVI_##_type##_Free(ptrptr); \
|
||||
} \
|
||||
\
|
||||
if (propertyNameList != selectedPropertyNameList) { \
|
||||
esxVI_String_Free(&propertyNameList); \
|
||||
} \
|
||||
\
|
||||
esxVI_ObjectContent_Free(&objectContentList); \
|
||||
\
|
||||
return result; \
|
||||
}
|
||||
|
||||
|
||||
|
@ -38,39 +38,39 @@
|
||||
|
||||
|
||||
|
||||
# define ESX_VI__SOAP__REQUEST_HEADER \
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" \
|
||||
"<soapenv:Envelope\n" \
|
||||
" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"\n" \
|
||||
" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"\n" \
|
||||
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" \
|
||||
" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\n" \
|
||||
# define ESX_VI__SOAP__REQUEST_HEADER \
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" \
|
||||
"<soapenv:Envelope\n" \
|
||||
" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"\n" \
|
||||
" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"\n" \
|
||||
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" \
|
||||
" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\n" \
|
||||
"<soapenv:Body>\n"
|
||||
|
||||
|
||||
|
||||
# define ESX_VI__SOAP__REQUEST_FOOTER \
|
||||
"</soapenv:Body>\n" \
|
||||
# define ESX_VI__SOAP__REQUEST_FOOTER \
|
||||
"</soapenv:Body>\n" \
|
||||
"</soapenv:Envelope>"
|
||||
|
||||
|
||||
|
||||
# define ESV_VI__XML_TAG__OPEN(_buffer, _element, _type) \
|
||||
do { \
|
||||
virBufferAddLit(_buffer, "<"); \
|
||||
virBufferAdd(_buffer, _element, -1); \
|
||||
virBufferAddLit(_buffer, " xmlns=\"urn:vim25\" xsi:type=\""); \
|
||||
virBufferAdd(_buffer, _type, -1); \
|
||||
virBufferAddLit(_buffer, "\">"); \
|
||||
# define ESV_VI__XML_TAG__OPEN(_buffer, _element, _type) \
|
||||
do { \
|
||||
virBufferAddLit(_buffer, "<"); \
|
||||
virBufferAdd(_buffer, _element, -1); \
|
||||
virBufferAddLit(_buffer, " xmlns=\"urn:vim25\" xsi:type=\""); \
|
||||
virBufferAdd(_buffer, _type, -1); \
|
||||
virBufferAddLit(_buffer, "\">"); \
|
||||
} while (0)
|
||||
|
||||
|
||||
|
||||
# define ESV_VI__XML_TAG__CLOSE(_buffer, _element) \
|
||||
do { \
|
||||
virBufferAddLit(_buffer, "</"); \
|
||||
virBufferAdd(_buffer, _element, -1); \
|
||||
virBufferAddLit(_buffer, ">"); \
|
||||
# define ESV_VI__XML_TAG__CLOSE(_buffer, _element) \
|
||||
do { \
|
||||
virBufferAddLit(_buffer, "</"); \
|
||||
virBufferAdd(_buffer, _element, -1); \
|
||||
virBufferAddLit(_buffer, ">"); \
|
||||
} while (0)
|
||||
|
||||
|
||||
|
@ -32,141 +32,141 @@
|
||||
|
||||
|
||||
|
||||
#define ESX_VI__METHOD__CHECK_OUTPUT__None \
|
||||
#define ESX_VI__METHOD__CHECK_OUTPUT__None \
|
||||
/* nothing */
|
||||
|
||||
|
||||
|
||||
#define ESX_VI__METHOD__CHECK_OUTPUT__NotNone \
|
||||
if (!output || *output) { \
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); \
|
||||
return -1; \
|
||||
#define ESX_VI__METHOD__CHECK_OUTPUT__NotNone \
|
||||
if (!output || *output) { \
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); \
|
||||
return -1; \
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define ESX_VI__METHOD__CHECK_OUTPUT__RequiredItem \
|
||||
#define ESX_VI__METHOD__CHECK_OUTPUT__RequiredItem \
|
||||
ESX_VI__METHOD__CHECK_OUTPUT__NotNone
|
||||
|
||||
|
||||
|
||||
#define ESX_VI__METHOD__CHECK_OUTPUT__RequiredList \
|
||||
#define ESX_VI__METHOD__CHECK_OUTPUT__RequiredList \
|
||||
ESX_VI__METHOD__CHECK_OUTPUT__NotNone
|
||||
|
||||
|
||||
|
||||
#define ESX_VI__METHOD__CHECK_OUTPUT__OptionalItem \
|
||||
#define ESX_VI__METHOD__CHECK_OUTPUT__OptionalItem \
|
||||
ESX_VI__METHOD__CHECK_OUTPUT__NotNone
|
||||
|
||||
|
||||
|
||||
#define ESX_VI__METHOD__CHECK_OUTPUT__OptionalList \
|
||||
#define ESX_VI__METHOD__CHECK_OUTPUT__OptionalList \
|
||||
ESX_VI__METHOD__CHECK_OUTPUT__NotNone
|
||||
|
||||
|
||||
|
||||
#define ESX_VI__METHOD__DESERIALIZE_OUTPUT__None(_type, _suffix) \
|
||||
#define ESX_VI__METHOD__DESERIALIZE_OUTPUT__None(_type, _suffix) \
|
||||
/* nothing */
|
||||
|
||||
|
||||
|
||||
#define ESX_VI__METHOD__DESERIALIZE_OUTPUT__RequiredItem(_type, _suffix) \
|
||||
if (esxVI_##_type##_Deserialize##_suffix(response->node, output) < 0) { \
|
||||
goto cleanup; \
|
||||
#define ESX_VI__METHOD__DESERIALIZE_OUTPUT__RequiredItem(_type, _suffix) \
|
||||
if (esxVI_##_type##_Deserialize##_suffix(response->node, output) < 0) { \
|
||||
goto cleanup; \
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define ESX_VI__METHOD__DESERIALIZE_OUTPUT__RequiredList(_type, _suffix) \
|
||||
if (esxVI_##_type##_DeserializeList(response->node, output) < 0) { \
|
||||
goto cleanup; \
|
||||
#define ESX_VI__METHOD__DESERIALIZE_OUTPUT__RequiredList(_type, _suffix) \
|
||||
if (esxVI_##_type##_DeserializeList(response->node, output) < 0) { \
|
||||
goto cleanup; \
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define ESX_VI__METHOD__DESERIALIZE_OUTPUT__OptionalItem(_type, _suffix) \
|
||||
if (response->node && \
|
||||
esxVI_##_type##_Deserialize##_suffix(response->node, output) < 0) { \
|
||||
goto cleanup; \
|
||||
#define ESX_VI__METHOD__DESERIALIZE_OUTPUT__OptionalItem(_type, _suffix) \
|
||||
if (response->node && \
|
||||
esxVI_##_type##_Deserialize##_suffix(response->node, output) < 0) { \
|
||||
goto cleanup; \
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define ESX_VI__METHOD__DESERIALIZE_OUTPUT__OptionalList(_type, _suffix) \
|
||||
if (response->node && \
|
||||
esxVI_##_type##_DeserializeList(response->node, output) < 0) { \
|
||||
goto cleanup; \
|
||||
#define ESX_VI__METHOD__DESERIALIZE_OUTPUT__OptionalList(_type, _suffix) \
|
||||
if (response->node && \
|
||||
esxVI_##_type##_DeserializeList(response->node, output) < 0) { \
|
||||
goto cleanup; \
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define ESX_VI__METHOD(_name, _this_from_service, _parameters, _output_type, \
|
||||
_deserialize_suffix, _occurrence, _validate, \
|
||||
_serialize) \
|
||||
int \
|
||||
esxVI_##_name _parameters \
|
||||
{ \
|
||||
int result = -1; \
|
||||
const char *methodName = #_name; \
|
||||
virBuffer buffer = VIR_BUFFER_INITIALIZER; \
|
||||
char *request = NULL; \
|
||||
esxVI_Response *response = NULL; \
|
||||
\
|
||||
ESX_VI__METHOD__PARAMETER__THIS__##_this_from_service \
|
||||
\
|
||||
ESX_VI__METHOD__CHECK_OUTPUT__##_occurrence \
|
||||
\
|
||||
_validate \
|
||||
\
|
||||
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_HEADER); \
|
||||
virBufferAddLit(&buffer, "<"#_name" xmlns=\"urn:vim25\">"); \
|
||||
\
|
||||
_serialize \
|
||||
\
|
||||
virBufferAddLit(&buffer, "</"#_name">"); \
|
||||
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER); \
|
||||
\
|
||||
if (virBufferCheckError(&buffer) < 0) \
|
||||
goto cleanup; \
|
||||
\
|
||||
request = virBufferContentAndReset(&buffer); \
|
||||
\
|
||||
if (esxVI_Context_Execute(ctx, methodName, request, &response, \
|
||||
esxVI_Occurrence_##_occurrence) < 0) { \
|
||||
goto cleanup; \
|
||||
} \
|
||||
\
|
||||
ESX_VI__METHOD__DESERIALIZE_OUTPUT__##_occurrence \
|
||||
(_output_type, _deserialize_suffix) \
|
||||
\
|
||||
result = 0; \
|
||||
\
|
||||
cleanup: \
|
||||
if (result < 0) { \
|
||||
virBufferFreeAndReset(&buffer); \
|
||||
} \
|
||||
\
|
||||
VIR_FREE(request); \
|
||||
esxVI_Response_Free(&response); \
|
||||
\
|
||||
return result; \
|
||||
#define ESX_VI__METHOD(_name, _this_from_service, _parameters, _output_type, \
|
||||
_deserialize_suffix, _occurrence, _validate, \
|
||||
_serialize) \
|
||||
int \
|
||||
esxVI_##_name _parameters \
|
||||
{ \
|
||||
int result = -1; \
|
||||
const char *methodName = #_name; \
|
||||
virBuffer buffer = VIR_BUFFER_INITIALIZER; \
|
||||
char *request = NULL; \
|
||||
esxVI_Response *response = NULL; \
|
||||
\
|
||||
ESX_VI__METHOD__PARAMETER__THIS__##_this_from_service \
|
||||
\
|
||||
ESX_VI__METHOD__CHECK_OUTPUT__##_occurrence \
|
||||
\
|
||||
_validate \
|
||||
\
|
||||
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_HEADER); \
|
||||
virBufferAddLit(&buffer, "<"#_name" xmlns=\"urn:vim25\">"); \
|
||||
\
|
||||
_serialize \
|
||||
\
|
||||
virBufferAddLit(&buffer, "</"#_name">"); \
|
||||
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER); \
|
||||
\
|
||||
if (virBufferCheckError(&buffer) < 0) \
|
||||
goto cleanup; \
|
||||
\
|
||||
request = virBufferContentAndReset(&buffer); \
|
||||
\
|
||||
if (esxVI_Context_Execute(ctx, methodName, request, &response, \
|
||||
esxVI_Occurrence_##_occurrence) < 0) { \
|
||||
goto cleanup; \
|
||||
} \
|
||||
\
|
||||
ESX_VI__METHOD__DESERIALIZE_OUTPUT__##_occurrence \
|
||||
(_output_type, _deserialize_suffix) \
|
||||
\
|
||||
result = 0; \
|
||||
\
|
||||
cleanup: \
|
||||
if (result < 0) { \
|
||||
virBufferFreeAndReset(&buffer); \
|
||||
} \
|
||||
\
|
||||
VIR_FREE(request); \
|
||||
esxVI_Response_Free(&response); \
|
||||
\
|
||||
return result; \
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define ESX_VI__METHOD__PARAMETER__THIS_FROM_SERVICE(_type, _name) \
|
||||
esxVI_##_type *_this = NULL; \
|
||||
\
|
||||
if (!ctx->service) { \
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid call")); \
|
||||
return -1; \
|
||||
} \
|
||||
\
|
||||
#define ESX_VI__METHOD__PARAMETER__THIS_FROM_SERVICE(_type, _name) \
|
||||
esxVI_##_type *_this = NULL; \
|
||||
\
|
||||
if (!ctx->service) { \
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid call")); \
|
||||
return -1; \
|
||||
} \
|
||||
\
|
||||
_this = ctx->service->_name;
|
||||
|
||||
|
||||
|
||||
#define ESX_VI__METHOD__PARAMETER__THIS__/* explicit _this */ \
|
||||
#define ESX_VI__METHOD__PARAMETER__THIS__/* explicit _this */ \
|
||||
/* nothing */
|
||||
|
||||
|
||||
@ -177,33 +177,33 @@
|
||||
*
|
||||
* To be used as part of ESX_VI__METHOD.
|
||||
*/
|
||||
#define ESX_VI__METHOD__PARAMETER__REQUIRE(_name) \
|
||||
if (_name == 0) { \
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, \
|
||||
"Required parameter '%s' is missing for call to %s", \
|
||||
#_name, methodName); \
|
||||
return -1; \
|
||||
#define ESX_VI__METHOD__PARAMETER__REQUIRE(_name) \
|
||||
if (_name == 0) { \
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, \
|
||||
"Required parameter '%s' is missing for call to %s", \
|
||||
#_name, methodName); \
|
||||
return -1; \
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define ESX_VI__METHOD__PARAMETER__SERIALIZE(_type, _name) \
|
||||
if (esxVI_##_type##_Serialize(_name, #_name, &buffer) < 0) { \
|
||||
goto cleanup; \
|
||||
#define ESX_VI__METHOD__PARAMETER__SERIALIZE(_type, _name) \
|
||||
if (esxVI_##_type##_Serialize(_name, #_name, &buffer) < 0) { \
|
||||
goto cleanup; \
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define ESX_VI__METHOD__PARAMETER__SERIALIZE_LIST(_type, _name) \
|
||||
if (esxVI_##_type##_SerializeList(_name, #_name, &buffer) < 0) { \
|
||||
goto cleanup; \
|
||||
#define ESX_VI__METHOD__PARAMETER__SERIALIZE_LIST(_type, _name) \
|
||||
if (esxVI_##_type##_SerializeList(_name, #_name, &buffer) < 0) { \
|
||||
goto cleanup; \
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define ESX_VI__METHOD__PARAMETER__SERIALIZE_VALUE(_type, _name) \
|
||||
if (esxVI_##_type##_SerializeValue(_name, #_name, &buffer) < 0) { \
|
||||
goto cleanup; \
|
||||
#define ESX_VI__METHOD__PARAMETER__SERIALIZE_VALUE(_type, _name) \
|
||||
if (esxVI_##_type##_SerializeValue(_name, #_name, &buffer) < 0) { \
|
||||
goto cleanup; \
|
||||
}
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
260
src/internal.h
260
src/internal.h
@ -77,9 +77,9 @@
|
||||
# define STRPREFIX(a, b) (strncmp(a, b, strlen(b)) == 0)
|
||||
# define STRSKIP(a, b) (STRPREFIX(a, b) ? (a) + strlen(b) : NULL)
|
||||
|
||||
# define STREQ_NULLABLE(a, b) \
|
||||
# define STREQ_NULLABLE(a, b) \
|
||||
((a) ? (b) && STREQ((a), (b)) : !(b))
|
||||
# define STRNEQ_NULLABLE(a, b) \
|
||||
# define STRNEQ_NULLABLE(a, b) \
|
||||
((a) ? !(b) || STRNEQ((a), (b)) : !!(b))
|
||||
|
||||
# define NUL_TERMINATE(buf) do { (buf)[sizeof(buf)-1] = '\0'; } while (0)
|
||||
@ -205,11 +205,11 @@
|
||||
/* Workaround bogus GCC 6.0 for logical 'or' equal expression warnings.
|
||||
* (GCC bz 69602) */
|
||||
# if BROKEN_GCC_WLOGICALOP_EQUAL_EXPR
|
||||
# define VIR_WARNINGS_NO_WLOGICALOP_EQUAL_EXPR \
|
||||
_Pragma ("GCC diagnostic push") \
|
||||
# define VIR_WARNINGS_NO_WLOGICALOP_EQUAL_EXPR \
|
||||
_Pragma ("GCC diagnostic push") \
|
||||
_Pragma ("GCC diagnostic ignored \"-Wlogical-op\"")
|
||||
# else
|
||||
# define VIR_WARNINGS_NO_WLOGICALOP_EQUAL_EXPR \
|
||||
# define VIR_WARNINGS_NO_WLOGICALOP_EQUAL_EXPR \
|
||||
_Pragma ("GCC diagnostic push")
|
||||
# endif
|
||||
|
||||
@ -226,7 +226,7 @@
|
||||
/* Workaround bogus GCC < 4.6 that produces false -Wlogical-op warnings for
|
||||
* strchr(). Those old GCCs don't support push/pop. */
|
||||
# if BROKEN_GCC_WLOGICALOP_STRCHR
|
||||
# define VIR_WARNINGS_NO_WLOGICALOP_STRCHR \
|
||||
# define VIR_WARNINGS_NO_WLOGICALOP_STRCHR \
|
||||
_Pragma ("GCC diagnostic ignored \"-Wlogical-op\"")
|
||||
# else
|
||||
# define VIR_WARNINGS_NO_WLOGICALOP_STRCHR
|
||||
@ -248,11 +248,11 @@
|
||||
*
|
||||
* In place exchange of two values
|
||||
*/
|
||||
# define SWAP(a, b) \
|
||||
do { \
|
||||
(a) = (a) ^ (b); \
|
||||
(b) = (a) ^ (b); \
|
||||
(a) = (a) ^ (b); \
|
||||
# define SWAP(a, b) \
|
||||
do { \
|
||||
(a) = (a) ^ (b); \
|
||||
(b) = (a) ^ (b); \
|
||||
(a) = (a) ^ (b); \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
@ -261,10 +261,10 @@
|
||||
* Steals pointer passed as second argument into the first argument. Second
|
||||
* argument must not have side effects.
|
||||
*/
|
||||
# define VIR_STEAL_PTR(a, b) \
|
||||
do { \
|
||||
(a) = (b); \
|
||||
(b) = NULL; \
|
||||
# define VIR_STEAL_PTR(a, b) \
|
||||
do { \
|
||||
(a) = (b); \
|
||||
(b) = NULL; \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
@ -278,15 +278,15 @@
|
||||
* Returns nothing. Exits the caller function if unsupported flags were
|
||||
* passed to it.
|
||||
*/
|
||||
# define virCheckFlags(supported, retval) \
|
||||
do { \
|
||||
unsigned long __unsuppflags = flags & ~(supported); \
|
||||
if (__unsuppflags) { \
|
||||
virReportInvalidArg(flags, \
|
||||
# define virCheckFlags(supported, retval) \
|
||||
do { \
|
||||
unsigned long __unsuppflags = flags & ~(supported); \
|
||||
if (__unsuppflags) { \
|
||||
virReportInvalidArg(flags, \
|
||||
_("unsupported flags (0x%lx) in function %s"), \
|
||||
__unsuppflags, __FUNCTION__); \
|
||||
return retval; \
|
||||
} \
|
||||
__unsuppflags, __FUNCTION__); \
|
||||
return retval; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
@ -300,15 +300,15 @@
|
||||
* Returns nothing. Jumps to a label if unsupported flags were
|
||||
* passed to it.
|
||||
*/
|
||||
# define virCheckFlagsGoto(supported, label) \
|
||||
do { \
|
||||
unsigned long __unsuppflags = flags & ~(supported); \
|
||||
if (__unsuppflags) { \
|
||||
virReportInvalidArg(flags, \
|
||||
# define virCheckFlagsGoto(supported, label) \
|
||||
do { \
|
||||
unsigned long __unsuppflags = flags & ~(supported); \
|
||||
if (__unsuppflags) { \
|
||||
virReportInvalidArg(flags, \
|
||||
_("unsupported flags (0x%lx) in function %s"), \
|
||||
__unsuppflags, __FUNCTION__); \
|
||||
goto label; \
|
||||
} \
|
||||
__unsuppflags, __FUNCTION__); \
|
||||
goto label; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/* Macros to help dealing with mutually exclusive flags. */
|
||||
@ -326,15 +326,15 @@
|
||||
* This helper does an early return and therefore it has to be called
|
||||
* before anything that would require cleanup.
|
||||
*/
|
||||
# define VIR_EXCLUSIVE_FLAGS_RET(FLAG1, FLAG2, RET) \
|
||||
do { \
|
||||
if ((flags & FLAG1) && (flags & FLAG2)) { \
|
||||
virReportInvalidArg(ctl, \
|
||||
_("Flags '%s' and '%s' are mutually " \
|
||||
"exclusive"), \
|
||||
#FLAG1, #FLAG2); \
|
||||
return RET; \
|
||||
} \
|
||||
# define VIR_EXCLUSIVE_FLAGS_RET(FLAG1, FLAG2, RET) \
|
||||
do { \
|
||||
if ((flags & FLAG1) && (flags & FLAG2)) { \
|
||||
virReportInvalidArg(ctl, \
|
||||
_("Flags '%s' and '%s' are mutually " \
|
||||
"exclusive"), \
|
||||
#FLAG1, #FLAG2); \
|
||||
return RET; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
@ -350,15 +350,15 @@
|
||||
* Returns nothing. Jumps to a label if unsupported flags were
|
||||
* passed to it.
|
||||
*/
|
||||
# define VIR_EXCLUSIVE_FLAGS_GOTO(FLAG1, FLAG2, LABEL) \
|
||||
do { \
|
||||
if ((flags & FLAG1) && (flags & FLAG2)) { \
|
||||
virReportInvalidArg(ctl, \
|
||||
_("Flags '%s' and '%s' are mutually " \
|
||||
"exclusive"), \
|
||||
#FLAG1, #FLAG2); \
|
||||
goto LABEL; \
|
||||
} \
|
||||
# define VIR_EXCLUSIVE_FLAGS_GOTO(FLAG1, FLAG2, LABEL) \
|
||||
do { \
|
||||
if ((flags & FLAG1) && (flags & FLAG2)) { \
|
||||
virReportInvalidArg(ctl, \
|
||||
_("Flags '%s' and '%s' are mutually " \
|
||||
"exclusive"), \
|
||||
#FLAG1, #FLAG2); \
|
||||
goto LABEL; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/* Macros to help dealing with flag requirements. */
|
||||
@ -376,14 +376,14 @@
|
||||
* This helper does an early return and therefore it has to be called
|
||||
* before anything that would require cleanup.
|
||||
*/
|
||||
# define VIR_REQUIRE_FLAG_RET(FLAG1, FLAG2, RET) \
|
||||
do { \
|
||||
if ((flags & FLAG1) && !(flags & FLAG2)) { \
|
||||
virReportInvalidArg(ctl, \
|
||||
_("Flag '%s' is required by flag '%s'"), \
|
||||
#FLAG2, #FLAG1); \
|
||||
return RET; \
|
||||
} \
|
||||
# define VIR_REQUIRE_FLAG_RET(FLAG1, FLAG2, RET) \
|
||||
do { \
|
||||
if ((flags & FLAG1) && !(flags & FLAG2)) { \
|
||||
virReportInvalidArg(ctl, \
|
||||
_("Flag '%s' is required by flag '%s'"), \
|
||||
#FLAG2, #FLAG1); \
|
||||
return RET; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
@ -398,90 +398,90 @@
|
||||
*
|
||||
* Returns nothing. Jumps to a label if required flag is not set.
|
||||
*/
|
||||
# define VIR_REQUIRE_FLAG_GOTO(FLAG1, FLAG2, LABEL) \
|
||||
do { \
|
||||
if ((flags & FLAG1) && !(flags & FLAG2)) { \
|
||||
virReportInvalidArg(ctl, \
|
||||
_("Flag '%s' is required by flag '%s'"), \
|
||||
#FLAG2, #FLAG1); \
|
||||
goto LABEL; \
|
||||
} \
|
||||
# define VIR_REQUIRE_FLAG_GOTO(FLAG1, FLAG2, LABEL) \
|
||||
do { \
|
||||
if ((flags & FLAG1) && !(flags & FLAG2)) { \
|
||||
virReportInvalidArg(ctl, \
|
||||
_("Flag '%s' is required by flag '%s'"), \
|
||||
#FLAG2, #FLAG1); \
|
||||
goto LABEL; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
# define virCheckNonNullArgReturn(argname, retval) \
|
||||
do { \
|
||||
if (argname == NULL) { \
|
||||
virReportInvalidNonNullArg(argname); \
|
||||
return retval; \
|
||||
} \
|
||||
# define virCheckNonNullArgReturn(argname, retval) \
|
||||
do { \
|
||||
if (argname == NULL) { \
|
||||
virReportInvalidNonNullArg(argname); \
|
||||
return retval; \
|
||||
} \
|
||||
} while (0)
|
||||
# define virCheckNullArgGoto(argname, label) \
|
||||
do { \
|
||||
if (argname != NULL) { \
|
||||
virReportInvalidNullArg(argname); \
|
||||
goto label; \
|
||||
} \
|
||||
# define virCheckNullArgGoto(argname, label) \
|
||||
do { \
|
||||
if (argname != NULL) { \
|
||||
virReportInvalidNullArg(argname); \
|
||||
goto label; \
|
||||
} \
|
||||
} while (0)
|
||||
# define virCheckNonNullArgGoto(argname, label) \
|
||||
do { \
|
||||
if (argname == NULL) { \
|
||||
virReportInvalidNonNullArg(argname); \
|
||||
goto label; \
|
||||
} \
|
||||
# define virCheckNonNullArgGoto(argname, label) \
|
||||
do { \
|
||||
if (argname == NULL) { \
|
||||
virReportInvalidNonNullArg(argname); \
|
||||
goto label; \
|
||||
} \
|
||||
} while (0)
|
||||
# define virCheckNonEmptyStringArgGoto(argname, label) \
|
||||
do { \
|
||||
if (argname == NULL) { \
|
||||
virReportInvalidNonNullArg(argname); \
|
||||
goto label; \
|
||||
} \
|
||||
if (*argname == '\0') { \
|
||||
virReportInvalidEmptyStringArg(argname); \
|
||||
goto label; \
|
||||
} \
|
||||
do { \
|
||||
if (argname == NULL) { \
|
||||
virReportInvalidNonNullArg(argname); \
|
||||
goto label; \
|
||||
} \
|
||||
if (*argname == '\0') { \
|
||||
virReportInvalidEmptyStringArg(argname); \
|
||||
goto label; \
|
||||
} \
|
||||
} while (0)
|
||||
# define virCheckPositiveArgGoto(argname, label) \
|
||||
do { \
|
||||
if (argname <= 0) { \
|
||||
virReportInvalidPositiveArg(argname); \
|
||||
goto label; \
|
||||
} \
|
||||
# define virCheckPositiveArgGoto(argname, label) \
|
||||
do { \
|
||||
if (argname <= 0) { \
|
||||
virReportInvalidPositiveArg(argname); \
|
||||
goto label; \
|
||||
} \
|
||||
} while (0)
|
||||
# define virCheckPositiveArgReturn(argname, retval) \
|
||||
do { \
|
||||
if (argname <= 0) { \
|
||||
virReportInvalidPositiveArg(argname); \
|
||||
return retval; \
|
||||
} \
|
||||
# define virCheckPositiveArgReturn(argname, retval) \
|
||||
do { \
|
||||
if (argname <= 0) { \
|
||||
virReportInvalidPositiveArg(argname); \
|
||||
return retval; \
|
||||
} \
|
||||
} while (0)
|
||||
# define virCheckNonZeroArgGoto(argname, label) \
|
||||
do { \
|
||||
if (argname == 0) { \
|
||||
virReportInvalidNonZeroArg(argname); \
|
||||
goto label; \
|
||||
} \
|
||||
# define virCheckNonZeroArgGoto(argname, label) \
|
||||
do { \
|
||||
if (argname == 0) { \
|
||||
virReportInvalidNonZeroArg(argname); \
|
||||
goto label; \
|
||||
} \
|
||||
} while (0)
|
||||
# define virCheckZeroArgGoto(argname, label) \
|
||||
do { \
|
||||
if (argname != 0) { \
|
||||
virReportInvalidNonZeroArg(argname); \
|
||||
goto label; \
|
||||
} \
|
||||
# define virCheckZeroArgGoto(argname, label) \
|
||||
do { \
|
||||
if (argname != 0) { \
|
||||
virReportInvalidNonZeroArg(argname); \
|
||||
goto label; \
|
||||
} \
|
||||
} while (0)
|
||||
# define virCheckNonNegativeArgGoto(argname, label) \
|
||||
do { \
|
||||
if (argname < 0) { \
|
||||
virReportInvalidNonNegativeArg(argname); \
|
||||
goto label; \
|
||||
} \
|
||||
# define virCheckNonNegativeArgGoto(argname, label) \
|
||||
do { \
|
||||
if (argname < 0) { \
|
||||
virReportInvalidNonNegativeArg(argname); \
|
||||
goto label; \
|
||||
} \
|
||||
} while (0)
|
||||
# define virCheckReadOnlyGoto(flags, label) \
|
||||
do { \
|
||||
if ((flags) & VIR_CONNECT_RO) { \
|
||||
# define virCheckReadOnlyGoto(flags, label) \
|
||||
do { \
|
||||
if ((flags) & VIR_CONNECT_RO) { \
|
||||
virReportRestrictedError(_("read only access prevents %s"), \
|
||||
__FUNCTION__); \
|
||||
goto label; \
|
||||
} \
|
||||
__FUNCTION__); \
|
||||
goto label; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
@ -494,8 +494,8 @@
|
||||
|
||||
/* Round up to the next closest power of 2. It will return rounded number or 0
|
||||
* for 0 or number more than 2^31 (for 32bit unsigned int). */
|
||||
# define VIR_ROUND_UP_POWER_OF_TWO(value) \
|
||||
((value) > 0 && (value) <= 1U << (sizeof(unsigned int) * 8 - 1) ? \
|
||||
# define VIR_ROUND_UP_POWER_OF_TWO(value) \
|
||||
((value) > 0 && (value) <= 1U << (sizeof(unsigned int) * 8 - 1) ? \
|
||||
1U << (sizeof(unsigned int) * 8 - count_leading_zeros((value) - 1)) : 0)
|
||||
|
||||
|
||||
|
@ -31,8 +31,8 @@
|
||||
# include "virchrdev.h"
|
||||
|
||||
# define JOB_MASK(job) (job == 0 ? 0 : 1 << (job - 1))
|
||||
# define DEFAULT_JOB_MASK \
|
||||
(JOB_MASK(LIBXL_JOB_DESTROY) | \
|
||||
# define DEFAULT_JOB_MASK \
|
||||
(JOB_MASK(LIBXL_JOB_DESTROY) | \
|
||||
JOB_MASK(LIBXL_JOB_ABORT))
|
||||
|
||||
/* Only 1 job is allowed at any time
|
||||
|
@ -83,13 +83,13 @@ VIR_LOG_INIT("libxl.libxl_driver");
|
||||
/* Number of Xen scheduler parameters */
|
||||
#define XEN_SCHED_CREDIT_NPARAM 2
|
||||
|
||||
#define LIBXL_CHECK_DOM0_GOTO(name, label) \
|
||||
do { \
|
||||
if (STREQ_NULLABLE(name, "Domain-0")) { \
|
||||
virReportError(VIR_ERR_OPERATION_INVALID, "%s", \
|
||||
#define LIBXL_CHECK_DOM0_GOTO(name, label) \
|
||||
do { \
|
||||
if (STREQ_NULLABLE(name, "Domain-0")) { \
|
||||
virReportError(VIR_ERR_OPERATION_INVALID, "%s", \
|
||||
_("Domain-0 does not support requested operation")); \
|
||||
goto label; \
|
||||
} \
|
||||
goto label; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
@ -5392,16 +5392,16 @@ libxlDomainBlockStatsVBD(virDomainObjPtr vm,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
# define LIBXL_SET_VBDSTAT(FIELD, VAR, MUL) \
|
||||
# define LIBXL_SET_VBDSTAT(FIELD, VAR, MUL) \
|
||||
if ((virAsprintf(&name, "%s/"FIELD, path) < 0) || \
|
||||
(virFileReadAll(name, 256, &val) < 0) || \
|
||||
(sscanf(val, "%llu", &status) != 1)) { \
|
||||
virReportError(VIR_ERR_OPERATION_FAILED, \
|
||||
_("cannot read %s"), name); \
|
||||
goto cleanup; \
|
||||
} \
|
||||
VAR += (status * MUL); \
|
||||
VIR_FREE(name); \
|
||||
(virFileReadAll(name, 256, &val) < 0) || \
|
||||
(sscanf(val, "%llu", &status) != 1)) { \
|
||||
virReportError(VIR_ERR_OPERATION_FAILED, \
|
||||
_("cannot read %s"), name); \
|
||||
goto cleanup; \
|
||||
} \
|
||||
VAR += (status * MUL); \
|
||||
VIR_FREE(name); \
|
||||
VIR_FREE(val);
|
||||
|
||||
LIBXL_SET_VBDSTAT("f_req", stats->f_req, 1)
|
||||
@ -5584,12 +5584,12 @@ libxlDomainBlockStatsFlags(virDomainPtr dom,
|
||||
|
||||
nstats = 0;
|
||||
|
||||
#define LIBXL_BLKSTAT_ASSIGN_PARAM(VAR, NAME) \
|
||||
if (nstats < *nparams && (blkstats.VAR) != -1) { \
|
||||
if (virTypedParameterAssign(params + nstats, NAME, \
|
||||
#define LIBXL_BLKSTAT_ASSIGN_PARAM(VAR, NAME) \
|
||||
if (nstats < *nparams && (blkstats.VAR) != -1) { \
|
||||
if (virTypedParameterAssign(params + nstats, NAME, \
|
||||
VIR_TYPED_PARAM_LLONG, (blkstats.VAR)) < 0) \
|
||||
goto endjob; \
|
||||
nstats++; \
|
||||
goto endjob; \
|
||||
nstats++; \
|
||||
}
|
||||
|
||||
LIBXL_BLKSTAT_ASSIGN_PARAM(wr_bytes, VIR_DOMAIN_BLOCK_STATS_WRITE_BYTES);
|
||||
|
@ -26,16 +26,16 @@
|
||||
|
||||
# include "libxl_conf.h"
|
||||
|
||||
# define LIBXL_MIGRATION_FLAGS \
|
||||
(VIR_MIGRATE_LIVE | \
|
||||
VIR_MIGRATE_PEER2PEER | \
|
||||
VIR_MIGRATE_TUNNELLED | \
|
||||
VIR_MIGRATE_PERSIST_DEST | \
|
||||
VIR_MIGRATE_UNDEFINE_SOURCE | \
|
||||
# define LIBXL_MIGRATION_FLAGS \
|
||||
(VIR_MIGRATE_LIVE | \
|
||||
VIR_MIGRATE_PEER2PEER | \
|
||||
VIR_MIGRATE_TUNNELLED | \
|
||||
VIR_MIGRATE_PERSIST_DEST | \
|
||||
VIR_MIGRATE_UNDEFINE_SOURCE | \
|
||||
VIR_MIGRATE_PAUSED)
|
||||
|
||||
/* All supported migration parameters and their types. */
|
||||
# define LIBXL_MIGRATION_PARAMETERS \
|
||||
# define LIBXL_MIGRATION_PARAMETERS \
|
||||
VIR_MIGRATE_PARAM_URI, VIR_TYPED_PARAM_STRING, \
|
||||
VIR_MIGRATE_PARAM_DEST_NAME, VIR_TYPED_PARAM_STRING, \
|
||||
VIR_MIGRATE_PARAM_DEST_XML, VIR_TYPED_PARAM_STRING, \
|
||||
|
@ -106,9 +106,9 @@ struct _virLockManagerParam {
|
||||
# define VIR_LOCK_MANAGER_VERSION_MINOR 0
|
||||
# define VIR_LOCK_MANAGER_VERSION_MICRO 0
|
||||
|
||||
# define VIR_LOCK_MANAGER_VERSION \
|
||||
((VIR_LOCK_MANAGER_VERSION_MAJOR * 1000 * 1000) + \
|
||||
(VIR_LOCK_MANAGER_VERSION_MINOR * 1000) + \
|
||||
# define VIR_LOCK_MANAGER_VERSION \
|
||||
((VIR_LOCK_MANAGER_VERSION_MAJOR * 1000 * 1000) + \
|
||||
(VIR_LOCK_MANAGER_VERSION_MINOR * 1000) + \
|
||||
(VIR_LOCK_MANAGER_VERSION_MICRO))
|
||||
|
||||
|
||||
|
@ -42,20 +42,20 @@
|
||||
|
||||
VIR_LOG_INIT("locking.lock_manager");
|
||||
|
||||
#define CHECK_DRIVER(field, errret) \
|
||||
if (!driver->field) { \
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, \
|
||||
#define CHECK_DRIVER(field, errret) \
|
||||
if (!driver->field) { \
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, \
|
||||
_("Missing '%s' field in lock manager driver"), \
|
||||
#field); \
|
||||
return errret; \
|
||||
#field); \
|
||||
return errret; \
|
||||
}
|
||||
|
||||
#define CHECK_MANAGER(field, errret) \
|
||||
if (!lock->driver->field) { \
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, \
|
||||
#define CHECK_MANAGER(field, errret) \
|
||||
if (!lock->driver->field) { \
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, \
|
||||
_("Missing '%s' field in lock manager driver"), \
|
||||
#field); \
|
||||
return errret; \
|
||||
#field); \
|
||||
return errret; \
|
||||
}
|
||||
|
||||
struct _virLockManagerPlugin {
|
||||
|
@ -847,11 +847,11 @@ lxcDomainSetMemoryParameters(virDomainPtr dom,
|
||||
goto endjob;
|
||||
}
|
||||
|
||||
#define VIR_GET_LIMIT_PARAMETER(PARAM, VALUE) \
|
||||
if ((rc = virTypedParamsGetULLong(params, nparams, PARAM, &VALUE)) < 0) \
|
||||
goto endjob; \
|
||||
\
|
||||
if (rc == 1) \
|
||||
#define VIR_GET_LIMIT_PARAMETER(PARAM, VALUE) \
|
||||
if ((rc = virTypedParamsGetULLong(params, nparams, PARAM, &VALUE)) < 0) \
|
||||
goto endjob; \
|
||||
\
|
||||
if (rc == 1) \
|
||||
set_ ## VALUE = true;
|
||||
|
||||
VIR_GET_LIMIT_PARAMETER(VIR_DOMAIN_MEMORY_SWAP_HARD_LIMIT, swap_hard_limit)
|
||||
@ -879,16 +879,16 @@ lxcDomainSetMemoryParameters(virDomainPtr dom,
|
||||
}
|
||||
}
|
||||
|
||||
#define VIR_SET_MEM_PARAMETER(FUNC, VALUE) \
|
||||
if (set_ ## VALUE) { \
|
||||
if (def) { \
|
||||
if ((rc = FUNC(priv->cgroup, VALUE)) < 0) \
|
||||
goto endjob; \
|
||||
def->mem.VALUE = VALUE; \
|
||||
} \
|
||||
\
|
||||
if (persistentDef) \
|
||||
persistentDef->mem.VALUE = VALUE; \
|
||||
#define VIR_SET_MEM_PARAMETER(FUNC, VALUE) \
|
||||
if (set_ ## VALUE) { \
|
||||
if (def) { \
|
||||
if ((rc = FUNC(priv->cgroup, VALUE)) < 0) \
|
||||
goto endjob; \
|
||||
def->mem.VALUE = VALUE; \
|
||||
} \
|
||||
\
|
||||
if (persistentDef) \
|
||||
persistentDef->mem.VALUE = VALUE; \
|
||||
}
|
||||
|
||||
/* Soft limit doesn't clash with the others */
|
||||
|
@ -401,16 +401,16 @@ udevFillMdevType(struct udev_device *device,
|
||||
int ret = -1;
|
||||
char *attrpath = NULL;
|
||||
|
||||
#define MDEV_GET_SYSFS_ATTR(attr_name, cb, ...) \
|
||||
do { \
|
||||
if (virAsprintf(&attrpath, "%s/%s", dir, #attr_name) < 0) \
|
||||
goto cleanup; \
|
||||
\
|
||||
if (cb(device, attrpath, __VA_ARGS__) < 0) \
|
||||
goto cleanup; \
|
||||
\
|
||||
VIR_FREE(attrpath); \
|
||||
} while (0) \
|
||||
#define MDEV_GET_SYSFS_ATTR(attr_name, cb, ...) \
|
||||
do { \
|
||||
if (virAsprintf(&attrpath, "%s/%s", dir, #attr_name) < 0) \
|
||||
goto cleanup; \
|
||||
\
|
||||
if (cb(device, attrpath, __VA_ARGS__) < 0) \
|
||||
goto cleanup; \
|
||||
\
|
||||
VIR_FREE(attrpath); \
|
||||
} while (0) \
|
||||
|
||||
if (VIR_STRDUP(type->id, last_component(dir)) < 0)
|
||||
goto cleanup;
|
||||
|
@ -1836,37 +1836,37 @@ ebtablesCreateRuleInstance(virFirewallPtr fw,
|
||||
PRINT_CHAIN(chain, chainPrefix, ifname,
|
||||
chainSuffix);
|
||||
|
||||
#define INST_ITEM(STRUCT, ITEM, CLI) \
|
||||
if (HAS_ENTRY_ITEM(&rule->p.STRUCT.ITEM)) { \
|
||||
if (printDataType(vars, \
|
||||
field, sizeof(field), \
|
||||
&rule->p.STRUCT.ITEM) < 0) \
|
||||
goto cleanup; \
|
||||
virFirewallRuleAddArg(fw, fwrule, CLI); \
|
||||
if (ENTRY_WANT_NEG_SIGN(&rule->p.STRUCT.ITEM)) \
|
||||
virFirewallRuleAddArg(fw, fwrule, "!"); \
|
||||
virFirewallRuleAddArg(fw, fwrule, field); \
|
||||
#define INST_ITEM(STRUCT, ITEM, CLI) \
|
||||
if (HAS_ENTRY_ITEM(&rule->p.STRUCT.ITEM)) { \
|
||||
if (printDataType(vars, \
|
||||
field, sizeof(field), \
|
||||
&rule->p.STRUCT.ITEM) < 0) \
|
||||
goto cleanup; \
|
||||
virFirewallRuleAddArg(fw, fwrule, CLI); \
|
||||
if (ENTRY_WANT_NEG_SIGN(&rule->p.STRUCT.ITEM)) \
|
||||
virFirewallRuleAddArg(fw, fwrule, "!"); \
|
||||
virFirewallRuleAddArg(fw, fwrule, field); \
|
||||
}
|
||||
|
||||
#define INST_ITEM_2PARMS(STRUCT, ITEM, ITEM_HI, CLI, SEP) \
|
||||
if (HAS_ENTRY_ITEM(&rule->p.STRUCT.ITEM)) { \
|
||||
if (printDataType(vars, \
|
||||
field, sizeof(field), \
|
||||
&rule->p.STRUCT.ITEM) < 0) \
|
||||
goto cleanup; \
|
||||
virFirewallRuleAddArg(fw, fwrule, CLI); \
|
||||
if (ENTRY_WANT_NEG_SIGN(&rule->p.STRUCT.ITEM)) \
|
||||
virFirewallRuleAddArg(fw, fwrule, "!"); \
|
||||
if (HAS_ENTRY_ITEM(&rule->p.STRUCT.ITEM_HI)) { \
|
||||
if (printDataType(vars, \
|
||||
fieldalt, sizeof(fieldalt), \
|
||||
&rule->p.STRUCT.ITEM_HI) < 0) \
|
||||
goto cleanup; \
|
||||
virFirewallRuleAddArgFormat(fw, fwrule, \
|
||||
#define INST_ITEM_2PARMS(STRUCT, ITEM, ITEM_HI, CLI, SEP) \
|
||||
if (HAS_ENTRY_ITEM(&rule->p.STRUCT.ITEM)) { \
|
||||
if (printDataType(vars, \
|
||||
field, sizeof(field), \
|
||||
&rule->p.STRUCT.ITEM) < 0) \
|
||||
goto cleanup; \
|
||||
virFirewallRuleAddArg(fw, fwrule, CLI); \
|
||||
if (ENTRY_WANT_NEG_SIGN(&rule->p.STRUCT.ITEM)) \
|
||||
virFirewallRuleAddArg(fw, fwrule, "!"); \
|
||||
if (HAS_ENTRY_ITEM(&rule->p.STRUCT.ITEM_HI)) { \
|
||||
if (printDataType(vars, \
|
||||
fieldalt, sizeof(fieldalt), \
|
||||
&rule->p.STRUCT.ITEM_HI) < 0) \
|
||||
goto cleanup; \
|
||||
virFirewallRuleAddArgFormat(fw, fwrule, \
|
||||
"%s%s%s", field, SEP, fieldalt); \
|
||||
} else { \
|
||||
virFirewallRuleAddArg(fw, fwrule, field); \
|
||||
} \
|
||||
} else { \
|
||||
virFirewallRuleAddArg(fw, fwrule, field); \
|
||||
} \
|
||||
}
|
||||
#define INST_ITEM_RANGE(S, I, I_HI, C) \
|
||||
INST_ITEM_2PARMS(S, I, I_HI, C, ":")
|
||||
|
@ -31,11 +31,11 @@
|
||||
|
||||
# include "internal.h"
|
||||
|
||||
# define OPENVZ_MIGRATION_FLAGS \
|
||||
# define OPENVZ_MIGRATION_FLAGS \
|
||||
(VIR_MIGRATE_LIVE)
|
||||
|
||||
/* All supported migration parameters and their types. */
|
||||
# define OPENVZ_MIGRATION_PARAMETERS \
|
||||
# define OPENVZ_MIGRATION_PARAMETERS \
|
||||
VIR_MIGRATE_PARAM_URI, VIR_TYPED_PARAM_STRING, \
|
||||
VIR_MIGRATE_PARAM_DEST_NAME, VIR_TYPED_PARAM_STRING, \
|
||||
VIR_MIGRATE_PARAM_DEST_XML, VIR_TYPED_PARAM_STRING, \
|
||||
|
@ -871,10 +871,10 @@ phypUUIDTable_Free(uuid_tablePtr uuid_table)
|
||||
VIR_FREE(uuid_table);
|
||||
}
|
||||
|
||||
#define SPECIALCHARACTER_CASES \
|
||||
case '&': case ';': case '`': case '@': case '"': case '|': case '*': \
|
||||
case '?': case '~': case '<': case '>': case '^': case '(': case ')': \
|
||||
case '[': case ']': case '{': case '}': case '$': case '%': case '#': \
|
||||
#define SPECIALCHARACTER_CASES \
|
||||
case '&': case ';': case '`': case '@': case '"': case '|': case '*': \
|
||||
case '?': case '~': case '<': case '>': case '^': case '(': case ')': \
|
||||
case '[': case ']': case '{': case '}': case '$': case '%': case '#': \
|
||||
case '\\': case '\n': case '\r': case '\t':
|
||||
|
||||
static bool
|
||||
|
@ -1807,10 +1807,10 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
|
||||
if (qemuCheckDiskConfigBlkdeviotune(disk, qemuCaps) < 0)
|
||||
goto error;
|
||||
|
||||
#define IOTUNE_ADD(_field, _label) \
|
||||
if (disk->blkdeviotune._field) { \
|
||||
virBufferAsprintf(&opt, ",throttling." _label "=%llu", \
|
||||
disk->blkdeviotune._field); \
|
||||
#define IOTUNE_ADD(_field, _label) \
|
||||
if (disk->blkdeviotune._field) { \
|
||||
virBufferAsprintf(&opt, ",throttling." _label "=%llu", \
|
||||
disk->blkdeviotune._field); \
|
||||
}
|
||||
|
||||
IOTUNE_ADD(total_bytes_sec, "bps-total");
|
||||
|
@ -266,17 +266,17 @@ virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool privileged)
|
||||
* If the service specific directory doesn't exist, 'assume' that the
|
||||
* user has created and populated the "SYSCONFDIR" + "pki/libvirt-default".
|
||||
*/
|
||||
#define SET_TLS_X509_CERT_DEFAULT(val) \
|
||||
do { \
|
||||
if (virFileExists(SYSCONFDIR "/pki/libvirt-"#val)) { \
|
||||
if (VIR_STRDUP(cfg->val ## TLSx509certdir, \
|
||||
SYSCONFDIR "/pki/libvirt-"#val) < 0) \
|
||||
goto error; \
|
||||
} else { \
|
||||
if (VIR_STRDUP(cfg->val ## TLSx509certdir, \
|
||||
cfg->defaultTLSx509certdir) < 0) \
|
||||
goto error; \
|
||||
} \
|
||||
#define SET_TLS_X509_CERT_DEFAULT(val) \
|
||||
do { \
|
||||
if (virFileExists(SYSCONFDIR "/pki/libvirt-"#val)) { \
|
||||
if (VIR_STRDUP(cfg->val ## TLSx509certdir, \
|
||||
SYSCONFDIR "/pki/libvirt-"#val) < 0) \
|
||||
goto error; \
|
||||
} else { \
|
||||
if (VIR_STRDUP(cfg->val ## TLSx509certdir, \
|
||||
cfg->defaultTLSx509certdir) < 0) \
|
||||
goto error; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
SET_TLS_X509_CERT_DEFAULT(vnc);
|
||||
@ -446,14 +446,14 @@ virQEMUDriverConfigTLSDirResetDefaults(virQEMUDriverConfigPtr cfg)
|
||||
STREQ(cfg->defaultTLSx509certdir, SYSCONFDIR "/pki/qemu"))
|
||||
return 0;
|
||||
|
||||
#define CHECK_RESET_CERT_DIR_DEFAULT(val) \
|
||||
do { \
|
||||
if (STREQ(cfg->val ## TLSx509certdir, SYSCONFDIR "/pki/qemu")) { \
|
||||
VIR_FREE(cfg->val ## TLSx509certdir); \
|
||||
if (VIR_STRDUP(cfg->val ## TLSx509certdir, \
|
||||
cfg->defaultTLSx509certdir) < 0) \
|
||||
return -1; \
|
||||
} \
|
||||
#define CHECK_RESET_CERT_DIR_DEFAULT(val) \
|
||||
do { \
|
||||
if (STREQ(cfg->val ## TLSx509certdir, SYSCONFDIR "/pki/qemu")) { \
|
||||
VIR_FREE(cfg->val ## TLSx509certdir); \
|
||||
if (VIR_STRDUP(cfg->val ## TLSx509certdir, \
|
||||
cfg->defaultTLSx509certdir) < 0) \
|
||||
return -1; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
CHECK_RESET_CERT_DIR_DEFAULT(vnc);
|
||||
@ -565,30 +565,30 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
|
||||
if (virConfGetValueString(conf, "vxhs_tls_x509_cert_dir", &cfg->vxhsTLSx509certdir) < 0)
|
||||
goto cleanup;
|
||||
|
||||
#define GET_CONFIG_TLS_CERTINFO(val) \
|
||||
do { \
|
||||
if ((rv = virConfGetValueBool(conf, #val "_tls_x509_verify", \
|
||||
&cfg->val## TLSx509verify)) < 0) \
|
||||
goto cleanup; \
|
||||
if (rv == 0) \
|
||||
cfg->val## TLSx509verify = cfg->defaultTLSx509verify; \
|
||||
if ((rv = virConfGetValueString(conf, #val "_tls_x509_cert_dir", \
|
||||
&cfg->val## TLSx509certdir)) < 0) \
|
||||
goto cleanup; \
|
||||
if (virConfGetValueString(conf, \
|
||||
#val "_tls_x509_secret_uuid", \
|
||||
&cfg->val## TLSx509secretUUID) < 0) \
|
||||
goto cleanup; \
|
||||
#define GET_CONFIG_TLS_CERTINFO(val) \
|
||||
do { \
|
||||
if ((rv = virConfGetValueBool(conf, #val "_tls_x509_verify", \
|
||||
&cfg->val## TLSx509verify)) < 0) \
|
||||
goto cleanup; \
|
||||
if (rv == 0) \
|
||||
cfg->val## TLSx509verify = cfg->defaultTLSx509verify; \
|
||||
if ((rv = virConfGetValueString(conf, #val "_tls_x509_cert_dir", \
|
||||
&cfg->val## TLSx509certdir)) < 0) \
|
||||
goto cleanup; \
|
||||
if (virConfGetValueString(conf, \
|
||||
#val "_tls_x509_secret_uuid", \
|
||||
&cfg->val## TLSx509secretUUID) < 0) \
|
||||
goto cleanup; \
|
||||
/* Only if a *tls_x509_cert_dir wasn't found (e.g. rv == 0), should \
|
||||
* we copy the defaultTLSx509secretUUID. If this environment needs \
|
||||
* a passphrase to decode the certificate, then it should provide \
|
||||
* it's own secretUUID for that. */ \
|
||||
if (rv == 0 && !cfg->val## TLSx509secretUUID && \
|
||||
cfg->defaultTLSx509secretUUID) { \
|
||||
if (VIR_STRDUP(cfg->val## TLSx509secretUUID, \
|
||||
cfg->defaultTLSx509secretUUID) < 0) \
|
||||
goto cleanup; \
|
||||
} \
|
||||
* we copy the defaultTLSx509secretUUID. If this environment needs \
|
||||
* a passphrase to decode the certificate, then it should provide \
|
||||
* it's own secretUUID for that. */ \
|
||||
if (rv == 0 && !cfg->val## TLSx509secretUUID && \
|
||||
cfg->defaultTLSx509secretUUID) { \
|
||||
if (VIR_STRDUP(cfg->val## TLSx509secretUUID, \
|
||||
cfg->defaultTLSx509secretUUID) < 0) \
|
||||
goto cleanup; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
if (virConfGetValueBool(conf, "chardev_tls", &cfg->chardevTLS) < 0)
|
||||
|
@ -6219,16 +6219,16 @@ bool
|
||||
qemuDomainDiskChangeSupported(virDomainDiskDefPtr disk,
|
||||
virDomainDiskDefPtr orig_disk)
|
||||
{
|
||||
#define CHECK_EQ(field, field_name, nullable) \
|
||||
do { \
|
||||
if (nullable && !disk->field) \
|
||||
break; \
|
||||
if (disk->field != orig_disk->field) { \
|
||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, \
|
||||
_("cannot modify field '%s' of the disk"), \
|
||||
field_name); \
|
||||
return false; \
|
||||
} \
|
||||
#define CHECK_EQ(field, field_name, nullable) \
|
||||
do { \
|
||||
if (nullable && !disk->field) \
|
||||
break; \
|
||||
if (disk->field != orig_disk->field) { \
|
||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, \
|
||||
_("cannot modify field '%s' of the disk"), \
|
||||
field_name); \
|
||||
return false; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
CHECK_EQ(device, "device", false);
|
||||
|
@ -39,7 +39,7 @@
|
||||
# include "virobject.h"
|
||||
# include "logging/log_manager.h"
|
||||
|
||||
# define QEMU_DOMAIN_FORMAT_LIVE_FLAGS \
|
||||
# define QEMU_DOMAIN_FORMAT_LIVE_FLAGS \
|
||||
(VIR_DOMAIN_XML_SECURE)
|
||||
|
||||
# if ULONG_MAX == 4294967295
|
||||
@ -51,14 +51,14 @@
|
||||
# endif
|
||||
|
||||
# define JOB_MASK(job) (job == 0 ? 0 : 1 << (job - 1))
|
||||
# define QEMU_JOB_DEFAULT_MASK \
|
||||
(JOB_MASK(QEMU_JOB_QUERY) | \
|
||||
JOB_MASK(QEMU_JOB_DESTROY) | \
|
||||
# define QEMU_JOB_DEFAULT_MASK \
|
||||
(JOB_MASK(QEMU_JOB_QUERY) | \
|
||||
JOB_MASK(QEMU_JOB_DESTROY) | \
|
||||
JOB_MASK(QEMU_JOB_ABORT))
|
||||
|
||||
/* Jobs which have to be tracked in domain state XML. */
|
||||
# define QEMU_DOMAIN_TRACK_JOBS \
|
||||
(JOB_MASK(QEMU_JOB_DESTROY) | \
|
||||
# define QEMU_DOMAIN_TRACK_JOBS \
|
||||
(JOB_MASK(QEMU_JOB_DESTROY) | \
|
||||
JOB_MASK(QEMU_JOB_ASYNC))
|
||||
|
||||
/* Only 1 job is allowed at any time
|
||||
@ -331,7 +331,7 @@ struct _qemuDomainObjPrivate {
|
||||
virBitmapPtr migrationCaps;
|
||||
};
|
||||
|
||||
# define QEMU_DOMAIN_PRIVATE(vm) \
|
||||
# define QEMU_DOMAIN_PRIVATE(vm) \
|
||||
((qemuDomainObjPrivatePtr) (vm)->privateData)
|
||||
|
||||
# define QEMU_DOMAIN_DISK_PRIVATE(disk) \
|
||||
@ -376,7 +376,7 @@ struct _qemuDomainStorageSourcePrivate {
|
||||
|
||||
virObjectPtr qemuDomainStorageSourcePrivateNew(void);
|
||||
|
||||
# define QEMU_DOMAIN_HOSTDEV_PRIVATE(hostdev) \
|
||||
# define QEMU_DOMAIN_HOSTDEV_PRIVATE(hostdev) \
|
||||
((qemuDomainHostdevPrivatePtr) (hostdev)->privateData)
|
||||
|
||||
|
||||
@ -400,7 +400,7 @@ struct _qemuDomainVcpuPrivate {
|
||||
int vcpus;
|
||||
};
|
||||
|
||||
# define QEMU_DOMAIN_VCPU_PRIVATE(vcpu) \
|
||||
# define QEMU_DOMAIN_VCPU_PRIVATE(vcpu) \
|
||||
((qemuDomainVcpuPrivatePtr) (vcpu)->privateData)
|
||||
|
||||
|
||||
@ -424,7 +424,7 @@ struct _qemuDomainHostdevPrivate {
|
||||
qemuDomainSecretInfoPtr secinfo;
|
||||
};
|
||||
|
||||
# define QEMU_DOMAIN_CHR_SOURCE_PRIVATE(dev) \
|
||||
# define QEMU_DOMAIN_CHR_SOURCE_PRIVATE(dev) \
|
||||
((qemuDomainChrSourcePrivatePtr) (dev)->privateData)
|
||||
|
||||
typedef struct _qemuDomainChrSourcePrivate qemuDomainChrSourcePrivate;
|
||||
|
@ -9443,11 +9443,11 @@ qemuDomainSetMemoryParameters(virDomainPtr dom,
|
||||
goto endjob;
|
||||
}
|
||||
|
||||
#define VIR_GET_LIMIT_PARAMETER(PARAM, VALUE) \
|
||||
if ((rc = virTypedParamsGetULLong(params, nparams, PARAM, &VALUE)) < 0) \
|
||||
goto endjob; \
|
||||
\
|
||||
if (rc == 1) \
|
||||
#define VIR_GET_LIMIT_PARAMETER(PARAM, VALUE) \
|
||||
if ((rc = virTypedParamsGetULLong(params, nparams, PARAM, &VALUE)) < 0) \
|
||||
goto endjob; \
|
||||
\
|
||||
if (rc == 1) \
|
||||
set_ ## VALUE = true;
|
||||
|
||||
VIR_GET_LIMIT_PARAMETER(VIR_DOMAIN_MEMORY_SWAP_HARD_LIMIT, swap_hard_limit)
|
||||
@ -9475,16 +9475,16 @@ qemuDomainSetMemoryParameters(virDomainPtr dom,
|
||||
}
|
||||
}
|
||||
|
||||
#define VIR_SET_MEM_PARAMETER(FUNC, VALUE) \
|
||||
if (set_ ## VALUE) { \
|
||||
if (def) { \
|
||||
if ((rc = FUNC(priv->cgroup, VALUE)) < 0) \
|
||||
goto endjob; \
|
||||
def->mem.VALUE = VALUE; \
|
||||
} \
|
||||
\
|
||||
if (persistentDef) \
|
||||
persistentDef->mem.VALUE = VALUE; \
|
||||
#define VIR_SET_MEM_PARAMETER(FUNC, VALUE) \
|
||||
if (set_ ## VALUE) { \
|
||||
if (def) { \
|
||||
if ((rc = FUNC(priv->cgroup, VALUE)) < 0) \
|
||||
goto endjob; \
|
||||
def->mem.VALUE = VALUE; \
|
||||
} \
|
||||
\
|
||||
if (persistentDef) \
|
||||
persistentDef->mem.VALUE = VALUE; \
|
||||
}
|
||||
|
||||
/* Soft limit doesn't clash with the others */
|
||||
@ -9525,10 +9525,10 @@ qemuDomainSetMemoryParameters(virDomainPtr dom,
|
||||
}
|
||||
|
||||
|
||||
#define QEMU_ASSIGN_MEM_PARAM(index, name, value) \
|
||||
if (index < *nparams && \
|
||||
virTypedParameterAssign(¶ms[index], name, VIR_TYPED_PARAM_ULLONG, \
|
||||
value) < 0) \
|
||||
#define QEMU_ASSIGN_MEM_PARAM(index, name, value) \
|
||||
if (index < *nparams && \
|
||||
virTypedParameterAssign(¶ms[index], name, VIR_TYPED_PARAM_ULLONG, \
|
||||
value) < 0) \
|
||||
goto cleanup
|
||||
|
||||
static int
|
||||
@ -10159,13 +10159,13 @@ qemuSetIOThreadsBWLive(virDomainObjPtr vm, virCgroupPtr cgroup,
|
||||
}
|
||||
|
||||
|
||||
#define SCHED_RANGE_CHECK(VAR, NAME, MIN, MAX) \
|
||||
if (((VAR) > 0 && (VAR) < (MIN)) || (VAR) > (MAX)) { \
|
||||
virReportError(VIR_ERR_INVALID_ARG, \
|
||||
_("value of '%s' is out of range [%lld, %lld]"), \
|
||||
NAME, MIN, MAX); \
|
||||
rc = -1; \
|
||||
goto endjob; \
|
||||
#define SCHED_RANGE_CHECK(VAR, NAME, MIN, MAX) \
|
||||
if (((VAR) > 0 && (VAR) < (MIN)) || (VAR) > (MAX)) { \
|
||||
virReportError(VIR_ERR_INVALID_ARG, \
|
||||
_("value of '%s' is out of range [%lld, %lld]"), \
|
||||
NAME, MIN, MAX); \
|
||||
rc = -1; \
|
||||
goto endjob; \
|
||||
}
|
||||
|
||||
static int
|
||||
@ -10689,12 +10689,12 @@ qemuDomainGetSchedulerParametersFlags(virDomainPtr dom,
|
||||
}
|
||||
}
|
||||
|
||||
#define QEMU_SCHED_ASSIGN(param, name, type) \
|
||||
if (*nparams < maxparams && \
|
||||
virTypedParameterAssign(&(params[(*nparams)++]), \
|
||||
VIR_DOMAIN_SCHEDULER_ ## name, \
|
||||
VIR_TYPED_PARAM_ ## type, \
|
||||
data.param) < 0) \
|
||||
#define QEMU_SCHED_ASSIGN(param, name, type) \
|
||||
if (*nparams < maxparams && \
|
||||
virTypedParameterAssign(&(params[(*nparams)++]), \
|
||||
VIR_DOMAIN_SCHEDULER_ ## name, \
|
||||
VIR_TYPED_PARAM_ ## type, \
|
||||
data.param) < 0) \
|
||||
goto cleanup
|
||||
|
||||
QEMU_SCHED_ASSIGN(shares, CPU_SHARES, ULLONG);
|
||||
@ -10830,8 +10830,8 @@ qemuDomainBlockStatsGatherTotals(void *payload,
|
||||
qemuBlockStatsPtr data = payload;
|
||||
qemuBlockStatsPtr total = opaque;
|
||||
|
||||
#define QEMU_BLOCK_STAT_TOTAL(NAME) \
|
||||
if (data->NAME > 0) \
|
||||
#define QEMU_BLOCK_STAT_TOTAL(NAME) \
|
||||
if (data->NAME > 0) \
|
||||
total->NAME += data->NAME
|
||||
|
||||
QEMU_BLOCK_STAT_TOTAL(wr_bytes);
|
||||
@ -11016,12 +11016,12 @@ qemuDomainBlockStatsFlags(virDomainPtr dom,
|
||||
|
||||
nstats = 0;
|
||||
|
||||
#define QEMU_BLOCK_STATS_ASSIGN_PARAM(VAR, NAME) \
|
||||
if (nstats < *nparams && (blockstats->VAR) != -1) { \
|
||||
if (virTypedParameterAssign(params + nstats, NAME, \
|
||||
#define QEMU_BLOCK_STATS_ASSIGN_PARAM(VAR, NAME) \
|
||||
if (nstats < *nparams && (blockstats->VAR) != -1) { \
|
||||
if (virTypedParameterAssign(params + nstats, NAME, \
|
||||
VIR_TYPED_PARAM_LLONG, (blockstats->VAR)) < 0) \
|
||||
goto endjob; \
|
||||
nstats++; \
|
||||
goto endjob; \
|
||||
nstats++; \
|
||||
}
|
||||
|
||||
QEMU_BLOCK_STATS_ASSIGN_PARAM(wr_bytes, VIR_DOMAIN_BLOCK_STATS_WRITE_BYTES);
|
||||
@ -17772,11 +17772,11 @@ qemuDomainSetBlockIoTuneDefaults(virDomainBlockIoTuneInfoPtr newinfo,
|
||||
virDomainBlockIoTuneInfoPtr oldinfo,
|
||||
qemuBlockIoTuneSetFlags set_fields)
|
||||
{
|
||||
#define SET_IOTUNE_DEFAULTS(BOOL, FIELD) \
|
||||
if (!(set_fields & QEMU_BLOCK_IOTUNE_SET_##BOOL)) { \
|
||||
newinfo->total_##FIELD = oldinfo->total_##FIELD; \
|
||||
newinfo->read_##FIELD = oldinfo->read_##FIELD; \
|
||||
newinfo->write_##FIELD = oldinfo->write_##FIELD; \
|
||||
#define SET_IOTUNE_DEFAULTS(BOOL, FIELD) \
|
||||
if (!(set_fields & QEMU_BLOCK_IOTUNE_SET_##BOOL)) { \
|
||||
newinfo->total_##FIELD = oldinfo->total_##FIELD; \
|
||||
newinfo->read_##FIELD = oldinfo->read_##FIELD; \
|
||||
newinfo->write_##FIELD = oldinfo->write_##FIELD; \
|
||||
}
|
||||
|
||||
SET_IOTUNE_DEFAULTS(BYTES, bytes_sec);
|
||||
@ -17803,13 +17803,13 @@ qemuDomainSetBlockIoTuneDefaults(virDomainBlockIoTuneInfoPtr newinfo,
|
||||
* will cause an error. So, to mimic that, if our oldinfo was set and
|
||||
* our newinfo is clearing, then set max_length based on whether we
|
||||
* have a value in the family set/defined. */
|
||||
#define SET_MAX_LENGTH(BOOL, FIELD) \
|
||||
if (!(set_fields & QEMU_BLOCK_IOTUNE_SET_##BOOL)) \
|
||||
newinfo->FIELD##_max_length = oldinfo->FIELD##_max_length; \
|
||||
else if ((set_fields & QEMU_BLOCK_IOTUNE_SET_##BOOL) && \
|
||||
oldinfo->FIELD##_max_length && \
|
||||
!newinfo->FIELD##_max_length) \
|
||||
newinfo->FIELD##_max_length = (newinfo->FIELD || \
|
||||
#define SET_MAX_LENGTH(BOOL, FIELD) \
|
||||
if (!(set_fields & QEMU_BLOCK_IOTUNE_SET_##BOOL)) \
|
||||
newinfo->FIELD##_max_length = oldinfo->FIELD##_max_length; \
|
||||
else if ((set_fields & QEMU_BLOCK_IOTUNE_SET_##BOOL) && \
|
||||
oldinfo->FIELD##_max_length && \
|
||||
!newinfo->FIELD##_max_length) \
|
||||
newinfo->FIELD##_max_length = (newinfo->FIELD || \
|
||||
newinfo->FIELD##_max) ? 1 : 0;
|
||||
|
||||
SET_MAX_LENGTH(BYTES_MAX_LENGTH, total_bytes_sec);
|
||||
@ -17921,16 +17921,16 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
|
||||
VIR_DOMAIN_TUNABLE_BLKDEV_DISK, path) < 0)
|
||||
goto endjob;
|
||||
|
||||
#define SET_IOTUNE_FIELD(FIELD, BOOL, CONST) \
|
||||
if (STREQ(param->field, VIR_DOMAIN_BLOCK_IOTUNE_##CONST)) { \
|
||||
info.FIELD = param->value.ul; \
|
||||
set_fields |= QEMU_BLOCK_IOTUNE_SET_##BOOL; \
|
||||
if (virTypedParamsAddULLong(&eventParams, &eventNparams, \
|
||||
&eventMaxparams, \
|
||||
VIR_DOMAIN_TUNABLE_BLKDEV_##CONST, \
|
||||
param->value.ul) < 0) \
|
||||
goto endjob; \
|
||||
continue; \
|
||||
#define SET_IOTUNE_FIELD(FIELD, BOOL, CONST) \
|
||||
if (STREQ(param->field, VIR_DOMAIN_BLOCK_IOTUNE_##CONST)) { \
|
||||
info.FIELD = param->value.ul; \
|
||||
set_fields |= QEMU_BLOCK_IOTUNE_SET_##BOOL; \
|
||||
if (virTypedParamsAddULLong(&eventParams, &eventNparams, \
|
||||
&eventMaxparams, \
|
||||
VIR_DOMAIN_TUNABLE_BLKDEV_##CONST, \
|
||||
param->value.ul) < 0) \
|
||||
goto endjob; \
|
||||
continue; \
|
||||
}
|
||||
|
||||
for (i = 0; i < nparams; i++) {
|
||||
@ -18077,31 +18077,31 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
|
||||
set_fields) < 0)
|
||||
goto endjob;
|
||||
|
||||
#define CHECK_MAX(val, _bool) \
|
||||
do { \
|
||||
if (info.val##_max) { \
|
||||
if (!info.val) { \
|
||||
if (QEMU_BLOCK_IOTUNE_SET_##_bool) { \
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, \
|
||||
_("cannot reset '%s' when " \
|
||||
"'%s' is set"), \
|
||||
#val, #val "_max"); \
|
||||
} else { \
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, \
|
||||
#define CHECK_MAX(val, _bool) \
|
||||
do { \
|
||||
if (info.val##_max) { \
|
||||
if (!info.val) { \
|
||||
if (QEMU_BLOCK_IOTUNE_SET_##_bool) { \
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, \
|
||||
_("cannot reset '%s' when " \
|
||||
"'%s' is set"), \
|
||||
#val, #val "_max"); \
|
||||
} else { \
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, \
|
||||
_("value '%s' cannot be set if " \
|
||||
"'%s' is not set"), \
|
||||
#val "_max", #val); \
|
||||
} \
|
||||
goto endjob; \
|
||||
} \
|
||||
if (info.val##_max < info.val) { \
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, \
|
||||
_("value '%s' cannot be " \
|
||||
"smaller than '%s'"), \
|
||||
#val "_max", #val); \
|
||||
goto endjob; \
|
||||
} \
|
||||
} \
|
||||
"'%s' is not set"), \
|
||||
#val "_max", #val); \
|
||||
} \
|
||||
goto endjob; \
|
||||
} \
|
||||
if (info.val##_max < info.val) { \
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, \
|
||||
_("value '%s' cannot be " \
|
||||
"smaller than '%s'"), \
|
||||
#val "_max", #val); \
|
||||
goto endjob; \
|
||||
} \
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
CHECK_MAX(total_bytes_sec, BYTES);
|
||||
@ -18275,12 +18275,12 @@ qemuDomainGetBlockIoTune(virDomainPtr dom,
|
||||
goto endjob;
|
||||
}
|
||||
|
||||
#define BLOCK_IOTUNE_ASSIGN(name, var) \
|
||||
if (*nparams < maxparams && \
|
||||
virTypedParameterAssign(¶ms[(*nparams)++], \
|
||||
VIR_DOMAIN_BLOCK_IOTUNE_ ## name, \
|
||||
VIR_TYPED_PARAM_ULLONG, \
|
||||
reply.var) < 0) \
|
||||
#define BLOCK_IOTUNE_ASSIGN(name, var) \
|
||||
if (*nparams < maxparams && \
|
||||
virTypedParameterAssign(¶ms[(*nparams)++], \
|
||||
VIR_DOMAIN_BLOCK_IOTUNE_ ## name, \
|
||||
VIR_TYPED_PARAM_ULLONG, \
|
||||
reply.var) < 0) \
|
||||
goto endjob
|
||||
|
||||
|
||||
@ -19445,13 +19445,13 @@ qemuDomainGetStatsBalloon(virQEMUDriverPtr driver,
|
||||
if (nr_stats < 0)
|
||||
return 0;
|
||||
|
||||
#define STORE_MEM_RECORD(TAG, NAME) \
|
||||
if (stats[i].tag == VIR_DOMAIN_MEMORY_STAT_ ##TAG) \
|
||||
if (virTypedParamsAddULLong(&record->params, \
|
||||
&record->nparams, \
|
||||
maxparams, \
|
||||
"balloon." NAME, \
|
||||
stats[i].val) < 0) \
|
||||
#define STORE_MEM_RECORD(TAG, NAME) \
|
||||
if (stats[i].tag == VIR_DOMAIN_MEMORY_STAT_ ##TAG) \
|
||||
if (virTypedParamsAddULLong(&record->params, \
|
||||
&record->nparams, \
|
||||
maxparams, \
|
||||
"balloon." NAME, \
|
||||
stats[i].val) < 0) \
|
||||
return -1;
|
||||
|
||||
for (i = 0; i < nr_stats; i++) {
|
||||
@ -19683,16 +19683,16 @@ qemuDomainGetStatsInterface(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
|
||||
#undef QEMU_ADD_NET_PARAM
|
||||
|
||||
#define QEMU_ADD_BLOCK_PARAM_UI(record, maxparams, num, name, value) \
|
||||
do { \
|
||||
char param_name[VIR_TYPED_PARAM_FIELD_LENGTH]; \
|
||||
snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH, \
|
||||
"block.%zu.%s", num, name); \
|
||||
if (virTypedParamsAddUInt(&(record)->params, \
|
||||
&(record)->nparams, \
|
||||
maxparams, \
|
||||
param_name, \
|
||||
value) < 0) \
|
||||
goto cleanup; \
|
||||
do { \
|
||||
char param_name[VIR_TYPED_PARAM_FIELD_LENGTH]; \
|
||||
snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH, \
|
||||
"block.%zu.%s", num, name); \
|
||||
if (virTypedParamsAddUInt(&(record)->params, \
|
||||
&(record)->nparams, \
|
||||
maxparams, \
|
||||
param_name, \
|
||||
value) < 0) \
|
||||
goto cleanup; \
|
||||
} while (0)
|
||||
|
||||
/* expects a LL, but typed parameter must be ULL */
|
||||
@ -20674,11 +20674,11 @@ qemuDomainGetGuestVcpusParams(virTypedParameterPtr *params,
|
||||
ignore_value(virBitmapSetBit(offlinable, info[i].id));
|
||||
}
|
||||
|
||||
#define ADD_BITMAP(name) \
|
||||
if (!(tmp = virBitmapFormat(name))) \
|
||||
goto cleanup; \
|
||||
if (virTypedParamsAddString(&par, &npar, &maxpar, #name, tmp) < 0) \
|
||||
goto cleanup; \
|
||||
#define ADD_BITMAP(name) \
|
||||
if (!(tmp = virBitmapFormat(name))) \
|
||||
goto cleanup; \
|
||||
if (virTypedParamsAddString(&par, &npar, &maxpar, #name, tmp) < 0) \
|
||||
goto cleanup; \
|
||||
VIR_FREE(tmp)
|
||||
|
||||
ADD_BITMAP(vcpus);
|
||||
|
@ -2412,16 +2412,16 @@ qemuMigrationParams(virTypedParameterPtr params,
|
||||
if (!params)
|
||||
return migParams;
|
||||
|
||||
#define GET(PARAM, VAR) \
|
||||
do { \
|
||||
int rc; \
|
||||
if ((rc = virTypedParamsGetInt(params, nparams, \
|
||||
VIR_MIGRATE_PARAM_ ## PARAM, \
|
||||
&migParams->VAR)) < 0) \
|
||||
goto error; \
|
||||
\
|
||||
if (rc == 1) \
|
||||
migParams->VAR ## _set = true; \
|
||||
#define GET(PARAM, VAR) \
|
||||
do { \
|
||||
int rc; \
|
||||
if ((rc = virTypedParamsGetInt(params, nparams, \
|
||||
VIR_MIGRATE_PARAM_ ## PARAM, \
|
||||
&migParams->VAR)) < 0) \
|
||||
goto error; \
|
||||
\
|
||||
if (rc == 1) \
|
||||
migParams->VAR ## _set = true; \
|
||||
} while (0)
|
||||
|
||||
GET(AUTO_CONVERGE_INITIAL, cpuThrottleInitial);
|
||||
@ -5887,17 +5887,17 @@ qemuMigrationCompressionParse(virTypedParameterPtr params,
|
||||
compression->methods |= 1ULL << method;
|
||||
}
|
||||
|
||||
#define GET_PARAM(PARAM, TYPE, VALUE) \
|
||||
do { \
|
||||
int rc; \
|
||||
const char *par = VIR_MIGRATE_PARAM_COMPRESSION_ ## PARAM; \
|
||||
\
|
||||
if ((rc = virTypedParamsGet ## TYPE(params, nparams, \
|
||||
#define GET_PARAM(PARAM, TYPE, VALUE) \
|
||||
do { \
|
||||
int rc; \
|
||||
const char *par = VIR_MIGRATE_PARAM_COMPRESSION_ ## PARAM; \
|
||||
\
|
||||
if ((rc = virTypedParamsGet ## TYPE(params, nparams, \
|
||||
par, &compression->VALUE)) < 0) \
|
||||
goto error; \
|
||||
\
|
||||
if (rc == 1) \
|
||||
compression->VALUE ## _set = true; \
|
||||
goto error; \
|
||||
\
|
||||
if (rc == 1) \
|
||||
compression->VALUE ## _set = true; \
|
||||
} while (0)
|
||||
|
||||
if (params) {
|
||||
|
@ -29,45 +29,45 @@ typedef struct _qemuMigrationCompression qemuMigrationCompression;
|
||||
typedef qemuMigrationCompression *qemuMigrationCompressionPtr;
|
||||
|
||||
/* All supported qemu migration flags. */
|
||||
# define QEMU_MIGRATION_FLAGS \
|
||||
(VIR_MIGRATE_LIVE | \
|
||||
VIR_MIGRATE_PEER2PEER | \
|
||||
VIR_MIGRATE_TUNNELLED | \
|
||||
VIR_MIGRATE_PERSIST_DEST | \
|
||||
VIR_MIGRATE_UNDEFINE_SOURCE | \
|
||||
VIR_MIGRATE_PAUSED | \
|
||||
VIR_MIGRATE_NON_SHARED_DISK | \
|
||||
VIR_MIGRATE_NON_SHARED_INC | \
|
||||
VIR_MIGRATE_CHANGE_PROTECTION | \
|
||||
VIR_MIGRATE_UNSAFE | \
|
||||
VIR_MIGRATE_OFFLINE | \
|
||||
VIR_MIGRATE_COMPRESSED | \
|
||||
VIR_MIGRATE_ABORT_ON_ERROR | \
|
||||
VIR_MIGRATE_AUTO_CONVERGE | \
|
||||
VIR_MIGRATE_RDMA_PIN_ALL | \
|
||||
VIR_MIGRATE_POSTCOPY | \
|
||||
# define QEMU_MIGRATION_FLAGS \
|
||||
(VIR_MIGRATE_LIVE | \
|
||||
VIR_MIGRATE_PEER2PEER | \
|
||||
VIR_MIGRATE_TUNNELLED | \
|
||||
VIR_MIGRATE_PERSIST_DEST | \
|
||||
VIR_MIGRATE_UNDEFINE_SOURCE | \
|
||||
VIR_MIGRATE_PAUSED | \
|
||||
VIR_MIGRATE_NON_SHARED_DISK | \
|
||||
VIR_MIGRATE_NON_SHARED_INC | \
|
||||
VIR_MIGRATE_CHANGE_PROTECTION | \
|
||||
VIR_MIGRATE_UNSAFE | \
|
||||
VIR_MIGRATE_OFFLINE | \
|
||||
VIR_MIGRATE_COMPRESSED | \
|
||||
VIR_MIGRATE_ABORT_ON_ERROR | \
|
||||
VIR_MIGRATE_AUTO_CONVERGE | \
|
||||
VIR_MIGRATE_RDMA_PIN_ALL | \
|
||||
VIR_MIGRATE_POSTCOPY | \
|
||||
VIR_MIGRATE_TLS)
|
||||
|
||||
/* All supported migration parameters and their types. */
|
||||
# define QEMU_MIGRATION_PARAMETERS \
|
||||
VIR_MIGRATE_PARAM_URI, VIR_TYPED_PARAM_STRING, \
|
||||
VIR_MIGRATE_PARAM_DEST_NAME, VIR_TYPED_PARAM_STRING, \
|
||||
VIR_MIGRATE_PARAM_DEST_XML, VIR_TYPED_PARAM_STRING, \
|
||||
VIR_MIGRATE_PARAM_BANDWIDTH, VIR_TYPED_PARAM_ULLONG, \
|
||||
VIR_MIGRATE_PARAM_GRAPHICS_URI, VIR_TYPED_PARAM_STRING, \
|
||||
VIR_MIGRATE_PARAM_LISTEN_ADDRESS, VIR_TYPED_PARAM_STRING, \
|
||||
VIR_MIGRATE_PARAM_MIGRATE_DISKS, VIR_TYPED_PARAM_STRING | \
|
||||
# define QEMU_MIGRATION_PARAMETERS \
|
||||
VIR_MIGRATE_PARAM_URI, VIR_TYPED_PARAM_STRING, \
|
||||
VIR_MIGRATE_PARAM_DEST_NAME, VIR_TYPED_PARAM_STRING, \
|
||||
VIR_MIGRATE_PARAM_DEST_XML, VIR_TYPED_PARAM_STRING, \
|
||||
VIR_MIGRATE_PARAM_BANDWIDTH, VIR_TYPED_PARAM_ULLONG, \
|
||||
VIR_MIGRATE_PARAM_GRAPHICS_URI, VIR_TYPED_PARAM_STRING, \
|
||||
VIR_MIGRATE_PARAM_LISTEN_ADDRESS, VIR_TYPED_PARAM_STRING, \
|
||||
VIR_MIGRATE_PARAM_MIGRATE_DISKS, VIR_TYPED_PARAM_STRING | \
|
||||
VIR_TYPED_PARAM_MULTIPLE, \
|
||||
VIR_MIGRATE_PARAM_DISKS_PORT, VIR_TYPED_PARAM_INT, \
|
||||
VIR_MIGRATE_PARAM_COMPRESSION, VIR_TYPED_PARAM_STRING | \
|
||||
VIR_MIGRATE_PARAM_DISKS_PORT, VIR_TYPED_PARAM_INT, \
|
||||
VIR_MIGRATE_PARAM_COMPRESSION, VIR_TYPED_PARAM_STRING | \
|
||||
VIR_TYPED_PARAM_MULTIPLE, \
|
||||
VIR_MIGRATE_PARAM_COMPRESSION_MT_LEVEL, VIR_TYPED_PARAM_INT, \
|
||||
VIR_MIGRATE_PARAM_COMPRESSION_MT_THREADS, VIR_TYPED_PARAM_INT, \
|
||||
VIR_MIGRATE_PARAM_COMPRESSION_MT_DTHREADS, VIR_TYPED_PARAM_INT, \
|
||||
VIR_MIGRATE_PARAM_COMPRESSION_MT_LEVEL, VIR_TYPED_PARAM_INT, \
|
||||
VIR_MIGRATE_PARAM_COMPRESSION_MT_THREADS, VIR_TYPED_PARAM_INT, \
|
||||
VIR_MIGRATE_PARAM_COMPRESSION_MT_DTHREADS, VIR_TYPED_PARAM_INT, \
|
||||
VIR_MIGRATE_PARAM_COMPRESSION_XBZRLE_CACHE, VIR_TYPED_PARAM_ULLONG, \
|
||||
VIR_MIGRATE_PARAM_PERSIST_XML, VIR_TYPED_PARAM_STRING, \
|
||||
VIR_MIGRATE_PARAM_AUTO_CONVERGE_INITIAL, VIR_TYPED_PARAM_INT, \
|
||||
VIR_MIGRATE_PARAM_AUTO_CONVERGE_INCREMENT, VIR_TYPED_PARAM_INT, \
|
||||
VIR_MIGRATE_PARAM_PERSIST_XML, VIR_TYPED_PARAM_STRING, \
|
||||
VIR_MIGRATE_PARAM_AUTO_CONVERGE_INITIAL, VIR_TYPED_PARAM_INT, \
|
||||
VIR_MIGRATE_PARAM_AUTO_CONVERGE_INCREMENT, VIR_TYPED_PARAM_INT, \
|
||||
NULL
|
||||
|
||||
|
||||
|
@ -118,20 +118,20 @@ struct _qemuMonitor {
|
||||
* the function if not. The macro also adds a debug statement regarding the
|
||||
* monitor.
|
||||
*/
|
||||
#define QEMU_CHECK_MONITOR_FULL(mon, force_json, exit) \
|
||||
do { \
|
||||
if (!mon) { \
|
||||
virReportError(VIR_ERR_INVALID_ARG, "%s", \
|
||||
_("monitor must not be NULL")); \
|
||||
exit; \
|
||||
} \
|
||||
VIR_DEBUG("mon:%p vm:%p json:%d fd:%d", \
|
||||
mon, mon->vm, mon->json, mon->fd); \
|
||||
if (force_json && !mon->json) { \
|
||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", \
|
||||
_("JSON monitor is required")); \
|
||||
exit; \
|
||||
} \
|
||||
#define QEMU_CHECK_MONITOR_FULL(mon, force_json, exit) \
|
||||
do { \
|
||||
if (!mon) { \
|
||||
virReportError(VIR_ERR_INVALID_ARG, "%s", \
|
||||
_("monitor must not be NULL")); \
|
||||
exit; \
|
||||
} \
|
||||
VIR_DEBUG("mon:%p vm:%p json:%d fd:%d", \
|
||||
mon, mon->vm, mon->json, mon->fd); \
|
||||
if (force_json && !mon->json) { \
|
||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", \
|
||||
_("JSON monitor is required")); \
|
||||
exit; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/* Check monitor and return NULL on error */
|
||||
@ -1289,15 +1289,15 @@ qemuMonitorHMPCommandWithFd(qemuMonitorPtr mon,
|
||||
|
||||
|
||||
/* Ensure proper locking around callbacks. */
|
||||
#define QEMU_MONITOR_CALLBACK(mon, ret, callback, ...) \
|
||||
do { \
|
||||
virObjectRef(mon); \
|
||||
virObjectUnlock(mon); \
|
||||
if ((mon)->cb && (mon)->cb->callback) \
|
||||
(ret) = (mon)->cb->callback(mon, __VA_ARGS__, \
|
||||
#define QEMU_MONITOR_CALLBACK(mon, ret, callback, ...) \
|
||||
do { \
|
||||
virObjectRef(mon); \
|
||||
virObjectUnlock(mon); \
|
||||
if ((mon)->cb && (mon)->cb->callback) \
|
||||
(ret) = (mon)->cb->callback(mon, __VA_ARGS__, \
|
||||
(mon)->callbackOpaque); \
|
||||
virObjectLock(mon); \
|
||||
virObjectUnref(mon); \
|
||||
virObjectLock(mon); \
|
||||
virObjectUnref(mon); \
|
||||
} while (0)
|
||||
|
||||
|
||||
|
@ -1718,19 +1718,19 @@ qemuMonitorJSONGetBalloonInfo(qemuMonitorPtr mon,
|
||||
* rates and/or whether data has been collected since a previous cycle.
|
||||
* It's currently unused.
|
||||
*/
|
||||
#define GET_BALLOON_STATS(OBJECT, FIELD, TAG, DIVISOR) \
|
||||
if (virJSONValueObjectHasKey(OBJECT, FIELD) && \
|
||||
(got < nr_stats)) { \
|
||||
if (virJSONValueObjectGetNumberUlong(OBJECT, FIELD, &mem) < 0) { \
|
||||
VIR_DEBUG("Failed to get '%s' value", FIELD); \
|
||||
} else { \
|
||||
/* Not being collected? No point in providing bad data */ \
|
||||
if (mem != -1UL) { \
|
||||
stats[got].tag = TAG; \
|
||||
stats[got].val = mem / DIVISOR; \
|
||||
got++; \
|
||||
} \
|
||||
} \
|
||||
#define GET_BALLOON_STATS(OBJECT, FIELD, TAG, DIVISOR) \
|
||||
if (virJSONValueObjectHasKey(OBJECT, FIELD) && \
|
||||
(got < nr_stats)) { \
|
||||
if (virJSONValueObjectGetNumberUlong(OBJECT, FIELD, &mem) < 0) { \
|
||||
VIR_DEBUG("Failed to get '%s' value", FIELD); \
|
||||
} else { \
|
||||
/* Not being collected? No point in providing bad data */ \
|
||||
if (mem != -1UL) { \
|
||||
stats[got].tag = TAG; \
|
||||
stats[got].val = mem / DIVISOR; \
|
||||
got++; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
@ -2006,14 +2006,14 @@ qemuMonitorJSONGetOneBlockStatsInfo(virJSONValuePtr dev,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
#define QEMU_MONITOR_BLOCK_STAT_GET(NAME, VAR, MANDATORY) \
|
||||
if (MANDATORY || virJSONValueObjectHasKey(stats, NAME)) { \
|
||||
nstats++; \
|
||||
if (virJSONValueObjectGetNumberLong(stats, NAME, &VAR) < 0) { \
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, \
|
||||
_("cannot read %s statistic"), NAME); \
|
||||
goto cleanup; \
|
||||
} \
|
||||
#define QEMU_MONITOR_BLOCK_STAT_GET(NAME, VAR, MANDATORY) \
|
||||
if (MANDATORY || virJSONValueObjectHasKey(stats, NAME)) { \
|
||||
nstats++; \
|
||||
if (virJSONValueObjectGetNumberLong(stats, NAME, &VAR) < 0) { \
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, \
|
||||
_("cannot read %s statistic"), NAME); \
|
||||
goto cleanup; \
|
||||
} \
|
||||
}
|
||||
QEMU_MONITOR_BLOCK_STAT_GET("rd_bytes", bstats->rd_bytes, true);
|
||||
QEMU_MONITOR_BLOCK_STAT_GET("wr_bytes", bstats->wr_bytes, true);
|
||||
@ -2678,28 +2678,28 @@ qemuMonitorJSONGetMigrationParams(qemuMonitorPtr mon,
|
||||
|
||||
result = virJSONValueObjectGet(reply, "return");
|
||||
|
||||
#define PARSE_SET(API, VAR, FIELD) \
|
||||
do { \
|
||||
if (API(result, FIELD, ¶ms->VAR) == 0) \
|
||||
params->VAR ## _set = true; \
|
||||
#define PARSE_SET(API, VAR, FIELD) \
|
||||
do { \
|
||||
if (API(result, FIELD, ¶ms->VAR) == 0) \
|
||||
params->VAR ## _set = true; \
|
||||
} while (0)
|
||||
|
||||
#define PARSE_INT(VAR, FIELD) \
|
||||
#define PARSE_INT(VAR, FIELD) \
|
||||
PARSE_SET(virJSONValueObjectGetNumberInt, VAR, FIELD)
|
||||
|
||||
#define PARSE_ULONG(VAR, FIELD) \
|
||||
#define PARSE_ULONG(VAR, FIELD) \
|
||||
PARSE_SET(virJSONValueObjectGetNumberUlong, VAR, FIELD)
|
||||
|
||||
#define PARSE_BOOL(VAR, FIELD) \
|
||||
#define PARSE_BOOL(VAR, FIELD) \
|
||||
PARSE_SET(virJSONValueObjectGetBoolean, VAR, FIELD)
|
||||
|
||||
#define PARSE_STR(VAR, FIELD) \
|
||||
do { \
|
||||
const char *str; \
|
||||
if ((str = virJSONValueObjectGetString(result, FIELD))) { \
|
||||
if (VIR_STRDUP(params->VAR, str) < 0) \
|
||||
goto cleanup; \
|
||||
} \
|
||||
#define PARSE_STR(VAR, FIELD) \
|
||||
do { \
|
||||
const char *str; \
|
||||
if ((str = virJSONValueObjectGetString(result, FIELD))) { \
|
||||
if (VIR_STRDUP(params->VAR, str) < 0) \
|
||||
goto cleanup; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
PARSE_INT(compressLevel, "compress-level");
|
||||
@ -2745,26 +2745,26 @@ qemuMonitorJSONSetMigrationParams(qemuMonitorPtr mon,
|
||||
if (!(args = virJSONValueNewObject()))
|
||||
goto cleanup;
|
||||
|
||||
#define APPEND(VALID, API, VAR, FIELD) \
|
||||
do { \
|
||||
if (VALID && API(args, FIELD, params->VAR) < 0) \
|
||||
goto cleanup; \
|
||||
#define APPEND(VALID, API, VAR, FIELD) \
|
||||
do { \
|
||||
if (VALID && API(args, FIELD, params->VAR) < 0) \
|
||||
goto cleanup; \
|
||||
} while (0)
|
||||
|
||||
#define APPEND_INT(VAR, FIELD) \
|
||||
APPEND(params->VAR ## _set, \
|
||||
#define APPEND_INT(VAR, FIELD) \
|
||||
APPEND(params->VAR ## _set, \
|
||||
virJSONValueObjectAppendNumberInt, VAR, FIELD)
|
||||
|
||||
#define APPEND_STR(VAR, FIELD) \
|
||||
APPEND(params->VAR, \
|
||||
#define APPEND_STR(VAR, FIELD) \
|
||||
APPEND(params->VAR, \
|
||||
virJSONValueObjectAppendString, VAR, FIELD)
|
||||
|
||||
#define APPEND_ULONG(VAR, FIELD) \
|
||||
APPEND(params->VAR ## _set, \
|
||||
#define APPEND_ULONG(VAR, FIELD) \
|
||||
APPEND(params->VAR ## _set, \
|
||||
virJSONValueObjectAppendNumberUlong, VAR, FIELD)
|
||||
|
||||
#define APPEND_BOOL(VAR, FIELD) \
|
||||
APPEND(params->VAR ## _set, \
|
||||
#define APPEND_BOOL(VAR, FIELD) \
|
||||
APPEND(params->VAR ## _set, \
|
||||
virJSONValueObjectAppendBoolean, VAR, FIELD)
|
||||
|
||||
APPEND_INT(compressLevel, "compress-level");
|
||||
@ -4626,21 +4626,21 @@ int qemuMonitorJSONOpenGraphics(qemuMonitorPtr mon,
|
||||
}
|
||||
|
||||
|
||||
#define GET_THROTTLE_STATS_OPTIONAL(FIELD, STORE) \
|
||||
if (virJSONValueObjectGetNumberUlong(inserted, \
|
||||
FIELD, \
|
||||
&reply->STORE) < 0) { \
|
||||
reply->STORE = 0; \
|
||||
#define GET_THROTTLE_STATS_OPTIONAL(FIELD, STORE) \
|
||||
if (virJSONValueObjectGetNumberUlong(inserted, \
|
||||
FIELD, \
|
||||
&reply->STORE) < 0) { \
|
||||
reply->STORE = 0; \
|
||||
}
|
||||
#define GET_THROTTLE_STATS(FIELD, STORE) \
|
||||
if (virJSONValueObjectGetNumberUlong(inserted, \
|
||||
FIELD, \
|
||||
&reply->STORE) < 0) { \
|
||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, \
|
||||
_("block_io_throttle field '%s' missing " \
|
||||
"in qemu's output"), \
|
||||
#STORE); \
|
||||
goto cleanup; \
|
||||
#define GET_THROTTLE_STATS(FIELD, STORE) \
|
||||
if (virJSONValueObjectGetNumberUlong(inserted, \
|
||||
FIELD, \
|
||||
&reply->STORE) < 0) { \
|
||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, \
|
||||
_("block_io_throttle field '%s' missing " \
|
||||
"in qemu's output"), \
|
||||
#STORE); \
|
||||
goto cleanup; \
|
||||
}
|
||||
static int
|
||||
qemuMonitorJSONBlockIoThrottleInfo(virJSONValuePtr result,
|
||||
@ -5859,11 +5859,11 @@ int qemuMonitorJSONGetObjectProperty(qemuMonitorPtr mon,
|
||||
}
|
||||
|
||||
|
||||
#define MAKE_SET_CMD(STRING, VALUE) \
|
||||
cmd = qemuMonitorJSONMakeCommand("qom-set", \
|
||||
"s:path", path, \
|
||||
"s:property", property, \
|
||||
STRING, VALUE, \
|
||||
#define MAKE_SET_CMD(STRING, VALUE) \
|
||||
cmd = qemuMonitorJSONMakeCommand("qom-set", \
|
||||
"s:path", path, \
|
||||
"s:property", property, \
|
||||
STRING, VALUE, \
|
||||
NULL)
|
||||
int qemuMonitorJSONSetObjectProperty(qemuMonitorPtr mon,
|
||||
const char *path,
|
||||
|
@ -932,16 +932,16 @@ qemuMonitorTextGetAllBlockStatsInfo(qemuMonitorPtr mon,
|
||||
*value = '\0';
|
||||
value++;
|
||||
|
||||
#define QEMU_MONITOR_TEXT_READ_BLOCK_STAT(NAME, VAR) \
|
||||
if (STREQ(key, NAME)) { \
|
||||
nstats++; \
|
||||
if (virStrToLong_ll(value, NULL, 10, &VAR) < 0) { \
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, \
|
||||
_("'info blockstats' contains malformed " \
|
||||
#define QEMU_MONITOR_TEXT_READ_BLOCK_STAT(NAME, VAR) \
|
||||
if (STREQ(key, NAME)) { \
|
||||
nstats++; \
|
||||
if (virStrToLong_ll(value, NULL, 10, &VAR) < 0) { \
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, \
|
||||
_("'info blockstats' contains malformed " \
|
||||
"parameter '%s' value '%s'"), NAME, value);\
|
||||
goto cleanup; \
|
||||
} \
|
||||
continue; \
|
||||
goto cleanup; \
|
||||
} \
|
||||
continue; \
|
||||
}
|
||||
|
||||
QEMU_MONITOR_TEXT_READ_BLOCK_STAT("rd_bytes", stats->rd_bytes);
|
||||
|
@ -1912,12 +1912,12 @@ qemuParseCommandLine(virCapsPtr caps,
|
||||
if (ARCH_IS_X86(def->os.arch))
|
||||
def->features[VIR_DOMAIN_FEATURE_ACPI] = VIR_TRISTATE_SWITCH_ON;
|
||||
|
||||
#define WANT_VALUE() \
|
||||
const char *val = progargv[++i]; \
|
||||
if (!val) { \
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, \
|
||||
_("missing value for %s argument"), arg); \
|
||||
goto error; \
|
||||
#define WANT_VALUE() \
|
||||
const char *val = progargv[++i]; \
|
||||
if (!val) { \
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, \
|
||||
_("missing value for %s argument"), arg); \
|
||||
goto error; \
|
||||
}
|
||||
|
||||
/* One initial loop to get list of NICs, so we
|
||||
|
@ -58,14 +58,14 @@
|
||||
VIR_LOG_INIT("remote.remote_driver");
|
||||
|
||||
#if SIZEOF_LONG < 8
|
||||
# define HYPER_TO_TYPE(_type, _to, _from) \
|
||||
do { \
|
||||
if ((_from) != (_type)(_from)) { \
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, \
|
||||
# define HYPER_TO_TYPE(_type, _to, _from) \
|
||||
do { \
|
||||
if ((_from) != (_type)(_from)) { \
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, \
|
||||
_("conversion from hyper to %s overflowed"), #_type); \
|
||||
goto done; \
|
||||
} \
|
||||
(_to) = (_from); \
|
||||
goto done; \
|
||||
} \
|
||||
(_to) = (_from); \
|
||||
} while (0)
|
||||
|
||||
# define HYPER_TO_LONG(_to, _from) HYPER_TO_TYPE(long, _to, _from)
|
||||
@ -670,27 +670,27 @@ remoteConnectSupportsFeatureUnlocked(virConnectPtr conn,
|
||||
}
|
||||
|
||||
/* helper macro to ease extraction of arguments from the URI */
|
||||
#define EXTRACT_URI_ARG_STR(ARG_NAME, ARG_VAR) \
|
||||
if (STRCASEEQ(var->name, ARG_NAME)) { \
|
||||
VIR_FREE(ARG_VAR); \
|
||||
if (VIR_STRDUP(ARG_VAR, var->value) < 0) \
|
||||
goto failed; \
|
||||
var->ignore = 1; \
|
||||
continue; \
|
||||
#define EXTRACT_URI_ARG_STR(ARG_NAME, ARG_VAR) \
|
||||
if (STRCASEEQ(var->name, ARG_NAME)) { \
|
||||
VIR_FREE(ARG_VAR); \
|
||||
if (VIR_STRDUP(ARG_VAR, var->value) < 0) \
|
||||
goto failed; \
|
||||
var->ignore = 1; \
|
||||
continue; \
|
||||
}
|
||||
|
||||
#define EXTRACT_URI_ARG_BOOL(ARG_NAME, ARG_VAR) \
|
||||
if (STRCASEEQ(var->name, ARG_NAME)) { \
|
||||
int tmp; \
|
||||
if (virStrToLong_i(var->value, NULL, 10, &tmp) < 0) { \
|
||||
virReportError(VIR_ERR_INVALID_ARG, \
|
||||
_("Failed to parse value of URI component %s"), \
|
||||
var->name); \
|
||||
goto failed; \
|
||||
} \
|
||||
ARG_VAR = tmp == 0; \
|
||||
var->ignore = 1; \
|
||||
continue; \
|
||||
#define EXTRACT_URI_ARG_BOOL(ARG_NAME, ARG_VAR) \
|
||||
if (STRCASEEQ(var->name, ARG_NAME)) { \
|
||||
int tmp; \
|
||||
if (virStrToLong_i(var->value, NULL, 10, &tmp) < 0) { \
|
||||
virReportError(VIR_ERR_INVALID_ARG, \
|
||||
_("Failed to parse value of URI component %s"), \
|
||||
var->name); \
|
||||
goto failed; \
|
||||
} \
|
||||
ARG_VAR = tmp == 0; \
|
||||
var->ignore = 1; \
|
||||
continue; \
|
||||
}
|
||||
/*
|
||||
* URIs that this driver needs to handle:
|
||||
|
@ -427,8 +427,8 @@ virNetClientPtr virNetClientNewSSH(const char *nodename,
|
||||
return virNetClientNew(sock, NULL);
|
||||
}
|
||||
|
||||
#define DEFAULT_VALUE(VAR, VAL) \
|
||||
if (!VAR) \
|
||||
#define DEFAULT_VALUE(VAR, VAL) \
|
||||
if (!VAR) \
|
||||
VAR = VAL;
|
||||
virNetClientPtr virNetClientNewLibSSH2(const char *host,
|
||||
const char *port,
|
||||
@ -536,8 +536,8 @@ virNetClientPtr virNetClientNewLibSSH2(const char *host,
|
||||
}
|
||||
#undef DEFAULT_VALUE
|
||||
|
||||
#define DEFAULT_VALUE(VAR, VAL) \
|
||||
if (!VAR) \
|
||||
#define DEFAULT_VALUE(VAR, VAL) \
|
||||
if (!VAR) \
|
||||
VAR = VAL;
|
||||
virNetClientPtr virNetClientNewLibssh(const char *host,
|
||||
const char *port,
|
||||
|
@ -39,7 +39,7 @@ typedef enum {
|
||||
VIR_SECURITY_MANAGER_MOUNT_NAMESPACE = 1 << 5,
|
||||
} virSecurityManagerNewFlags;
|
||||
|
||||
# define VIR_SECURITY_MANAGER_NEW_MASK \
|
||||
# define VIR_SECURITY_MANAGER_NEW_MASK \
|
||||
(VIR_SECURITY_MANAGER_ALLOW_DISK_PROBE | \
|
||||
VIR_SECURITY_MANAGER_DEFAULT_CONFINED | \
|
||||
VIR_SECURITY_MANAGER_REQUIRE_CONFINED | \
|
||||
|
@ -114,8 +114,8 @@ virStorageDriverLoadBackendModule(const char *name,
|
||||
}
|
||||
|
||||
|
||||
#define VIR_STORAGE_BACKEND_REGISTER(func, module) \
|
||||
if (virStorageDriverLoadBackendModule(module, #func, allbackends) < 0) \
|
||||
#define VIR_STORAGE_BACKEND_REGISTER(func, module) \
|
||||
if (virStorageDriverLoadBackendModule(module, #func, allbackends) < 0) \
|
||||
return -1
|
||||
|
||||
int
|
||||
|
@ -358,7 +358,7 @@ void virDispose(void *ptrptr, size_t count, size_t element_size, size_t *countpt
|
||||
* Returns -1 on failure (with OOM error reported), 0 on success
|
||||
*/
|
||||
# define VIR_INSERT_ELEMENT(ptr, at, count, newelem) \
|
||||
virInsertElementsN(&(ptr), sizeof(*(ptr)), at, &(count), \
|
||||
virInsertElementsN(&(ptr), sizeof(*(ptr)), at, &(count), \
|
||||
VIR_TYPEMATCH(ptr, &(newelem)), &(newelem), true, false, \
|
||||
true, VIR_FROM_THIS, __FILE__, __FUNCTION__, __LINE__)
|
||||
# define VIR_INSERT_ELEMENT_COPY(ptr, at, count, newelem) \
|
||||
@ -376,7 +376,7 @@ void virDispose(void *ptrptr, size_t count, size_t element_size, size_t *countpt
|
||||
|
||||
/* Quiet version of macros above */
|
||||
# define VIR_INSERT_ELEMENT_QUIET(ptr, at, count, newelem) \
|
||||
virInsertElementsN(&(ptr), sizeof(*(ptr)), at, &(count), \
|
||||
virInsertElementsN(&(ptr), sizeof(*(ptr)), at, &(count), \
|
||||
VIR_TYPEMATCH(ptr, &(newelem)), &(newelem), true, false, \
|
||||
false, 0, NULL, NULL, 0)
|
||||
# define VIR_INSERT_ELEMENT_COPY_QUIET(ptr, at, count, newelem) \
|
||||
@ -428,33 +428,33 @@ void virDispose(void *ptrptr, size_t count, size_t element_size, size_t *countpt
|
||||
* Returns -1 on failure (with OOM error reported), 0 on success
|
||||
*/
|
||||
# define VIR_APPEND_ELEMENT(ptr, count, newelem) \
|
||||
virInsertElementsN(&(ptr), sizeof(*(ptr)), -1, &(count), \
|
||||
virInsertElementsN(&(ptr), sizeof(*(ptr)), -1, &(count), \
|
||||
VIR_TYPEMATCH(ptr, &(newelem)), &(newelem), true, false, \
|
||||
true, VIR_FROM_THIS, __FILE__, __FUNCTION__, __LINE__)
|
||||
# define VIR_APPEND_ELEMENT_COPY(ptr, count, newelem) \
|
||||
virInsertElementsN(&(ptr), sizeof(*(ptr)), -1, &(count), \
|
||||
virInsertElementsN(&(ptr), sizeof(*(ptr)), -1, &(count), \
|
||||
VIR_TYPEMATCH(ptr, &(newelem)), &(newelem), false, false, \
|
||||
true, VIR_FROM_THIS, __FILE__, __FUNCTION__, __LINE__)
|
||||
# define VIR_APPEND_ELEMENT_INPLACE(ptr, count, newelem) \
|
||||
ignore_value(virInsertElementsN(&(ptr), sizeof(*(ptr)), -1, &(count), \
|
||||
VIR_TYPEMATCH(ptr, &(newelem)), \
|
||||
&(newelem), true, true, false, \
|
||||
VIR_FROM_THIS, __FILE__, \
|
||||
ignore_value(virInsertElementsN(&(ptr), sizeof(*(ptr)), -1, &(count), \
|
||||
VIR_TYPEMATCH(ptr, &(newelem)), \
|
||||
&(newelem), true, true, false, \
|
||||
VIR_FROM_THIS, __FILE__, \
|
||||
__FUNCTION__, __LINE__))
|
||||
# define VIR_APPEND_ELEMENT_COPY_INPLACE(ptr, count, newelem) \
|
||||
ignore_value(virInsertElementsN(&(ptr), sizeof(*(ptr)), -1, &(count), \
|
||||
VIR_TYPEMATCH(ptr, &(newelem)), \
|
||||
&(newelem), false, true, false, \
|
||||
VIR_FROM_THIS, __FILE__, \
|
||||
ignore_value(virInsertElementsN(&(ptr), sizeof(*(ptr)), -1, &(count), \
|
||||
VIR_TYPEMATCH(ptr, &(newelem)), \
|
||||
&(newelem), false, true, false, \
|
||||
VIR_FROM_THIS, __FILE__, \
|
||||
__FUNCTION__, __LINE__))
|
||||
|
||||
/* Quiet version of macros above */
|
||||
# define VIR_APPEND_ELEMENT_QUIET(ptr, count, newelem) \
|
||||
virInsertElementsN(&(ptr), sizeof(*(ptr)), -1, &(count), \
|
||||
virInsertElementsN(&(ptr), sizeof(*(ptr)), -1, &(count), \
|
||||
VIR_TYPEMATCH(ptr, &(newelem)), &(newelem), true, false, \
|
||||
false, 0, NULL, NULL, 0)
|
||||
# define VIR_APPEND_ELEMENT_COPY_QUIET(ptr, count, newelem) \
|
||||
virInsertElementsN(&(ptr), sizeof(*(ptr)), -1, &(count), \
|
||||
virInsertElementsN(&(ptr), sizeof(*(ptr)), -1, &(count), \
|
||||
VIR_TYPEMATCH(ptr, &(newelem)), &(newelem), false, false, \
|
||||
false, 0, NULL, NULL, 0)
|
||||
|
||||
@ -576,7 +576,7 @@ void virDispose(void *ptrptr, size_t count, size_t element_size, size_t *countpt
|
||||
*
|
||||
* This macro is not safe to be used on arguments with side effects.
|
||||
*/
|
||||
# define VIR_DISPOSE_STRING(ptr) virDispose(1 ? (void *) &(ptr) : (ptr), \
|
||||
# define VIR_DISPOSE_STRING(ptr) virDispose(1 ? (void *) &(ptr) : (ptr), \
|
||||
(ptr) ? strlen((ptr)) : 0, 1, NULL)
|
||||
|
||||
|
||||
@ -588,7 +588,7 @@ void virDispose(void *ptrptr, size_t count, size_t element_size, size_t *countpt
|
||||
*
|
||||
* This macro is safe to be used on arguments with side effects.
|
||||
*/
|
||||
# define VIR_DISPOSE(ptr) virDispose(1 ? (void *) &(ptr) : (ptr), 1, \
|
||||
# define VIR_DISPOSE(ptr) virDispose(1 ? (void *) &(ptr) : (ptr), 1, \
|
||||
sizeof(*(ptr)), NULL)
|
||||
|
||||
|
||||
|
@ -156,62 +156,62 @@ VIR_STATIC unsigned int virAtomicIntXor(volatile unsigned int *atomic,
|
||||
|
||||
# ifdef VIR_ATOMIC_OPS_GCC
|
||||
|
||||
# define virAtomicIntGet(atomic) \
|
||||
(__extension__ ({ \
|
||||
(void)verify_true(sizeof(*(atomic)) == sizeof(int)); \
|
||||
(void)(0 ? *(atomic) ^ *(atomic) : 0); \
|
||||
__sync_synchronize(); \
|
||||
(int)*(atomic); \
|
||||
# define virAtomicIntGet(atomic) \
|
||||
(__extension__ ({ \
|
||||
(void)verify_true(sizeof(*(atomic)) == sizeof(int)); \
|
||||
(void)(0 ? *(atomic) ^ *(atomic) : 0); \
|
||||
__sync_synchronize(); \
|
||||
(int)*(atomic); \
|
||||
}))
|
||||
# define virAtomicIntSet(atomic, newval) \
|
||||
(__extension__ ({ \
|
||||
(void)verify_true(sizeof(*(atomic)) == sizeof(int)); \
|
||||
(void)(0 ? *(atomic) ^ (newval) : 0); \
|
||||
*(atomic) = (newval); \
|
||||
__sync_synchronize(); \
|
||||
# define virAtomicIntSet(atomic, newval) \
|
||||
(__extension__ ({ \
|
||||
(void)verify_true(sizeof(*(atomic)) == sizeof(int)); \
|
||||
(void)(0 ? *(atomic) ^ (newval) : 0); \
|
||||
*(atomic) = (newval); \
|
||||
__sync_synchronize(); \
|
||||
}))
|
||||
# define virAtomicIntInc(atomic) \
|
||||
(__extension__ ({ \
|
||||
(void)verify_true(sizeof(*(atomic)) == sizeof(int)); \
|
||||
(void)(0 ? *(atomic) ^ *(atomic) : 0); \
|
||||
__sync_add_and_fetch((atomic), 1); \
|
||||
# define virAtomicIntInc(atomic) \
|
||||
(__extension__ ({ \
|
||||
(void)verify_true(sizeof(*(atomic)) == sizeof(int)); \
|
||||
(void)(0 ? *(atomic) ^ *(atomic) : 0); \
|
||||
__sync_add_and_fetch((atomic), 1); \
|
||||
}))
|
||||
# define virAtomicIntDecAndTest(atomic) \
|
||||
(__extension__ ({ \
|
||||
(void)verify_true(sizeof(*(atomic)) == sizeof(int)); \
|
||||
(void)(0 ? *(atomic) ^ *(atomic) : 0); \
|
||||
__sync_fetch_and_sub((atomic), 1) == 1; \
|
||||
# define virAtomicIntDecAndTest(atomic) \
|
||||
(__extension__ ({ \
|
||||
(void)verify_true(sizeof(*(atomic)) == sizeof(int)); \
|
||||
(void)(0 ? *(atomic) ^ *(atomic) : 0); \
|
||||
__sync_fetch_and_sub((atomic), 1) == 1; \
|
||||
}))
|
||||
# define virAtomicIntCompareExchange(atomic, oldval, newval) \
|
||||
(__extension__ ({ \
|
||||
(void)verify_true(sizeof(*(atomic)) == sizeof(int)); \
|
||||
(void)(0 ? *(atomic) ^ (newval) ^ (oldval) : 0); \
|
||||
(bool)__sync_bool_compare_and_swap((atomic), \
|
||||
(oldval), (newval)); \
|
||||
# define virAtomicIntCompareExchange(atomic, oldval, newval) \
|
||||
(__extension__ ({ \
|
||||
(void)verify_true(sizeof(*(atomic)) == sizeof(int)); \
|
||||
(void)(0 ? *(atomic) ^ (newval) ^ (oldval) : 0); \
|
||||
(bool)__sync_bool_compare_and_swap((atomic), \
|
||||
(oldval), (newval)); \
|
||||
}))
|
||||
# define virAtomicIntAdd(atomic, val) \
|
||||
(__extension__ ({ \
|
||||
(void)verify_true(sizeof(*(atomic)) == sizeof(int)); \
|
||||
(void)(0 ? *(atomic) ^ (val) : 0); \
|
||||
(int) __sync_fetch_and_add((atomic), (val)); \
|
||||
# define virAtomicIntAdd(atomic, val) \
|
||||
(__extension__ ({ \
|
||||
(void)verify_true(sizeof(*(atomic)) == sizeof(int)); \
|
||||
(void)(0 ? *(atomic) ^ (val) : 0); \
|
||||
(int) __sync_fetch_and_add((atomic), (val)); \
|
||||
}))
|
||||
# define virAtomicIntAnd(atomic, val) \
|
||||
(__extension__ ({ \
|
||||
(void)verify_true(sizeof(*(atomic)) == sizeof(int)); \
|
||||
(void) (0 ? *(atomic) ^ (val) : 0); \
|
||||
(unsigned int) __sync_fetch_and_and((atomic), (val)); \
|
||||
# define virAtomicIntAnd(atomic, val) \
|
||||
(__extension__ ({ \
|
||||
(void)verify_true(sizeof(*(atomic)) == sizeof(int)); \
|
||||
(void) (0 ? *(atomic) ^ (val) : 0); \
|
||||
(unsigned int) __sync_fetch_and_and((atomic), (val)); \
|
||||
}))
|
||||
# define virAtomicIntOr(atomic, val) \
|
||||
(__extension__ ({ \
|
||||
(void)verify_true(sizeof(*(atomic)) == sizeof(int)); \
|
||||
(void) (0 ? *(atomic) ^ (val) : 0); \
|
||||
(unsigned int) __sync_fetch_and_or((atomic), (val)); \
|
||||
# define virAtomicIntOr(atomic, val) \
|
||||
(__extension__ ({ \
|
||||
(void)verify_true(sizeof(*(atomic)) == sizeof(int)); \
|
||||
(void) (0 ? *(atomic) ^ (val) : 0); \
|
||||
(unsigned int) __sync_fetch_and_or((atomic), (val)); \
|
||||
}))
|
||||
# define virAtomicIntXor(atomic, val) \
|
||||
(__extension__ ({ \
|
||||
(void)verify_true(sizeof(*(atomic)) == sizeof(int)); \
|
||||
(void) (0 ? *(atomic) ^ (val) : 0); \
|
||||
(unsigned int) __sync_fetch_and_xor((atomic), (val)); \
|
||||
# define virAtomicIntXor(atomic, val) \
|
||||
(__extension__ ({ \
|
||||
(void)verify_true(sizeof(*(atomic)) == sizeof(int)); \
|
||||
(void) (0 ? *(atomic) ^ (val) : 0); \
|
||||
(unsigned int) __sync_fetch_and_xor((atomic), (val)); \
|
||||
}))
|
||||
|
||||
|
||||
@ -430,23 +430,23 @@ virAtomicIntXor(volatile unsigned int *atomic,
|
||||
* functions, in the same way that we can with GCC
|
||||
* atomic op helpers.
|
||||
*/
|
||||
# define virAtomicIntGet(atomic) \
|
||||
# define virAtomicIntGet(atomic) \
|
||||
virAtomicIntGet((int *)atomic)
|
||||
# define virAtomicIntSet(atomic, val) \
|
||||
# define virAtomicIntSet(atomic, val) \
|
||||
virAtomicIntSet((int *)atomic, val)
|
||||
# define virAtomicIntInc(atomic) \
|
||||
# define virAtomicIntInc(atomic) \
|
||||
virAtomicIntInc((int *)atomic)
|
||||
# define virAtomicIntDecAndTest(atomic) \
|
||||
# define virAtomicIntDecAndTest(atomic) \
|
||||
virAtomicIntDecAndTest((int *)atomic)
|
||||
# define virAtomicIntCompareExchange(atomic, oldval, newval) \
|
||||
# define virAtomicIntCompareExchange(atomic, oldval, newval) \
|
||||
virAtomicIntCompareExchange((int *)atomic, oldval, newval)
|
||||
# define virAtomicIntAdd(atomic, val) \
|
||||
# define virAtomicIntAdd(atomic, val) \
|
||||
virAtomicIntAdd((int *)atomic, val)
|
||||
# define virAtomicIntAnd(atomic, val) \
|
||||
# define virAtomicIntAnd(atomic, val) \
|
||||
virAtomicIntAnd((unsigned int *)atomic, val)
|
||||
# define virAtomicIntOr(atomic, val) \
|
||||
# define virAtomicIntOr(atomic, val) \
|
||||
virAtomicIntOr((unsigned int *)atomic, val)
|
||||
# define virAtomicIntXor(atomic, val) \
|
||||
# define virAtomicIntXor(atomic, val) \
|
||||
virAtomicIntXor((unsigned int *)atomic, val)
|
||||
|
||||
# endif
|
||||
|
@ -47,12 +47,12 @@ char *virAuditEncode(const char *key, const char *value);
|
||||
|
||||
void virAuditClose(void);
|
||||
|
||||
# define VIR_AUDIT(type, success, ...) \
|
||||
virAuditSend(&virLogSelf, __FILE__, __LINE__, __func__, \
|
||||
# define VIR_AUDIT(type, success, ...) \
|
||||
virAuditSend(&virLogSelf, __FILE__, __LINE__, __func__, \
|
||||
NULL, NULL, type, success, __VA_ARGS__);
|
||||
|
||||
# define VIR_AUDIT_USER(type, success, clienttty, clientaddr, ...) \
|
||||
virAuditSend(&virLogSelf, __FILE__, __LINE__, __func__, \
|
||||
# define VIR_AUDIT_USER(type, success, clienttty, clientaddr, ...) \
|
||||
virAuditSend(&virLogSelf, __FILE__, __LINE__, __func__, \
|
||||
clienttty, clientaddr, type, success, __VA_ARGS__);
|
||||
|
||||
# define VIR_AUDIT_STR(str) \
|
||||
|
@ -967,8 +967,8 @@ virCommandNewVAList(const char *binary, va_list list)
|
||||
}
|
||||
|
||||
|
||||
#define VIR_COMMAND_MAYBE_CLOSE_FD(fd, flags) \
|
||||
if ((fd > STDERR_FILENO) && \
|
||||
#define VIR_COMMAND_MAYBE_CLOSE_FD(fd, flags) \
|
||||
if ((fd > STDERR_FILENO) && \
|
||||
(flags & VIR_COMMAND_PASS_FD_CLOSE_PARENT)) \
|
||||
VIR_FORCE_CLOSE(fd)
|
||||
|
||||
|
@ -61,12 +61,12 @@ struct _virConfParserCtxt {
|
||||
#define NEXT if (ctxt->cur < ctxt->end) ctxt->cur++;
|
||||
#define IS_EOL(c) (((c) == '\n') || ((c) == '\r'))
|
||||
|
||||
#define SKIP_BLANKS_AND_EOL \
|
||||
#define SKIP_BLANKS_AND_EOL \
|
||||
do { while ((ctxt->cur < ctxt->end) && (c_isblank(CUR) || IS_EOL(CUR))) { \
|
||||
if (CUR == '\n') ctxt->line++; \
|
||||
if (CUR == '\n') ctxt->line++; \
|
||||
ctxt->cur++; } } while (0)
|
||||
#define SKIP_BLANKS \
|
||||
do { while ((ctxt->cur < ctxt->end) && (c_isblank(CUR))) \
|
||||
#define SKIP_BLANKS \
|
||||
do { while ((ctxt->cur < ctxt->end) && (c_isblank(CUR))) \
|
||||
ctxt->cur++; } while (0)
|
||||
|
||||
VIR_ENUM_IMPL(virConf, VIR_CONF_LAST,
|
||||
|
@ -579,24 +579,24 @@ virDBusIsAllowedRefType(const char *sig)
|
||||
}
|
||||
|
||||
|
||||
# define SET_NEXT_VAL(dbustype, vargtype, arrtype, sigtype, fmt) \
|
||||
do { \
|
||||
dbustype x; \
|
||||
if (arrayref) { \
|
||||
arrtype valarray = arrayptr; \
|
||||
x = (dbustype)*valarray; \
|
||||
valarray++; \
|
||||
arrayptr = valarray; \
|
||||
} else { \
|
||||
x = (dbustype)va_arg(args, vargtype); \
|
||||
} \
|
||||
if (!dbus_message_iter_append_basic(iter, sigtype, &x)) { \
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, \
|
||||
# define SET_NEXT_VAL(dbustype, vargtype, arrtype, sigtype, fmt) \
|
||||
do { \
|
||||
dbustype x; \
|
||||
if (arrayref) { \
|
||||
arrtype valarray = arrayptr; \
|
||||
x = (dbustype)*valarray; \
|
||||
valarray++; \
|
||||
arrayptr = valarray; \
|
||||
} else { \
|
||||
x = (dbustype)va_arg(args, vargtype); \
|
||||
} \
|
||||
if (!dbus_message_iter_append_basic(iter, sigtype, &x)) { \
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, \
|
||||
_("Cannot append basic type %s"), #vargtype);\
|
||||
goto cleanup; \
|
||||
} \
|
||||
goto cleanup; \
|
||||
} \
|
||||
VIR_DEBUG("Appended basic type '" #dbustype "' varg '" #vargtype\
|
||||
"' sig '%c' val '" fmt "'", sigtype, (vargtype)x); \
|
||||
"' sig '%c' val '" fmt "'", sigtype, (vargtype)x); \
|
||||
} while (0)
|
||||
|
||||
|
||||
@ -854,25 +854,25 @@ virDBusMessageIterEncode(DBusMessageIter *rootiter,
|
||||
# undef SET_NEXT_VAL
|
||||
|
||||
|
||||
# define GET_NEXT_VAL(dbustype, member, vargtype, fmt) \
|
||||
do { \
|
||||
DBusBasicValue v; \
|
||||
dbustype *x = (dbustype *)&v.member; \
|
||||
vargtype *y; \
|
||||
if (arrayref) { \
|
||||
VIR_DEBUG("Use arrayref"); \
|
||||
vargtype **xptrptr = arrayptr; \
|
||||
if (VIR_EXPAND_N(*xptrptr, *narrayptr, 1) < 0) \
|
||||
goto cleanup; \
|
||||
y = (*xptrptr + (*narrayptr - 1)); \
|
||||
VIR_DEBUG("Expanded to %zu", *narrayptr); \
|
||||
} else { \
|
||||
y = va_arg(args, vargtype *); \
|
||||
} \
|
||||
dbus_message_iter_get_basic(iter, x); \
|
||||
*y = *x; \
|
||||
VIR_DEBUG("Read basic type '" #dbustype "' varg '" #vargtype \
|
||||
"' val '" fmt "'", (vargtype)*y); \
|
||||
# define GET_NEXT_VAL(dbustype, member, vargtype, fmt) \
|
||||
do { \
|
||||
DBusBasicValue v; \
|
||||
dbustype *x = (dbustype *)&v.member; \
|
||||
vargtype *y; \
|
||||
if (arrayref) { \
|
||||
VIR_DEBUG("Use arrayref"); \
|
||||
vargtype **xptrptr = arrayptr; \
|
||||
if (VIR_EXPAND_N(*xptrptr, *narrayptr, 1) < 0) \
|
||||
goto cleanup; \
|
||||
y = (*xptrptr + (*narrayptr - 1)); \
|
||||
VIR_DEBUG("Expanded to %zu", *narrayptr); \
|
||||
} else { \
|
||||
y = va_arg(args, vargtype *); \
|
||||
} \
|
||||
dbus_message_iter_get_basic(iter, x); \
|
||||
*y = *x; \
|
||||
VIR_DEBUG("Read basic type '" #dbustype "' varg '" #vargtype \
|
||||
"' val '" fmt "'", (vargtype)*y); \
|
||||
} while (0)
|
||||
|
||||
|
||||
|
@ -111,12 +111,12 @@ unsigned long dnsmasqCapsGetVersion(dnsmasqCapsPtr caps);
|
||||
# define DNSMASQ_RA_MAJOR_REQD 2
|
||||
# define DNSMASQ_RA_MINOR_REQD 64
|
||||
|
||||
# define DNSMASQ_DHCPv6_SUPPORT(CAPS) \
|
||||
(dnsmasqCapsGetVersion(CAPS) >= \
|
||||
# define DNSMASQ_DHCPv6_SUPPORT(CAPS) \
|
||||
(dnsmasqCapsGetVersion(CAPS) >= \
|
||||
(DNSMASQ_DHCPv6_MAJOR_REQD * 1000000) + \
|
||||
(DNSMASQ_DHCPv6_MINOR_REQD * 1000))
|
||||
# define DNSMASQ_RA_SUPPORT(CAPS) \
|
||||
(dnsmasqCapsGetVersion(CAPS) >= \
|
||||
(DNSMASQ_RA_MAJOR_REQD * 1000000) + \
|
||||
# define DNSMASQ_RA_SUPPORT(CAPS) \
|
||||
(dnsmasqCapsGetVersion(CAPS) >= \
|
||||
(DNSMASQ_RA_MAJOR_REQD * 1000000) + \
|
||||
(DNSMASQ_RA_MINOR_REQD * 1000))
|
||||
#endif /* __DNSMASQ_H__ */
|
||||
|
@ -34,14 +34,14 @@
|
||||
* Read 8 bytes at BUF as a big-endian 64-bit number. Caller is
|
||||
* responsible to avoid reading beyond array bounds.
|
||||
*/
|
||||
# define virReadBufInt64BE(buf) \
|
||||
(((uint64_t)(uint8_t)((buf)[0]) << 56) | \
|
||||
((uint64_t)(uint8_t)((buf)[1]) << 48) | \
|
||||
((uint64_t)(uint8_t)((buf)[2]) << 40) | \
|
||||
((uint64_t)(uint8_t)((buf)[3]) << 32) | \
|
||||
((uint64_t)(uint8_t)((buf)[4]) << 24) | \
|
||||
((uint64_t)(uint8_t)((buf)[5]) << 16) | \
|
||||
((uint64_t)(uint8_t)((buf)[6]) << 8) | \
|
||||
# define virReadBufInt64BE(buf) \
|
||||
(((uint64_t)(uint8_t)((buf)[0]) << 56) | \
|
||||
((uint64_t)(uint8_t)((buf)[1]) << 48) | \
|
||||
((uint64_t)(uint8_t)((buf)[2]) << 40) | \
|
||||
((uint64_t)(uint8_t)((buf)[3]) << 32) | \
|
||||
((uint64_t)(uint8_t)((buf)[4]) << 24) | \
|
||||
((uint64_t)(uint8_t)((buf)[5]) << 16) | \
|
||||
((uint64_t)(uint8_t)((buf)[6]) << 8) | \
|
||||
(uint64_t)(uint8_t)((buf)[7]))
|
||||
|
||||
/**
|
||||
@ -52,14 +52,14 @@
|
||||
* Read 8 bytes at BUF as a little-endian 64-bit number. Caller is
|
||||
* responsible to avoid reading beyond array bounds.
|
||||
*/
|
||||
# define virReadBufInt64LE(buf) \
|
||||
((uint64_t)(uint8_t)((buf)[0]) | \
|
||||
((uint64_t)(uint8_t)((buf)[1]) << 8) | \
|
||||
((uint64_t)(uint8_t)((buf)[2]) << 16) | \
|
||||
((uint64_t)(uint8_t)((buf)[3]) << 24) | \
|
||||
((uint64_t)(uint8_t)((buf)[4]) << 32) | \
|
||||
((uint64_t)(uint8_t)((buf)[5]) << 40) | \
|
||||
((uint64_t)(uint8_t)((buf)[6]) << 48) | \
|
||||
# define virReadBufInt64LE(buf) \
|
||||
((uint64_t)(uint8_t)((buf)[0]) | \
|
||||
((uint64_t)(uint8_t)((buf)[1]) << 8) | \
|
||||
((uint64_t)(uint8_t)((buf)[2]) << 16) | \
|
||||
((uint64_t)(uint8_t)((buf)[3]) << 24) | \
|
||||
((uint64_t)(uint8_t)((buf)[4]) << 32) | \
|
||||
((uint64_t)(uint8_t)((buf)[5]) << 40) | \
|
||||
((uint64_t)(uint8_t)((buf)[6]) << 48) | \
|
||||
((uint64_t)(uint8_t)((buf)[7]) << 56))
|
||||
|
||||
/**
|
||||
@ -70,10 +70,10 @@
|
||||
* Read 4 bytes at BUF as a big-endian 32-bit number. Caller is
|
||||
* responsible to avoid reading beyond array bounds.
|
||||
*/
|
||||
# define virReadBufInt32BE(buf) \
|
||||
(((uint32_t)(uint8_t)((buf)[0]) << 24) | \
|
||||
((uint32_t)(uint8_t)((buf)[1]) << 16) | \
|
||||
((uint32_t)(uint8_t)((buf)[2]) << 8) | \
|
||||
# define virReadBufInt32BE(buf) \
|
||||
(((uint32_t)(uint8_t)((buf)[0]) << 24) | \
|
||||
((uint32_t)(uint8_t)((buf)[1]) << 16) | \
|
||||
((uint32_t)(uint8_t)((buf)[2]) << 8) | \
|
||||
(uint32_t)(uint8_t)((buf)[3]))
|
||||
|
||||
/**
|
||||
@ -84,10 +84,10 @@
|
||||
* Read 4 bytes at BUF as a little-endian 32-bit number. Caller is
|
||||
* responsible to avoid reading beyond array bounds.
|
||||
*/
|
||||
# define virReadBufInt32LE(buf) \
|
||||
((uint32_t)(uint8_t)((buf)[0]) | \
|
||||
((uint32_t)(uint8_t)((buf)[1]) << 8) | \
|
||||
((uint32_t)(uint8_t)((buf)[2]) << 16) | \
|
||||
# define virReadBufInt32LE(buf) \
|
||||
((uint32_t)(uint8_t)((buf)[0]) | \
|
||||
((uint32_t)(uint8_t)((buf)[1]) << 8) | \
|
||||
((uint32_t)(uint8_t)((buf)[2]) << 16) | \
|
||||
((uint32_t)(uint8_t)((buf)[3]) << 24))
|
||||
|
||||
/**
|
||||
@ -98,8 +98,8 @@
|
||||
* Read 2 bytes at BUF as a big-endian 16-bit number. Caller is
|
||||
* responsible to avoid reading beyond array bounds.
|
||||
*/
|
||||
# define virReadBufInt16BE(buf) \
|
||||
(((uint16_t)(uint8_t)((buf)[0]) << 8) | \
|
||||
# define virReadBufInt16BE(buf) \
|
||||
(((uint16_t)(uint8_t)((buf)[0]) << 8) | \
|
||||
(uint16_t)(uint8_t)((buf)[1]))
|
||||
|
||||
/**
|
||||
@ -110,8 +110,8 @@
|
||||
* Read 2 bytes at BUF as a little-endian 16-bit number. Caller is
|
||||
* responsible to avoid reading beyond array bounds.
|
||||
*/
|
||||
# define virReadBufInt16LE(buf) \
|
||||
((uint16_t)(uint8_t)((buf)[0]) | \
|
||||
# define virReadBufInt16LE(buf) \
|
||||
((uint16_t)(uint8_t)((buf)[0]) | \
|
||||
((uint16_t)(uint8_t)((buf)[1]) << 8))
|
||||
|
||||
#endif /* __VIR_ENDIAN_H__ */
|
||||
|
@ -62,105 +62,105 @@ void virReportSystemErrorFull(int domcode,
|
||||
const char *fmt, ...)
|
||||
ATTRIBUTE_FMT_PRINTF(6, 7);
|
||||
|
||||
# define virReportSystemError(theerrno, fmt,...) \
|
||||
virReportSystemErrorFull(VIR_FROM_THIS, \
|
||||
(theerrno), \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
# define virReportSystemError(theerrno, fmt,...) \
|
||||
virReportSystemErrorFull(VIR_FROM_THIS, \
|
||||
(theerrno), \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
(fmt), __VA_ARGS__)
|
||||
|
||||
# define virReportInvalidNullArg(argname) \
|
||||
virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__, \
|
||||
VIR_FROM_THIS, \
|
||||
VIR_ERR_INVALID_ARG, \
|
||||
VIR_ERR_ERROR, \
|
||||
__FUNCTION__, \
|
||||
#argname, \
|
||||
NULL, \
|
||||
0, 0, \
|
||||
_("%s in %s must be NULL"), \
|
||||
# define virReportInvalidNullArg(argname) \
|
||||
virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__, \
|
||||
VIR_FROM_THIS, \
|
||||
VIR_ERR_INVALID_ARG, \
|
||||
VIR_ERR_ERROR, \
|
||||
__FUNCTION__, \
|
||||
#argname, \
|
||||
NULL, \
|
||||
0, 0, \
|
||||
_("%s in %s must be NULL"), \
|
||||
#argname, __FUNCTION__)
|
||||
# define virReportInvalidNonNullArg(argname) \
|
||||
virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__, \
|
||||
VIR_FROM_THIS, \
|
||||
VIR_ERR_INVALID_ARG, \
|
||||
VIR_ERR_ERROR, \
|
||||
__FUNCTION__, \
|
||||
#argname, \
|
||||
NULL, \
|
||||
0, 0, \
|
||||
_("%s in %s must not be NULL"), \
|
||||
# define virReportInvalidNonNullArg(argname) \
|
||||
virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__, \
|
||||
VIR_FROM_THIS, \
|
||||
VIR_ERR_INVALID_ARG, \
|
||||
VIR_ERR_ERROR, \
|
||||
__FUNCTION__, \
|
||||
#argname, \
|
||||
NULL, \
|
||||
0, 0, \
|
||||
_("%s in %s must not be NULL"), \
|
||||
#argname, __FUNCTION__)
|
||||
# define virReportInvalidEmptyStringArg(argname) \
|
||||
virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__, \
|
||||
VIR_FROM_THIS, \
|
||||
VIR_ERR_INVALID_ARG, \
|
||||
VIR_ERR_ERROR, \
|
||||
__FUNCTION__, \
|
||||
#argname, \
|
||||
NULL, \
|
||||
0, 0, \
|
||||
_("string %s in %s must not be empty"), \
|
||||
# define virReportInvalidEmptyStringArg(argname) \
|
||||
virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__, \
|
||||
VIR_FROM_THIS, \
|
||||
VIR_ERR_INVALID_ARG, \
|
||||
VIR_ERR_ERROR, \
|
||||
__FUNCTION__, \
|
||||
#argname, \
|
||||
NULL, \
|
||||
0, 0, \
|
||||
_("string %s in %s must not be empty"), \
|
||||
#argname, __FUNCTION__)
|
||||
# define virReportInvalidPositiveArg(argname) \
|
||||
virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__, \
|
||||
VIR_FROM_THIS, \
|
||||
VIR_ERR_INVALID_ARG, \
|
||||
VIR_ERR_ERROR, \
|
||||
__FUNCTION__, \
|
||||
#argname, \
|
||||
NULL, \
|
||||
0, 0, \
|
||||
_("%s in %s must be greater than zero"), \
|
||||
# define virReportInvalidPositiveArg(argname) \
|
||||
virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__, \
|
||||
VIR_FROM_THIS, \
|
||||
VIR_ERR_INVALID_ARG, \
|
||||
VIR_ERR_ERROR, \
|
||||
__FUNCTION__, \
|
||||
#argname, \
|
||||
NULL, \
|
||||
0, 0, \
|
||||
_("%s in %s must be greater than zero"), \
|
||||
#argname, __FUNCTION__)
|
||||
# define virReportInvalidNonZeroArg(argname) \
|
||||
virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__, \
|
||||
VIR_FROM_THIS, \
|
||||
VIR_ERR_INVALID_ARG, \
|
||||
VIR_ERR_ERROR, \
|
||||
__FUNCTION__, \
|
||||
#argname, \
|
||||
NULL, \
|
||||
0, 0, \
|
||||
_("%s in %s must not be zero"), \
|
||||
# define virReportInvalidNonZeroArg(argname) \
|
||||
virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__, \
|
||||
VIR_FROM_THIS, \
|
||||
VIR_ERR_INVALID_ARG, \
|
||||
VIR_ERR_ERROR, \
|
||||
__FUNCTION__, \
|
||||
#argname, \
|
||||
NULL, \
|
||||
0, 0, \
|
||||
_("%s in %s must not be zero"), \
|
||||
#argname, __FUNCTION__)
|
||||
# define virReportInvalidZeroArg(argname) \
|
||||
virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__, \
|
||||
VIR_FROM_THIS, \
|
||||
VIR_ERR_INVALID_ARG, \
|
||||
VIR_ERR_ERROR, \
|
||||
__FUNCTION__, \
|
||||
#argname, \
|
||||
NULL, \
|
||||
0, 0, \
|
||||
_("%s in %s must be zero"), \
|
||||
# define virReportInvalidZeroArg(argname) \
|
||||
virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__, \
|
||||
VIR_FROM_THIS, \
|
||||
VIR_ERR_INVALID_ARG, \
|
||||
VIR_ERR_ERROR, \
|
||||
__FUNCTION__, \
|
||||
#argname, \
|
||||
NULL, \
|
||||
0, 0, \
|
||||
_("%s in %s must be zero"), \
|
||||
#argname, __FUNCTION__)
|
||||
# define virReportInvalidNonNegativeArg(argname) \
|
||||
virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__, \
|
||||
VIR_FROM_THIS, \
|
||||
VIR_ERR_INVALID_ARG, \
|
||||
VIR_ERR_ERROR, \
|
||||
__FUNCTION__, \
|
||||
#argname, \
|
||||
NULL, \
|
||||
0, 0, \
|
||||
_("%s in %s must be zero or greater"), \
|
||||
# define virReportInvalidNonNegativeArg(argname) \
|
||||
virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__, \
|
||||
VIR_FROM_THIS, \
|
||||
VIR_ERR_INVALID_ARG, \
|
||||
VIR_ERR_ERROR, \
|
||||
__FUNCTION__, \
|
||||
#argname, \
|
||||
NULL, \
|
||||
0, 0, \
|
||||
_("%s in %s must be zero or greater"), \
|
||||
#argname, __FUNCTION__)
|
||||
# define virReportInvalidArg(argname, fmt, ...) \
|
||||
virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__, \
|
||||
VIR_FROM_THIS, \
|
||||
VIR_ERR_INVALID_ARG, \
|
||||
VIR_ERR_ERROR, \
|
||||
__FUNCTION__, \
|
||||
#argname, \
|
||||
NULL, \
|
||||
0, 0, \
|
||||
# define virReportInvalidArg(argname, fmt, ...) \
|
||||
virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__, \
|
||||
VIR_FROM_THIS, \
|
||||
VIR_ERR_INVALID_ARG, \
|
||||
VIR_ERR_ERROR, \
|
||||
__FUNCTION__, \
|
||||
#argname, \
|
||||
NULL, \
|
||||
0, 0, \
|
||||
(fmt), __VA_ARGS__)
|
||||
|
||||
# define virReportUnsupportedError() \
|
||||
virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_NO_SUPPORT, \
|
||||
# define virReportUnsupportedError() \
|
||||
virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_NO_SUPPORT, \
|
||||
__FILE__, __FUNCTION__, __LINE__, __FUNCTION__)
|
||||
# define virReportRestrictedError(...) \
|
||||
virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_OPERATION_DENIED, \
|
||||
# define virReportRestrictedError(...) \
|
||||
virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_OPERATION_DENIED, \
|
||||
__FILE__, __FUNCTION__, __LINE__, __VA_ARGS__)
|
||||
|
||||
|
||||
@ -172,11 +172,11 @@ void virReportOOMErrorFull(int domcode,
|
||||
# define virReportOOMError() \
|
||||
virReportOOMErrorFull(VIR_FROM_THIS, __FILE__, __FUNCTION__, __LINE__)
|
||||
|
||||
# define virReportError(code, ...) \
|
||||
virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \
|
||||
# define virReportError(code, ...) \
|
||||
virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \
|
||||
__FUNCTION__, __LINE__, __VA_ARGS__)
|
||||
|
||||
# define virReportErrorObject(obj) \
|
||||
# define virReportErrorObject(obj) \
|
||||
virRaiseErrorObject(__FILE__, __FUNCTION__, __LINE__, obj)
|
||||
|
||||
int virSetError(virErrorPtr newerr);
|
||||
|
@ -69,14 +69,14 @@ FILE *virFileFdopen(int *fdptr, const char *mode) ATTRIBUTE_RETURN_CHECK;
|
||||
|
||||
/* Similar VIR_FORCE_CLOSE() but ignores EBADF errors since they are expected
|
||||
* during mass close after fork(). */
|
||||
# define VIR_MASS_CLOSE(FD) \
|
||||
ignore_value(virFileClose(&(FD), \
|
||||
VIR_FILE_CLOSE_PRESERVE_ERRNO | \
|
||||
# define VIR_MASS_CLOSE(FD) \
|
||||
ignore_value(virFileClose(&(FD), \
|
||||
VIR_FILE_CLOSE_PRESERVE_ERRNO | \
|
||||
VIR_FILE_CLOSE_IGNORE_EBADF))
|
||||
|
||||
# define VIR_LOG_CLOSE(FD) \
|
||||
ignore_value(virFileClose(&(FD), \
|
||||
VIR_FILE_CLOSE_PRESERVE_ERRNO | \
|
||||
# define VIR_LOG_CLOSE(FD) \
|
||||
ignore_value(virFileClose(&(FD), \
|
||||
VIR_FILE_CLOSE_PRESERVE_ERRNO | \
|
||||
VIR_FILE_CLOSE_DONT_LOG))
|
||||
|
||||
/* Opaque type for managing a wrapper around a fd. */
|
||||
|
@ -306,33 +306,33 @@ void virFirewallFree(virFirewallPtr firewall)
|
||||
VIR_FREE(firewall);
|
||||
}
|
||||
|
||||
#define VIR_FIREWALL_RETURN_IF_ERROR(firewall) \
|
||||
do { \
|
||||
if (!firewall || firewall->err) \
|
||||
return; \
|
||||
#define VIR_FIREWALL_RETURN_IF_ERROR(firewall) \
|
||||
do { \
|
||||
if (!firewall || firewall->err) \
|
||||
return; \
|
||||
} while (0)
|
||||
|
||||
#define VIR_FIREWALL_RULE_RETURN_IF_ERROR(firewall, rule)\
|
||||
do { \
|
||||
if (!firewall || firewall->err || !rule) \
|
||||
return; \
|
||||
do { \
|
||||
if (!firewall || firewall->err || !rule) \
|
||||
return; \
|
||||
} while (0)
|
||||
|
||||
#define VIR_FIREWALL_RETURN_NULL_IF_ERROR(firewall) \
|
||||
do { \
|
||||
if (!firewall || firewall->err) \
|
||||
return NULL; \
|
||||
#define VIR_FIREWALL_RETURN_NULL_IF_ERROR(firewall) \
|
||||
do { \
|
||||
if (!firewall || firewall->err) \
|
||||
return NULL; \
|
||||
} while (0)
|
||||
|
||||
#define ADD_ARG(rule, str) \
|
||||
do { \
|
||||
if (VIR_RESIZE_N(rule->args, \
|
||||
rule->argsAlloc, \
|
||||
rule->argsLen, 1) < 0) \
|
||||
goto no_memory; \
|
||||
\
|
||||
#define ADD_ARG(rule, str) \
|
||||
do { \
|
||||
if (VIR_RESIZE_N(rule->args, \
|
||||
rule->argsAlloc, \
|
||||
rule->argsLen, 1) < 0) \
|
||||
goto no_memory; \
|
||||
\
|
||||
if (VIR_STRDUP(rule->args[rule->argsLen++], str) < 0) \
|
||||
goto no_memory; \
|
||||
goto no_memory; \
|
||||
} while (0)
|
||||
|
||||
static virFirewallRulePtr
|
||||
|
@ -41,10 +41,10 @@ VIR_LOG_INIT("util.hash");
|
||||
|
||||
/* #define DEBUG_GROW */
|
||||
|
||||
#define virHashIterationError(ret) \
|
||||
do { \
|
||||
VIR_ERROR(_("Hash operation not allowed during iteration")); \
|
||||
return ret; \
|
||||
#define virHashIterationError(ret) \
|
||||
do { \
|
||||
VIR_ERROR(_("Hash operation not allowed during iteration")); \
|
||||
return ret; \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
|
@ -877,11 +877,11 @@ virLogNewOutputToSyslog(virLogPriority priority,
|
||||
|
||||
|
||||
# if USE_JOURNALD
|
||||
# define IOVEC_SET(iov, data, size) \
|
||||
do { \
|
||||
struct iovec *_i = &(iov); \
|
||||
_i->iov_base = (void*)(data); \
|
||||
_i->iov_len = (size); \
|
||||
# define IOVEC_SET(iov, data, size) \
|
||||
do { \
|
||||
struct iovec *_i = &(iov); \
|
||||
_i->iov_base = (void*)(data); \
|
||||
_i->iov_len = (size); \
|
||||
} while (0)
|
||||
|
||||
# define IOVEC_SET_STRING(iov, str) IOVEC_SET(iov, str, strlen(str))
|
||||
|
@ -34,7 +34,7 @@
|
||||
"libvirt version: " VERSION ", package: " PACKAGER_VERSION
|
||||
# endif
|
||||
# else
|
||||
# define VIR_LOG_VERSION_STRING \
|
||||
# define VIR_LOG_VERSION_STRING \
|
||||
"libvirt version: " VERSION
|
||||
# endif
|
||||
|
||||
@ -73,12 +73,12 @@ struct _virLogSource {
|
||||
* log statements in a file are conditionally disabled
|
||||
* at compile time due to configure options.
|
||||
*/
|
||||
# define VIR_LOG_INIT(n) \
|
||||
# define VIR_LOG_INIT(n) \
|
||||
static ATTRIBUTE_UNUSED virLogSource virLogSelf = { \
|
||||
.name = "" n "", \
|
||||
.priority = VIR_LOG_ERROR, \
|
||||
.serial = 0, \
|
||||
.flags = 0, \
|
||||
.name = "" n "", \
|
||||
.priority = VIR_LOG_ERROR, \
|
||||
.serial = 0, \
|
||||
.flags = 0, \
|
||||
};
|
||||
|
||||
/*
|
||||
@ -87,7 +87,7 @@ struct _virLogSource {
|
||||
* defined at runtime from the libvirt daemon configuration file
|
||||
*/
|
||||
# ifdef ENABLE_DEBUG
|
||||
# define VIR_DEBUG_INT(src, filename, linenr, funcname, ...) \
|
||||
# define VIR_DEBUG_INT(src, filename, linenr, funcname, ...) \
|
||||
virLogMessage(src, VIR_LOG_DEBUG, filename, linenr, funcname, NULL, __VA_ARGS__)
|
||||
# else
|
||||
/**
|
||||
@ -100,24 +100,24 @@ static inline void virLogEatParams(virLogSourcePtr unused, ...)
|
||||
/* Silence gcc */
|
||||
unused = unused;
|
||||
}
|
||||
# define VIR_DEBUG_INT(src, filename, linenr, funcname, ...) \
|
||||
# define VIR_DEBUG_INT(src, filename, linenr, funcname, ...) \
|
||||
virLogEatParams(src, filename, linenr, funcname, __VA_ARGS__)
|
||||
# endif /* !ENABLE_DEBUG */
|
||||
|
||||
# define VIR_INFO_INT(src, filename, linenr, funcname, ...) \
|
||||
# define VIR_INFO_INT(src, filename, linenr, funcname, ...) \
|
||||
virLogMessage(src, VIR_LOG_INFO, filename, linenr, funcname, NULL, __VA_ARGS__)
|
||||
# define VIR_WARN_INT(src, filename, linenr, funcname, ...) \
|
||||
# define VIR_WARN_INT(src, filename, linenr, funcname, ...) \
|
||||
virLogMessage(src, VIR_LOG_WARN, filename, linenr, funcname, NULL, __VA_ARGS__)
|
||||
# define VIR_ERROR_INT(src, filename, linenr, funcname, ...) \
|
||||
# define VIR_ERROR_INT(src, filename, linenr, funcname, ...) \
|
||||
virLogMessage(src, VIR_LOG_ERROR, filename, linenr, funcname, NULL, __VA_ARGS__)
|
||||
|
||||
# define VIR_DEBUG(...) \
|
||||
# define VIR_DEBUG(...) \
|
||||
VIR_DEBUG_INT(&virLogSelf, __FILE__, __LINE__, __func__, __VA_ARGS__)
|
||||
# define VIR_INFO(...) \
|
||||
# define VIR_INFO(...) \
|
||||
VIR_INFO_INT(&virLogSelf, __FILE__, __LINE__, __func__, __VA_ARGS__)
|
||||
# define VIR_WARN(...) \
|
||||
# define VIR_WARN(...) \
|
||||
VIR_WARN_INT(&virLogSelf, __FILE__, __LINE__, __func__, __VA_ARGS__)
|
||||
# define VIR_ERROR(...) \
|
||||
# define VIR_ERROR(...) \
|
||||
VIR_ERROR_INT(&virLogSelf, __FILE__, __LINE__, __func__, __VA_ARGS__)
|
||||
|
||||
|
||||
|
@ -95,7 +95,7 @@ VIR_LOG_INIT("util.netdev");
|
||||
# define GFEATURES_SIZE 2
|
||||
# define FEATURE_WORD(blocks, index, field) ((blocks)[(index) / 32U].field)
|
||||
# define FEATURE_FIELD_FLAG(index) (1U << (index) % 32U)
|
||||
# define FEATURE_BIT_IS_SET(blocks, index, field) \
|
||||
# define FEATURE_BIT_IS_SET(blocks, index, field) \
|
||||
(FEATURE_WORD(blocks, index, field) & FEATURE_FIELD_FLAG(index))
|
||||
#endif
|
||||
|
||||
@ -285,7 +285,7 @@ virNetDevSetMACInternal(const char *ifname,
|
||||
}
|
||||
|
||||
|
||||
#elif defined(SIOCSIFLLADDR) && defined(HAVE_STRUCT_IFREQ) && \
|
||||
#elif defined(SIOCSIFLLADDR) && defined(HAVE_STRUCT_IFREQ) && \
|
||||
HAVE_DECL_LINK_ADDR
|
||||
|
||||
|
||||
|
@ -357,26 +357,26 @@ virNetDevOpenvswitchInterfaceStats(const char *ifname,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
#define GET_STAT(name, member) \
|
||||
do { \
|
||||
VIR_FREE(output); \
|
||||
virCommandFree(cmd); \
|
||||
cmd = virCommandNew(OVSVSCTL); \
|
||||
virNetDevOpenvswitchAddTimeout(cmd); \
|
||||
virCommandAddArgList(cmd, "get", "Interface", ifname, \
|
||||
"statistics:" name, NULL); \
|
||||
virCommandSetOutputBuffer(cmd, &output); \
|
||||
if (virCommandRun(cmd, NULL) < 0) { \
|
||||
stats->member = -1; \
|
||||
} else { \
|
||||
if (virStrToLong_ll(output, &tmp, 10, &stats->member) < 0 || \
|
||||
*tmp != '\n') { \
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", \
|
||||
_("Fail to parse ovs-vsctl output")); \
|
||||
goto cleanup; \
|
||||
} \
|
||||
gotStats = true; \
|
||||
} \
|
||||
#define GET_STAT(name, member) \
|
||||
do { \
|
||||
VIR_FREE(output); \
|
||||
virCommandFree(cmd); \
|
||||
cmd = virCommandNew(OVSVSCTL); \
|
||||
virNetDevOpenvswitchAddTimeout(cmd); \
|
||||
virCommandAddArgList(cmd, "get", "Interface", ifname, \
|
||||
"statistics:" name, NULL); \
|
||||
virCommandSetOutputBuffer(cmd, &output); \
|
||||
if (virCommandRun(cmd, NULL) < 0) { \
|
||||
stats->member = -1; \
|
||||
} else { \
|
||||
if (virStrToLong_ll(output, &tmp, 10, &stats->member) < 0 || \
|
||||
*tmp != '\n') { \
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", \
|
||||
_("Fail to parse ovs-vsctl output")); \
|
||||
goto cleanup; \
|
||||
} \
|
||||
gotStats = true; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/* The TX/RX fields appear to be swapped here
|
||||
|
@ -49,19 +49,19 @@ struct _virClass {
|
||||
|
||||
#define VIR_OBJECT_NOTVALID(obj) (!obj || ((obj->u.s.magic & 0xFFFF0000) != 0xCAFE0000))
|
||||
|
||||
#define VIR_OBJECT_USAGE_PRINT_WARNING(anyobj, objclass) \
|
||||
do { \
|
||||
virObjectPtr obj = anyobj; \
|
||||
if (VIR_OBJECT_NOTVALID(obj)) { \
|
||||
if (!obj) \
|
||||
VIR_WARN("Object cannot be NULL"); \
|
||||
else \
|
||||
VIR_WARN("Object %p has a bad magic number %X", \
|
||||
obj, obj->u.s.magic); \
|
||||
} else { \
|
||||
VIR_WARN("Object %p (%s) is not a %s instance", \
|
||||
anyobj, obj->klass->name, #objclass); \
|
||||
} \
|
||||
#define VIR_OBJECT_USAGE_PRINT_WARNING(anyobj, objclass) \
|
||||
do { \
|
||||
virObjectPtr obj = anyobj; \
|
||||
if (VIR_OBJECT_NOTVALID(obj)) { \
|
||||
if (!obj) \
|
||||
VIR_WARN("Object cannot be NULL"); \
|
||||
else \
|
||||
VIR_WARN("Object %p has a bad magic number %X", \
|
||||
obj, obj->u.s.magic); \
|
||||
} else { \
|
||||
VIR_WARN("Object %p (%s) is not a %s instance", \
|
||||
anyobj, obj->klass->name, #objclass); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
|
@ -190,9 +190,9 @@ struct _virPCIDeviceList {
|
||||
#define PCI_EXT_CAP_ACS_RR 0x04
|
||||
#define PCI_EXT_CAP_ACS_CR 0x08
|
||||
#define PCI_EXT_CAP_ACS_UF 0x10
|
||||
#define PCI_EXT_CAP_ACS_ENABLED (PCI_EXT_CAP_ACS_SV | \
|
||||
PCI_EXT_CAP_ACS_RR | \
|
||||
PCI_EXT_CAP_ACS_CR | \
|
||||
#define PCI_EXT_CAP_ACS_ENABLED (PCI_EXT_CAP_ACS_SV | \
|
||||
PCI_EXT_CAP_ACS_RR | \
|
||||
PCI_EXT_CAP_ACS_CR | \
|
||||
PCI_EXT_CAP_ACS_UF)
|
||||
|
||||
#define PCI_EXP_TYPE_ROOT_INT_EP 0x9 /* Root Complex Integrated Endpoint */
|
||||
|
@ -49,51 +49,51 @@
|
||||
* arrays into pointers; while any integer can be widened to intptr_t
|
||||
* then cast to void *. */
|
||||
# define VIR_ADD_CAST(a) ((void *)(intptr_t)(a))
|
||||
# define VIR_ADD_CAST1(a) \
|
||||
# define VIR_ADD_CAST1(a) \
|
||||
VIR_ADD_CAST(a)
|
||||
# define VIR_ADD_CAST2(a, b) \
|
||||
# define VIR_ADD_CAST2(a, b) \
|
||||
VIR_ADD_CAST(a), VIR_ADD_CAST(b)
|
||||
# define VIR_ADD_CAST3(a, b, c) \
|
||||
# define VIR_ADD_CAST3(a, b, c) \
|
||||
VIR_ADD_CAST(a), VIR_ADD_CAST(b), VIR_ADD_CAST(c)
|
||||
# define VIR_ADD_CAST4(a, b, c, d) \
|
||||
VIR_ADD_CAST(a), VIR_ADD_CAST(b), VIR_ADD_CAST(c), \
|
||||
# define VIR_ADD_CAST4(a, b, c, d) \
|
||||
VIR_ADD_CAST(a), VIR_ADD_CAST(b), VIR_ADD_CAST(c), \
|
||||
VIR_ADD_CAST(d)
|
||||
# define VIR_ADD_CAST5(a, b, c, d, e) \
|
||||
VIR_ADD_CAST(a), VIR_ADD_CAST(b), VIR_ADD_CAST(c), \
|
||||
# define VIR_ADD_CAST5(a, b, c, d, e) \
|
||||
VIR_ADD_CAST(a), VIR_ADD_CAST(b), VIR_ADD_CAST(c), \
|
||||
VIR_ADD_CAST(d), VIR_ADD_CAST(e)
|
||||
# define VIR_ADD_CAST6(a, b, c, d, e, f) \
|
||||
VIR_ADD_CAST(a), VIR_ADD_CAST(b), VIR_ADD_CAST(c), \
|
||||
# define VIR_ADD_CAST6(a, b, c, d, e, f) \
|
||||
VIR_ADD_CAST(a), VIR_ADD_CAST(b), VIR_ADD_CAST(c), \
|
||||
VIR_ADD_CAST(d), VIR_ADD_CAST(e), VIR_ADD_CAST(f)
|
||||
# define VIR_ADD_CAST7(a, b, c, d, e, f, g) \
|
||||
VIR_ADD_CAST(a), VIR_ADD_CAST(b), VIR_ADD_CAST(c), \
|
||||
VIR_ADD_CAST(d), VIR_ADD_CAST(e), VIR_ADD_CAST(f), \
|
||||
# define VIR_ADD_CAST7(a, b, c, d, e, f, g) \
|
||||
VIR_ADD_CAST(a), VIR_ADD_CAST(b), VIR_ADD_CAST(c), \
|
||||
VIR_ADD_CAST(d), VIR_ADD_CAST(e), VIR_ADD_CAST(f), \
|
||||
VIR_ADD_CAST(g)
|
||||
# define VIR_ADD_CAST8(a, b, c, d, e, f, g, h) \
|
||||
VIR_ADD_CAST(a), VIR_ADD_CAST(b), VIR_ADD_CAST(c), \
|
||||
VIR_ADD_CAST(d), VIR_ADD_CAST(e), VIR_ADD_CAST(f), \
|
||||
# define VIR_ADD_CAST8(a, b, c, d, e, f, g, h) \
|
||||
VIR_ADD_CAST(a), VIR_ADD_CAST(b), VIR_ADD_CAST(c), \
|
||||
VIR_ADD_CAST(d), VIR_ADD_CAST(e), VIR_ADD_CAST(f), \
|
||||
VIR_ADD_CAST(g), VIR_ADD_CAST(h)
|
||||
# define VIR_ADD_CAST9(a, b, c, d, e, f, g, h, i) \
|
||||
VIR_ADD_CAST(a), VIR_ADD_CAST(b), VIR_ADD_CAST(c), \
|
||||
VIR_ADD_CAST(d), VIR_ADD_CAST(e), VIR_ADD_CAST(f), \
|
||||
# define VIR_ADD_CAST9(a, b, c, d, e, f, g, h, i) \
|
||||
VIR_ADD_CAST(a), VIR_ADD_CAST(b), VIR_ADD_CAST(c), \
|
||||
VIR_ADD_CAST(d), VIR_ADD_CAST(e), VIR_ADD_CAST(f), \
|
||||
VIR_ADD_CAST(g), VIR_ADD_CAST(h), VIR_ADD_CAST(i)
|
||||
|
||||
# define VIR_ADD_CASTS(...) \
|
||||
VIR_ADD_CAST_EXPAND(VIR_ADD_CAST, VIR_COUNT_ARGS(__VA_ARGS__), \
|
||||
# define VIR_ADD_CASTS(...) \
|
||||
VIR_ADD_CAST_EXPAND(VIR_ADD_CAST, VIR_COUNT_ARGS(__VA_ARGS__), \
|
||||
__VA_ARGS__)
|
||||
|
||||
# define PROBE_EXPAND(NAME, ARGS) NAME(ARGS)
|
||||
# define PROBE(NAME, FMT, ...) \
|
||||
VIR_INFO_INT(&virLogSelf, \
|
||||
__FILE__, __LINE__, __func__, \
|
||||
#NAME ": " FMT, __VA_ARGS__); \
|
||||
if (LIBVIRT_ ## NAME ## _ENABLED()) { \
|
||||
PROBE_EXPAND(LIBVIRT_ ## NAME, \
|
||||
VIR_ADD_CASTS(__VA_ARGS__)); \
|
||||
# define PROBE(NAME, FMT, ...) \
|
||||
VIR_INFO_INT(&virLogSelf, \
|
||||
__FILE__, __LINE__, __func__, \
|
||||
#NAME ": " FMT, __VA_ARGS__); \
|
||||
if (LIBVIRT_ ## NAME ## _ENABLED()) { \
|
||||
PROBE_EXPAND(LIBVIRT_ ## NAME, \
|
||||
VIR_ADD_CASTS(__VA_ARGS__)); \
|
||||
}
|
||||
# else
|
||||
# define PROBE(NAME, FMT, ...) \
|
||||
VIR_INFO_INT(&virLogSelf, \
|
||||
__FILE__, __LINE__, __func__, \
|
||||
# define PROBE(NAME, FMT, ...) \
|
||||
VIR_INFO_INT(&virLogSelf, \
|
||||
__FILE__, __LINE__, __func__, \
|
||||
#NAME ": " FMT, __VA_ARGS__);
|
||||
# endif
|
||||
|
||||
|
@ -57,13 +57,13 @@ typedef struct {
|
||||
socklen_t len;
|
||||
} virSocketAddr;
|
||||
|
||||
# define VIR_SOCKET_ADDR_VALID(s) \
|
||||
# define VIR_SOCKET_ADDR_VALID(s) \
|
||||
((s)->data.sa.sa_family != AF_UNSPEC)
|
||||
|
||||
# define VIR_SOCKET_ADDR_IS_FAMILY(s, f) \
|
||||
# define VIR_SOCKET_ADDR_IS_FAMILY(s, f) \
|
||||
((s)->data.sa.sa_family == f)
|
||||
|
||||
# define VIR_SOCKET_ADDR_FAMILY(s) \
|
||||
# define VIR_SOCKET_ADDR_FAMILY(s) \
|
||||
((s)->data.sa.sa_family)
|
||||
|
||||
# define VIR_SOCKET_ADDR_IPV4_ALL "0.0.0.0"
|
||||
|
@ -192,7 +192,7 @@ int virVasprintfInternal(bool report, int domcode, const char *filename,
|
||||
* Returns -1 on failure (with OOM error reported), 0 if @src was NULL,
|
||||
* 1 if @src was copied
|
||||
*/
|
||||
# define VIR_STRNDUP(dst, src, n) virStrndup(&(dst), src, n, true, \
|
||||
# define VIR_STRNDUP(dst, src, n) virStrndup(&(dst), src, n, true, \
|
||||
VIR_FROM_THIS, __FILE__, \
|
||||
__FUNCTION__, __LINE__)
|
||||
|
||||
|
@ -1063,7 +1063,7 @@ virSysinfoRead(void)
|
||||
return virSysinfoReadS390();
|
||||
#elif defined(WIN32) || \
|
||||
!(defined(__x86_64__) || \
|
||||
defined(__i386__) || \
|
||||
defined(__i386__) || \
|
||||
defined(__amd64__) || \
|
||||
defined(__arm__) || \
|
||||
defined(__aarch64__) || \
|
||||
@ -1312,14 +1312,14 @@ virSysinfoFormat(virBufferPtr buf, virSysinfoDefPtr def)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define CHECK_FIELD(name, desc) \
|
||||
do { \
|
||||
if (STRNEQ_NULLABLE(src->name, dst->name)) { \
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, \
|
||||
#define CHECK_FIELD(name, desc) \
|
||||
do { \
|
||||
if (STRNEQ_NULLABLE(src->name, dst->name)) { \
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, \
|
||||
_("Target sysinfo %s %s does not match source %s"), \
|
||||
desc, NULLSTR(dst->name), NULLSTR(src->name)); \
|
||||
goto cleanup; \
|
||||
} \
|
||||
goto cleanup; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
static bool
|
||||
|
@ -53,18 +53,18 @@ static void virSystemdEscapeName(virBufferPtr buf,
|
||||
{
|
||||
static const char hextable[16] = "0123456789abcdef";
|
||||
|
||||
#define ESCAPE(c) \
|
||||
do { \
|
||||
virBufferAddChar(buf, '\\'); \
|
||||
virBufferAddChar(buf, 'x'); \
|
||||
virBufferAddChar(buf, hextable[(c >> 4) & 15]); \
|
||||
virBufferAddChar(buf, hextable[c & 15]); \
|
||||
#define ESCAPE(c) \
|
||||
do { \
|
||||
virBufferAddChar(buf, '\\'); \
|
||||
virBufferAddChar(buf, 'x'); \
|
||||
virBufferAddChar(buf, hextable[(c >> 4) & 15]); \
|
||||
virBufferAddChar(buf, hextable[c & 15]); \
|
||||
} while (0)
|
||||
|
||||
#define VALID_CHARS \
|
||||
"0123456789" \
|
||||
"abcdefghijklmnopqrstuvwxyz" \
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" \
|
||||
#define VALID_CHARS \
|
||||
"0123456789" \
|
||||
"abcdefghijklmnopqrstuvwxyz" \
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" \
|
||||
":-_.\\"
|
||||
|
||||
if (*name == '.') {
|
||||
|
@ -71,14 +71,14 @@ struct virOnceControl {
|
||||
};
|
||||
|
||||
|
||||
# define VIR_MUTEX_INITIALIZER \
|
||||
{ \
|
||||
# define VIR_MUTEX_INITIALIZER \
|
||||
{ \
|
||||
.lock = PTHREAD_MUTEX_INITIALIZER \
|
||||
}
|
||||
|
||||
# define VIR_ONCE_CONTROL_INITIALIZER \
|
||||
{ \
|
||||
.once = PTHREAD_ONCE_INIT \
|
||||
{ \
|
||||
.once = PTHREAD_ONCE_INIT \
|
||||
}
|
||||
|
||||
typedef void (*virOnceFunc)(void);
|
||||
@ -190,27 +190,27 @@ int virThreadLocalSet(virThreadLocalPtr l, void*) ATTRIBUTE_RETURN_CHECK;
|
||||
* Which will ensure that 'virMyObjectOnceInit' is
|
||||
* guaranteed to be invoked exactly once.
|
||||
*/
|
||||
# define VIR_ONCE_GLOBAL_INIT(classname) \
|
||||
# define VIR_ONCE_GLOBAL_INIT(classname) \
|
||||
static virOnceControl classname ## OnceControl = VIR_ONCE_CONTROL_INITIALIZER; \
|
||||
static virErrorPtr classname ## OnceError; \
|
||||
\
|
||||
static void classname ## Once(void) \
|
||||
{ \
|
||||
if (classname ## OnceInit() < 0) \
|
||||
classname ## OnceError = virSaveLastError(); \
|
||||
} \
|
||||
\
|
||||
static int classname ## Initialize(void) \
|
||||
{ \
|
||||
if (virOnce(&classname ## OnceControl, classname ## Once) < 0) \
|
||||
return -1; \
|
||||
\
|
||||
if (classname ## OnceError) { \
|
||||
virSetError(classname ## OnceError); \
|
||||
return -1; \
|
||||
} \
|
||||
\
|
||||
return 0; \
|
||||
static virErrorPtr classname ## OnceError; \
|
||||
\
|
||||
static void classname ## Once(void) \
|
||||
{ \
|
||||
if (classname ## OnceInit() < 0) \
|
||||
classname ## OnceError = virSaveLastError(); \
|
||||
} \
|
||||
\
|
||||
static int classname ## Initialize(void) \
|
||||
{ \
|
||||
if (virOnce(&classname ## OnceControl, classname ## Once) < 0) \
|
||||
return -1; \
|
||||
\
|
||||
if (classname ## OnceError) { \
|
||||
virSetError(classname ## OnceError); \
|
||||
return -1; \
|
||||
} \
|
||||
\
|
||||
return 0; \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -526,16 +526,16 @@ virTypedParamsFilter(virTypedParameterPtr params,
|
||||
}
|
||||
|
||||
|
||||
#define VIR_TYPED_PARAM_CHECK_TYPE(check_type) \
|
||||
do { if (param->type != check_type) { \
|
||||
virReportError(VIR_ERR_INVALID_ARG, \
|
||||
#define VIR_TYPED_PARAM_CHECK_TYPE(check_type) \
|
||||
do { if (param->type != check_type) { \
|
||||
virReportError(VIR_ERR_INVALID_ARG, \
|
||||
_("Invalid type '%s' requested for parameter '%s', " \
|
||||
"actual type is '%s'"), \
|
||||
virTypedParameterTypeToString(check_type), \
|
||||
name, \
|
||||
virTypedParameterTypeToString(param->type)); \
|
||||
virDispatchError(NULL); \
|
||||
return -1; \
|
||||
"actual type is '%s'"), \
|
||||
virTypedParameterTypeToString(check_type), \
|
||||
name, \
|
||||
virTypedParameterTypeToString(param->type)); \
|
||||
virDispatchError(NULL); \
|
||||
return -1; \
|
||||
} } while (0)
|
||||
|
||||
|
||||
|
@ -120,19 +120,19 @@ int virTypedParamsSerialize(virTypedParameterPtr params,
|
||||
|
||||
VIR_ENUM_DECL(virTypedParameter)
|
||||
|
||||
# define VIR_TYPED_PARAMS_DEBUG(params, nparams) \
|
||||
do { \
|
||||
int _i; \
|
||||
if (!params) \
|
||||
break; \
|
||||
for (_i = 0; _i < (nparams); _i++) { \
|
||||
char *_value = virTypedParameterToString((params) + _i); \
|
||||
VIR_DEBUG("params[\"%s\"]=(%s)%s", \
|
||||
(params)[_i].field, \
|
||||
virTypedParameterTypeToString((params)[_i].type), \
|
||||
NULLSTR(_value)); \
|
||||
VIR_FREE(_value); \
|
||||
} \
|
||||
# define VIR_TYPED_PARAMS_DEBUG(params, nparams) \
|
||||
do { \
|
||||
int _i; \
|
||||
if (!params) \
|
||||
break; \
|
||||
for (_i = 0; _i < (nparams); _i++) { \
|
||||
char *_value = virTypedParameterToString((params) + _i); \
|
||||
VIR_DEBUG("params[\"%s\"]=(%s)%s", \
|
||||
(params)[_i].field, \
|
||||
virTypedParameterTypeToString((params)[_i].type), \
|
||||
NULLSTR(_value)); \
|
||||
VIR_FREE(_value); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#endif /* __VIR_TYPED_PARAM_H */
|
||||
|
@ -78,22 +78,22 @@ const char *virEnumToString(const char *const*types,
|
||||
unsigned int ntypes,
|
||||
int type);
|
||||
|
||||
# define VIR_ENUM_IMPL(name, lastVal, ...) \
|
||||
static const char *const name ## TypeList[] = { __VA_ARGS__ }; \
|
||||
verify(ARRAY_CARDINALITY(name ## TypeList) == lastVal); \
|
||||
const char *name ## TypeToString(int type) { \
|
||||
return virEnumToString(name ## TypeList, \
|
||||
ARRAY_CARDINALITY(name ## TypeList), \
|
||||
type); \
|
||||
} \
|
||||
int name ## TypeFromString(const char *type) { \
|
||||
return virEnumFromString(name ## TypeList, \
|
||||
ARRAY_CARDINALITY(name ## TypeList), \
|
||||
type); \
|
||||
# define VIR_ENUM_IMPL(name, lastVal, ...) \
|
||||
static const char *const name ## TypeList[] = { __VA_ARGS__ }; \
|
||||
verify(ARRAY_CARDINALITY(name ## TypeList) == lastVal); \
|
||||
const char *name ## TypeToString(int type) { \
|
||||
return virEnumToString(name ## TypeList, \
|
||||
ARRAY_CARDINALITY(name ## TypeList), \
|
||||
type); \
|
||||
} \
|
||||
int name ## TypeFromString(const char *type) { \
|
||||
return virEnumFromString(name ## TypeList, \
|
||||
ARRAY_CARDINALITY(name ## TypeList), \
|
||||
type); \
|
||||
}
|
||||
|
||||
# define VIR_ENUM_DECL(name) \
|
||||
const char *name ## TypeToString(int type); \
|
||||
# define VIR_ENUM_DECL(name) \
|
||||
const char *name ## TypeToString(int type); \
|
||||
int name ## TypeFromString(const char*type);
|
||||
|
||||
/* No-op workarounds for functionality missing in mingw. */
|
||||
@ -219,7 +219,7 @@ unsigned long long virMemoryMaxValue(bool ulong) ATTRIBUTE_NOINLINE;
|
||||
* This macro assigns @lvalue to @rvalue and evaluates as true if the value of
|
||||
* @rvalue did not fit into the @lvalue.
|
||||
*/
|
||||
# define VIR_ASSIGN_IS_OVERFLOW(lvalue, rvalue) \
|
||||
# define VIR_ASSIGN_IS_OVERFLOW(lvalue, rvalue) \
|
||||
(((lvalue) = (rvalue)) != (rvalue))
|
||||
|
||||
#endif /* __VIR_UTIL_H__ */
|
||||
|
@ -32,15 +32,15 @@
|
||||
* @conn: connection
|
||||
* @uuid: possibly null UUID array
|
||||
*/
|
||||
# define VIR_UUID_DEBUG(conn, uuid) \
|
||||
do { \
|
||||
if (uuid) { \
|
||||
char _uuidstr[VIR_UUID_STRING_BUFLEN]; \
|
||||
virUUIDFormat(uuid, _uuidstr); \
|
||||
VIR_DEBUG("conn=%p, uuid=%s", conn, _uuidstr); \
|
||||
} else { \
|
||||
VIR_DEBUG("conn=%p, uuid=(null)", conn); \
|
||||
} \
|
||||
# define VIR_UUID_DEBUG(conn, uuid) \
|
||||
do { \
|
||||
if (uuid) { \
|
||||
char _uuidstr[VIR_UUID_STRING_BUFLEN]; \
|
||||
virUUIDFormat(uuid, _uuidstr); \
|
||||
VIR_DEBUG("conn=%p, uuid=%s", conn, _uuidstr); \
|
||||
} else { \
|
||||
VIR_DEBUG("conn=%p, uuid=(null)", conn); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
|
@ -40,8 +40,8 @@
|
||||
|
||||
#define VIR_FROM_THIS VIR_FROM_XML
|
||||
|
||||
#define virGenericReportError(from, code, ...) \
|
||||
virReportErrorHelper(from, code, __FILE__, \
|
||||
#define virGenericReportError(from, code, ...) \
|
||||
virReportErrorHelper(from, code, __FILE__, \
|
||||
__FUNCTION__, __LINE__, __VA_ARGS__)
|
||||
|
||||
/* Internal data to be passed to SAX parser and used by error handler. */
|
||||
|
@ -97,7 +97,7 @@ const char *virXMLPickShellSafeComment(const char *str1, const char *str2);
|
||||
*
|
||||
* Return the parsed document object, or NULL on failure.
|
||||
*/
|
||||
# define virXMLParse(filename, xmlStr, url) \
|
||||
# define virXMLParse(filename, xmlStr, url) \
|
||||
virXMLParseHelper(VIR_FROM_THIS, filename, xmlStr, url, NULL)
|
||||
|
||||
/**
|
||||
@ -109,7 +109,7 @@ const char *virXMLPickShellSafeComment(const char *str1, const char *str2);
|
||||
*
|
||||
* Return the parsed document object, or NULL on failure.
|
||||
*/
|
||||
# define virXMLParseString(xmlStr, url) \
|
||||
# define virXMLParseString(xmlStr, url) \
|
||||
virXMLParseHelper(VIR_FROM_THIS, NULL, xmlStr, url, NULL)
|
||||
|
||||
/**
|
||||
@ -120,7 +120,7 @@ const char *virXMLPickShellSafeComment(const char *str1, const char *str2);
|
||||
*
|
||||
* Return the parsed document object, or NULL on failure.
|
||||
*/
|
||||
# define virXMLParseFile(filename) \
|
||||
# define virXMLParseFile(filename) \
|
||||
virXMLParseHelper(VIR_FROM_THIS, filename, NULL, NULL, NULL)
|
||||
|
||||
/**
|
||||
@ -135,7 +135,7 @@ const char *virXMLPickShellSafeComment(const char *str1, const char *str2);
|
||||
*
|
||||
* Return the parsed document object, or NULL on failure.
|
||||
*/
|
||||
# define virXMLParseCtxt(filename, xmlStr, url, pctxt) \
|
||||
# define virXMLParseCtxt(filename, xmlStr, url, pctxt) \
|
||||
virXMLParseHelper(VIR_FROM_THIS, filename, xmlStr, url, pctxt)
|
||||
|
||||
/**
|
||||
@ -149,7 +149,7 @@ const char *virXMLPickShellSafeComment(const char *str1, const char *str2);
|
||||
*
|
||||
* Return the parsed document object, or NULL on failure.
|
||||
*/
|
||||
# define virXMLParseStringCtxt(xmlStr, url, pctxt) \
|
||||
# define virXMLParseStringCtxt(xmlStr, url, pctxt) \
|
||||
virXMLParseHelper(VIR_FROM_THIS, NULL, xmlStr, url, pctxt)
|
||||
|
||||
/**
|
||||
@ -162,7 +162,7 @@ const char *virXMLPickShellSafeComment(const char *str1, const char *str2);
|
||||
*
|
||||
* Return the parsed document object, or NULL on failure.
|
||||
*/
|
||||
# define virXMLParseFileCtxt(filename, pctxt) \
|
||||
# define virXMLParseFileCtxt(filename, pctxt) \
|
||||
virXMLParseHelper(VIR_FROM_THIS, filename, NULL, NULL, pctxt)
|
||||
|
||||
int virXMLSaveFile(const char *path,
|
||||
|
@ -498,7 +498,7 @@ PL_GetEventQueueMonitor(PLEventQueue* self);
|
||||
# define PL_ENTER_EVENT_QUEUE_MONITOR(queue) \
|
||||
PR_EnterMonitor(PL_GetEventQueueMonitor(queue))
|
||||
|
||||
# define PL_EXIT_EVENT_QUEUE_MONITOR(queue) \
|
||||
# define PL_EXIT_EVENT_QUEUE_MONITOR(queue) \
|
||||
PR_ExitMonitor(PL_GetEventQueueMonitor(queue))
|
||||
|
||||
PR_EXTERN(PRStatus) PL_PostEvent(PLEventQueue* self, PLEvent* event);
|
||||
@ -659,8 +659,8 @@ typedef struct nsIException nsIException; /* forward declaration */
|
||||
* To maintain binary compatibility with COM's IUnknown, we define the IID
|
||||
* of nsISupports to be the same as that of COM's IUnknown.
|
||||
*/
|
||||
# define NS_ISUPPORTS_IID \
|
||||
{ 0x00000000, 0x0000, 0x0000, \
|
||||
# define NS_ISUPPORTS_IID \
|
||||
{ 0x00000000, 0x0000, 0x0000, \
|
||||
{0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} }
|
||||
|
||||
/**
|
||||
|
@ -498,7 +498,7 @@ PL_GetEventQueueMonitor(PLEventQueue* self);
|
||||
# define PL_ENTER_EVENT_QUEUE_MONITOR(queue) \
|
||||
PR_EnterMonitor(PL_GetEventQueueMonitor(queue))
|
||||
|
||||
# define PL_EXIT_EVENT_QUEUE_MONITOR(queue) \
|
||||
# define PL_EXIT_EVENT_QUEUE_MONITOR(queue) \
|
||||
PR_ExitMonitor(PL_GetEventQueueMonitor(queue))
|
||||
|
||||
PR_EXTERN(PRStatus) PL_PostEvent(PLEventQueue* self, PLEvent* event);
|
||||
@ -659,8 +659,8 @@ typedef struct nsIException nsIException; /* forward declaration */
|
||||
* To maintain binary compatibility with COM's IUnknown, we define the IID
|
||||
* of nsISupports to be the same as that of COM's IUnknown.
|
||||
*/
|
||||
# define NS_ISUPPORTS_IID \
|
||||
{ 0x00000000, 0x0000, 0x0000, \
|
||||
# define NS_ISUPPORTS_IID \
|
||||
{ 0x00000000, 0x0000, 0x0000, \
|
||||
{0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} }
|
||||
|
||||
/**
|
||||
|
@ -498,7 +498,7 @@ PL_GetEventQueueMonitor(PLEventQueue* self);
|
||||
# define PL_ENTER_EVENT_QUEUE_MONITOR(queue) \
|
||||
PR_EnterMonitor(PL_GetEventQueueMonitor(queue))
|
||||
|
||||
# define PL_EXIT_EVENT_QUEUE_MONITOR(queue) \
|
||||
# define PL_EXIT_EVENT_QUEUE_MONITOR(queue) \
|
||||
PR_ExitMonitor(PL_GetEventQueueMonitor(queue))
|
||||
|
||||
PR_EXTERN(PRStatus) PL_PostEvent(PLEventQueue* self, PLEvent* event);
|
||||
@ -659,8 +659,8 @@ typedef struct nsIException nsIException; /* forward declaration */
|
||||
* To maintain binary compatibility with COM's IUnknown, we define the IID
|
||||
* of nsISupports to be the same as that of COM's IUnknown.
|
||||
*/
|
||||
# define NS_ISUPPORTS_IID \
|
||||
{ 0x00000000, 0x0000, 0x0000, \
|
||||
# define NS_ISUPPORTS_IID \
|
||||
{ 0x00000000, 0x0000, 0x0000, \
|
||||
{0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} }
|
||||
|
||||
/**
|
||||
|
@ -498,7 +498,7 @@ PL_GetEventQueueMonitor(PLEventQueue* self);
|
||||
# define PL_ENTER_EVENT_QUEUE_MONITOR(queue) \
|
||||
PR_EnterMonitor(PL_GetEventQueueMonitor(queue))
|
||||
|
||||
# define PL_EXIT_EVENT_QUEUE_MONITOR(queue) \
|
||||
# define PL_EXIT_EVENT_QUEUE_MONITOR(queue) \
|
||||
PR_ExitMonitor(PL_GetEventQueueMonitor(queue))
|
||||
|
||||
PR_EXTERN(PRStatus) PL_PostEvent(PLEventQueue* self, PLEvent* event);
|
||||
@ -659,8 +659,8 @@ typedef struct nsIException nsIException; /* forward declaration */
|
||||
* To maintain binary compatibility with COM's IUnknown, we define the IID
|
||||
* of nsISupports to be the same as that of COM's IUnknown.
|
||||
*/
|
||||
# define NS_ISUPPORTS_IID \
|
||||
{ 0x00000000, 0x0000, 0x0000, \
|
||||
# define NS_ISUPPORTS_IID \
|
||||
{ 0x00000000, 0x0000, 0x0000, \
|
||||
{0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} }
|
||||
|
||||
/**
|
||||
|
@ -493,7 +493,7 @@ PL_GetEventQueueMonitor(PLEventQueue* self);
|
||||
# define PL_ENTER_EVENT_QUEUE_MONITOR(queue) \
|
||||
PR_EnterMonitor(PL_GetEventQueueMonitor(queue))
|
||||
|
||||
# define PL_EXIT_EVENT_QUEUE_MONITOR(queue) \
|
||||
# define PL_EXIT_EVENT_QUEUE_MONITOR(queue) \
|
||||
PR_ExitMonitor(PL_GetEventQueueMonitor(queue))
|
||||
|
||||
PR_EXTERN(PRStatus) PL_PostEvent(PLEventQueue* self, PLEvent* event);
|
||||
@ -654,8 +654,8 @@ typedef struct nsIException nsIException; /* forward declaration */
|
||||
* To maintain binary compatibility with COM's IUnknown, we define the IID
|
||||
* of nsISupports to be the same as that of COM's IUnknown.
|
||||
*/
|
||||
# define NS_ISUPPORTS_IID \
|
||||
{ 0x00000000, 0x0000, 0x0000, \
|
||||
# define NS_ISUPPORTS_IID \
|
||||
{ 0x00000000, 0x0000, 0x0000, \
|
||||
{0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} }
|
||||
|
||||
/**
|
||||
|
@ -493,7 +493,7 @@ PL_GetEventQueueMonitor(PLEventQueue* self);
|
||||
# define PL_ENTER_EVENT_QUEUE_MONITOR(queue) \
|
||||
PR_EnterMonitor(PL_GetEventQueueMonitor(queue))
|
||||
|
||||
# define PL_EXIT_EVENT_QUEUE_MONITOR(queue) \
|
||||
# define PL_EXIT_EVENT_QUEUE_MONITOR(queue) \
|
||||
PR_ExitMonitor(PL_GetEventQueueMonitor(queue))
|
||||
|
||||
PR_EXTERN(PRStatus) PL_PostEvent(PLEventQueue* self, PLEvent* event);
|
||||
@ -654,8 +654,8 @@ typedef struct nsIException nsIException; /* forward declaration */
|
||||
* To maintain binary compatibility with COM's IUnknown, we define the IID
|
||||
* of nsISupports to be the same as that of COM's IUnknown.
|
||||
*/
|
||||
# define NS_ISUPPORTS_IID \
|
||||
{ 0x00000000, 0x0000, 0x0000, \
|
||||
# define NS_ISUPPORTS_IID \
|
||||
{ 0x00000000, 0x0000, 0x0000, \
|
||||
{0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} }
|
||||
|
||||
/**
|
||||
|
@ -558,7 +558,7 @@ PL_GetEventQueueMonitor(PLEventQueue* self);
|
||||
# define PL_ENTER_EVENT_QUEUE_MONITOR(queue) \
|
||||
PR_EnterMonitor(PL_GetEventQueueMonitor(queue))
|
||||
|
||||
# define PL_EXIT_EVENT_QUEUE_MONITOR(queue) \
|
||||
# define PL_EXIT_EVENT_QUEUE_MONITOR(queue) \
|
||||
PR_ExitMonitor(PL_GetEventQueueMonitor(queue))
|
||||
|
||||
PR_EXTERN(PRStatus) PL_PostEvent(PLEventQueue* self, PLEvent* event);
|
||||
|
@ -561,7 +561,7 @@ PL_GetEventQueueMonitor(PLEventQueue* self);
|
||||
# define PL_ENTER_EVENT_QUEUE_MONITOR(queue) \
|
||||
PR_EnterMonitor(PL_GetEventQueueMonitor(queue))
|
||||
|
||||
# define PL_EXIT_EVENT_QUEUE_MONITOR(queue) \
|
||||
# define PL_EXIT_EVENT_QUEUE_MONITOR(queue) \
|
||||
PR_ExitMonitor(PL_GetEventQueueMonitor(queue))
|
||||
|
||||
PR_EXTERN(PRStatus) PL_PostEvent(PLEventQueue* self, PLEvent* event);
|
||||
|
@ -347,28 +347,28 @@ typedef nsISupports IKeyboard;
|
||||
# define RC_SUCCEEDED(rc) NS_SUCCEEDED(rc.resultCode)
|
||||
# define RC_FAILED(rc) NS_FAILED(rc.resultCode)
|
||||
|
||||
# define VBOX_UTF16_FREE(arg) \
|
||||
do { \
|
||||
if (arg) { \
|
||||
gVBoxAPI.UPFN.Utf16Free(data->pFuncs, arg); \
|
||||
(arg) = NULL; \
|
||||
} \
|
||||
# define VBOX_UTF16_FREE(arg) \
|
||||
do { \
|
||||
if (arg) { \
|
||||
gVBoxAPI.UPFN.Utf16Free(data->pFuncs, arg); \
|
||||
(arg) = NULL; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
# define VBOX_UTF8_FREE(arg) \
|
||||
do { \
|
||||
if (arg) { \
|
||||
gVBoxAPI.UPFN.Utf8Free(data->pFuncs, arg); \
|
||||
(arg) = NULL; \
|
||||
} \
|
||||
# define VBOX_UTF8_FREE(arg) \
|
||||
do { \
|
||||
if (arg) { \
|
||||
gVBoxAPI.UPFN.Utf8Free(data->pFuncs, arg); \
|
||||
(arg) = NULL; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
# define VBOX_COM_UNALLOC_MEM(arg) \
|
||||
do { \
|
||||
if (arg) { \
|
||||
gVBoxAPI.UPFN.ComUnallocMem(data->pFuncs, arg); \
|
||||
(arg) = NULL; \
|
||||
} \
|
||||
# define VBOX_COM_UNALLOC_MEM(arg) \
|
||||
do { \
|
||||
if (arg) { \
|
||||
gVBoxAPI.UPFN.ComUnallocMem(data->pFuncs, arg); \
|
||||
(arg) = NULL; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
# define VBOX_UTF16_TO_UTF8(arg1, arg2) gVBoxAPI.UPFN.Utf16ToUtf8(data->pFuncs, arg1, arg2)
|
||||
@ -376,20 +376,20 @@ typedef nsISupports IKeyboard;
|
||||
|
||||
# define VBOX_ADDREF(arg) gVBoxAPI.nsUISupports.AddRef((void *)(arg))
|
||||
|
||||
# define VBOX_RELEASE(arg) \
|
||||
do { \
|
||||
if (arg) { \
|
||||
gVBoxAPI.nsUISupports.Release((void *)arg); \
|
||||
(arg) = NULL; \
|
||||
} \
|
||||
# define VBOX_RELEASE(arg) \
|
||||
do { \
|
||||
if (arg) { \
|
||||
gVBoxAPI.nsUISupports.Release((void *)arg); \
|
||||
(arg) = NULL; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
# define VBOX_MEDIUM_RELEASE(arg) \
|
||||
do { \
|
||||
if (arg) { \
|
||||
gVBoxAPI.UIMedium.Release(arg); \
|
||||
(arg) = NULL; \
|
||||
} \
|
||||
# define VBOX_MEDIUM_RELEASE(arg) \
|
||||
do { \
|
||||
if (arg) { \
|
||||
gVBoxAPI.UIMedium.Release(arg); \
|
||||
(arg) = NULL; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
# define vboxIIDUnalloc(iid) gVBoxAPI.UIID.vboxIIDUnalloc(data, iid)
|
||||
@ -406,28 +406,28 @@ typedef nsISupports IKeyboard;
|
||||
(gVBoxAPI.UArray.handleGetMachines(data->vboxObj))
|
||||
|
||||
/* Set result to -1 in case of failure. */
|
||||
# define installUniformedAPI(gVBoxAPI, result) \
|
||||
do { \
|
||||
result = 0; \
|
||||
if (uVersion >= 3002051 && uVersion < 4000051) { \
|
||||
vbox40InstallUniformedAPI(&gVBoxAPI); \
|
||||
} else if (uVersion >= 4000051 && uVersion < 4001051) { \
|
||||
vbox41InstallUniformedAPI(&gVBoxAPI); \
|
||||
} else if (uVersion >= 4001051 && uVersion < 4002020) { \
|
||||
vbox42InstallUniformedAPI(&gVBoxAPI); \
|
||||
} else if (uVersion >= 4002020 && uVersion < 4002051) { \
|
||||
vbox42_20InstallUniformedAPI(&gVBoxAPI); \
|
||||
} else if (uVersion >= 4002051 && uVersion < 4003004) { \
|
||||
vbox43InstallUniformedAPI(&gVBoxAPI); \
|
||||
} else if (uVersion >= 4003004 && uVersion < 4003051) { \
|
||||
vbox43_4InstallUniformedAPI(&gVBoxAPI); \
|
||||
} else if (uVersion >= 4003051 && uVersion < 5000051) { \
|
||||
vbox50InstallUniformedAPI(&gVBoxAPI); \
|
||||
} else if (uVersion >= 5000051 && uVersion < 5001051) { \
|
||||
vbox51InstallUniformedAPI(&gVBoxAPI); \
|
||||
} else { \
|
||||
result = -1; \
|
||||
} \
|
||||
# define installUniformedAPI(gVBoxAPI, result) \
|
||||
do { \
|
||||
result = 0; \
|
||||
if (uVersion >= 3002051 && uVersion < 4000051) { \
|
||||
vbox40InstallUniformedAPI(&gVBoxAPI); \
|
||||
} else if (uVersion >= 4000051 && uVersion < 4001051) { \
|
||||
vbox41InstallUniformedAPI(&gVBoxAPI); \
|
||||
} else if (uVersion >= 4001051 && uVersion < 4002020) { \
|
||||
vbox42InstallUniformedAPI(&gVBoxAPI); \
|
||||
} else if (uVersion >= 4002020 && uVersion < 4002051) { \
|
||||
vbox42_20InstallUniformedAPI(&gVBoxAPI); \
|
||||
} else if (uVersion >= 4002051 && uVersion < 4003004) { \
|
||||
vbox43InstallUniformedAPI(&gVBoxAPI); \
|
||||
} else if (uVersion >= 4003004 && uVersion < 4003051) { \
|
||||
vbox43_4InstallUniformedAPI(&gVBoxAPI); \
|
||||
} else if (uVersion >= 4003051 && uVersion < 5000051) { \
|
||||
vbox50InstallUniformedAPI(&gVBoxAPI); \
|
||||
} else if (uVersion >= 5000051 && uVersion < 5001051) { \
|
||||
vbox51InstallUniformedAPI(&gVBoxAPI); \
|
||||
} else { \
|
||||
result = -1; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#endif /* VBOX_COMMON_H */
|
||||
|
@ -88,31 +88,31 @@ VIR_LOG_INIT("vbox.vbox_tmpl");
|
||||
#define vboxUnsupported() \
|
||||
VIR_WARN("No %s in current vbox version %d.", __FUNCTION__, VBOX_API_VERSION);
|
||||
|
||||
#define VBOX_UTF16_FREE(arg) \
|
||||
do { \
|
||||
if (arg) { \
|
||||
data->pFuncs->pfnUtf16Free(arg); \
|
||||
(arg) = NULL; \
|
||||
} \
|
||||
#define VBOX_UTF16_FREE(arg) \
|
||||
do { \
|
||||
if (arg) { \
|
||||
data->pFuncs->pfnUtf16Free(arg); \
|
||||
(arg) = NULL; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define VBOX_UTF8_FREE(arg) \
|
||||
do { \
|
||||
if (arg) { \
|
||||
data->pFuncs->pfnUtf8Free(arg); \
|
||||
(arg) = NULL; \
|
||||
} \
|
||||
#define VBOX_UTF8_FREE(arg) \
|
||||
do { \
|
||||
if (arg) { \
|
||||
data->pFuncs->pfnUtf8Free(arg); \
|
||||
(arg) = NULL; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define VBOX_UTF16_TO_UTF8(arg1, arg2) data->pFuncs->pfnUtf16ToUtf8(arg1, arg2)
|
||||
#define VBOX_UTF8_TO_UTF16(arg1, arg2) data->pFuncs->pfnUtf8ToUtf16(arg1, arg2)
|
||||
|
||||
#define VBOX_RELEASE(arg) \
|
||||
do { \
|
||||
if (arg) { \
|
||||
(arg)->vtbl->nsisupports.Release((nsISupports *)(arg)); \
|
||||
(arg) = NULL; \
|
||||
} \
|
||||
#define VBOX_RELEASE(arg) \
|
||||
do { \
|
||||
if (arg) { \
|
||||
(arg)->vtbl->nsisupports.Release((nsISupports *)(arg)); \
|
||||
(arg) = NULL; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define VBOX_MEDIUM_RELEASE(arg) VBOX_RELEASE(arg)
|
||||
|
@ -499,10 +499,10 @@ def->parallels[0]...
|
||||
|
||||
#define VIR_FROM_THIS VIR_FROM_NONE
|
||||
|
||||
#define VMX_BUILD_NAME_EXTRA(_suffix, _extra) \
|
||||
#define VMX_BUILD_NAME_EXTRA(_suffix, _extra) \
|
||||
snprintf(_suffix##_name, sizeof(_suffix##_name), "%s."_extra, prefix);
|
||||
|
||||
#define VMX_BUILD_NAME(_suffix) \
|
||||
#define VMX_BUILD_NAME(_suffix) \
|
||||
VMX_BUILD_NAME_EXTRA(_suffix, #_suffix)
|
||||
|
||||
/* directly map the virDomainControllerModel to virVMXSCSIControllerModel,
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user