From 3e7db8d3e8538bcd5deb1b111fb1233fc18831aa Mon Sep 17 00:00:00 2001 From: Andrea Bolognani Date: Fri, 3 Nov 2017 13:09:47 +0100 Subject: [PATCH] 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 --- Makefile.am | 10 +- Makefile.nonreentrant | 2 +- cfg.mk | 824 +++++------ config-post.h | 2 +- daemon/Makefile.am | 172 +-- daemon/remote.c | 46 +- docs/Makefile.am | 56 +- examples/Makefile.am | 2 +- examples/domsuspend/suspend.c | 26 +- examples/domtop/domtop.c | 26 +- examples/object-events/event-test.c | 8 +- src/Makefile.am | 1510 ++++++++++----------- src/access/viraccessdriverpolkit.c | 4 +- src/access/viraccessmanager.c | 4 +- src/conf/cpu_conf.c | 4 +- src/conf/domain_capabilities.c | 32 +- src/conf/domain_capabilities.h | 12 +- src/conf/domain_conf.c | 62 +- src/conf/interface_conf.h | 2 +- src/conf/network_conf.h | 10 +- src/conf/secret_conf.h | 6 +- src/conf/snapshot_conf.h | 10 +- src/conf/storage_conf.h | 12 +- src/conf/virdomainobjlist.h | 14 +- src/cpu/cpu_x86.c | 48 +- src/datatypes.c | 12 +- src/datatypes.h | 590 ++++---- src/driver.h | 4 +- src/esx/esx_driver.c | 8 +- src/esx/esx_vi.c | 258 ++-- src/esx/esx_vi.h | 42 +- src/esx/esx_vi_methods.c | 196 +-- src/esx/esx_vi_types.c | 1022 +++++++------- src/internal.h | 260 ++-- src/libxl/libxl_domain.h | 4 +- src/libxl/libxl_driver.c | 40 +- src/libxl/libxl_migration.h | 14 +- src/locking/lock_driver.h | 6 +- src/locking/lock_manager.c | 20 +- src/lxc/lxc_driver.c | 30 +- src/node_device/node_device_udev.c | 20 +- src/nwfilter/nwfilter_ebiptables_driver.c | 56 +- src/openvz/openvz_driver.h | 4 +- src/phyp/phyp_driver.c | 8 +- src/qemu/qemu_command.c | 8 +- src/qemu/qemu_conf.c | 84 +- src/qemu/qemu_domain.c | 20 +- src/qemu/qemu_domain.h | 20 +- src/qemu/qemu_driver.c | 226 +-- src/qemu/qemu_migration.c | 40 +- src/qemu/qemu_migration.h | 66 +- src/qemu/qemu_monitor.c | 44 +- src/qemu/qemu_monitor_json.c | 132 +- src/qemu/qemu_monitor_text.c | 18 +- src/qemu/qemu_parse_command.c | 12 +- src/remote/remote_driver.c | 52 +- src/rpc/virnetclient.c | 8 +- src/security/security_manager.h | 2 +- src/storage/storage_backend.c | 4 +- src/util/viralloc.h | 32 +- src/util/viratomic.h | 114 +- src/util/viraudit.h | 8 +- src/util/vircommand.c | 4 +- src/util/virconf.c | 8 +- src/util/virdbus.c | 70 +- src/util/virdnsmasq.h | 10 +- src/util/virendian.h | 56 +- src/util/virerror.h | 180 +-- src/util/virfile.h | 12 +- src/util/virfirewall.c | 38 +- src/util/virhash.c | 8 +- src/util/virlog.c | 10 +- src/util/virlog.h | 30 +- src/util/virnetdev.c | 4 +- src/util/virnetdevopenvswitch.c | 40 +- src/util/virobject.c | 26 +- src/util/virpci.c | 6 +- src/util/virprobe.h | 60 +- src/util/virsocketaddr.h | 6 +- src/util/virstring.h | 2 +- src/util/virsysinfo.c | 14 +- src/util/virsystemd.c | 20 +- src/util/virthread.h | 48 +- src/util/virtypedparam.c | 18 +- src/util/virtypedparam.h | 26 +- src/util/virutil.h | 30 +- src/util/viruuid.h | 18 +- src/util/virxml.c | 4 +- src/util/virxml.h | 12 +- src/vbox/vbox_CAPI_v4_0.h | 6 +- src/vbox/vbox_CAPI_v4_1.h | 6 +- src/vbox/vbox_CAPI_v4_2.h | 6 +- src/vbox/vbox_CAPI_v4_2_20.h | 6 +- src/vbox/vbox_CAPI_v4_3.h | 6 +- src/vbox/vbox_CAPI_v4_3_4.h | 6 +- src/vbox/vbox_CAPI_v5_0.h | 2 +- src/vbox/vbox_CAPI_v5_1.h | 2 +- src/vbox/vbox_common.h | 104 +- src/vbox/vbox_tmpl.c | 36 +- src/vmx/vmx.c | 4 +- src/vz/vz_driver.c | 70 +- src/vz/vz_sdk.c | 80 +- src/vz/vz_utils.h | 22 +- src/xen/xen_driver.c | 4 +- src/xen/xen_driver.h | 8 +- src/xen/xen_hypervisor.c | 398 +++--- tests/Makefile.am | 78 +- tests/bhyveargv2xmltest.c | 24 +- tests/bhyvexml2argvtest.c | 20 +- tests/bhyvexml2xmltest.c | 12 +- tests/commandtest.c | 6 +- tests/cputest.c | 168 +-- tests/domaincapstest.c | 128 +- tests/domainconftest.c | 16 +- tests/domainsnapshotxml2xmltest.c | 14 +- tests/esxutilstest.c | 12 +- tests/genericxml2xmltest.c | 14 +- tests/interfacexml2xmltest.c | 6 +- tests/libxlxml2domconfigtest.c | 16 +- tests/lxcconf2xmltest.c | 12 +- tests/lxcxml2xmltest.c | 14 +- tests/metadatatest.c | 18 +- tests/networkxml2conftest.c | 20 +- tests/networkxml2firewalltest.c | 16 +- tests/networkxml2xmltest.c | 12 +- tests/networkxml2xmlupdatetest.c | 32 +- tests/nodedevxml2xmltest.c | 6 +- tests/nsstest.c | 16 +- tests/nwfilterxml2firewalltest.c | 16 +- tests/nwfilterxml2xmltest.c | 18 +- tests/openvzutilstest.c | 12 +- tests/qemuagenttest.c | 4 +- tests/qemuargv2xmltest.c | 14 +- tests/qemucapabilitiestest.c | 18 +- tests/qemucaps2xmltest.c | 8 +- tests/qemucapsprobemock.c | 14 +- tests/qemucommandutiltest.c | 22 +- tests/qemuhelptest.c | 24 +- tests/qemuhotplugtest.c | 94 +- tests/qemumonitorjsontest.c | 352 ++--- tests/qemumonitortest.c | 12 +- tests/qemuxml2argvtest.c | 60 +- tests/qemuxml2xmltest.c | 48 +- tests/secretxml2xmltest.c | 12 +- tests/securityselinuxlabeltest.c | 4 +- tests/securityselinuxtest.c | 24 +- tests/sexpr2xmltest.c | 14 +- tests/sockettest.c | 132 +- tests/storagebackendsheepdogtest.c | 38 +- tests/storagepoolxml2xmltest.c | 6 +- tests/storagevolxml2argvtest.c | 18 +- tests/storagevolxml2xmltest.c | 14 +- tests/testutils.h | 64 +- tests/utiltest.c | 24 +- tests/vboxsnapshotxmltest.c | 6 +- tests/virauthconfigtest.c | 14 +- tests/virbitmaptest.c | 44 +- tests/virbuftest.c | 72 +- tests/vircaps2xmltest.c | 12 +- tests/vircgroupmock.c | 28 +- tests/vircgrouptest.c | 40 +- tests/virconftest.c | 30 +- tests/vircryptotest.c | 40 +- tests/virdbustest.c | 36 +- tests/virdrivermoduletest.c | 12 +- tests/virfilecachetest.c | 14 +- tests/virfiletest.c | 44 +- tests/virfilewrapper.c | 14 +- tests/virfirewalltest.c | 96 +- tests/virhashtest.c | 22 +- tests/virhostdevtest.c | 28 +- tests/viriscsitest.c | 20 +- tests/virjsontest.c | 14 +- tests/virkeycodetest.c | 32 +- tests/virkmodtest.c | 14 +- tests/virlogtest.c | 26 +- tests/virmacmaptest.c | 66 +- tests/virmock.h | 186 +-- tests/virnetdaemontest.c | 16 +- tests/virnetdevbandwidthtest.c | 60 +- tests/virnetdevtest.c | 12 +- tests/virnettlscontexttest.c | 52 +- tests/virnettlshelpers.c | 36 +- tests/virnettlssessiontest.c | 90 +- tests/virpcimock.c | 30 +- tests/virpcitest.c | 80 +- tests/virschematest.c | 80 +- tests/virscsitest.c | 10 +- tests/virshtest.c | 14 +- tests/virstoragetest.c | 98 +- tests/virstorageutiltest.c | 30 +- tests/virstringtest.c | 232 ++-- tests/virsystemdtest.c | 72 +- tests/virt-aa-helper-test | 2 +- tests/virtimetest.c | 66 +- tests/viruritest.c | 24 +- tests/virusbtest.c | 36 +- tests/vmwarevertest.c | 16 +- tests/vmx2xmltest.c | 16 +- tests/xlconfigtest.c | 40 +- tests/xmconfigtest.c | 32 +- tests/xml2sexprtest.c | 14 +- tests/xml2vmxtest.c | 16 +- tools/Makefile.am | 252 ++-- tools/nss/libvirt_nss.c | 22 +- tools/virsh-domain-monitor.c | 16 +- tools/virsh-domain.c | 144 +- tools/virsh-interface.c | 22 +- tools/virsh-interface.h | 4 +- tools/virsh-network.c | 26 +- tools/virsh-network.h | 4 +- tools/virsh-nwfilter.c | 14 +- tools/virsh-nwfilter.h | 4 +- tools/virsh-pool.c | 192 +-- tools/virsh-pool.h | 4 +- tools/virsh-snapshot.c | 40 +- tools/virsh-volume.c | 30 +- tools/virsh-volume.h | 4 +- tools/virsh.h | 66 +- tools/virt-admin.c | 32 +- tools/virt-host-validate-bhyve.c | 18 +- tools/vsh.h | 136 +- tools/wireshark/src/packet-libvirt.c | 30 +- 223 files changed, 6392 insertions(+), 6392 deletions(-) diff --git a/Makefile.am b/Makefile.am index d042e9a31f..5a805b5ee8 100644 --- a/Makefile.am +++ b/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 diff --git a/Makefile.nonreentrant b/Makefile.nonreentrant index a832983225..87bb9db20e 100644 --- a/Makefile.nonreentrant +++ b/Makefile.nonreentrant @@ -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 __ \ diff --git a/cfg.mk b/cfg.mk index 8ad09e7da1..d5db05f688 100644 --- a/cfg.mk +++ b/cfg.mk @@ -42,40 +42,40 @@ generated_files = \ _test_script_regex = \<\(init\|test-lib\)\.sh\> # Tests not to run as part of "make distcheck". -local-checks-to-skip = \ - changelog-check \ - makefile-check \ - makefile_path_separator_check \ - patch-check \ - sc_GPL_version \ - sc_always_defined_macros \ - sc_cast_of_alloca_return_value \ - sc_cross_check_PATH_usage_in_tests \ - sc_dd_max_sym_length \ - sc_error_exit_success \ - sc_file_system \ - sc_immutable_NEWS \ - sc_makefile_path_separator_check \ - sc_obsolete_symbols \ - sc_prohibit_S_IS_definition \ - sc_prohibit_atoi_atof \ - sc_prohibit_hash_without_use \ - sc_prohibit_jm_in_m4 \ - sc_prohibit_quote_without_use \ - sc_prohibit_quotearg_without_use \ - sc_prohibit_stat_st_blocks \ - sc_prohibit_undesirable_word_seq \ - sc_root_tests \ - sc_space_tab \ - sc_sun_os_names \ - sc_system_h_headers \ - sc_texinfo_acronym \ - sc_tight_scope \ - sc_two_space_separator_in_usage \ - sc_error_message_uppercase \ - sc_program_name \ - sc_require_test_exit_idiom \ - sc_makefile_check \ +local-checks-to-skip = \ + changelog-check \ + makefile-check \ + makefile_path_separator_check \ + patch-check \ + sc_GPL_version \ + sc_always_defined_macros \ + sc_cast_of_alloca_return_value \ + sc_cross_check_PATH_usage_in_tests \ + sc_dd_max_sym_length \ + sc_error_exit_success \ + sc_file_system \ + sc_immutable_NEWS \ + sc_makefile_path_separator_check \ + sc_obsolete_symbols \ + sc_prohibit_S_IS_definition \ + sc_prohibit_atoi_atof \ + sc_prohibit_hash_without_use \ + sc_prohibit_jm_in_m4 \ + sc_prohibit_quote_without_use \ + sc_prohibit_quotearg_without_use \ + sc_prohibit_stat_st_blocks \ + sc_prohibit_undesirable_word_seq \ + sc_root_tests \ + sc_space_tab \ + sc_sun_os_names \ + sc_system_h_headers \ + sc_texinfo_acronym \ + sc_tight_scope \ + sc_two_space_separator_in_usage \ + sc_error_message_uppercase \ + sc_program_name \ + sc_require_test_exit_idiom \ + sc_makefile_check \ sc_useless_cpp_parens # Most developers don't run 'make distcheck'. We want the official @@ -94,91 +94,91 @@ VC_LIST_ALWAYS_EXCLUDE_REGEX = \ (^(docs/(news(-[0-9]*)?\.html\.in|.*\.patch))|\.(po|fig|gif|ico|png))$$ # Functions like free() that are no-ops on NULL arguments. -useless_free_options = \ - --name=VBOX_UTF16_FREE \ - --name=VBOX_UTF8_FREE \ - --name=VBOX_COM_UNALLOC_MEM \ - --name=VIR_FREE \ - --name=qemuCapsFree \ - --name=qemuMigrationCookieFree \ - --name=qemuMigrationCookieGraphicsFree \ - --name=sexpr_free \ - --name=usbFreeDevice \ - --name=virBandwidthDefFree \ - --name=virBitmapFree \ - --name=virCPUDefFree \ - --name=virCapabilitiesFree \ - --name=virCapabilitiesFreeGuest \ - --name=virCapabilitiesFreeGuestDomain \ - --name=virCapabilitiesFreeGuestFeature \ - --name=virCapabilitiesFreeGuestMachine \ - --name=virCapabilitiesFreeHostNUMACell \ - --name=virCapabilitiesFreeMachines \ - --name=virCgroupFree \ - --name=virCommandFree \ - --name=virConfFreeList \ - --name=virConfFreeValue \ - --name=virDomainActualNetDefFree \ - --name=virDomainChrDefFree \ - --name=virDomainChrSourceDefFree \ - --name=virDomainControllerDefFree \ - --name=virDomainDefFree \ - --name=virDomainDeviceDefFree \ - --name=virDomainDiskDefFree \ - --name=virDomainEventCallbackListFree \ - --name=virObjectEventQueueFree \ - --name=virDomainFSDefFree \ - --name=virDomainGraphicsDefFree \ - --name=virDomainHostdevDefFree \ - --name=virDomainInputDefFree \ - --name=virDomainNetDefFree \ - --name=virDomainObjFree \ - --name=virDomainSmartcardDefFree \ - --name=virDomainSnapshotDefFree \ - --name=virDomainSnapshotObjFree \ - --name=virDomainSoundDefFree \ - --name=virDomainVideoDefFree \ - --name=virDomainWatchdogDefFree \ - --name=virFileDirectFdFree \ - --name=virHashFree \ - --name=virInterfaceDefFree \ - --name=virInterfaceIpDefFree \ - --name=virInterfaceObjFree \ - --name=virInterfaceProtocolDefFree \ - --name=virJSONValueFree \ - --name=virLastErrFreeData \ - --name=virNetMessageFree \ - --name=virNetServerMDNSFree \ - --name=virNetServerMDNSEntryFree \ - --name=virNetServerMDNSGroupFree \ - --name=virNWFilterDefFree \ - --name=virNWFilterEntryFree \ - --name=virNWFilterHashTableFree \ - --name=virNWFilterIPAddrLearnReqFree \ - --name=virNWFilterIncludeDefFree \ - --name=virNWFilterObjFree \ - --name=virNWFilterRuleDefFree \ - --name=virNWFilterRuleInstFree \ - --name=virNetworkDefFree \ - --name=virNodeDeviceDefFree \ - --name=virNodeDeviceObjFree \ - --name=virObjectUnref \ - --name=virObjectFreeCallback \ - --name=virPCIDeviceFree \ - --name=virSecretDefFree \ - --name=virStorageEncryptionFree \ - --name=virStorageEncryptionSecretFree \ - --name=virStorageFileFreeMetadata \ - --name=virStoragePoolDefFree \ - --name=virStoragePoolObjFree \ - --name=virStoragePoolSourceFree \ - --name=virStorageVolDefFree \ - --name=virThreadPoolFree \ - --name=xmlBufferFree \ - --name=xmlFree \ - --name=xmlFreeDoc \ - --name=xmlFreeNode \ - --name=xmlXPathFreeContext \ +useless_free_options = \ + --name=VBOX_UTF16_FREE \ + --name=VBOX_UTF8_FREE \ + --name=VBOX_COM_UNALLOC_MEM \ + --name=VIR_FREE \ + --name=qemuCapsFree \ + --name=qemuMigrationCookieFree \ + --name=qemuMigrationCookieGraphicsFree \ + --name=sexpr_free \ + --name=usbFreeDevice \ + --name=virBandwidthDefFree \ + --name=virBitmapFree \ + --name=virCPUDefFree \ + --name=virCapabilitiesFree \ + --name=virCapabilitiesFreeGuest \ + --name=virCapabilitiesFreeGuestDomain \ + --name=virCapabilitiesFreeGuestFeature \ + --name=virCapabilitiesFreeGuestMachine \ + --name=virCapabilitiesFreeHostNUMACell \ + --name=virCapabilitiesFreeMachines \ + --name=virCgroupFree \ + --name=virCommandFree \ + --name=virConfFreeList \ + --name=virConfFreeValue \ + --name=virDomainActualNetDefFree \ + --name=virDomainChrDefFree \ + --name=virDomainChrSourceDefFree \ + --name=virDomainControllerDefFree \ + --name=virDomainDefFree \ + --name=virDomainDeviceDefFree \ + --name=virDomainDiskDefFree \ + --name=virDomainEventCallbackListFree \ + --name=virObjectEventQueueFree \ + --name=virDomainFSDefFree \ + --name=virDomainGraphicsDefFree \ + --name=virDomainHostdevDefFree \ + --name=virDomainInputDefFree \ + --name=virDomainNetDefFree \ + --name=virDomainObjFree \ + --name=virDomainSmartcardDefFree \ + --name=virDomainSnapshotDefFree \ + --name=virDomainSnapshotObjFree \ + --name=virDomainSoundDefFree \ + --name=virDomainVideoDefFree \ + --name=virDomainWatchdogDefFree \ + --name=virFileDirectFdFree \ + --name=virHashFree \ + --name=virInterfaceDefFree \ + --name=virInterfaceIpDefFree \ + --name=virInterfaceObjFree \ + --name=virInterfaceProtocolDefFree \ + --name=virJSONValueFree \ + --name=virLastErrFreeData \ + --name=virNetMessageFree \ + --name=virNetServerMDNSFree \ + --name=virNetServerMDNSEntryFree \ + --name=virNetServerMDNSGroupFree \ + --name=virNWFilterDefFree \ + --name=virNWFilterEntryFree \ + --name=virNWFilterHashTableFree \ + --name=virNWFilterIPAddrLearnReqFree \ + --name=virNWFilterIncludeDefFree \ + --name=virNWFilterObjFree \ + --name=virNWFilterRuleDefFree \ + --name=virNWFilterRuleInstFree \ + --name=virNetworkDefFree \ + --name=virNodeDeviceDefFree \ + --name=virNodeDeviceObjFree \ + --name=virObjectUnref \ + --name=virObjectFreeCallback \ + --name=virPCIDeviceFree \ + --name=virSecretDefFree \ + --name=virStorageEncryptionFree \ + --name=virStorageEncryptionSecretFree \ + --name=virStorageFileFreeMetadata \ + --name=virStoragePoolDefFree \ + --name=virStoragePoolObjFree \ + --name=virStoragePoolSourceFree \ + --name=virStorageVolDefFree \ + --name=virThreadPoolFree \ + --name=xmlBufferFree \ + --name=xmlFree \ + --name=xmlFreeDoc \ + --name=xmlFreeNode \ + --name=xmlXPathFreeContext \ --name=xmlXPathFreeObject # The following template was generated by this command: @@ -277,18 +277,18 @@ useless_free_options = \ # Avoid uses of write(2). Either switch to streams (fwrite), or use # the safewrite wrapper. sc_avoid_write: - @prohibit='\&2; \ + @test "$$(cat $(srcdir)/include/libvirt/libvirt-domain.h \ + $(srcdir)/include/libvirt/virterror.h \ + $(srcdir)/include/libvirt/libvirt-qemu.h \ + $(srcdir)/include/libvirt/libvirt-lxc.h \ + $(srcdir)/include/libvirt/libvirt-admin.h \ + | grep -c '\(long\|unsigned\) flags')" != 4 && \ + { echo '$(ME): new API should use "unsigned int flags"' 1>&2; \ exit 1; } || : - @prohibit=' flags ATTRIBUTE_UNUSED' \ - halt='flags should be checked with virCheckFlags' \ + @prohibit=' flags ATTRIBUTE_UNUSED' \ + halt='flags should be checked with virCheckFlags' \ $(_sc_search_regexp) - @prohibit='^[^@]*([^d] (int|long long)|[^dg] long) flags[;,)]' \ - halt='flags should be unsigned' \ + @prohibit='^[^@]*([^d] (int|long long)|[^dg] long) flags[;,)]' \ + halt='flags should be unsigned' \ $(_sc_search_regexp) # Avoid functions that should only be called via macro counterparts. sc_prohibit_internal_functions: @prohibit='vir(Free|AllocN?|ReallocN|(Insert|Delete)ElementsN|File(Close|Fclose|Fdopen)) *\(' \ - halt='use VIR_ macros instead of internal functions' \ + halt='use VIR_ macros instead of internal functions' \ $(_sc_search_regexp) # Avoid raw malloc and free, except in documentation comments. sc_prohibit_raw_allocation: - @prohibit='^.[^*].*\<((m|c|re)alloc|free) *\([^)]' \ - halt='use VIR_ macros from viralloc.h instead of malloc/free' \ + @prohibit='^.[^*].*\<((m|c|re)alloc|free) *\([^)]' \ + halt='use VIR_ macros from viralloc.h instead of malloc/free' \ $(_sc_search_regexp) # Avoid functions that can lead to double-close bugs. sc_prohibit_close: - @prohibit='([^>.]|^)\<[fp]?close *\(' \ - halt='use VIR_{FORCE_}[F]CLOSE instead of [f]close' \ + @prohibit='([^>.]|^)\<[fp]?close *\(' \ + halt='use VIR_{FORCE_}[F]CLOSE instead of [f]close' \ $(_sc_search_regexp) - @prohibit='\. sc_prohibit_ctype_h: - @prohibit='^# *include *' \ - halt='use c-ctype.h instead of ctype.h' \ + @prohibit='^# *include *' \ + halt='use c-ctype.h instead of ctype.h' \ $(_sc_search_regexp) # Insist on correct types for [pug]id. sc_correct_id_types: - @prohibit='\<(int|long) *[pug]id\>' \ - halt='use pid_t for pid, uid_t for uid, gid_t for gid' \ + @prohibit='\<(int|long) *[pug]id\>' \ + halt='use pid_t for pid, uid_t for uid, gid_t for gid' \ $(_sc_search_regexp) # "const fooPtr a" is the same as "foo * const a", even though it is @@ -468,17 +468,17 @@ sc_correct_id_types: # the confusing mix of typedef vs. const placement. # Also requires that all 'fooPtr' typedefs are actually pointers. sc_forbid_const_pointer_typedef: - @prohibit='(^|[^"])const \w*Ptr' \ - halt='"const fooPtr var" does not declare what you meant' \ + @prohibit='(^|[^"])const \w*Ptr' \ + halt='"const fooPtr var" does not declare what you meant' \ $(_sc_search_regexp) - @prohibit='typedef [^(]+ [^*]\w*Ptr\b' \ - halt='use correct style and type for Ptr typedefs' \ + @prohibit='typedef [^(]+ [^*]\w*Ptr\b' \ + halt='use correct style and type for Ptr typedefs' \ $(_sc_search_regexp) # Forbid sizeof foo or sizeof (foo), require sizeof(foo) sc_size_of_brackets: - @prohibit='sizeof\s' \ - halt='use sizeof(foo), not sizeof (foo) or sizeof foo' \ + @prohibit='sizeof\s' \ + halt='use sizeof(foo), not sizeof (foo) or sizeof foo' \ $(_sc_search_regexp) # Ensure that no C source file, docs, or rng schema uses TABs for @@ -486,8 +486,8 @@ sc_size_of_brackets: # files in gnulib, since they're imported. space_indent_files=(\.(rng|s?[ch](\.in)?|html.in|py|pl|syms)|(daemon|tools)/.*\.in) sc_TAB_in_indentation: - @prohibit='^ * ' \ - in_vc_files='$(space_indent_files)$$' \ + @prohibit='^ * ' \ + in_vc_files='$(space_indent_files)$$' \ halt='indent with space, not TAB, in C, sh, html, py, syms and RNG schemas' \ $(_sc_search_regexp) @@ -495,94 +495,94 @@ ctype_re = isalnum|isalpha|isascii|isblank|iscntrl|isdigit|isgraph|islower\ |isprint|ispunct|isspace|isupper|isxdigit|tolower|toupper sc_avoid_ctype_macros: - @prohibit='\b($(ctype_re)) *\(' \ - halt='use c-ctype.h instead of ctype macros' \ + @prohibit='\b($(ctype_re)) *\(' \ + halt='use c-ctype.h instead of ctype macros' \ $(_sc_search_regexp) sc_avoid_strcase: - @prohibit='\bstrn?case(cmp|str) *\(' \ - halt='use c-strcase.h instead of raw strcase functions' \ + @prohibit='\bstrn?case(cmp|str) *\(' \ + halt='use c-strcase.h instead of raw strcase functions' \ $(_sc_search_regexp) sc_prohibit_virBufferAdd_with_string_literal: - @prohibit='\ are not required to be thread-safe sc_prohibit_libgen: - @prohibit='( (base|dir)name *\(|include .libgen\.h)' \ - halt='use functions from gnulib "dirname.h", not ' \ + @prohibit='( (base|dir)name *\(|include .libgen\.h)' \ + halt='use functions from gnulib "dirname.h", not ' \ $(_sc_search_regexp) # raw xmlGetProp requires some nasty casts sc_prohibit_xmlGetProp: - @prohibit='\&2; \ + | $(SED) 's/_("\([^\"]\|\\.\)\+"//;s/[ ]"%s"//' \ + | grep '[ ]"' && \ + { echo '$(ME): found unmarked diagnostic(s)' 1>&2; \ exit 1; } || : # Like the above, but prohibit a newline at the end of a diagnostic. @@ -640,103 +640,103 @@ sc_libvirt_unmarked_diagnostics: # there are functions to which this one applies but that do not get marked # diagnostics. sc_prohibit_newline_at_end_of_diagnostic: - @grep -A2 -nE \ - '\<$(func_re) *\(' $$($(VC_LIST_EXCEPT)) \ - | grep '\\n"' \ - && { echo '$(ME): newline at end of message(s)' 1>&2; \ + @grep -A2 -nE \ + '\<$(func_re) *\(' $$($(VC_LIST_EXCEPT)) \ + | grep '\\n"' \ + && { echo '$(ME): newline at end of message(s)' 1>&2; \ exit 1; } || : # Look for diagnostics that lack a % in the format string, except that we # allow VIR_ERROR to do this, and ignore functions that take a single # string rather than a format argument. sc_prohibit_diagnostic_without_format: - @{ grep -nE '\<$(func_re) *\(.*;$$' $$($(VC_LIST_EXCEPT)); \ + @{ grep -nE '\<$(func_re) *\(.*;$$' $$($(VC_LIST_EXCEPT)); \ grep -A2 -nE '\<$(func_re) *\(.*,$$' $$($(VC_LIST_EXCEPT)); } \ - | $(SED) -rn -e ':l; /[,"]$$/ {N;b l;}' \ - -e '/(xenapiSessionErrorHandler|vah_(error|warning))/d' \ - -e '/\<$(func_re) *\([^"]*"([^%"]|"\n[^"]*")*"[,)]/p' \ - | grep -vE 'VIR_ERROR' && \ - { echo '$(ME): found diagnostic without %' 1>&2; \ + | $(SED) -rn -e ':l; /[,"]$$/ {N;b l;}' \ + -e '/(xenapiSessionErrorHandler|vah_(error|warning))/d' \ + -e '/\<$(func_re) *\([^"]*"([^%"]|"\n[^"]*")*"[,)]/p' \ + | grep -vE 'VIR_ERROR' && \ + { echo '$(ME): found diagnostic without %' 1>&2; \ exit 1; } || : # The strings "" and "%s" should never be marked for translation. # Files under tests/ and examples/ should not be translated. sc_prohibit_useless_translation: - @prohibit='_\("(%s)?"\)' \ - halt='found useless translation' \ + @prohibit='_\("(%s)?"\)' \ + halt='found useless translation' \ $(_sc_search_regexp) - @prohibit='\&2; \ + @grep -n -A1 '"$$' $$($(VC_LIST_EXCEPT)) \ + | $(SED) -ne ':l; /"$$/ {N;b l;}; s/"\n[^"]*"/""/g; s/\\n/ /g' \ + -e '/_(.*[^\ ]""[^\ ]/p' | grep . && \ + { echo '$(ME): missing whitespace at line split' 1>&2; \ exit 1; } || : # Enforce recommended preprocessor indentation style. sc_preprocessor_indentation: - @if cppi --version >/dev/null 2>&1; then \ - $(VC_LIST_EXCEPT) | grep -E '\.[ch](\.in)?$$' | xargs cppi -a -c \ - || { echo '$(ME): incorrect preprocessor indentation' 1>&2; \ - exit 1; }; \ - else \ - echo '$(ME): skipping test $@: cppi not installed' 1>&2; \ + @if cppi --version >/dev/null 2>&1; then \ + $(VC_LIST_EXCEPT) | grep -E '\.[ch](\.in)?$$' | xargs cppi -a -c \ + || { echo '$(ME): incorrect preprocessor indentation' 1>&2; \ + exit 1; }; \ + else \ + echo '$(ME): skipping test $@: cppi not installed' 1>&2; \ fi # Enforce similar spec file indentation style, by running cppi on a # (comment-only) C file that mirrors the same layout as the spec file. sc_spec_indentation: - @if cppi --version >/dev/null 2>&1; then \ - for f in $$($(VC_LIST_EXCEPT) | grep '\.spec\.in$$'); do \ - $(SED) -e 's|#|// #|; s|%ifn*\(arch\)* |#if a // |' \ - -e 's/%\(else\|endif\|define\)/#\1/' \ - -e 's/^\( *\)\1\1\1#/#\1/' \ - -e 's|^\( *[^#/ ]\)|// \1|; s|^\( */[^/]\)|// \1|' $$f \ - | cppi -a -c 2>&1 | $(SED) "s|standard input|$$f|"; \ - done | { if grep . >&2; then false; else :; fi; } \ - || { echo '$(ME): incorrect preprocessor indentation' 1>&2; \ - exit 1; }; \ - else \ - echo '$(ME): skipping test $@: cppi not installed' 1>&2; \ + @if cppi --version >/dev/null 2>&1; then \ + for f in $$($(VC_LIST_EXCEPT) | grep '\.spec\.in$$'); do \ + $(SED) -e 's|#|// #|; s|%ifn*\(arch\)* |#if a // |' \ + -e 's/%\(else\|endif\|define\)/#\1/' \ + -e 's/^\( *\)\1\1\1#/#\1/' \ + -e 's|^\( *[^#/ ]\)|// \1|; s|^\( */[^/]\)|// \1|' $$f \ + | cppi -a -c 2>&1 | $(SED) "s|standard input|$$f|"; \ + done | { if grep . >&2; then false; else :; fi; } \ + || { echo '$(ME): incorrect preprocessor indentation' 1>&2; \ + exit 1; }; \ + else \ + echo '$(ME): skipping test $@: cppi not installed' 1>&2; \ fi # Nested conditionals are easier to understand if we enforce that endifs # can be paired back to the if sc_makefile_conditionals: - @prohibit='(else|endif)($$| *#)' \ - in_vc_files='Makefile\.am' \ - halt='match "if FOO" with "endif FOO" in Makefiles' \ + @prohibit='(else|endif)($$| *#)' \ + in_vc_files='Makefile\.am' \ + halt='match "if FOO" with "endif FOO" in Makefiles' \ $(_sc_search_regexp) # Long lines can be harder to diff; too long, and git send-email chokes. # For now, only enforce line length on files where we have intentionally # fixed things and don't want to regress. sc_prohibit_long_lines: - @prohibit='.{90}' \ - in_vc_files='\.arg[sv]' \ - halt='Wrap long lines in expected output files' \ + @prohibit='.{90}' \ + in_vc_files='\.arg[sv]' \ + halt='Wrap long lines in expected output files' \ $(_sc_search_regexp) - @prohibit='.{80}' \ - in_vc_files='Makefile\.am' \ - halt='Wrap long lines in Makefiles' \ + @prohibit='.{80}' \ + in_vc_files='Makefile\.am' \ + halt='Wrap long lines in Makefiles' \ $(_sc_search_regexp) sc_copyright_format: - @require='Copyright .*Red 'Hat', Inc\.' \ - containing='Copyright .*Red 'Hat \ - halt='Red Hat copyright is missing Inc.' \ + @require='Copyright .*Red 'Hat', Inc\.' \ + containing='Copyright .*Red 'Hat \ + halt='Red Hat copyright is missing Inc.' \ $(_sc_search_regexp) - @prohibit='Copyright [^(].*Red 'Hat \ - halt='consistently use (C) in Red Hat copyright' \ + @prohibit='Copyright [^(].*Red 'Hat \ + halt='consistently use (C) in Red Hat copyright' \ $(_sc_search_regexp) - @prohibit='\' \ - halt='spell Red Hat as two words' \ + @prohibit='\' \ + halt='spell Red Hat as two words' \ $(_sc_search_regexp) # Prefer the new URL listing over the old street address listing when @@ -746,22 +746,22 @@ sc_copyright_format: # version. Note that our typical copyright boilerplate refers to the # license by name, not by reference to a top-level file. sc_copyright_usage: - @prohibit=Boston,' MA' \ - halt='Point to , not an address' \ + @prohibit=Boston,' MA' \ + halt='Point to , not an address' \ $(_sc_search_regexp) - @require='COPYING\.LESSER' \ - containing='COPYING' \ - halt='Refer to COPYING.LESSER for LGPL' \ + @require='COPYING\.LESSER' \ + containing='COPYING' \ + halt='Refer to COPYING.LESSER for LGPL' \ $(_sc_search_regexp) - @prohibit='COPYING\.LIB' \ - halt='Refer to COPYING.LESSER for LGPL' \ + @prohibit='COPYING\.LIB' \ + halt='Refer to COPYING.LESSER for LGPL' \ $(_sc_search_regexp) # Some functions/macros produce messages intended solely for developers # and maintainers. Do not mark them for translation. sc_prohibit_gettext_markup: - @prohibit='\&2; \ + @grep -A1 -nE '^[^#]*VIR_ENUM_IMPL *\(' $$($(VC_LIST_EXCEPT)) \ + | $(SED) -ne '/VIR_ENUM_IMPL[^,]*,$$/N' \ + -e '/VIR_ENUM_IMPL[^,]*,[^,]*[^_,][^L,][^A,][^S,][^T,],/p' \ + -e '/VIR_ENUM_IMPL[^,]*,[^,]\{0,4\},/p' \ + | grep . && \ + { echo '$(ME): enum impl needs to use _LAST marker' 1>&2; \ exit 1; } || : # In Python files we don't want to end lines with a semicolon like in C sc_prohibit_semicolon_at_eol_in_python: - @prohibit='^[^#].*\;$$' \ - in_vc_files='\.py$$' \ - halt='python does not require to end lines with a semicolon' \ + @prohibit='^[^#].*\;$$' \ + in_vc_files='\.py$$' \ + halt='python does not require to end lines with a semicolon' \ $(_sc_search_regexp) # mymain() in test files should use return, not exit, for nicer output sc_prohibit_exit_in_tests: - @prohibit='\ form. Except for external tools, # e.g. Python binding, examples and tools subdirectories. sc_prohibit_include_public_headers_brackets: - @prohibit='# *include *' \ - in_vc_files='\.[ch]$$' \ - halt='Do not include libvirt/*.h in internal source' \ + @prohibit='# *include *' \ + in_vc_files='\.[ch]$$' \ + halt='Do not include libvirt/*.h in internal source' \ $(_sc_search_regexp) # is only needed in .c files; .h files do not need it since # .c files must include config.h before any other .h. sc_prohibit_config_h_in_headers: - @prohibit='^# *include\>.*config\.h' \ - in_vc_files='\.h$$' \ - halt='headers should not include ' \ + @prohibit='^# *include\>.*config\.h' \ + in_vc_files='\.h$$' \ + halt='headers should not include ' \ $(_sc_search_regexp) sc_prohibit_unbounded_arrays_in_rpc: - @prohibit='<>' \ - in_vc_files='\.x$$' \ - halt='Arrays in XDR must have a upper limit set for ' \ + @prohibit='<>' \ + in_vc_files='\.x$$' \ + halt='Arrays in XDR must have a upper limit set for ' \ $(_sc_search_regexp) sc_prohibit_getenv: - @prohibit='\b(secure_)?getenv *\(' \ - exclude='exempt from syntax-check' \ - halt='Use virGetEnv{Allow,Block}SUID instead of getenv' \ + @prohibit='\b(secure_)?getenv *\(' \ + exclude='exempt from syntax-check' \ + halt='Use virGetEnv{Allow,Block}SUID instead of getenv' \ $(_sc_search_regexp) sc_prohibit_atoi: - @prohibit='\bato(i|f|l|ll|q) *\(' \ + @prohibit='\bato(i|f|l|ll|q) *\(' \ halt='Use virStrToLong* instead of atoi, atol, atof, atoq, atoll' \ $(_sc_search_regexp) sc_prohibit_wrong_filename_in_comment: - @fail=0; \ - awk 'BEGIN { \ - fail=0; \ - } FNR < 3 { \ + @fail=0; \ + awk 'BEGIN { \ + fail=0; \ + } FNR < 3 { \ n=match($$0, /[[:space:]][^[:space:]]*[.][ch][[:space:]:]/); \ - if (n > 0) { \ - A=substr($$0, RSTART+1, RLENGTH-2); \ - n=split(FILENAME, arr, "/"); \ - if (A != arr[n]) { \ - print "in " FILENAME ": " A " mentioned in comments "; \ - fail=1; \ - } \ - } \ - } END { \ - if (fail == 1) { \ - exit 1; \ - } \ - }' $$($(VC_LIST_EXCEPT) | grep '\.[ch]$$') || fail=1; \ - if test $$fail -eq 1; then \ - { echo '$(ME): The file name in comments must match the' \ - 'actual file name' 1>&2; exit 1; } \ + if (n > 0) { \ + A=substr($$0, RSTART+1, RLENGTH-2); \ + n=split(FILENAME, arr, "/"); \ + if (A != arr[n]) { \ + print "in " FILENAME ": " A " mentioned in comments "; \ + fail=1; \ + } \ + } \ + } END { \ + if (fail == 1) { \ + exit 1; \ + } \ + }' $$($(VC_LIST_EXCEPT) | grep '\.[ch]$$') || fail=1; \ + if test $$fail -eq 1; then \ + { echo '$(ME): The file name in comments must match the' \ + 'actual file name' 1>&2; exit 1; } \ fi; sc_prohibit_virConnectOpen_in_virsh: - @prohibit='\bvirConnectOpen[a-zA-Z]* *\(' \ - in_vc_files='tools/virsh-.*\.[ch]$$' \ - halt='Use vshConnect() in virsh instead of virConnectOpen*' \ + @prohibit='\bvirConnectOpen[a-zA-Z]* *\(' \ + in_vc_files='tools/virsh-.*\.[ch]$$' \ + halt='Use vshConnect() in virsh instead of virConnectOpen*' \ $(_sc_search_regexp) sc_require_space_before_label: - @prohibit='^( ?)?[_a-zA-Z0-9]+:$$' \ - in_vc_files='\.[ch]$$' \ - halt='Top-level labels should be indented by one space' \ + @prohibit='^( ?)?[_a-zA-Z0-9]+:$$' \ + in_vc_files='\.[ch]$$' \ + halt='Top-level labels should be indented by one space' \ $(_sc_search_regexp) # Allow for up to three spaces before the label: this is to avoid running # into situations where neither this rule nor require_space_before_label # would apply, eg. a line matching ^[a-zA-Z0-9]+ :$ sc_prohibit_space_in_label: - @prohibit='^ {0,3}[_a-zA-Z0-9]+ +:$$' \ - in_vc_files='\.[ch]$$' \ - halt='There should be no space between label name and colon' \ + @prohibit='^ {0,3}[_a-zA-Z0-9]+ +:$$' \ + in_vc_files='\.[ch]$$' \ + halt='There should be no space between label name and colon' \ $(_sc_search_regexp) # Doesn't catch all cases of mismatched braces across if-else, but it helps sc_require_if_else_matching_braces: - @prohibit='( else( if .*\))? {|} else( if .*\))?$$)' \ - in_vc_files='\.[chx]$$' \ - halt='if one side of if-else uses {}, both sides must use it' \ + @prohibit='( else( if .*\))? {|} else( if .*\))?$$)' \ + in_vc_files='\.[chx]$$' \ + halt='if one side of if-else uses {}, both sides must use it' \ $(_sc_search_regexp) sc_curly_braces_style: - @files=$$($(VC_LIST_EXCEPT) | grep '\.[ch]$$'); \ - if $(GREP) -nHP \ -'^\s*(?!([a-zA-Z_]*for_?each[a-zA-Z_]*) ?\()([_a-zA-Z0-9]+( [_a-zA-Z0-9]+)* ?\()?(\*?[_a-zA-Z0-9]+(,? \*?[_a-zA-Z0-9\[\]]+)+|void)\) ?\{' \ - $$files; then \ - echo '$(ME): Non-K&R style used for curly braces around' \ - 'function body' 1>&2; exit 1; \ - fi; \ + @files=$$($(VC_LIST_EXCEPT) | grep '\.[ch]$$'); \ + if $(GREP) -nHP \ +'^\s*(?!([a-zA-Z_]*for_?each[a-zA-Z_]*) ?\()([_a-zA-Z0-9]+( [_a-zA-Z0-9]+)* ?\()?(\*?[_a-zA-Z0-9]+(,? \*?[_a-zA-Z0-9\[\]]+)+|void)\) ?\{' \ + $$files; then \ + echo '$(ME): Non-K&R style used for curly braces around' \ + 'function body' 1>&2; exit 1; \ + fi; \ if $(GREP) -A1 -En ' ((if|for|while|switch) \(|(else|do)\b)[^{]*$$'\ - $$files | $(GREP) '^[^ ]*- *{'; then \ + $$files | $(GREP) '^[^ ]*- *{'; then \ echo '$(ME): Use hanging braces for compound statements' 1>&2; exit 1; \ fi sc_prohibit_windows_special_chars_in_filename: - @files=$$($(VC_LIST_EXCEPT) | grep '[:*?"<>|]'); \ - test -n "$$files" && { echo '$(ME): Windows special chars' \ + @files=$$($(VC_LIST_EXCEPT) | grep '[:*?"<>|]'); \ + test -n "$$files" && { echo '$(ME): Windows special chars' \ 'in filename not allowed:' 1>&2; echo $$files 1>&2; exit 1; } || : sc_prohibit_mixed_case_abbreviations: - @prohibit='Pci|Usb|Scsi' \ - in_vc_files='\.[ch]$$' \ - halt='Use PCI, USB, SCSI, not Pci, Usb, Scsi' \ + @prohibit='Pci|Usb|Scsi' \ + in_vc_files='\.[ch]$$' \ + halt='Use PCI, USB, SCSI, not Pci, Usb, Scsi' \ $(_sc_search_regexp) # Require #include in all files that call setlocale() sc_require_locale_h: - @require='include.*locale\.h' \ - containing='setlocale *(' \ - halt='setlocale() requires ' \ + @require='include.*locale\.h' \ + containing='setlocale *(' \ + halt='setlocale() requires ' \ $(_sc_search_regexp) sc_prohibit_empty_first_line: - @awk 'BEGIN { fail=0; } \ - FNR == 1 { if ($$0 == "") { print FILENAME ":1:"; fail=1; } } \ - END { if (fail == 1) { \ - print "$(ME): Prohibited empty first line" > "/dev/stderr"; \ + @awk 'BEGIN { fail=0; } \ + FNR == 1 { if ($$0 == "") { print FILENAME ":1:"; fail=1; } } \ + END { if (fail == 1) { \ + print "$(ME): Prohibited empty first line" > "/dev/stderr"; \ } exit fail; }' $$($(VC_LIST_EXCEPT)); sc_prohibit_paren_brace: - @prohibit='\)\{$$' \ - in_vc_files='\.[chx]$$' \ - halt='Put space between closing parenthesis and opening brace' \ + @prohibit='\)\{$$' \ + in_vc_files='\.[chx]$$' \ + halt='Put space between closing parenthesis and opening brace' \ $(_sc_search_regexp) # C guarantees that static variables are zero initialized, and some compilers # waste space by sticking explicit initializers in .data instead of .bss sc_prohibit_static_zero_init: - @prohibit='\bstatic\b.*= *(0[^xX0-9]|NULL|false)' \ - in_vc_files='\.[chx](\.in)?$$' \ + @prohibit='\bstatic\b.*= *(0[^xX0-9]|NULL|false)' \ + in_vc_files='\.[chx](\.in)?$$' \ halt='static variables do not need explicit zero initialization'\ $(_sc_search_regexp) # FreeBSD exports the "devname" symbol which produces a warning. sc_prohibit_devname: - @prohibit='\bdevname\b' \ + @prohibit='\bdevname\b' \ exclude='sc_prohibit_devname' \ halt='avoid using devname as FreeBSD exports the symbol' \ $(_sc_search_regexp) @@ -972,7 +972,7 @@ sc_prohibit_system_error_with_vir_err: # functions. There's a corresponding exclude to allow usage within tests, # docs, examples, tools, src/libvirt-*.c, and include/libvirt/libvirt-*.h sc_prohibit_virXXXFree: - @prohibit='\bvir(Domain|Network|NodeDevice|StorageVol|StoragePool|Stream|Secret|NWFilter|Interface|DomainSnapshot)Free\b' \ + @prohibit='\bvir(Domain|Network|NodeDevice|StorageVol|StoragePool|Stream|Secret|NWFilter|Interface|DomainSnapshot)Free\b' \ exclude='sc_prohibit_virXXXFree' \ halt='avoid using virXXXFree, use virObjectUnref instead' \ $(_sc_search_regexp) @@ -994,28 +994,28 @@ sc_prohibit_pthread_create: $(_sc_search_regexp) sc_prohibit_not_streq: - @prohibit='! *STRN?EQ *\(.*\)' \ - halt='Use STRNEQ instead of !STREQ and STREQ instead of !STRNEQ' \ + @prohibit='! *STRN?EQ *\(.*\)' \ + halt='Use STRNEQ instead of !STREQ and STREQ instead of !STRNEQ' \ $(_sc_search_regexp) sc_prohibit_verbose_strcat: - @prohibit='strncat\([^,]*,\s+([^,]*),\s+strlen\(\1\)\)' \ - in_vc_files='\.[ch]$$' \ + @prohibit='strncat\([^,]*,\s+([^,]*),\s+strlen\(\1\)\)' \ + in_vc_files='\.[ch]$$' \ halt='Use strcat(a, b) instead of strncat(a, b, strlen(b))' \ $(_sc_search_regexp) # Ensure that each .c file containing a "main" function also # calls virGettextInitialize sc_gettext_init: - @require='virGettextInitialize *\(' \ - in_vc_files='\.c$$' \ - containing='\
= ((maj) << 16) + (min)) #endif diff --git a/daemon/Makefile.am b/daemon/Makefile.am index 697778e565..b0c28d2313 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -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 $@ diff --git a/daemon/remote.c b/daemon/remote.c index 3f7d2d3440..07557e9c35 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -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); /* diff --git a/docs/Makefile.am b/docs/Makefile.am index 8a201882c5..9620587a77 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -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 \ diff --git a/examples/Makefile.am b/examples/Makefile.am index 2956e142c4..ef2f79db31 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -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 diff --git a/examples/domsuspend/suspend.c b/examples/domsuspend/suspend.c index 493a4b7b21..919932b0e8 100644 --- a/examples/domsuspend/suspend.c +++ b/examples/domsuspend/suspend.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 diff --git a/examples/domtop/domtop.c b/examples/domtop/domtop.c index d449bacd70..2077c49fbd 100644 --- a/examples/domtop/domtop.c +++ b/examples/domtop/domtop.c @@ -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) diff --git a/examples/object-events/event-test.c b/examples/object-events/event-test.c index a144638879..8499e0b38e 100644 --- a/examples/object-events/event-test.c +++ b/examples/object-events/event-test.c @@ -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[] = { diff --git a/src/Makefile.am b/src/Makefile.am index b74856ba78..1d24231249 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -25,31 +25,31 @@ abs_topsrcdir = $(shell cd $(top_srcdir) && pwd) # No libraries with the exception of LIBXML should be listed # here. List them against the individual XXX_la_CFLAGS targets # that actually use them. Also keep GETTEXT_CPPFLAGS at the end. -INCLUDES = -I../gnulib/lib \ - -I$(top_srcdir)/gnulib/lib \ - -I$(top_srcdir) \ - -I../include \ - -I$(top_srcdir)/include \ - -I$(srcdir)/util \ - -I./util \ - -DIN_LIBVIRT \ - -Dabs_topbuilddir="\"$(abs_topbuilddir)\"" \ - -Dabs_topsrcdir="\"$(abs_topsrcdir)\"" \ +INCLUDES = -I../gnulib/lib \ + -I$(top_srcdir)/gnulib/lib \ + -I$(top_srcdir) \ + -I../include \ + -I$(top_srcdir)/include \ + -I$(srcdir)/util \ + -I./util \ + -DIN_LIBVIRT \ + -Dabs_topbuilddir="\"$(abs_topbuilddir)\"" \ + -Dabs_topsrcdir="\"$(abs_topsrcdir)\"" \ $(GETTEXT_CPPFLAGS) WARN_CFLAGS += $(STRICT_FRAME_LIMIT_CFLAGS) -AM_CFLAGS = $(LIBXML_CFLAGS) \ - $(WARN_CFLAGS) \ - $(LOCK_CHECKING_CFLAGS) \ - $(WIN32_EXTRA_CFLAGS) \ +AM_CFLAGS = $(LIBXML_CFLAGS) \ + $(WARN_CFLAGS) \ + $(LOCK_CHECKING_CFLAGS) \ + $(WIN32_EXTRA_CFLAGS) \ $(COVERAGE_CFLAGS) -AM_LDFLAGS = $(DRIVER_MODULES_LDFLAGS) \ - $(COVERAGE_LDFLAGS) \ - $(RELRO_LDFLAGS) \ - $(NO_INDIRECT_LDFLAGS) \ - $(CYGWIN_EXTRA_LDFLAGS) \ - $(MINGW_EXTRA_LDFLAGS) \ +AM_LDFLAGS = $(DRIVER_MODULES_LDFLAGS) \ + $(COVERAGE_LDFLAGS) \ + $(RELRO_LDFLAGS) \ + $(NO_INDIRECT_LDFLAGS) \ + $(CYGWIN_EXTRA_LDFLAGS) \ + $(MINGW_EXTRA_LDFLAGS) \ $(NULL) POD2MAN = pod2man -c "Virtualization Support" -r "$(PACKAGE)-$(VERSION)" @@ -95,107 +95,107 @@ augeastest_DATA = # These files are not related to driver APIs. Simply generic # helper APIs for various purposes -UTIL_SOURCES = \ - util/viralloc.c util/viralloc.h \ - util/virarch.h util/virarch.c \ - util/viratomic.h util/viratomic.c \ - util/viraudit.c util/viraudit.h \ - util/virauth.c util/virauth.h \ - util/virauthconfig.c util/virauthconfig.h \ - util/virbitmap.c util/virbitmap.h \ - util/virbuffer.c util/virbuffer.h \ - util/virperf.c util/virperf.h \ - util/vircgroup.c util/vircgroup.h util/vircgrouppriv.h \ - util/virclosecallbacks.c util/virclosecallbacks.h \ +UTIL_SOURCES = \ + util/viralloc.c util/viralloc.h \ + util/virarch.h util/virarch.c \ + util/viratomic.h util/viratomic.c \ + util/viraudit.c util/viraudit.h \ + util/virauth.c util/virauth.h \ + util/virauthconfig.c util/virauthconfig.h \ + util/virbitmap.c util/virbitmap.h \ + util/virbuffer.c util/virbuffer.h \ + util/virperf.c util/virperf.h \ + util/vircgroup.c util/vircgroup.h util/vircgrouppriv.h \ + util/virclosecallbacks.c util/virclosecallbacks.h \ util/vircommand.c util/vircommand.h util/vircommandpriv.h \ - util/virconf.c util/virconf.h \ - util/vircrypto.c util/vircrypto.h \ - util/virdbus.c util/virdbus.h util/virdbuspriv.h \ - util/virdnsmasq.c util/virdnsmasq.h \ - util/virebtables.c util/virebtables.h \ - util/virendian.h \ - util/virerror.c util/virerror.h \ - util/virevent.c util/virevent.h \ - util/vireventpoll.c util/vireventpoll.h \ - util/virfcp.c util/virfcp.h \ - util/virfdstream.c util/virfdstream.h \ - util/virfile.c util/virfile.h \ - util/virfirewall.c util/virfirewall.h \ - util/virfirewallpriv.h \ - util/virfirmware.c util/virfirmware.h \ - util/virgettext.c util/virgettext.h \ - util/virgic.c util/virgic.h \ - util/virhash.c util/virhash.h \ - util/virhashcode.c util/virhashcode.h \ - util/virhook.c util/virhook.h \ + util/virconf.c util/virconf.h \ + util/vircrypto.c util/vircrypto.h \ + util/virdbus.c util/virdbus.h util/virdbuspriv.h \ + util/virdnsmasq.c util/virdnsmasq.h \ + util/virebtables.c util/virebtables.h \ + util/virendian.h \ + util/virerror.c util/virerror.h \ + util/virevent.c util/virevent.h \ + util/vireventpoll.c util/vireventpoll.h \ + util/virfcp.c util/virfcp.h \ + util/virfdstream.c util/virfdstream.h \ + util/virfile.c util/virfile.h \ + util/virfirewall.c util/virfirewall.h \ + util/virfirewallpriv.h \ + util/virfirmware.c util/virfirmware.h \ + util/virgettext.c util/virgettext.h \ + util/virgic.c util/virgic.h \ + util/virhash.c util/virhash.h \ + util/virhashcode.c util/virhashcode.h \ + util/virhook.c util/virhook.h \ util/virhostcpu.c util/virhostcpu.h util/virhostcpupriv.h \ - util/virhostdev.c util/virhostdev.h \ - util/virhostmem.c util/virhostmem.h \ - util/viridentity.c util/viridentity.h \ - util/virinitctl.c util/virinitctl.h \ - util/viriptables.c util/viriptables.h \ - util/viriscsi.c util/viriscsi.h \ - util/virjson.c util/virjson.h \ - util/virkeycode.c util/virkeycode.h \ - util/virkeyfile.c util/virkeyfile.h \ - util/virlease.c util/virlease.h \ - util/virlockspace.c util/virlockspace.h \ - util/virlog.c util/virlog.h \ - util/virmacaddr.h util/virmacaddr.c \ - util/virmacmap.h util/virmacmap.c \ - util/virnetdev.h util/virnetdev.c \ + util/virhostdev.c util/virhostdev.h \ + util/virhostmem.c util/virhostmem.h \ + util/viridentity.c util/viridentity.h \ + util/virinitctl.c util/virinitctl.h \ + util/viriptables.c util/viriptables.h \ + util/viriscsi.c util/viriscsi.h \ + util/virjson.c util/virjson.h \ + util/virkeycode.c util/virkeycode.h \ + util/virkeyfile.c util/virkeyfile.h \ + util/virlease.c util/virlease.h \ + util/virlockspace.c util/virlockspace.h \ + util/virlog.c util/virlog.h \ + util/virmacaddr.h util/virmacaddr.c \ + util/virmacmap.h util/virmacmap.c \ + util/virnetdev.h util/virnetdev.c \ util/virnetdevbandwidth.h util/virnetdevbandwidth.c \ - util/virnetdevbridge.h util/virnetdevbridge.c \ - util/virnetdevip.h util/virnetdevip.c \ - util/virnetdevmacvlan.c util/virnetdevmacvlan.h \ + util/virnetdevbridge.h util/virnetdevbridge.c \ + util/virnetdevip.h util/virnetdevip.c \ + util/virnetdevmacvlan.c util/virnetdevmacvlan.h \ util/virnetdevmidonet.h util/virnetdevmidonet.c \ util/virnetdevopenvswitch.h util/virnetdevopenvswitch.c \ - util/virnetdevtap.h util/virnetdevtap.c \ - util/virnetdevveth.h util/virnetdevveth.c \ - util/virnetdevvlan.h util/virnetdevvlan.c \ + util/virnetdevtap.h util/virnetdevtap.c \ + util/virnetdevveth.h util/virnetdevveth.c \ + util/virnetdevvlan.h util/virnetdevvlan.c \ util/virnetdevvportprofile.h util/virnetdevvportprofile.c \ - util/virnetlink.c util/virnetlink.h \ - util/virnodesuspend.c util/virnodesuspend.h \ - util/virkmod.c util/virkmod.h \ - util/virnuma.c util/virnuma.h \ - util/virobject.c util/virobject.h \ - util/virpci.c util/virpci.h \ - util/virpidfile.c util/virpidfile.h \ - util/virpolkit.c util/virpolkit.h \ + util/virnetlink.c util/virnetlink.h \ + util/virnodesuspend.c util/virnodesuspend.h \ + util/virkmod.c util/virkmod.h \ + util/virnuma.c util/virnuma.h \ + util/virobject.c util/virobject.h \ + util/virpci.c util/virpci.h \ + util/virpidfile.c util/virpidfile.h \ + util/virpolkit.c util/virpolkit.h \ util/virportallocator.c util/virportallocator.h \ - util/virprobe.h \ - util/virprocess.c util/virprocess.h \ - util/virqemu.c util/virqemu.h \ - util/virrandom.h util/virrandom.c \ - util/virresctrl.h util/virresctrl.c \ - util/virrotatingfile.h util/virrotatingfile.c \ - util/virscsi.c util/virscsi.h \ - util/virscsihost.c util/virscsihost.h \ - util/virscsivhost.c util/virscsivhost.h \ - util/virseclabel.c util/virseclabel.h \ - util/virsecret.c util/virsecret.h \ - util/virsexpr.c util/virsexpr.h \ - util/virsocketaddr.h util/virsocketaddr.c \ + util/virprobe.h \ + util/virprocess.c util/virprocess.h \ + util/virqemu.c util/virqemu.h \ + util/virrandom.h util/virrandom.c \ + util/virresctrl.h util/virresctrl.c \ + util/virrotatingfile.h util/virrotatingfile.c \ + util/virscsi.c util/virscsi.h \ + util/virscsihost.c util/virscsihost.h \ + util/virscsivhost.c util/virscsivhost.h \ + util/virseclabel.c util/virseclabel.h \ + util/virsecret.c util/virsecret.h \ + util/virsexpr.c util/virsexpr.h \ + util/virsocketaddr.h util/virsocketaddr.c \ util/virstorageencryption.c util/virstorageencryption.h \ - util/virstoragefile.c util/virstoragefile.h \ - util/virstring.h util/virstring.c \ - util/virsysinfo.c util/virsysinfo.h util/virsysinfopriv.h \ + util/virstoragefile.c util/virstoragefile.h \ + util/virstring.h util/virstring.c \ + util/virsysinfo.c util/virsysinfo.h util/virsysinfopriv.h \ util/virsystemd.c util/virsystemd.h util/virsystemdpriv.h \ - util/virthread.c util/virthread.h \ - util/virthreadjob.c util/virthreadjob.h \ - util/virthreadpool.c util/virthreadpool.h \ - util/virtime.h util/virtime.c \ - util/virtpm.h util/virtpm.c \ - util/virtypedparam.c util/virtypedparam.h \ - util/virusb.c util/virusb.h \ - util/viruri.h util/viruri.c \ - util/virutil.c util/virutil.h \ - util/viruuid.c util/viruuid.h \ - util/virvhba.c util/virvhba.h \ - util/virxdrdefs.h \ - util/virxml.c util/virxml.h \ - util/virmdev.c util/virmdev.h \ - util/virfilecache.c util/virfilecache.h \ + util/virthread.c util/virthread.h \ + util/virthreadjob.c util/virthreadjob.h \ + util/virthreadpool.c util/virthreadpool.h \ + util/virtime.h util/virtime.c \ + util/virtpm.h util/virtpm.c \ + util/virtypedparam.c util/virtypedparam.h \ + util/virusb.c util/virusb.h \ + util/viruri.h util/viruri.c \ + util/virutil.c util/virutil.h \ + util/viruuid.c util/viruuid.h \ + util/virvhba.c util/virvhba.h \ + util/virxdrdefs.h \ + util/virxml.c util/virxml.h \ + util/virmdev.c util/virmdev.h \ + util/virfilecache.c util/virfilecache.h \ $(NULL) EXTRA_DIST += \ @@ -274,35 +274,35 @@ CLEANFILES += $(KEYMANS) $(KEYPODS) # Internal generic driver infrastructure DATATYPES_SOURCES = datatypes.h datatypes.c -DRIVER_SOURCES = \ - driver.c driver.h \ - driver-hypervisor.h \ - driver-interface.h \ - driver-network.h \ - driver-nodedev.h \ - driver-nwfilter.h \ - driver-secret.h \ - driver-state.h \ - driver-storage.h \ - driver-stream.h \ - internal.h \ - $(DATATYPES_SOURCES) \ - libvirt.c libvirt_internal.h \ - libvirt-domain.c \ - libvirt-domain-snapshot.c \ - libvirt-host.c \ - libvirt-interface.c \ - libvirt-network.c \ - libvirt-nodedev.c \ - libvirt-nwfilter.c \ - libvirt-secret.c \ - libvirt-storage.c \ - libvirt-stream.c \ - locking/lock_manager.c locking/lock_manager.h \ - locking/lock_driver.h \ - locking/lock_driver_nop.h locking/lock_driver_nop.c \ - locking/domain_lock.h locking/domain_lock.c \ - logging/log_manager.c logging/log_manager.h \ +DRIVER_SOURCES = \ + driver.c driver.h \ + driver-hypervisor.h \ + driver-interface.h \ + driver-network.h \ + driver-nodedev.h \ + driver-nwfilter.h \ + driver-secret.h \ + driver-state.h \ + driver-storage.h \ + driver-stream.h \ + internal.h \ + $(DATATYPES_SOURCES) \ + libvirt.c libvirt_internal.h \ + libvirt-domain.c \ + libvirt-domain-snapshot.c \ + libvirt-host.c \ + libvirt-interface.c \ + libvirt-network.c \ + libvirt-nodedev.c \ + libvirt-nwfilter.c \ + libvirt-secret.c \ + libvirt-storage.c \ + libvirt-stream.c \ + locking/lock_manager.c locking/lock_manager.h \ + locking/lock_driver.h \ + locking/lock_driver_nop.h locking/lock_driver_nop.c \ + locking/domain_lock.h locking/domain_lock.c \ + logging/log_manager.c logging/log_manager.h \ $(NULL) LOCK_DRIVER_SANLOCK_SOURCES = \ @@ -390,125 +390,125 @@ logging/log_daemon_dispatch_stubs.h: $(LOG_PROTOCOL) \ $(LOG_PROTOCOL) > $(srcdir)/logging/log_daemon_dispatch_stubs.h -NETDEV_CONF_SOURCES = \ +NETDEV_CONF_SOURCES = \ conf/netdev_bandwidth_conf.h conf/netdev_bandwidth_conf.c \ conf/netdev_vport_profile_conf.h conf/netdev_vport_profile_conf.c \ conf/netdev_vlan_conf.h conf/netdev_vlan_conf.c # XML configuration format handling sources # Domain driver generic impl APIs -DOMAIN_CONF_SOURCES = \ - conf/capabilities.c conf/capabilities.h \ - conf/domain_addr.c conf/domain_addr.h \ - conf/domain_capabilities.c conf/domain_capabilities.h \ - conf/domain_conf.c conf/domain_conf.h \ - conf/domain_audit.c conf/domain_audit.h \ - conf/domain_nwfilter.c conf/domain_nwfilter.h \ - conf/virsavecookie.c conf/virsavecookie.h \ - conf/snapshot_conf.c conf/snapshot_conf.h \ - conf/numa_conf.c conf/numa_conf.h \ +DOMAIN_CONF_SOURCES = \ + conf/capabilities.c conf/capabilities.h \ + conf/domain_addr.c conf/domain_addr.h \ + conf/domain_capabilities.c conf/domain_capabilities.h \ + conf/domain_conf.c conf/domain_conf.h \ + conf/domain_audit.c conf/domain_audit.h \ + conf/domain_nwfilter.c conf/domain_nwfilter.h \ + conf/virsavecookie.c conf/virsavecookie.h \ + conf/snapshot_conf.c conf/snapshot_conf.h \ + conf/numa_conf.c conf/numa_conf.h \ conf/virdomainobjlist.c conf/virdomainobjlist.h -OBJECT_EVENT_SOURCES = \ +OBJECT_EVENT_SOURCES = \ conf/object_event.c conf/object_event.h \ conf/object_event_private.h -DOMAIN_EVENT_SOURCES = \ +DOMAIN_EVENT_SOURCES = \ conf/domain_event.c conf/domain_event.h -NETWORK_EVENT_SOURCES = \ +NETWORK_EVENT_SOURCES = \ conf/network_event.c conf/network_event.h -STORAGE_EVENT_SOURCES = \ +STORAGE_EVENT_SOURCES = \ conf/storage_event.c conf/storage_event.h -NODE_DEVICE_EVENT_SOURCES = \ +NODE_DEVICE_EVENT_SOURCES = \ conf/node_device_event.c conf/node_device_event.h -SECRET_EVENT_SOURCES = \ +SECRET_EVENT_SOURCES = \ conf/secret_event.c conf/secret_event.h # Network driver generic impl APIs -NETWORK_CONF_SOURCES = \ - conf/network_conf.c conf/network_conf.h \ - conf/virnetworkobj.c conf/virnetworkobj.h \ +NETWORK_CONF_SOURCES = \ + conf/network_conf.c conf/network_conf.h \ + conf/virnetworkobj.c conf/virnetworkobj.h \ conf/networkcommon_conf.c conf/networkcommon_conf.h # Network filter driver generic impl APIs -NWFILTER_PARAM_CONF_SOURCES = \ - conf/nwfilter_params.c conf/nwfilter_params.h \ - conf/nwfilter_ipaddrmap.c \ - conf/nwfilter_ipaddrmap.h \ - conf/nwfilter_conf.h \ +NWFILTER_PARAM_CONF_SOURCES = \ + conf/nwfilter_params.c conf/nwfilter_params.h \ + conf/nwfilter_ipaddrmap.c \ + conf/nwfilter_ipaddrmap.h \ + conf/nwfilter_conf.h \ conf/virnwfilterobj.h -NWFILTER_CONF_SOURCES = \ - $(NWFILTER_PARAM_CONF_SOURCES) \ - conf/nwfilter_conf.c conf/nwfilter_conf.h \ +NWFILTER_CONF_SOURCES = \ + $(NWFILTER_PARAM_CONF_SOURCES) \ + conf/nwfilter_conf.c conf/nwfilter_conf.h \ conf/virnwfilterobj.c conf/virnwfilterobj.h # Storage driver generic impl APIs -STORAGE_CONF_SOURCES = \ +STORAGE_CONF_SOURCES = \ conf/storage_adapter_conf.h conf/storage_adapter_conf.c \ - conf/storage_conf.h conf/storage_conf.c \ + conf/storage_conf.h conf/storage_conf.c \ conf/virstorageobj.h conf/virstorageobj.c # Interface driver generic impl APIs -INTERFACE_CONF_SOURCES = \ - conf/interface_conf.c conf/interface_conf.h \ +INTERFACE_CONF_SOURCES = \ + conf/interface_conf.c conf/interface_conf.h \ conf/virinterfaceobj.c conf/virinterfaceobj.h # Secret driver generic impl APIs -SECRET_CONF_SOURCES = \ - conf/secret_conf.h conf/secret_conf.c \ +SECRET_CONF_SOURCES = \ + conf/secret_conf.h conf/secret_conf.c \ conf/virsecretobj.h conf/virsecretobj.c # Network driver generic impl APIs -NODE_DEVICE_CONF_SOURCES = \ +NODE_DEVICE_CONF_SOURCES = \ conf/node_device_conf.c conf/node_device_conf.h \ conf/virnodedeviceobj.c conf/virnodedeviceobj.h -CPU_CONF_SOURCES = \ +CPU_CONF_SOURCES = \ conf/cpu_conf.c conf/cpu_conf.h # Safe character device handling helper APIs -CHRDEV_CONF_SOURCES = \ +CHRDEV_CONF_SOURCES = \ conf/virchrdev.c conf/virchrdev.h # Device Helper APIs -DEVICE_CONF_SOURCES = \ +DEVICE_CONF_SOURCES = \ conf/device_conf.c conf/device_conf.h -CONF_SOURCES = \ - $(NETDEV_CONF_SOURCES) \ - $(DOMAIN_CONF_SOURCES) \ - $(OBJECT_EVENT_SOURCES) \ - $(DOMAIN_EVENT_SOURCES) \ - $(NETWORK_EVENT_SOURCES) \ - $(STORAGE_EVENT_SOURCES) \ - $(NODE_DEVICE_EVENT_SOURCES) \ - $(SECRET_EVENT_SOURCES) \ - $(NETWORK_CONF_SOURCES) \ - $(NWFILTER_CONF_SOURCES) \ - $(NODE_DEVICE_CONF_SOURCES) \ - $(STORAGE_CONF_SOURCES) \ - $(INTERFACE_CONF_SOURCES) \ - $(SECRET_CONF_SOURCES) \ - $(CPU_CONF_SOURCES) \ - $(CHRDEV_CONF_SOURCES) \ +CONF_SOURCES = \ + $(NETDEV_CONF_SOURCES) \ + $(DOMAIN_CONF_SOURCES) \ + $(OBJECT_EVENT_SOURCES) \ + $(DOMAIN_EVENT_SOURCES) \ + $(NETWORK_EVENT_SOURCES) \ + $(STORAGE_EVENT_SOURCES) \ + $(NODE_DEVICE_EVENT_SOURCES) \ + $(SECRET_EVENT_SOURCES) \ + $(NETWORK_CONF_SOURCES) \ + $(NWFILTER_CONF_SOURCES) \ + $(NODE_DEVICE_CONF_SOURCES) \ + $(STORAGE_CONF_SOURCES) \ + $(INTERFACE_CONF_SOURCES) \ + $(SECRET_CONF_SOURCES) \ + $(CPU_CONF_SOURCES) \ + $(CHRDEV_CONF_SOURCES) \ $(DEVICE_CONF_SOURCES) # The remote RPC driver, covering domains, storage, networks, etc REMOTE_DRIVER_GENERATED = \ - remote/remote_protocol.c \ - remote/remote_protocol.h \ - remote/remote_client_bodies.h \ - remote/lxc_protocol.c \ - remote/lxc_protocol.h \ - remote/lxc_client_bodies.h \ - remote/qemu_protocol.c \ - remote/qemu_protocol.h \ - remote/qemu_client_bodies.h \ + remote/remote_protocol.c \ + remote/remote_protocol.h \ + remote/remote_client_bodies.h \ + remote/lxc_protocol.c \ + remote/lxc_protocol.h \ + remote/lxc_client_bodies.h \ + remote/qemu_protocol.c \ + remote/qemu_protocol.h \ + remote/qemu_client_bodies.h \ $(NULL) REMOTE_PROTOCOL = $(srcdir)/remote/remote_protocol.x @@ -534,8 +534,8 @@ remote/qemu_client_bodies.h: $(srcdir)/rpc/gendispatch.pl \ qemu QEMU $(QEMU_PROTOCOL) \ > $(srcdir)/remote/qemu_client_bodies.h -REMOTE_DRIVER_SOURCES = \ - remote/remote_driver.c remote/remote_driver.h \ +REMOTE_DRIVER_SOURCES = \ + remote/remote_driver.c remote/remote_driver.h \ $(REMOTE_DRIVER_GENERATED) EXTRA_DIST += $(REMOTE_DRIVER_PROTOCOL) \ @@ -544,8 +544,8 @@ EXTRA_DIST += $(REMOTE_DRIVER_PROTOCOL) \ ADMIN_PROTOCOL = $(srcdir)/admin/admin_protocol.x ADMIN_PROTOCOL_GENERATED = \ - admin/admin_protocol.c \ - admin/admin_protocol.h \ + admin/admin_protocol.c \ + admin/admin_protocol.h \ admin/admin_client.h admin/admin_client.h: $(srcdir)/rpc/gendispatch.pl \ @@ -587,45 +587,45 @@ struct_prefix = ($(libs_prefix)|$(other_prefix)) # the newest of the two, in case configure options changed and a stale # file is left around from an earlier build. PDWTAGS = \ - $(AM_V_GEN)if (pdwtags --help) > /dev/null 2>&1; then \ - o=`ls -t $(<:.lo=.$(OBJEXT)) \ - $(subst /,/.libs/,$(<:.lo=.$(OBJEXT))) \ - 2>/dev/null | sed -n 1p`; \ - test -f "$$o" || { echo ".o for $< not found" >&2; exit 1; }; \ - pdwtags --verbose $$o > $(@F)-t1 2> $(@F)-t2; \ - if test ! -s $(@F)-t1 && test -s $(@F)-t2; then \ - rm -rf $(@F)-t?; \ + $(AM_V_GEN)if (pdwtags --help) > /dev/null 2>&1; then \ + o=`ls -t $(<:.lo=.$(OBJEXT)) \ + $(subst /,/.libs/,$(<:.lo=.$(OBJEXT))) \ + 2>/dev/null | sed -n 1p`; \ + test -f "$$o" || { echo ".o for $< not found" >&2; exit 1; }; \ + pdwtags --verbose $$o > $(@F)-t1 2> $(@F)-t2; \ + if test ! -s $(@F)-t1 && test -s $(@F)-t2; then \ + rm -rf $(@F)-t?; \ echo 'WARNING: pdwtags appears broken; skipping the $@ test' >&2;\ - else \ - $(PERL) -0777 -n \ - -e 'foreach my $$p (split m!\n*(?:$(r1)|$(r2))\n!) {' \ - -e ' if ($$p =~ /^(struct|enum) $(struct_prefix)/ ||' \ - -e ' $$p =~ /^enum \{/) {' \ - -e ' $$p =~ s!\t*/\*.*?\*/!!sg;' \ - -e ' $$p =~ s!\s+\n!\n!sg;' \ - -e ' $$p =~ s!\s+$$!!;' \ - -e ' $$p =~ s!\t! !g;' \ - -e ' print "$$p\n";' \ - -e ' $$n++;' \ - -e ' }' \ - -e '}' \ - -e 'BEGIN {' \ - -e ' print "/* -*- c -*- */\n";' \ - -e '}' \ - -e 'END {' \ - -e ' if ($$n < 1) {' \ + else \ + $(PERL) -0777 -n \ + -e 'foreach my $$p (split m!\n*(?:$(r1)|$(r2))\n!) {' \ + -e ' if ($$p =~ /^(struct|enum) $(struct_prefix)/ ||' \ + -e ' $$p =~ /^enum \{/) {' \ + -e ' $$p =~ s!\t*/\*.*?\*/!!sg;' \ + -e ' $$p =~ s!\s+\n!\n!sg;' \ + -e ' $$p =~ s!\s+$$!!;' \ + -e ' $$p =~ s!\t! !g;' \ + -e ' print "$$p\n";' \ + -e ' $$n++;' \ + -e ' }' \ + -e '}' \ + -e 'BEGIN {' \ + -e ' print "/* -*- c -*- */\n";' \ + -e '}' \ + -e 'END {' \ + -e ' if ($$n < 1) {' \ -e ' warn "WARNING: your pdwtags program is too old\n";' \ - -e ' warn "WARNING: skipping the $@ test\n";' \ + -e ' warn "WARNING: skipping the $@ test\n";' \ -e ' warn "WARNING: install dwarves-1.3 or newer\n";' \ - -e ' exit 8;' \ - -e ' }' \ - -e '}' \ - < $(@F)-t1 > $(@F)-t3; \ + -e ' exit 8;' \ + -e ' }' \ + -e '}' \ + < $(@F)-t1 > $(@F)-t3; \ case $$? in 8) rm -f $(@F)-t?; exit 0;; 0) ;; *) exit 1;; esac;\ - diff -u $(@)s $(@F)-t3; st=$$?; rm -f $(@F)-t?; exit $$st; \ - fi; \ - else \ - echo 'WARNING: you lack pdwtags; skipping the $@ test' >&2; \ + diff -u $(@)s $(@F)-t3; st=$$?; rm -f $(@F)-t?; exit $$st; \ + fi; \ + else \ + echo 'WARNING: you lack pdwtags; skipping the $@ test' >&2; \ echo 'WARNING: install the dwarves package to get pdwtags' >&2; \ fi @@ -771,17 +771,17 @@ check-local: check-protocol check-symfile check-symsorting \ .PHONY: check-protocol $(PROTOCOL_STRUCTS:structs=struct) # Mock driver, covering domains, storage, networks, etc -TEST_DRIVER_SOURCES = \ +TEST_DRIVER_SOURCES = \ test/test_driver.c test/test_driver.h TEST_DRIVER_ASSETS = test/test-screenshot.png # Now the Hypervisor specific drivers -XEN_DRIVER_SOURCES = \ - xen/block_stats.c xen/block_stats.h \ - xen/xen_hypervisor.c xen/xen_hypervisor.h \ - xen/xen_driver.c xen/xen_driver.h \ - xen/xend_internal.c xen/xend_internal.h \ - xen/xm_internal.c xen/xm_internal.h \ +XEN_DRIVER_SOURCES = \ + xen/block_stats.c xen/block_stats.h \ + xen/xen_hypervisor.c xen/xen_hypervisor.h \ + xen/xen_driver.c xen/xen_driver.h \ + xen/xend_internal.c xen/xend_internal.h \ + xen/xm_internal.c xen/xm_internal.h \ xen/xs_internal.c xen/xs_internal.h if WITH_XEN_INOTIFY XEN_DRIVER_SOURCES += xen/xen_inotify.c xen/xen_inotify.h @@ -829,307 +829,307 @@ BUILT_SOURCES += $(LXC_GENERATED) CLEANFILES += $(LXC_GENERATED) -LXC_DRIVER_SOURCES = \ - $(LXC_MONITOR_PROTOCOL_GENERATED) \ - $(LXC_MONITOR_GENERATED) \ - lxc/lxc_conf.c lxc/lxc_conf.h \ - lxc/lxc_container.c lxc/lxc_container.h \ - lxc/lxc_cgroup.c lxc/lxc_cgroup.h \ - lxc/lxc_domain.c lxc/lxc_domain.h \ - lxc/lxc_hostdev.c lxc/lxc_hostdev.h \ - lxc/lxc_monitor.c lxc/lxc_monitor.h \ - lxc/lxc_process.c lxc/lxc_process.h \ - lxc/lxc_fuse.c lxc/lxc_fuse.h \ - lxc/lxc_native.c lxc/lxc_native.h \ +LXC_DRIVER_SOURCES = \ + $(LXC_MONITOR_PROTOCOL_GENERATED) \ + $(LXC_MONITOR_GENERATED) \ + lxc/lxc_conf.c lxc/lxc_conf.h \ + lxc/lxc_container.c lxc/lxc_container.h \ + lxc/lxc_cgroup.c lxc/lxc_cgroup.h \ + lxc/lxc_domain.c lxc/lxc_domain.h \ + lxc/lxc_hostdev.c lxc/lxc_hostdev.h \ + lxc/lxc_monitor.c lxc/lxc_monitor.h \ + lxc/lxc_process.c lxc/lxc_process.h \ + lxc/lxc_fuse.c lxc/lxc_fuse.h \ + lxc/lxc_native.c lxc/lxc_native.h \ lxc/lxc_driver.c lxc/lxc_driver.h -LXC_CONTROLLER_SOURCES = \ - $(LXC_MONITOR_PROTOCOL_GENERATED) \ - $(LXC_CONTROLLER_GENERATED) \ - lxc/lxc_conf.c lxc/lxc_conf.h \ - lxc/lxc_container.c lxc/lxc_container.h \ - lxc/lxc_cgroup.c lxc/lxc_cgroup.h \ - lxc/lxc_domain.c lxc/lxc_domain.h \ - lxc/lxc_fuse.c lxc/lxc_fuse.h \ +LXC_CONTROLLER_SOURCES = \ + $(LXC_MONITOR_PROTOCOL_GENERATED) \ + $(LXC_CONTROLLER_GENERATED) \ + lxc/lxc_conf.c lxc/lxc_conf.h \ + lxc/lxc_container.c lxc/lxc_container.h \ + lxc/lxc_cgroup.c lxc/lxc_cgroup.h \ + lxc/lxc_domain.c lxc/lxc_domain.h \ + lxc/lxc_fuse.c lxc/lxc_fuse.h \ lxc/lxc_controller.c -SECURITY_DRIVER_APPARMOR_HELPER_SOURCES = \ - $(DATATYPES_SOURCES) \ +SECURITY_DRIVER_APPARMOR_HELPER_SOURCES = \ + $(DATATYPES_SOURCES) \ security/virt-aa-helper.c -PHYP_DRIVER_SOURCES = \ +PHYP_DRIVER_SOURCES = \ phyp/phyp_driver.c phyp/phyp_driver.h -OPENVZ_DRIVER_SOURCES = \ - openvz/openvz_conf.c openvz/openvz_conf.h \ - openvz/openvz_driver.c openvz/openvz_driver.h \ +OPENVZ_DRIVER_SOURCES = \ + openvz/openvz_conf.c openvz/openvz_conf.h \ + openvz/openvz_driver.c openvz/openvz_driver.h \ openvz/openvz_util.c openvz/openvz_util.h -VMWARE_DRIVER_SOURCES = \ - vmware/vmware_driver.c vmware/vmware_driver.h \ +VMWARE_DRIVER_SOURCES = \ + vmware/vmware_driver.c vmware/vmware_driver.h \ vmware/vmware_conf.c vmware/vmware_conf.h -VBOX_DRIVER_SOURCES = \ - vbox/vbox_glue.c vbox/vbox_glue.h \ - vbox/vbox_driver.c vbox/vbox_driver.h \ - vbox/vbox_snapshot_conf.c vbox/vbox_snapshot_conf.h \ - vbox/vbox_V4_0.c vbox/vbox_CAPI_v4_0.h \ - vbox/vbox_V4_1.c vbox/vbox_CAPI_v4_1.h \ - vbox/vbox_V4_2.c vbox/vbox_CAPI_v4_2.h \ - vbox/vbox_V4_2_20.c vbox/vbox_CAPI_v4_2_20.h \ - vbox/vbox_V4_3.c vbox/vbox_CAPI_v4_3.h \ - vbox/vbox_V4_3_4.c vbox/vbox_CAPI_v4_3_4.h \ - vbox/vbox_V5_0.c vbox/vbox_CAPI_v5_0.h \ - vbox/vbox_V5_1.c vbox/vbox_CAPI_v5_1.h \ - vbox/vbox_common.c vbox/vbox_common.h \ - vbox/vbox_uniformed_api.h \ - vbox/vbox_get_driver.h \ - vbox/vbox_network.c \ +VBOX_DRIVER_SOURCES = \ + vbox/vbox_glue.c vbox/vbox_glue.h \ + vbox/vbox_driver.c vbox/vbox_driver.h \ + vbox/vbox_snapshot_conf.c vbox/vbox_snapshot_conf.h \ + vbox/vbox_V4_0.c vbox/vbox_CAPI_v4_0.h \ + vbox/vbox_V4_1.c vbox/vbox_CAPI_v4_1.h \ + vbox/vbox_V4_2.c vbox/vbox_CAPI_v4_2.h \ + vbox/vbox_V4_2_20.c vbox/vbox_CAPI_v4_2_20.h \ + vbox/vbox_V4_3.c vbox/vbox_CAPI_v4_3.h \ + vbox/vbox_V4_3_4.c vbox/vbox_CAPI_v4_3_4.h \ + vbox/vbox_V5_0.c vbox/vbox_CAPI_v5_0.h \ + vbox/vbox_V5_1.c vbox/vbox_CAPI_v5_1.h \ + vbox/vbox_common.c vbox/vbox_common.h \ + vbox/vbox_uniformed_api.h \ + vbox/vbox_get_driver.h \ + vbox/vbox_network.c \ vbox/vbox_storage.c -VBOX_DRIVER_EXTRA_DIST = \ - vbox/vbox_tmpl.c vbox/README \ - vbox/vbox_MSCOMGlue.c vbox/vbox_MSCOMGlue.h \ +VBOX_DRIVER_EXTRA_DIST = \ + vbox/vbox_tmpl.c vbox/README \ + vbox/vbox_MSCOMGlue.c vbox/vbox_MSCOMGlue.h \ vbox/vbox_XPCOMCGlue.c vbox/vbox_XPCOMCGlue.h -QEMU_DRIVER_SOURCES = \ - qemu/qemu_agent.c qemu/qemu_agent.h \ - qemu/qemu_alias.c qemu/qemu_alias.h \ - qemu/qemu_block.c qemu/qemu_block.h \ - qemu/qemu_blockjob.c qemu/qemu_blockjob.h \ - qemu/qemu_capabilities.c qemu/qemu_capabilities.h \ - qemu/qemu_command.c qemu/qemu_command.h \ - qemu/qemu_parse_command.c qemu/qemu_parse_command.h \ - qemu/qemu_domain.c qemu/qemu_domain.h \ - qemu/qemu_domain_address.c qemu/qemu_domain_address.h \ - qemu/qemu_cgroup.c qemu/qemu_cgroup.h \ - qemu/qemu_hostdev.c qemu/qemu_hostdev.h \ - qemu/qemu_hotplug.c qemu/qemu_hotplug.h \ - qemu/qemu_hotplugpriv.h \ - qemu/qemu_conf.c qemu/qemu_conf.h \ - qemu/qemu_process.c qemu/qemu_process.h \ - qemu/qemu_processpriv.h \ - qemu/qemu_migration.c qemu/qemu_migration.h \ +QEMU_DRIVER_SOURCES = \ + qemu/qemu_agent.c qemu/qemu_agent.h \ + qemu/qemu_alias.c qemu/qemu_alias.h \ + qemu/qemu_block.c qemu/qemu_block.h \ + qemu/qemu_blockjob.c qemu/qemu_blockjob.h \ + qemu/qemu_capabilities.c qemu/qemu_capabilities.h \ + qemu/qemu_command.c qemu/qemu_command.h \ + qemu/qemu_parse_command.c qemu/qemu_parse_command.h \ + qemu/qemu_domain.c qemu/qemu_domain.h \ + qemu/qemu_domain_address.c qemu/qemu_domain_address.h \ + qemu/qemu_cgroup.c qemu/qemu_cgroup.h \ + qemu/qemu_hostdev.c qemu/qemu_hostdev.h \ + qemu/qemu_hotplug.c qemu/qemu_hotplug.h \ + qemu/qemu_hotplugpriv.h \ + qemu/qemu_conf.c qemu/qemu_conf.h \ + qemu/qemu_process.c qemu/qemu_process.h \ + qemu/qemu_processpriv.h \ + qemu/qemu_migration.c qemu/qemu_migration.h \ qemu/qemu_migration_cookie.c qemu/qemu_migration_cookie.h \ - qemu/qemu_monitor.c qemu/qemu_monitor.h \ - qemu/qemu_monitor_text.c \ - qemu/qemu_monitor_text.h \ - qemu/qemu_monitor_json.c \ - qemu/qemu_monitor_json.h \ - qemu/qemu_driver.c qemu/qemu_driver.h \ - qemu/qemu_interface.c qemu/qemu_interface.h \ - qemu/qemu_capspriv.h \ + qemu/qemu_monitor.c qemu/qemu_monitor.h \ + qemu/qemu_monitor_text.c \ + qemu/qemu_monitor_text.h \ + qemu/qemu_monitor_json.c \ + qemu/qemu_monitor_json.h \ + qemu/qemu_driver.c qemu/qemu_driver.h \ + qemu/qemu_interface.c qemu/qemu_interface.h \ + qemu/qemu_capspriv.h \ qemu/qemu_security.c qemu/qemu_security.h -XENAPI_DRIVER_SOURCES = \ - xenapi/xenapi_driver.c xenapi/xenapi_driver.h \ - xenapi/xenapi_driver_private.h \ +XENAPI_DRIVER_SOURCES = \ + xenapi/xenapi_driver.c xenapi/xenapi_driver.h \ + xenapi/xenapi_driver_private.h \ xenapi/xenapi_utils.c xenapi/xenapi_utils.h -LIBXL_DRIVER_SOURCES = \ - libxl/libxl_conf.c libxl/libxl_conf.h \ - libxl/libxl_capabilities.c libxl/libxl_capabilities.h \ - libxl/libxl_domain.c libxl/libxl_domain.h \ - libxl/libxl_driver.c libxl/libxl_driver.h \ - libxl/libxl_logger.c libxl/libxl_logger.h \ +LIBXL_DRIVER_SOURCES = \ + libxl/libxl_conf.c libxl/libxl_conf.h \ + libxl/libxl_capabilities.c libxl/libxl_capabilities.h \ + libxl/libxl_domain.c libxl/libxl_domain.h \ + libxl/libxl_driver.c libxl/libxl_driver.h \ + libxl/libxl_logger.c libxl/libxl_logger.h \ libxl/libxl_migration.c libxl/libxl_migration.h -UML_DRIVER_SOURCES = \ - uml/uml_conf.c uml/uml_conf.h \ +UML_DRIVER_SOURCES = \ + uml/uml_conf.c uml/uml_conf.h \ uml/uml_driver.c uml/uml_driver.h -ESX_DRIVER_SOURCES = \ - esx/esx_private.h \ - esx/esx_driver.c esx/esx_driver.h \ - esx/esx_interface_driver.c esx/esx_interface_driver.h \ - esx/esx_network_driver.c esx/esx_network_driver.h \ - esx/esx_storage_driver.c esx/esx_storage_driver.h \ - esx/esx_storage_backend_vmfs.c esx/esx_storage_backend_vmfs.h \ - esx/esx_storage_backend_iscsi.c esx/esx_storage_backend_iscsi.h \ - esx/esx_stream.c esx/esx_stream.h \ - esx/esx_util.c esx/esx_util.h \ - esx/esx_vi.c esx/esx_vi.h \ - esx/esx_vi_methods.c esx/esx_vi_methods.h \ +ESX_DRIVER_SOURCES = \ + esx/esx_private.h \ + esx/esx_driver.c esx/esx_driver.h \ + esx/esx_interface_driver.c esx/esx_interface_driver.h \ + esx/esx_network_driver.c esx/esx_network_driver.h \ + esx/esx_storage_driver.c esx/esx_storage_driver.h \ + esx/esx_storage_backend_vmfs.c esx/esx_storage_backend_vmfs.h \ + esx/esx_storage_backend_iscsi.c esx/esx_storage_backend_iscsi.h \ + esx/esx_stream.c esx/esx_stream.h \ + esx/esx_util.c esx/esx_util.h \ + esx/esx_vi.c esx/esx_vi.h \ + esx/esx_vi_methods.c esx/esx_vi_methods.h \ esx/esx_vi_types.c esx/esx_vi_types.h -ESX_DRIVER_GENERATED = \ - esx/esx_vi_methods.generated.c \ - esx/esx_vi_methods.generated.h \ - esx/esx_vi_methods.generated.macro \ - esx/esx_vi_types.generated.c \ - esx/esx_vi_types.generated.h \ - esx/esx_vi_types.generated.typedef \ - esx/esx_vi_types.generated.typeenum \ - esx/esx_vi_types.generated.typetostring \ - esx/esx_vi_types.generated.typefromstring \ - esx/esx_vi.generated.c \ +ESX_DRIVER_GENERATED = \ + esx/esx_vi_methods.generated.c \ + esx/esx_vi_methods.generated.h \ + esx/esx_vi_methods.generated.macro \ + esx/esx_vi_types.generated.c \ + esx/esx_vi_types.generated.h \ + esx/esx_vi_types.generated.typedef \ + esx/esx_vi_types.generated.typeenum \ + esx/esx_vi_types.generated.typetostring \ + esx/esx_vi_types.generated.typefromstring \ + esx/esx_vi.generated.c \ esx/esx_vi.generated.h -ESX_DRIVER_EXTRA_DIST = \ - esx/README \ - esx/esx_vi_generator.input \ - esx/esx_vi_generator.py \ +ESX_DRIVER_EXTRA_DIST = \ + esx/README \ + esx/esx_vi_generator.input \ + esx/esx_vi_generator.py \ $(ESX_DRIVER_GENERATED) -HYPERV_DRIVER_SOURCES = \ - hyperv/hyperv_private.h \ - hyperv/hyperv_driver.c hyperv/hyperv_driver.h \ - hyperv/hyperv_util.c hyperv/hyperv_util.h \ - hyperv/hyperv_wmi.c hyperv/hyperv_wmi.h \ - hyperv/hyperv_wmi_classes.c hyperv/hyperv_wmi_classes.h \ +HYPERV_DRIVER_SOURCES = \ + hyperv/hyperv_private.h \ + hyperv/hyperv_driver.c hyperv/hyperv_driver.h \ + hyperv/hyperv_util.c hyperv/hyperv_util.h \ + hyperv/hyperv_wmi.c hyperv/hyperv_wmi.h \ + hyperv/hyperv_wmi_classes.c hyperv/hyperv_wmi_classes.h \ hyperv/openwsman.h -HYPERV_DRIVER_GENERATED = \ - hyperv/hyperv_wmi_classes.generated.c \ - hyperv/hyperv_wmi_classes.generated.h \ +HYPERV_DRIVER_GENERATED = \ + hyperv/hyperv_wmi_classes.generated.c \ + hyperv/hyperv_wmi_classes.generated.h \ hyperv/hyperv_wmi_classes.generated.typedef -HYPERV_DRIVER_EXTRA_DIST = \ - hyperv/hyperv_wmi_generator.input \ - hyperv/hyperv_wmi_generator.py \ +HYPERV_DRIVER_EXTRA_DIST = \ + hyperv/hyperv_wmi_generator.input \ + hyperv/hyperv_wmi_generator.py \ $(HYPERV_DRIVER_GENERATED) -VZ_DRIVER_SOURCES = \ - vz/vz_driver.h \ - vz/vz_driver.c \ - vz/vz_utils.c \ - vz/vz_utils.h \ - vz/vz_sdk.h \ +VZ_DRIVER_SOURCES = \ + vz/vz_driver.h \ + vz/vz_driver.c \ + vz/vz_utils.c \ + vz/vz_utils.h \ + vz/vz_sdk.h \ vz/vz_sdk.c -BHYVE_DRIVER_SOURCES = \ - bhyve/bhyve_capabilities.c \ - bhyve/bhyve_capabilities.h \ - bhyve/bhyve_command.c \ - bhyve/bhyve_command.h \ - bhyve/bhyve_conf.c \ - bhyve/bhyve_conf.h \ - bhyve/bhyve_parse_command.c \ - bhyve/bhyve_parse_command.h \ - bhyve/bhyve_device.c \ - bhyve/bhyve_device.h \ - bhyve/bhyve_domain.c \ - bhyve/bhyve_domain.h \ - bhyve/bhyve_driver.h \ - bhyve/bhyve_driver.c \ - bhyve/bhyve_monitor.c \ - bhyve/bhyve_monitor.h \ - bhyve/bhyve_process.c \ - bhyve/bhyve_process.h \ - bhyve/bhyve_utils.h \ +BHYVE_DRIVER_SOURCES = \ + bhyve/bhyve_capabilities.c \ + bhyve/bhyve_capabilities.h \ + bhyve/bhyve_command.c \ + bhyve/bhyve_command.h \ + bhyve/bhyve_conf.c \ + bhyve/bhyve_conf.h \ + bhyve/bhyve_parse_command.c \ + bhyve/bhyve_parse_command.h \ + bhyve/bhyve_device.c \ + bhyve/bhyve_device.h \ + bhyve/bhyve_domain.c \ + bhyve/bhyve_domain.h \ + bhyve/bhyve_driver.h \ + bhyve/bhyve_driver.c \ + bhyve/bhyve_monitor.c \ + bhyve/bhyve_monitor.h \ + bhyve/bhyve_process.c \ + bhyve/bhyve_process.h \ + bhyve/bhyve_utils.h \ $(NULL) -NETWORK_DRIVER_SOURCES = \ +NETWORK_DRIVER_SOURCES = \ network/bridge_driver.h network/bridge_driver.c \ - network/bridge_driver_platform.h \ - network/bridge_driver_platform.c \ + network/bridge_driver_platform.h \ + network/bridge_driver_platform.c \ $(NULL) EXTRA_DIST += network/bridge_driver_linux.c network/bridge_driver_nop.c INTERFACE_DRIVER_SOURCES = if WITH_INTERFACE -INTERFACE_DRIVER_SOURCES += \ - interface/interface_driver.h \ +INTERFACE_DRIVER_SOURCES += \ + interface/interface_driver.h \ interface/interface_driver.c if WITH_NETCF -INTERFACE_DRIVER_SOURCES += \ +INTERFACE_DRIVER_SOURCES += \ interface/interface_backend_netcf.c endif WITH_NETCF if WITH_UDEV -INTERFACE_DRIVER_SOURCES += \ +INTERFACE_DRIVER_SOURCES += \ interface/interface_backend_udev.c endif WITH_UDEV endif WITH_INTERFACE -SECRET_UTIL_SOURCES = \ +SECRET_UTIL_SOURCES = \ secret/secret_util.h secret/secret_util.c -SECRET_DRIVER_SOURCES = \ +SECRET_DRIVER_SOURCES = \ secret/secret_driver.h secret/secret_driver.c # Storage backend specific impls STORAGE_DRIVER_BACKEND_SOURCES = \ storage/storage_backend.h storage/storage_backend.c -STORAGE_DRIVER_SOURCES = \ - storage/storage_driver.h storage/storage_driver.c \ - storage/storage_source.h storage/storage_source.c \ +STORAGE_DRIVER_SOURCES = \ + storage/storage_driver.h storage/storage_driver.c \ + storage/storage_source.h storage/storage_source.c \ $(STORAGE_DRIVER_BACKEND_SOURCES) \ storage/storage_util.h storage/storage_util.c -STORAGE_DRIVER_FS_SOURCES = \ +STORAGE_DRIVER_FS_SOURCES = \ storage/storage_backend_fs.h storage/storage_backend_fs.c -STORAGE_DRIVER_LVM_SOURCES = \ - storage/storage_backend_logical.h \ +STORAGE_DRIVER_LVM_SOURCES = \ + storage/storage_backend_logical.h \ storage/storage_backend_logical.c -STORAGE_DRIVER_ISCSI_SOURCES = \ +STORAGE_DRIVER_ISCSI_SOURCES = \ storage/storage_backend_iscsi.h storage/storage_backend_iscsi.c -STORAGE_DRIVER_SCSI_SOURCES = \ +STORAGE_DRIVER_SCSI_SOURCES = \ storage/storage_backend_scsi.h storage/storage_backend_scsi.c -STORAGE_DRIVER_MPATH_SOURCES = \ +STORAGE_DRIVER_MPATH_SOURCES = \ storage/storage_backend_mpath.h storage/storage_backend_mpath.c -STORAGE_DRIVER_DISK_SOURCES = \ +STORAGE_DRIVER_DISK_SOURCES = \ storage/storage_backend_disk.h storage/storage_backend_disk.c -STORAGE_DRIVER_RBD_SOURCES = \ +STORAGE_DRIVER_RBD_SOURCES = \ storage/storage_backend_rbd.h storage/storage_backend_rbd.c -STORAGE_DRIVER_SHEEPDOG_SOURCES = \ +STORAGE_DRIVER_SHEEPDOG_SOURCES = \ storage/storage_backend_sheepdog.h storage/storage_backend_sheepdog.c \ storage/storage_backend_sheepdog_priv.h -STORAGE_DRIVER_GLUSTER_SOURCES = \ +STORAGE_DRIVER_GLUSTER_SOURCES = \ storage/storage_backend_gluster.h storage/storage_backend_gluster.c -STORAGE_DRIVER_ZFS_SOURCES = \ +STORAGE_DRIVER_ZFS_SOURCES = \ storage/storage_backend_zfs.h storage/storage_backend_zfs.c -STORAGE_DRIVER_VSTORAGE_SOURCES = \ - storage/storage_backend_vstorage.h \ +STORAGE_DRIVER_VSTORAGE_SOURCES = \ + storage/storage_backend_vstorage.h \ storage/storage_backend_vstorage.c -STORAGE_HELPER_DISK_SOURCES = \ +STORAGE_HELPER_DISK_SOURCES = \ storage/parthelper.c -UTIL_IO_HELPER_SOURCES = \ +UTIL_IO_HELPER_SOURCES = \ util/iohelper.c -NETWORK_LEASES_HELPER_SOURCES = \ +NETWORK_LEASES_HELPER_SOURCES = \ network/leaseshelper.c # Network filters -NWFILTER_DRIVER_SOURCES = \ - nwfilter/nwfilter_driver.h nwfilter/nwfilter_driver.c \ - nwfilter/nwfilter_tech_driver.h \ - nwfilter/nwfilter_gentech_driver.c \ - nwfilter/nwfilter_gentech_driver.h \ - nwfilter/nwfilter_dhcpsnoop.c \ - nwfilter/nwfilter_dhcpsnoop.h \ - nwfilter/nwfilter_ebiptables_driver.c \ - nwfilter/nwfilter_ebiptables_driver.h \ - nwfilter/nwfilter_learnipaddr.c \ +NWFILTER_DRIVER_SOURCES = \ + nwfilter/nwfilter_driver.h nwfilter/nwfilter_driver.c \ + nwfilter/nwfilter_tech_driver.h \ + nwfilter/nwfilter_gentech_driver.c \ + nwfilter/nwfilter_gentech_driver.h \ + nwfilter/nwfilter_dhcpsnoop.c \ + nwfilter/nwfilter_dhcpsnoop.h \ + nwfilter/nwfilter_ebiptables_driver.c \ + nwfilter/nwfilter_ebiptables_driver.h \ + nwfilter/nwfilter_learnipaddr.c \ nwfilter/nwfilter_learnipaddr.h # Security framework and drivers for various models -SECURITY_DRIVER_SOURCES = \ - security/security_driver.h security/security_driver.c \ - security/security_nop.h security/security_nop.c \ - security/security_stack.h security/security_stack.c \ - security/security_dac.h security/security_dac.c \ +SECURITY_DRIVER_SOURCES = \ + security/security_driver.h security/security_driver.c \ + security/security_nop.h security/security_nop.c \ + security/security_stack.h security/security_stack.c \ + security/security_dac.h security/security_dac.c \ security/security_manager.h security/security_manager.c -SECURITY_DRIVER_SELINUX_SOURCES = \ +SECURITY_DRIVER_SELINUX_SOURCES = \ security/security_selinux.h security/security_selinux.c -SECURITY_DRIVER_APPARMOR_SOURCES = \ +SECURITY_DRIVER_APPARMOR_SOURCES = \ security/security_apparmor.h security/security_apparmor.c ACCESS_DRIVER_GENERATED = \ @@ -1165,40 +1165,40 @@ ACCESS_DRIVER_POLKIT_POLICY = \ $(srcdir)/access/org.libvirt.api.policy -NODE_DEVICE_DRIVER_SOURCES = \ - node_device/node_device_driver.c \ - node_device/node_device_driver.h \ - node_device/node_device_linux_sysfs.c \ +NODE_DEVICE_DRIVER_SOURCES = \ + node_device/node_device_driver.c \ + node_device/node_device_driver.h \ + node_device/node_device_linux_sysfs.c \ node_device/node_device_linux_sysfs.h -NODE_DEVICE_DRIVER_HAL_SOURCES = \ - node_device/node_device_hal.c \ +NODE_DEVICE_DRIVER_HAL_SOURCES = \ + node_device/node_device_hal.c \ node_device/node_device_hal.h -NODE_DEVICE_DRIVER_UDEV_SOURCES = \ - node_device/node_device_udev.c \ +NODE_DEVICE_DRIVER_UDEV_SOURCES = \ + node_device/node_device_udev.c \ node_device/node_device_udev.h -CPU_SOURCES = \ - cpu/cpu.h cpu/cpu.c \ - cpu/cpu_x86.h cpu/cpu_x86.c cpu/cpu_x86_data.h \ - cpu/cpu_s390.h cpu/cpu_s390.c \ - cpu/cpu_arm.h cpu/cpu_arm.c \ - cpu/cpu_ppc64.h cpu/cpu_ppc64.c \ - cpu/cpu_ppc64_data.h \ +CPU_SOURCES = \ + cpu/cpu.h cpu/cpu.c \ + cpu/cpu_x86.h cpu/cpu_x86.c cpu/cpu_x86_data.h \ + cpu/cpu_s390.h cpu/cpu_s390.c \ + cpu/cpu_arm.h cpu/cpu_arm.c \ + cpu/cpu_ppc64.h cpu/cpu_ppc64.c \ + cpu/cpu_ppc64_data.h \ cpu/cpu_map.h cpu/cpu_map.c -VMX_SOURCES = \ +VMX_SOURCES = \ vmx/vmx.c vmx/vmx.h -XENCONFIG_SOURCES = \ - xenconfig/xenxs_private.h \ - xenconfig/xen_common.c xenconfig/xen_common.h \ - xenconfig/xen_sxpr.c xenconfig/xen_sxpr.h \ +XENCONFIG_SOURCES = \ + xenconfig/xenxs_private.h \ + xenconfig/xen_common.c xenconfig/xen_common.h \ + xenconfig/xen_sxpr.c xenconfig/xen_sxpr.h \ xenconfig/xen_xm.c xenconfig/xen_xm.h if WITH_LIBXL -XENCONFIG_LIBXL_SOURCES = \ - $(XENCONFIG_SOURCES) \ +XENCONFIG_LIBXL_SOURCES = \ + $(XENCONFIG_SOURCES) \ xenconfig/xen_xl.c xenconfig/xen_xl.h endif WITH_LIBXL @@ -1215,11 +1215,11 @@ EXTRA_DIST += $(pkgdata_DATA) noinst_LTLIBRARIES = libvirt_util.la libvirt_la_LIBADD = $(libvirt_la_BUILT_LIBADD) libvirt_la_BUILT_LIBADD = libvirt_util.la -libvirt_util_la_SOURCES = \ +libvirt_util_la_SOURCES = \ $(UTIL_SOURCES) libvirt_util_la_CFLAGS = $(CAPNG_CFLAGS) $(YAJL_CFLAGS) $(LIBNL_CFLAGS) \ $(AM_CFLAGS) $(AUDIT_CFLAGS) $(DEVMAPPER_CFLAGS) \ - $(DBUS_CFLAGS) $(LDEXP_LIBM) $(NUMACTL_CFLAGS) \ + $(DBUS_CFLAGS) $(LDEXP_LIBM) $(NUMACTL_CFLAGS) \ $(POLKIT_CFLAGS) $(GNUTLS_CFLAGS) $(ACL_CFLAGS) libvirt_util_la_LIBADD = $(CAPNG_LIBS) $(YAJL_LIBS) $(LIBNL_LIBS) \ $(THREAD_LIBS) $(AUDIT_LIBS) $(DEVMAPPER_LIBS) \ @@ -1308,11 +1308,11 @@ endif WITH_TEST if WITH_REMOTE noinst_LTLIBRARIES += libvirt_driver_remote.la libvirt_la_BUILT_LIBADD += libvirt_driver_remote.la -libvirt_driver_remote_la_CFLAGS = \ - $(GNUTLS_CFLAGS) \ - $(XDR_CFLAGS) \ - -I$(srcdir)/conf \ - -I$(srcdir)/rpc \ +libvirt_driver_remote_la_CFLAGS = \ + $(GNUTLS_CFLAGS) \ + $(XDR_CFLAGS) \ + -I$(srcdir)/conf \ + -I$(srcdir)/rpc \ $(AM_CFLAGS) libvirt_driver_remote_la_LDFLAGS = $(AM_LDFLAGS) libvirt_driver_remote_la_LIBADD = $(GNUTLS_LIBS) \ @@ -1341,11 +1341,11 @@ mod_LTLIBRARIES += libvirt_driver_xen.la libvirt_driver_xen_la_LIBADD += ../gnulib/lib/libgnu.la libvirt_driver_xen_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS) -libvirt_driver_xen_impl_la_CFLAGS = \ - $(XEN_CFLAGS) \ - -I$(srcdir)/access \ - -I$(srcdir)/conf \ - -I$(srcdir)/xenconfig \ +libvirt_driver_xen_impl_la_CFLAGS = \ + $(XEN_CFLAGS) \ + -I$(srcdir)/access \ + -I$(srcdir)/conf \ + -I$(srcdir)/xenconfig \ $(AM_CFLAGS) libvirt_driver_xen_impl_la_LDFLAGS = $(AM_LDFLAGS) libvirt_driver_xen_impl_la_LIBADD = $(XEN_LIBS) libvirt_xenconfig.la @@ -1387,13 +1387,13 @@ mod_LTLIBRARIES += \ libvirt_driver_vbox_la_LIBADD += ../gnulib/lib/libgnu.la libvirt_driver_vbox_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS) -libvirt_driver_vbox_impl_la_CFLAGS = \ - -I$(srcdir)/conf \ - $(AM_CFLAGS) \ +libvirt_driver_vbox_impl_la_CFLAGS = \ + -I$(srcdir)/conf \ + $(AM_CFLAGS) \ -DVBOX_DRIVER libvirt_driver_vbox_impl_la_LDFLAGS = $(AM_LDFLAGS) -libvirt_driver_vbox_impl_la_LIBADD = $(DLOPEN_LIBS) \ - $(WIN32_EXTRA_LIBS) \ +libvirt_driver_vbox_impl_la_LIBADD = $(DLOPEN_LIBS) \ + $(WIN32_EXTRA_LIBS) \ $(LIBXML_LIBS) libvirt_driver_vbox_impl_la_SOURCES = $(VBOX_DRIVER_SOURCES) endif WITH_VBOX @@ -1416,12 +1416,12 @@ mod_LTLIBRARIES += libvirt_driver_libxl.la libvirt_driver_libxl_la_LIBADD += ../gnulib/lib/libgnu.la libvirt_driver_libxl_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS) -libvirt_driver_libxl_impl_la_CFLAGS = \ - $(LIBXL_CFLAGS) \ - -I$(srcdir)/access \ - -I$(srcdir)/conf \ - -I$(srcdir)/secret \ - -I$(srcdir)/xenconfig \ +libvirt_driver_libxl_impl_la_CFLAGS = \ + $(LIBXL_CFLAGS) \ + -I$(srcdir)/access \ + -I$(srcdir)/conf \ + -I$(srcdir)/secret \ + -I$(srcdir)/xenconfig \ $(AM_CFLAGS) libvirt_driver_libxl_impl_la_LDFLAGS = $(AM_LDFLAGS) libvirt_driver_libxl_impl_la_LIBADD = $(LIBXL_LIBS) \ @@ -1706,7 +1706,7 @@ libvirt_driver_storage_impl_la_SOURCES += $(STORAGE_DRIVER_SOURCES) libvirt_storage_backend_fs_la_SOURCES = $(STORAGE_DRIVER_FS_SOURCES) -libvirt_storage_backend_fs_la_CFLAGS = \ +libvirt_storage_backend_fs_la_CFLAGS = \ -I$(srcdir)/conf \ $(AM_CFLAGS) @@ -1755,7 +1755,7 @@ if WITH_STORAGE_MPATH libvirt_storage_backend_mpath_la_SOURCES = \ $(STORAGE_DRIVER_MPATH_SOURCES) libvirt_storage_backend_mpath_la_LIBADD = $(DEVMAPPER_LIBS) -libvirt_storage_backend_mpath_la_CFLAGS = \ +libvirt_storage_backend_mpath_la_CFLAGS = \ -I$(srcdir)/conf \ $(DEVMAPPER_CFLAGS) \ $(AM_CFLAGS) @@ -1767,7 +1767,7 @@ endif WITH_STORAGE_MPATH if WITH_STORAGE_DISK libvirt_storage_backend_disk_la_SOURCES = $(STORAGE_DRIVER_DISK_SOURCES) -libvirt_storage_backend_disk_la_CFLAGS = \ +libvirt_storage_backend_disk_la_CFLAGS = \ -I$(srcdir)/conf \ $(AM_CFLAGS) @@ -1825,7 +1825,7 @@ endif WITH_STORAGE_GLUSTER if WITH_STORAGE_ZFS libvirt_storage_backend_zfs_la_SOURCES = $(STORAGE_DRIVER_ZFS_SOURCES) -libvirt_storage_backend_zfs_la_CFLAGS = \ +libvirt_storage_backend_zfs_la_CFLAGS = \ -I$(srcdir)/conf \ $(AM_CFLAGS) @@ -1837,7 +1837,7 @@ endif WITH_STORAGE_ZFS if WITH_STORAGE_VSTORAGE libvirt_storage_backend_vstorage_la_SOURCES = \ $(STORAGE_DRIVER_VSTORAGE_SOURCES) -libvirt_storage_backend_vstorage_la_CFLAGS = \ +libvirt_storage_backend_vstorage_la_CFLAGS = \ -I$(srcdir)/conf \ $(AM_CFLAGS) @@ -2009,51 +2009,51 @@ access/viraccessapichecklxc.c: $(srcdir)/rpc/gendispatch.pl \ > $(srcdir)/access/viraccessapichecklxc.c # Add all conditional sources just in case... -EXTRA_DIST += \ - $(TEST_DRIVER_SOURCES) \ - $(TEST_DRIVER_ASSETS) \ - $(REMOTE_DRIVER_SOURCES) \ - $(XEN_DRIVER_SOURCES) \ - $(QEMU_DRIVER_SOURCES) \ - $(LXC_DRIVER_SOURCES) \ - $(UML_DRIVER_SOURCES) \ - $(OPENVZ_DRIVER_SOURCES) \ - $(PHYP_DRIVER_SOURCES) \ - $(VBOX_DRIVER_SOURCES) \ - $(XENAPI_DRIVER_SOURCES) \ - $(LIBXL_DRIVER_SOURCES) \ - $(ESX_DRIVER_SOURCES) \ - $(ESX_DRIVER_EXTRA_DIST) \ - $(HYPERV_DRIVER_SOURCES) \ - $(HYPERV_DRIVER_EXTRA_DIST) \ - $(VZ_DRIVER_SOURCES) \ - $(BHYVE_DRIVER_SOURCES) \ - $(NETWORK_DRIVER_SOURCES) \ - $(INTERFACE_DRIVER_SOURCES) \ - $(STORAGE_DRIVER_SOURCES) \ - $(STORAGE_DRIVER_FS_SOURCES) \ - $(STORAGE_DRIVER_LVM_SOURCES) \ - $(STORAGE_DRIVER_ISCSI_SOURCES) \ - $(STORAGE_DRIVER_SCSI_SOURCES) \ - $(STORAGE_DRIVER_MPATH_SOURCES) \ - $(STORAGE_DRIVER_DISK_SOURCES) \ - $(STORAGE_DRIVER_RBD_SOURCES) \ - $(STORAGE_DRIVER_SHEEPDOG_SOURCES) \ - $(STORAGE_DRIVER_GLUSTER_SOURCES) \ - $(STORAGE_DRIVER_ZFS_SOURCES) \ - $(STORAGE_DRIVER_VSTORAGE_SOURCES) \ - $(NODE_DEVICE_DRIVER_SOURCES) \ - $(NODE_DEVICE_DRIVER_HAL_SOURCES) \ - $(NODE_DEVICE_DRIVER_UDEV_SOURCES) \ - $(NWFILTER_DRIVER_SOURCES) \ - $(SECURITY_DRIVER_SELINUX_SOURCES) \ - $(SECURITY_DRIVER_APPARMOR_SOURCES) \ - $(SECRET_DRIVER_SOURCES) \ - $(SECRET_UTIL_SOURCES) \ - $(VBOX_DRIVER_EXTRA_DIST) \ - $(VMWARE_DRIVER_SOURCES) \ - $(XENCONFIG_SOURCES) \ - $(XENCONFIG_LIBXL_SOURCES) \ +EXTRA_DIST += \ + $(TEST_DRIVER_SOURCES) \ + $(TEST_DRIVER_ASSETS) \ + $(REMOTE_DRIVER_SOURCES) \ + $(XEN_DRIVER_SOURCES) \ + $(QEMU_DRIVER_SOURCES) \ + $(LXC_DRIVER_SOURCES) \ + $(UML_DRIVER_SOURCES) \ + $(OPENVZ_DRIVER_SOURCES) \ + $(PHYP_DRIVER_SOURCES) \ + $(VBOX_DRIVER_SOURCES) \ + $(XENAPI_DRIVER_SOURCES) \ + $(LIBXL_DRIVER_SOURCES) \ + $(ESX_DRIVER_SOURCES) \ + $(ESX_DRIVER_EXTRA_DIST) \ + $(HYPERV_DRIVER_SOURCES) \ + $(HYPERV_DRIVER_EXTRA_DIST) \ + $(VZ_DRIVER_SOURCES) \ + $(BHYVE_DRIVER_SOURCES) \ + $(NETWORK_DRIVER_SOURCES) \ + $(INTERFACE_DRIVER_SOURCES) \ + $(STORAGE_DRIVER_SOURCES) \ + $(STORAGE_DRIVER_FS_SOURCES) \ + $(STORAGE_DRIVER_LVM_SOURCES) \ + $(STORAGE_DRIVER_ISCSI_SOURCES) \ + $(STORAGE_DRIVER_SCSI_SOURCES) \ + $(STORAGE_DRIVER_MPATH_SOURCES) \ + $(STORAGE_DRIVER_DISK_SOURCES) \ + $(STORAGE_DRIVER_RBD_SOURCES) \ + $(STORAGE_DRIVER_SHEEPDOG_SOURCES) \ + $(STORAGE_DRIVER_GLUSTER_SOURCES) \ + $(STORAGE_DRIVER_ZFS_SOURCES) \ + $(STORAGE_DRIVER_VSTORAGE_SOURCES) \ + $(NODE_DEVICE_DRIVER_SOURCES) \ + $(NODE_DEVICE_DRIVER_HAL_SOURCES) \ + $(NODE_DEVICE_DRIVER_UDEV_SOURCES) \ + $(NWFILTER_DRIVER_SOURCES) \ + $(SECURITY_DRIVER_SELINUX_SOURCES) \ + $(SECURITY_DRIVER_APPARMOR_SOURCES) \ + $(SECRET_DRIVER_SOURCES) \ + $(SECRET_UTIL_SOURCES) \ + $(VBOX_DRIVER_EXTRA_DIST) \ + $(VMWARE_DRIVER_SOURCES) \ + $(XENCONFIG_SOURCES) \ + $(XENCONFIG_LIBXL_SOURCES) \ $(ACCESS_DRIVER_POLKIT_POLICY) check-local: check-augeas @@ -2268,12 +2268,12 @@ SYM_FILES += $(srcdir)/libvirt_libssh.syms endif ! WITH_LIBSSH EXTRA_DIST += \ - libvirt_public.syms \ - libvirt_lxc.syms \ - libvirt_qemu.syms \ - libvirt_admin_public.syms \ - $(SYM_FILES) \ - $(ADMIN_SYM_FILES) \ + libvirt_public.syms \ + libvirt_lxc.syms \ + libvirt_qemu.syms \ + libvirt_admin_public.syms \ + $(SYM_FILES) \ + $(ADMIN_SYM_FILES) \ $(NULL) BUILT_SOURCES += $(GENERATED_SYM_FILES) @@ -2295,7 +2295,7 @@ libvirt.syms: libvirt_public.syms $(USED_SYM_FILES) \ %.def: %.syms $(AM_V_GEN)rm -f -- $@-tmp $@ ; \ printf 'EXPORTS\n' > $@-tmp && \ - sed -e '/^$$/d; /#/d; /:/d; /}/d; /\*/d; /LIBVIRT_/d' \ + sed -e '/^$$/d; /#/d; /:/d; /}/d; /\*/d; /LIBVIRT_/d' \ -e 's/[ ]*\(.*\)\;/ \1/g' $^ >> $@-tmp && \ chmod a-w $@-tmp && \ mv $@-tmp $@ @@ -2319,42 +2319,42 @@ EXTRA_DIST += admin/admin_remote.c lib_LTLIBRARIES += libvirt-admin.la libvirt_admin_la_SOURCES = \ - libvirt-admin.c \ - $(ADMIN_PROTOCOL_GENERATED) \ + libvirt-admin.c \ + $(ADMIN_PROTOCOL_GENERATED) \ $(DATATYPES_SOURCES) libvirt_admin_la_LDFLAGS = \ - $(VERSION_SCRIPT_FLAGS)$(LIBVIRT_ADMIN_SYMBOL_FILE) \ - -version-info $(LIBVIRT_VERSION_INFO) \ + $(VERSION_SCRIPT_FLAGS)$(LIBVIRT_ADMIN_SYMBOL_FILE) \ + -version-info $(LIBVIRT_VERSION_INFO) \ $(AM_LDFLAGS) libvirt_admin_la_LIBADD = \ - libvirt.la \ + libvirt.la \ $(CYGWIN_EXTRA_LIBADD) libvirt_admin_la_CFLAGS = \ - $(AM_CFLAGS) \ - -I$(srcdir)/remote \ - -I$(srcdir)/rpc \ + $(AM_CFLAGS) \ + -I$(srcdir)/remote \ + -I$(srcdir)/rpc \ -I$(srcdir)/admin libvirt_admin_la_CFLAGS += \ - $(XDR_CFLAGS) \ - $(CAPNG_CFLAGS) \ - $(YAJL_CFLAGS) \ - $(SSH2_CFLAGS) \ - $(SASL_CFLAGS) \ - $(GNUTLS_CFLAGS) \ + $(XDR_CFLAGS) \ + $(CAPNG_CFLAGS) \ + $(YAJL_CFLAGS) \ + $(SSH2_CFLAGS) \ + $(SASL_CFLAGS) \ + $(GNUTLS_CFLAGS) \ $(LIBSSH_CFLAGS) libvirt_admin_la_LIBADD += \ - $(CAPNG_LIBS) \ - $(YAJL_LIBS) \ - $(DEVMAPPER_LIBS) \ - $(LIBXML_LIBS) \ - $(SSH2_LIBS) \ - $(SASL_LIBS) \ - $(GNUTLS_LIBS) \ + $(CAPNG_LIBS) \ + $(YAJL_LIBS) \ + $(DEVMAPPER_LIBS) \ + $(LIBXML_LIBS) \ + $(SSH2_LIBS) \ + $(SASL_LIBS) \ + $(GNUTLS_LIBS) \ $(LIBSSH_LIBS) ADMIN_SYM_FILES = $(srcdir)/libvirt_admin_private.syms @@ -2474,87 +2474,87 @@ libvirt_lxc_la_LIBADD = libvirt.la $(CYGWIN_EXTRA_LIBADD) if WITH_SETUID_RPC_CLIENT noinst_LTLIBRARIES += libvirt-setuid-rpc-client.la -libvirt_setuid_rpc_client_la_SOURCES = \ - util/viralloc.c \ - util/viratomic.c \ - util/viratomic.h \ - util/virbitmap.c \ - util/virbuffer.c \ - util/vircgroup.c \ - util/vircommand.c \ - util/virconf.c \ - util/virdbus.c \ - util/virerror.c \ - util/virevent.c \ - util/vireventpoll.c \ - util/virfile.c \ - util/virgettext.c \ - util/virhash.c \ - util/virhashcode.c \ - util/virhostcpu.c \ - util/virjson.c \ - util/virlog.c \ - util/virobject.c \ - util/virpidfile.c \ - util/virprocess.c \ - util/virrandom.c \ - util/virsocketaddr.c \ - util/virstring.c \ - util/virsystemd.c \ - util/virtime.c \ - util/virthread.c \ - util/virthreadjob.c \ - util/virtypedparam.c \ - util/viruri.c \ - util/virutil.c \ - util/viruuid.c \ - conf/domain_event.c \ - conf/network_event.c \ - conf/object_event.c \ - conf/storage_event.c \ - conf/node_device_event.c \ - conf/secret_event.c \ - rpc/virnetsocket.c \ - rpc/virnetsocket.h \ - rpc/virnetmessage.h \ - rpc/virnetmessage.c \ - rpc/virkeepalive.c \ - rpc/virkeepalive.h \ - rpc/virnetclient.c \ - rpc/virnetclientprogram.c \ - rpc/virnetclientstream.c \ - rpc/virnetprotocol.c \ - remote/remote_driver.c \ - remote/remote_protocol.c \ - remote/qemu_protocol.c \ - remote/lxc_protocol.c \ - datatypes.c \ - libvirt.c \ - libvirt-domain.c \ - libvirt-domain-snapshot.c \ - libvirt-host.c \ - libvirt-interface.c \ - libvirt-network.c \ - libvirt-nodedev.c \ - libvirt-nwfilter.c \ - libvirt-secret.c \ - libvirt-storage.c \ - libvirt-stream.c \ - libvirt-lxc.c \ +libvirt_setuid_rpc_client_la_SOURCES = \ + util/viralloc.c \ + util/viratomic.c \ + util/viratomic.h \ + util/virbitmap.c \ + util/virbuffer.c \ + util/vircgroup.c \ + util/vircommand.c \ + util/virconf.c \ + util/virdbus.c \ + util/virerror.c \ + util/virevent.c \ + util/vireventpoll.c \ + util/virfile.c \ + util/virgettext.c \ + util/virhash.c \ + util/virhashcode.c \ + util/virhostcpu.c \ + util/virjson.c \ + util/virlog.c \ + util/virobject.c \ + util/virpidfile.c \ + util/virprocess.c \ + util/virrandom.c \ + util/virsocketaddr.c \ + util/virstring.c \ + util/virsystemd.c \ + util/virtime.c \ + util/virthread.c \ + util/virthreadjob.c \ + util/virtypedparam.c \ + util/viruri.c \ + util/virutil.c \ + util/viruuid.c \ + conf/domain_event.c \ + conf/network_event.c \ + conf/object_event.c \ + conf/storage_event.c \ + conf/node_device_event.c \ + conf/secret_event.c \ + rpc/virnetsocket.c \ + rpc/virnetsocket.h \ + rpc/virnetmessage.h \ + rpc/virnetmessage.c \ + rpc/virkeepalive.c \ + rpc/virkeepalive.h \ + rpc/virnetclient.c \ + rpc/virnetclientprogram.c \ + rpc/virnetclientstream.c \ + rpc/virnetprotocol.c \ + remote/remote_driver.c \ + remote/remote_protocol.c \ + remote/qemu_protocol.c \ + remote/lxc_protocol.c \ + datatypes.c \ + libvirt.c \ + libvirt-domain.c \ + libvirt-domain-snapshot.c \ + libvirt-host.c \ + libvirt-interface.c \ + libvirt-network.c \ + libvirt-nodedev.c \ + libvirt-nwfilter.c \ + libvirt-secret.c \ + libvirt-storage.c \ + libvirt-stream.c \ + libvirt-lxc.c \ $(NULL) -libvirt_setuid_rpc_client_la_LDFLAGS = \ - $(AM_LDFLAGS) \ - $(LIBXML_LIBS) \ - $(SECDRIVER_LIBS) \ +libvirt_setuid_rpc_client_la_LDFLAGS = \ + $(AM_LDFLAGS) \ + $(LIBXML_LIBS) \ + $(SECDRIVER_LIBS) \ $(NULL) -libvirt_setuid_rpc_client_la_CFLAGS = \ - -DLIBVIRT_SETUID_RPC_CLIENT \ - -I$(srcdir)/conf \ - -I$(srcdir)/rpc \ - $(AM_CFLAGS) \ - $(SECDRIVER_CFLAGS) \ - $(XDR_CFLAGS) \ +libvirt_setuid_rpc_client_la_CFLAGS = \ + -DLIBVIRT_SETUID_RPC_CLIENT \ + -I$(srcdir)/conf \ + -I$(srcdir)/rpc \ + $(AM_CFLAGS) \ + $(SECDRIVER_CFLAGS) \ + $(XDR_CFLAGS) \ $(NULL) endif WITH_SETUID_RPC_CLIENT @@ -2704,21 +2704,21 @@ uninstall-init:: endif ! WITH_LIBVIRTD virtlockd.init: locking/virtlockd.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 $@ virtlogd.init: logging/virtlogd.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 $@ virtlockd.8.in: locking/virtlockd.pod @@ -2824,27 +2824,27 @@ uninstall-systemd: endif ! WITH_LIBVIRTD virtlockd.service: locking/virtlockd.service.in $(top_builddir)/config.status - $(AM_V_GEN)sed \ - -e 's|[@]sbindir[@]|$(sbindir)|g' \ - < $< > $@-t && \ + $(AM_V_GEN)sed \ + -e 's|[@]sbindir[@]|$(sbindir)|g' \ + < $< > $@-t && \ mv $@-t $@ virtlockd.socket: locking/virtlockd.socket.in $(top_builddir)/config.status - $(AM_V_GEN)sed \ - -e 's|[@]localstatedir[@]|$(localstatedir)|g' \ - < $< > $@-t && \ + $(AM_V_GEN)sed \ + -e 's|[@]localstatedir[@]|$(localstatedir)|g' \ + < $< > $@-t && \ mv $@-t $@ virtlogd.service: logging/virtlogd.service.in $(top_builddir)/config.status - $(AM_V_GEN)sed \ - -e 's|[@]sbindir[@]|$(sbindir)|g' \ - < $< > $@-t && \ + $(AM_V_GEN)sed \ + -e 's|[@]sbindir[@]|$(sbindir)|g' \ + < $< > $@-t && \ mv $@-t $@ virtlogd.socket: logging/virtlogd.socket.in $(top_builddir)/config.status - $(AM_V_GEN)sed \ - -e 's|[@]localstatedir[@]|$(localstatedir)|g' \ - < $< > $@-t && \ + $(AM_V_GEN)sed \ + -e 's|[@]localstatedir[@]|$(localstatedir)|g' \ + < $< > $@-t && \ mv $@-t $@ @@ -2994,8 +2994,8 @@ libvirt_iohelper_LDFLAGS = \ $(AM_LDFLAGS) \ $(PIE_LDFLAGS) \ $(NULL) -libvirt_iohelper_LDADD = \ - libvirt_util.la \ +libvirt_iohelper_LDADD = \ + libvirt_util.la \ ../gnulib/lib/libgnu.la if WITH_DTRACE_PROBES libvirt_iohelper_LDADD += libvirt_probes.lo @@ -3013,8 +3013,8 @@ libvirt_leaseshelper_LDFLAGS = \ $(AM_LDFLAGS) \ $(PIE_LDFLAGS) \ $(NULL) -libvirt_leaseshelper_LDADD = \ - libvirt_util.la \ +libvirt_leaseshelper_LDADD = \ + libvirt_util.la \ ../gnulib/lib/libgnu.la if WITH_DTRACE_PROBES libvirt_leaseshelper_LDADD += libvirt_probes.lo @@ -3039,9 +3039,9 @@ libvirt_parthelper_LDFLAGS = \ $(AM_LDFLAGS) \ $(PIE_LDFLAGS) \ $(NULL) -libvirt_parthelper_LDADD = \ - $(LIBPARTED_LIBS) \ - libvirt_util.la \ +libvirt_parthelper_LDADD = \ + $(LIBPARTED_LIBS) \ + libvirt_util.la \ ../gnulib/lib/libgnu.la if WITH_DTRACE_PROBES libvirt_parthelper_LDADD += libvirt_probes.lo @@ -3077,14 +3077,14 @@ if WITH_LXC if WITH_LIBVIRTD libexec_PROGRAMS += libvirt_lxc -libvirt_lxc_SOURCES = \ - $(LXC_CONTROLLER_SOURCES) \ +libvirt_lxc_SOURCES = \ + $(LXC_CONTROLLER_SOURCES) \ $(DATATYPES_SOURCES) libvirt_lxc_LDFLAGS = \ $(AM_LDFLAGS) \ $(PIE_LDFLAGS) \ $(NULL) -libvirt_lxc_LDADD = \ +libvirt_lxc_LDADD = \ $(FUSE_LIBS) \ libvirt-net-rpc-server.la \ libvirt-net-rpc.la \ @@ -3096,14 +3096,14 @@ if WITH_DTRACE_PROBES libvirt_lxc_LDADD += libvirt_probes.lo endif WITH_DTRACE_PROBES libvirt_lxc_LDADD += $(SECDRIVER_LIBS) -libvirt_lxc_CFLAGS = \ - -I$(srcdir)/conf \ - $(AM_CFLAGS) \ - $(PIE_CFLAGS) \ - $(LIBNL_CFLAGS) \ - $(FUSE_CFLAGS) \ - $(DBUS_CFLAGS) \ - $(XDR_CFLAGS) \ +libvirt_lxc_CFLAGS = \ + -I$(srcdir)/conf \ + $(AM_CFLAGS) \ + $(PIE_CFLAGS) \ + $(LIBNL_CFLAGS) \ + $(FUSE_CFLAGS) \ + $(DBUS_CFLAGS) \ + $(XDR_CFLAGS) \ $(NULL) if WITH_BLKID libvirt_lxc_CFLAGS += $(BLKID_CFLAGS) @@ -3124,20 +3124,20 @@ virt_aa_helper_LDFLAGS = \ $(AM_LDFLAGS) \ $(PIE_LDFLAGS) \ $(NULL) -virt_aa_helper_LDADD = \ - libvirt.la \ - libvirt_conf.la \ - libvirt_util.la \ - libvirt_driver_storage_impl.la \ +virt_aa_helper_LDADD = \ + libvirt.la \ + libvirt_conf.la \ + libvirt_util.la \ + libvirt_driver_storage_impl.la \ ../gnulib/lib/libgnu.la if WITH_DTRACE_PROBES virt_aa_helper_LDADD += libvirt_probes.lo endif WITH_DTRACE_PROBES -virt_aa_helper_CFLAGS = \ - -I$(srcdir)/conf \ - -I$(srcdir)/security \ - $(AM_CFLAGS) \ - $(PIE_CFLAGS) \ +virt_aa_helper_CFLAGS = \ + -I$(srcdir)/conf \ + -I$(srcdir)/security \ + $(AM_CFLAGS) \ + $(PIE_CFLAGS) \ $(NULL) endif WITH_LIBVIRTD endif WITH_SECDRIVER_APPARMOR @@ -3146,68 +3146,68 @@ EXTRA_DIST += $(SECURITY_DRIVER_APPARMOR_HELPER_SOURCES) if WITH_NSS noinst_LTLIBRARIES += libvirt-nss.la -libvirt_nss_la_SOURCES = \ - util/viralloc.c \ - util/viralloc.h \ - util/viratomic.c \ - util/viratomic.h \ - util/virbitmap.c \ - util/virbitmap.h \ - util/virbuffer.c \ - util/virbuffer.h \ - util/vircommand.c \ - util/vircommand.h \ - util/virerror.c \ - util/virerror.h \ - util/virfile.c \ - util/virfile.h \ - util/virhash.c \ - util/virhash.h \ - util/virhashcode.c \ - util/virhashcode.h \ - util/virjson.c \ - util/virjson.h \ - util/virkmod.c \ - util/virkmod.h \ - util/virlease.c \ - util/virlease.h \ - util/virlog.c \ - util/virlog.h \ - util/virmacmap.c \ - util/virmacmap.h \ - util/virobject.c \ - util/virobject.h \ - util/virpidfile.c \ - util/virpidfile.h \ - util/virprocess.c \ - util/virprocess.h \ - util/virrandom.c \ - util/virrandom.h \ - util/virsocketaddr.c \ - util/virsocketaddr.h \ - util/virstring.c \ - util/virstring.h \ - util/virthread.c \ - util/virthread.h \ - util/virthreadjob.c \ - util/virthreadjob.h \ - util/virtime.c \ - util/virtime.h \ - util/virutil.c \ - util/virutil.h \ +libvirt_nss_la_SOURCES = \ + util/viralloc.c \ + util/viralloc.h \ + util/viratomic.c \ + util/viratomic.h \ + util/virbitmap.c \ + util/virbitmap.h \ + util/virbuffer.c \ + util/virbuffer.h \ + util/vircommand.c \ + util/vircommand.h \ + util/virerror.c \ + util/virerror.h \ + util/virfile.c \ + util/virfile.h \ + util/virhash.c \ + util/virhash.h \ + util/virhashcode.c \ + util/virhashcode.h \ + util/virjson.c \ + util/virjson.h \ + util/virkmod.c \ + util/virkmod.h \ + util/virlease.c \ + util/virlease.h \ + util/virlog.c \ + util/virlog.h \ + util/virmacmap.c \ + util/virmacmap.h \ + util/virobject.c \ + util/virobject.h \ + util/virpidfile.c \ + util/virpidfile.h \ + util/virprocess.c \ + util/virprocess.h \ + util/virrandom.c \ + util/virrandom.h \ + util/virsocketaddr.c \ + util/virsocketaddr.h \ + util/virstring.c \ + util/virstring.h \ + util/virthread.c \ + util/virthread.h \ + util/virthreadjob.c \ + util/virthreadjob.h \ + util/virtime.c \ + util/virtime.h \ + util/virutil.c \ + util/virutil.h \ $(NULL) -libvirt_nss_la_CFLAGS = \ - -DLIBVIRT_NSS \ - $(AM_CFLAGS) \ - $(YAJL_CFLAGS) \ +libvirt_nss_la_CFLAGS = \ + -DLIBVIRT_NSS \ + $(AM_CFLAGS) \ + $(YAJL_CFLAGS) \ $(NULL) -libvirt_nss_la_LDFLAGS = \ - $(AM_LDFLAGS) \ +libvirt_nss_la_LDFLAGS = \ + $(AM_LDFLAGS) \ $(NULL) -libvirt_nss_la_LIBADD = \ - $(YAJL_LIBS) \ +libvirt_nss_la_LIBADD = \ + $(YAJL_LIBS) \ $(NULL) endif WITH_NSS diff --git a/src/access/viraccessdriverpolkit.c b/src/access/viraccessdriverpolkit.c index 246af2f2ea..b964cfedff 100644 --- a/src/access/viraccessdriverpolkit.c +++ b/src/access/viraccessdriverpolkit.c @@ -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" diff --git a/src/access/viraccessmanager.c b/src/access/viraccessmanager.c index bcf552b8a7..cbfefb9d4f 100644 --- a/src/access/viraccessmanager.c +++ b/src/access/viraccessmanager.c @@ -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 { diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c index 669935acf8..603cf0e471 100644 --- a/src/conf/cpu_conf.c +++ b/src/conf/cpu_conf.c @@ -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)) { diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c index 7f96ff386b..e7323a81d7 100644 --- a/src/conf/domain_capabilities.c +++ b/src/conf/domain_capabilities.c @@ -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, "\n"); \ +#define FORMAT_EPILOGUE(item) \ + do { \ + virBufferAdjustIndent(buf, -2); \ + virBufferAddLit(buf, "\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) diff --git a/src/conf/domain_capabilities.h b/src/conf/domain_capabilities.h index 07640ed67f..fa4c1e442f 100644 --- a/src/conf/domain_capabilities.h +++ b/src/conf/domain_capabilities.h @@ -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, diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 77c20c6972..e34e8f4d0f 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -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\n", \ - def->blkdeviotune.val); \ +#define FORMAT_IOTUNE(val) \ + if (def->blkdeviotune.val) { \ + virBufferAsprintf(buf, "<" #val ">%llu\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 diff --git a/src/conf/interface_conf.h b/src/conf/interface_conf.h index 76f37b67c5..9ae2ceddb6 100644 --- a/src/conf/interface_conf.h +++ b/src/conf/interface_conf.h @@ -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) diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h index e9a5baf5bf..54c8ed1c4c 100644 --- a/src/conf/network_conf.h +++ b/src/conf/network_conf.h @@ -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) diff --git a/src/conf/secret_conf.h b/src/conf/secret_conf.h index aa81651d4f..19f612b8fe 100644 --- a/src/conf/secret_conf.h +++ b/src/conf/secret_conf.h @@ -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) diff --git a/src/conf/snapshot_conf.h b/src/conf/snapshot_conf.h index 1d663c77bc..20a42bd572 100644 --- a/src/conf/snapshot_conf.h +++ b/src/conf/snapshot_conf.h @@ -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 | \ diff --git a/src/conf/storage_conf.h b/src/conf/storage_conf.h index 8ac6796a61..6d60f70545 100644 --- a/src/conf/storage_conf.h +++ b/src/conf/storage_conf.h @@ -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 | \ diff --git a/src/conf/virdomainobjlist.h b/src/conf/virdomainobjlist.h index 3c59bd39fe..60220ca0db 100644 --- a/src/conf/virdomainobjlist.h +++ b/src/conf/virdomainobjlist.h @@ -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 | \ diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index a6cbd45766..f514fd2663 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -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) diff --git a/src/datatypes.c b/src/datatypes.c index 46414ae292..f7eef24ba8 100644 --- a/src/datatypes.c +++ b/src/datatypes.c @@ -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); diff --git a/src/datatypes.h b/src/datatypes.h index 8a0399cd0c..1a8ea01ba3 100644 --- a/src/datatypes.h +++ b/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__) diff --git a/src/driver.h b/src/driver.h index 420f6455d3..936c981603 100644 --- a/src/driver.h +++ b/src/driver.h @@ -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) diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index 0cce0a41a3..f575362059 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -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 diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c index 6d59bae9d8..edf52ff828 100644 --- a/src/esx/esx_vi.c +++ b/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; \ } diff --git a/src/esx/esx_vi.h b/src/esx/esx_vi.h index 47d518dd18..515024bb75 100644 --- a/src/esx/esx_vi.h +++ b/src/esx/esx_vi.h @@ -38,39 +38,39 @@ -# define ESX_VI__SOAP__REQUEST_HEADER \ - "\n" \ - "\n" \ +# define ESX_VI__SOAP__REQUEST_HEADER \ + "\n" \ + "\n" \ "\n" -# define ESX_VI__SOAP__REQUEST_FOOTER \ - "\n" \ +# define ESX_VI__SOAP__REQUEST_FOOTER \ + "\n" \ "" -# 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, ""); \ +# define ESV_VI__XML_TAG__CLOSE(_buffer, _element) \ + do { \ + virBufferAddLit(_buffer, ""); \ } while (0) diff --git a/src/esx/esx_vi_methods.c b/src/esx/esx_vi_methods.c index 184b01f1b9..a3d489dd66 100644 --- a/src/esx/esx_vi_methods.c +++ b/src/esx/esx_vi_methods.c @@ -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, ""); \ - 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, ""); \ + 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; \ } diff --git a/src/esx/esx_vi_types.c b/src/esx/esx_vi_types.c index 3ad2ba2922..be35af861c 100644 --- a/src/esx/esx_vi_types.c +++ b/src/esx/esx_vi_types.c @@ -39,354 +39,354 @@ VIR_LOG_INIT("esx.esx_vi_types"); -#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; \ - \ - (*ptrptr)->_type = esxVI_Type_##__type; \ - \ - return 0; \ + return -1; \ + } \ + \ + if (VIR_ALLOC(*ptrptr) < 0) \ + return -1; \ + \ + (*ptrptr)->_type = esxVI_Type_##__type; \ + \ + 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); \ } -#define ESX_VI__TEMPLATE__VALIDATE(__type, _require) \ - int \ - esxVI_##__type##_Validate(esxVI_##__type *item) \ - { \ - const char *typeName = esxVI_Type_ToString(esxVI_Type_##__type); \ - \ - if (item->_type <= esxVI_Type_Undefined || \ - item->_type >= esxVI_Type_Other) { \ - virReportError(VIR_ERR_INTERNAL_ERROR, \ +#define ESX_VI__TEMPLATE__VALIDATE(__type, _require) \ + int \ + esxVI_##__type##_Validate(esxVI_##__type *item) \ + { \ + const char *typeName = esxVI_Type_ToString(esxVI_Type_##__type); \ + \ + if (item->_type <= esxVI_Type_Undefined || \ + item->_type >= esxVI_Type_Other) { \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ _("%s object has invalid dynamic type"), typeName);\ - return -1; \ - } \ - \ - _require \ - \ - return 0; \ + return -1; \ + } \ + \ + _require \ + \ + return 0; \ } -#define ESX_VI__TEMPLATE__DEEP_COPY(_type, _deep_copy) \ - int \ - esxVI_##_type##_DeepCopy(esxVI_##_type **dest, esxVI_##_type *src) \ - { \ - if (!dest || *dest) { \ - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", \ - _("Invalid argument")); \ - return -1; \ - } \ - \ - if (!src) { \ - return 0; \ - } \ - \ - if (esxVI_##_type##_Alloc(dest) < 0) { \ - goto failure; \ - } \ - \ - _deep_copy \ - \ - return 0; \ - \ - failure: \ - esxVI_##_type##_Free(dest); \ - \ - return -1; \ +#define ESX_VI__TEMPLATE__DEEP_COPY(_type, _deep_copy) \ + int \ + esxVI_##_type##_DeepCopy(esxVI_##_type **dest, esxVI_##_type *src) \ + { \ + if (!dest || *dest) { \ + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", \ + _("Invalid argument")); \ + return -1; \ + } \ + \ + if (!src) { \ + return 0; \ + } \ + \ + if (esxVI_##_type##_Alloc(dest) < 0) { \ + goto failure; \ + } \ + \ + _deep_copy \ + \ + return 0; \ + \ + failure: \ + esxVI_##_type##_Free(dest); \ + \ + return -1; \ } -#define ESX_VI__TEMPLATE__LIST__APPEND(_type) \ - int \ - esxVI_##_type##_AppendToList(esxVI_##_type **list, esxVI_##_type *item) \ - { \ - return esxVI_List_Append((esxVI_List **)list, (esxVI_List *)item); \ +#define ESX_VI__TEMPLATE__LIST__APPEND(_type) \ + int \ + esxVI_##_type##_AppendToList(esxVI_##_type **list, esxVI_##_type *item) \ + { \ + return esxVI_List_Append((esxVI_List **)list, (esxVI_List *)item); \ } -#define ESX_VI__TEMPLATE__LIST__DEEP_COPY(_type) \ - int \ - esxVI_##_type##_DeepCopyList(esxVI_##_type **destList, \ - esxVI_##_type *srcList) \ - { \ - return esxVI_List_DeepCopy \ - ((esxVI_List **)destList, (esxVI_List *)srcList, \ - (esxVI_List_DeepCopyFunc)esxVI_##_type##_DeepCopy, \ - (esxVI_List_FreeFunc)esxVI_##_type##_Free); \ +#define ESX_VI__TEMPLATE__LIST__DEEP_COPY(_type) \ + int \ + esxVI_##_type##_DeepCopyList(esxVI_##_type **destList, \ + esxVI_##_type *srcList) \ + { \ + return esxVI_List_DeepCopy \ + ((esxVI_List **)destList, (esxVI_List *)srcList, \ + (esxVI_List_DeepCopyFunc)esxVI_##_type##_DeepCopy, \ + (esxVI_List_FreeFunc)esxVI_##_type##_Free); \ } -#define ESX_VI__TEMPLATE__LIST__CAST_FROM_ANY_TYPE(_type) \ - int \ - esxVI_##_type##_CastListFromAnyType(esxVI_AnyType *anyType, \ - esxVI_##_type **list) \ - { \ - return esxVI_List_CastFromAnyType \ - (anyType, (esxVI_List **)list, \ - (esxVI_List_CastFromAnyTypeFunc) \ - esxVI_##_type##_CastFromAnyType, \ - (esxVI_List_FreeFunc)esxVI_##_type##_Free); \ +#define ESX_VI__TEMPLATE__LIST__CAST_FROM_ANY_TYPE(_type) \ + int \ + esxVI_##_type##_CastListFromAnyType(esxVI_AnyType *anyType, \ + esxVI_##_type **list) \ + { \ + return esxVI_List_CastFromAnyType \ + (anyType, (esxVI_List **)list, \ + (esxVI_List_CastFromAnyTypeFunc) \ + esxVI_##_type##_CastFromAnyType, \ + (esxVI_List_FreeFunc)esxVI_##_type##_Free); \ } -#define ESX_VI__TEMPLATE__LIST__SERIALIZE(_type) \ - int \ - esxVI_##_type##_SerializeList(esxVI_##_type *list, const char *element, \ - virBufferPtr output) \ - { \ - return esxVI_List_Serialize((esxVI_List *)list, element, output, \ - (esxVI_List_SerializeFunc) \ - esxVI_##_type##_Serialize); \ +#define ESX_VI__TEMPLATE__LIST__SERIALIZE(_type) \ + int \ + esxVI_##_type##_SerializeList(esxVI_##_type *list, const char *element, \ + virBufferPtr output) \ + { \ + return esxVI_List_Serialize((esxVI_List *)list, element, output, \ + (esxVI_List_SerializeFunc) \ + esxVI_##_type##_Serialize); \ } -#define ESX_VI__TEMPLATE__LIST__DESERIALIZE(_type) \ - int \ - esxVI_##_type##_DeserializeList(xmlNodePtr node, esxVI_##_type **list) \ - { \ - return esxVI_List_Deserialize \ - (node, (esxVI_List **)list, \ - (esxVI_List_DeserializeFunc)esxVI_##_type##_Deserialize, \ - (esxVI_List_FreeFunc)esxVI_##_type##_Free); \ +#define ESX_VI__TEMPLATE__LIST__DESERIALIZE(_type) \ + int \ + esxVI_##_type##_DeserializeList(xmlNodePtr node, esxVI_##_type **list) \ + { \ + return esxVI_List_Deserialize \ + (node, (esxVI_List **)list, \ + (esxVI_List_DeserializeFunc)esxVI_##_type##_Deserialize, \ + (esxVI_List_FreeFunc)esxVI_##_type##_Free); \ } #define ESX_VI__TEMPLATE__CAST_FROM_ANY_TYPE_EXTRA(_type, _dest_type, _extra, \ - _dest_extra) \ - int \ - esxVI_##_type##_Cast##_dest_extra##FromAnyType(esxVI_AnyType *anyType, \ - _dest_type **ptrptr) \ - { \ - _dest_type *item ATTRIBUTE_UNUSED; \ - \ - if (!anyType || !ptrptr || *ptrptr) { \ - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", \ - _("Invalid argument")); \ - return -1; \ - } \ - \ - item = *ptrptr; \ - \ - _extra \ - \ - return esxVI_##_type##_Deserialize##_dest_extra(anyType->node, \ - ptrptr); \ + _dest_extra) \ + int \ + esxVI_##_type##_Cast##_dest_extra##FromAnyType(esxVI_AnyType *anyType, \ + _dest_type **ptrptr) \ + { \ + _dest_type *item ATTRIBUTE_UNUSED; \ + \ + if (!anyType || !ptrptr || *ptrptr) { \ + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", \ + _("Invalid argument")); \ + return -1; \ + } \ + \ + item = *ptrptr; \ + \ + _extra \ + \ + return esxVI_##_type##_Deserialize##_dest_extra(anyType->node, \ + ptrptr); \ } -#define ESX_VI__TEMPLATE__CAST_FROM_ANY_TYPE(_type) \ - ESX_VI__TEMPLATE__CAST_FROM_ANY_TYPE_EXTRA(_type, esxVI_##_type, \ - { \ - if (anyType->type != esxVI_Type_##_type) { \ - virReportError(VIR_ERR_INTERNAL_ERROR, \ - _("Call to %s for unexpected type '%s', " \ - "expected '%s'"), \ - __FUNCTION__, anyType->other, \ - esxVI_Type_ToString(esxVI_Type_##_type)); \ - return -1; \ - } \ +#define ESX_VI__TEMPLATE__CAST_FROM_ANY_TYPE(_type) \ + ESX_VI__TEMPLATE__CAST_FROM_ANY_TYPE_EXTRA(_type, esxVI_##_type, \ + { \ + if (anyType->type != esxVI_Type_##_type) { \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + _("Call to %s for unexpected type '%s', " \ + "expected '%s'"), \ + __FUNCTION__, anyType->other, \ + esxVI_Type_ToString(esxVI_Type_##_type)); \ + return -1; \ + } \ }, /* nothing */) -#define ESX_VI__TEMPLATE__CAST_VALUE_FROM_ANY_TYPE(_type, _value_type) \ - ESX_VI__TEMPLATE__CAST_FROM_ANY_TYPE_EXTRA(_type, _value_type, \ - { \ - if (anyType->type != esxVI_Type_##_type) { \ - virReportError(VIR_ERR_INTERNAL_ERROR, \ - _("Call to %s for unexpected type '%s', " \ - "expected '%s'"), \ - __FUNCTION__, anyType->other, \ - esxVI_Type_ToString(esxVI_Type_##_type)); \ - return -1; \ - } \ +#define ESX_VI__TEMPLATE__CAST_VALUE_FROM_ANY_TYPE(_type, _value_type) \ + ESX_VI__TEMPLATE__CAST_FROM_ANY_TYPE_EXTRA(_type, _value_type, \ + { \ + if (anyType->type != esxVI_Type_##_type) { \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + _("Call to %s for unexpected type '%s', " \ + "expected '%s'"), \ + __FUNCTION__, anyType->other, \ + esxVI_Type_ToString(esxVI_Type_##_type)); \ + return -1; \ + } \ }, Value) -#define ESX_VI__TEMPLATE__SERIALIZE_EXTRA(_type, _extra, _serialize) \ - int \ - esxVI_##_type##_Serialize(esxVI_##_type *item, \ - const char *element, virBufferPtr output) \ - { \ - if (!element || !output) { \ - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", \ - _("Invalid argument")); \ - return -1; \ - } \ - \ - if (!item) { \ - return 0; \ - } \ - \ - _extra \ - \ - if (esxVI_##_type##_Validate(item) < 0) { \ - return -1; \ - } \ - \ - ESV_VI__XML_TAG__OPEN(output, element, \ - esxVI_Type_ToString(esxVI_Type_##_type)); \ - \ - _serialize \ - \ - ESV_VI__XML_TAG__CLOSE(output, element); \ - \ - return 0; \ +#define ESX_VI__TEMPLATE__SERIALIZE_EXTRA(_type, _extra, _serialize) \ + int \ + esxVI_##_type##_Serialize(esxVI_##_type *item, \ + const char *element, virBufferPtr output) \ + { \ + if (!element || !output) { \ + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", \ + _("Invalid argument")); \ + return -1; \ + } \ + \ + if (!item) { \ + return 0; \ + } \ + \ + _extra \ + \ + if (esxVI_##_type##_Validate(item) < 0) { \ + return -1; \ + } \ + \ + ESV_VI__XML_TAG__OPEN(output, element, \ + esxVI_Type_ToString(esxVI_Type_##_type)); \ + \ + _serialize \ + \ + ESV_VI__XML_TAG__CLOSE(output, element); \ + \ + return 0; \ } -#define ESX_VI__TEMPLATE__SERIALIZE(_type, _serialize) \ +#define ESX_VI__TEMPLATE__SERIALIZE(_type, _serialize) \ ESX_VI__TEMPLATE__SERIALIZE_EXTRA(_type, /* nothing */, _serialize) -#define ESX_VI__TEMPLATE__DESERIALIZE_EXTRA(_type, _extra1, _extra2, \ - _deserialize) \ - int \ - esxVI_##_type##_Deserialize(xmlNodePtr node, esxVI_##_type **ptrptr) \ - { \ - xmlNodePtr childNode = NULL; \ - \ - _extra1 \ - \ - if (!ptrptr || *ptrptr) { \ - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", \ - _("Invalid argument")); \ - return -1; \ - } \ - \ - if (esxVI_##_type##_Alloc(ptrptr) < 0) { \ - return -1; \ - } \ - \ - _extra2 \ - \ - for (childNode = node->children; childNode; \ - childNode = childNode->next) { \ - if (childNode->type != XML_ELEMENT_NODE) { \ - virReportError(VIR_ERR_INTERNAL_ERROR, \ - _("Wrong XML element type %d"), \ - childNode->type); \ - goto failure; \ - } \ - \ - _deserialize \ - \ - VIR_WARN("Unexpected '%s' property", childNode->name); \ - } \ - \ - if (esxVI_##_type##_Validate(*ptrptr) < 0) { \ - goto failure; \ - } \ - \ - return 0; \ - \ - failure: \ - esxVI_##_type##_Free(ptrptr); \ - \ - return -1; \ +#define ESX_VI__TEMPLATE__DESERIALIZE_EXTRA(_type, _extra1, _extra2, \ + _deserialize) \ + int \ + esxVI_##_type##_Deserialize(xmlNodePtr node, esxVI_##_type **ptrptr) \ + { \ + xmlNodePtr childNode = NULL; \ + \ + _extra1 \ + \ + if (!ptrptr || *ptrptr) { \ + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", \ + _("Invalid argument")); \ + return -1; \ + } \ + \ + if (esxVI_##_type##_Alloc(ptrptr) < 0) { \ + return -1; \ + } \ + \ + _extra2 \ + \ + for (childNode = node->children; childNode; \ + childNode = childNode->next) { \ + if (childNode->type != XML_ELEMENT_NODE) { \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + _("Wrong XML element type %d"), \ + childNode->type); \ + goto failure; \ + } \ + \ + _deserialize \ + \ + VIR_WARN("Unexpected '%s' property", childNode->name); \ + } \ + \ + if (esxVI_##_type##_Validate(*ptrptr) < 0) { \ + goto failure; \ + } \ + \ + return 0; \ + \ + failure: \ + esxVI_##_type##_Free(ptrptr); \ + \ + return -1; \ } -#define ESX_VI__TEMPLATE__DESERIALIZE(_type, _deserialize) \ - ESX_VI__TEMPLATE__DESERIALIZE_EXTRA(_type, /* nothing */, /* nothing */, \ +#define ESX_VI__TEMPLATE__DESERIALIZE(_type, _deserialize) \ + ESX_VI__TEMPLATE__DESERIALIZE_EXTRA(_type, /* nothing */, /* nothing */, \ _deserialize) -#define ESX_VI__TEMPLATE__DESERIALIZE_NUMBER(_type, _xsdType, _min, _max) \ - int \ - esxVI_##_type##_Deserialize(xmlNodePtr node, esxVI_##_type **number) \ - { \ - int result = -1; \ - char *string; \ - long long value; \ - \ - if (!number || *number) { \ - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", \ - _("Invalid argument")); \ - return -1; \ - } \ - \ - if (esxVI_##_type##_Alloc(number) < 0) { \ - return -1; \ - } \ - \ - string = (char *)xmlNodeListGetString(node->doc, node->children, 1); \ - \ - if (!string) { \ - virReportError(VIR_ERR_INTERNAL_ERROR, \ +#define ESX_VI__TEMPLATE__DESERIALIZE_NUMBER(_type, _xsdType, _min, _max) \ + int \ + esxVI_##_type##_Deserialize(xmlNodePtr node, esxVI_##_type **number) \ + { \ + int result = -1; \ + char *string; \ + long long value; \ + \ + if (!number || *number) { \ + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", \ + _("Invalid argument")); \ + return -1; \ + } \ + \ + if (esxVI_##_type##_Alloc(number) < 0) { \ + return -1; \ + } \ + \ + string = (char *)xmlNodeListGetString(node->doc, node->children, 1); \ + \ + if (!string) { \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ _("XML node doesn't contain text, expecting an %s "\ - "value"), _xsdType); \ - goto cleanup; \ - } \ - \ - if (virStrToLong_ll(string, NULL, 10, &value) < 0) { \ - virReportError(VIR_ERR_INTERNAL_ERROR, \ + "value"), _xsdType); \ + goto cleanup; \ + } \ + \ + if (virStrToLong_ll(string, NULL, 10, &value) < 0) { \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ _("Unknown value '%s' for %s"), string, _xsdType); \ - goto cleanup; \ - } \ - \ - if (((_min) != INT64_MIN && value < (_min)) \ - || ((_max) != INT64_MAX && value > (_max))) { \ - virReportError(VIR_ERR_INTERNAL_ERROR, \ - _("Value '%s' is not representable as %s"), \ - string, _xsdType); \ - goto cleanup; \ - } \ - \ - (*number)->value = value; \ - \ - result = 0; \ - \ - cleanup: \ - if (result < 0) { \ - esxVI_##_type##_Free(number); \ - } \ - \ - VIR_FREE(string); \ - \ - return result; \ + goto cleanup; \ + } \ + \ + if (((_min) != INT64_MIN && value < (_min)) \ + || ((_max) != INT64_MAX && value > (_max))) { \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + _("Value '%s' is not representable as %s"), \ + string, _xsdType); \ + goto cleanup; \ + } \ + \ + (*number)->value = value; \ + \ + result = 0; \ + \ + cleanup: \ + if (result < 0) { \ + esxVI_##_type##_Free(number); \ + } \ + \ + VIR_FREE(string); \ + \ + return result; \ } @@ -395,93 +395,93 @@ VIR_LOG_INIT("esx.esx_vi_types"); * Macros for property handling to be used as part of other macros */ -#define ESX_VI__TEMPLATE__PROPERTY__DEEP_COPY(_type, _name) \ - if (esxVI_##_type##_DeepCopy(&(*dest)->_name, src->_name) < 0) { \ - goto failure; \ +#define ESX_VI__TEMPLATE__PROPERTY__DEEP_COPY(_type, _name) \ + if (esxVI_##_type##_DeepCopy(&(*dest)->_name, src->_name) < 0) { \ + goto failure; \ } -#define ESX_VI__TEMPLATE__PROPERTY__DEEP_COPY_LIST(_type, _name) \ - if (esxVI_##_type##_DeepCopyList(&(*dest)->_name, src->_name) < 0) { \ - goto failure; \ +#define ESX_VI__TEMPLATE__PROPERTY__DEEP_COPY_LIST(_type, _name) \ + if (esxVI_##_type##_DeepCopyList(&(*dest)->_name, src->_name) < 0) { \ + goto failure; \ } -#define ESX_VI__TEMPLATE__PROPERTY__DEEP_COPY_VALUE(_type, _name) \ - if (esxVI_##_type##_DeepCopyValue(&(*dest)->_name, src->_name) < 0) { \ - goto failure; \ +#define ESX_VI__TEMPLATE__PROPERTY__DEEP_COPY_VALUE(_type, _name) \ + if (esxVI_##_type##_DeepCopyValue(&(*dest)->_name, src->_name) < 0) { \ + goto failure; \ } -#define ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(_type, _name) \ - if (esxVI_##_type##_Serialize(item->_name, #_name, output) < 0) { \ - return -1; \ +#define ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(_type, _name) \ + if (esxVI_##_type##_Serialize(item->_name, #_name, output) < 0) { \ + return -1; \ } -#define ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_VALUE(_type, _name) \ - if (esxVI_##_type##_SerializeValue(item->_name, #_name, output) < 0) { \ - return -1; \ +#define ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_VALUE(_type, _name) \ + if (esxVI_##_type##_SerializeValue(item->_name, #_name, output) < 0) { \ + return -1; \ } -#define ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_LIST(_type, _name) \ - if (esxVI_##_type##_SerializeList(item->_name, #_name, output) < 0) { \ - return -1; \ +#define ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_LIST(_type, _name) \ + if (esxVI_##_type##_SerializeList(item->_name, #_name, output) < 0) { \ + return -1; \ } -#define ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(_type, _name) \ - if (virXMLNodeNameEqual(childNode, #_name)) { \ - if (esxVI_##_type##_Deserialize(childNode, &(*ptrptr)->_name) < 0) { \ - goto failure; \ - } \ - \ - continue; \ +#define ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(_type, _name) \ + if (virXMLNodeNameEqual(childNode, #_name)) { \ + if (esxVI_##_type##_Deserialize(childNode, &(*ptrptr)->_name) < 0) { \ + goto failure; \ + } \ + \ + continue; \ } -#define ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_IGNORE(_name) \ - if (virXMLNodeNameEqual(childNode, #_name)) { \ - continue; \ +#define ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_IGNORE(_name) \ + if (virXMLNodeNameEqual(childNode, #_name)) { \ + continue; \ } -#define ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(_type, _name) \ - if (virXMLNodeNameEqual(childNode, #_name)) { \ - if (esxVI_##_type##_DeserializeValue(childNode, \ - &(*ptrptr)->_name) < 0) { \ - goto failure; \ - } \ - \ - continue; \ +#define ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(_type, _name) \ + if (virXMLNodeNameEqual(childNode, #_name)) { \ + if (esxVI_##_type##_DeserializeValue(childNode, \ + &(*ptrptr)->_name) < 0) { \ + goto failure; \ + } \ + \ + continue; \ } -#define ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_LIST(_type, _name) \ - if (virXMLNodeNameEqual(childNode, #_name)) { \ - esxVI_##_type *_name##Item = NULL; \ - \ - if (esxVI_##_type##_Deserialize(childNode, &_name##Item) < 0) { \ - goto failure; \ - } \ - \ - if (esxVI_##_type##_AppendToList(&(*ptrptr)->_name, \ - _name##Item) < 0) { \ - esxVI_##_type##_Free(&_name##Item); \ - goto failure; \ - } \ - \ - continue; \ +#define ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_LIST(_type, _name) \ + if (virXMLNodeNameEqual(childNode, #_name)) { \ + esxVI_##_type *_name##Item = NULL; \ + \ + if (esxVI_##_type##_Deserialize(childNode, &_name##Item) < 0) { \ + goto failure; \ + } \ + \ + if (esxVI_##_type##_AppendToList(&(*ptrptr)->_name, \ + _name##Item) < 0) { \ + esxVI_##_type##_Free(&_name##Item); \ + goto failure; \ + } \ + \ + continue; \ } @@ -492,12 +492,12 @@ VIR_LOG_INIT("esx.esx_vi_types"); * * To be used as part of ESX_VI__TEMPLATE__VALIDATE. */ -#define ESX_VI__TEMPLATE__PROPERTY__REQUIRE(_name) \ - if (item->_name == 0) { \ - virReportError(VIR_ERR_INTERNAL_ERROR, \ - _("%s object is missing the required '%s' property"), \ - typeName, #_name); \ - return -1; \ +#define ESX_VI__TEMPLATE__PROPERTY__REQUIRE(_name) \ + if (item->_name == 0) { \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + _("%s object is missing the required '%s' property"), \ + typeName, #_name); \ + return -1; \ } @@ -506,34 +506,34 @@ VIR_LOG_INIT("esx.esx_vi_types"); * Macros to implement enumerations */ -#define ESX_VI__TEMPLATE__ENUMERATION__CAST_FROM_ANY_TYPE(_type) \ - int \ - esxVI_##_type##_CastFromAnyType(esxVI_AnyType *anyType, \ - esxVI_##_type *value) \ - { \ - return esxVI_Enumeration_CastFromAnyType \ - (&_esxVI_##_type##_Enumeration, anyType, (int *)value); \ +#define ESX_VI__TEMPLATE__ENUMERATION__CAST_FROM_ANY_TYPE(_type) \ + int \ + esxVI_##_type##_CastFromAnyType(esxVI_AnyType *anyType, \ + esxVI_##_type *value) \ + { \ + return esxVI_Enumeration_CastFromAnyType \ + (&_esxVI_##_type##_Enumeration, anyType, (int *)value); \ } -#define ESX_VI__TEMPLATE__ENUMERATION__SERIALIZE(_type) \ - int \ - esxVI_##_type##_Serialize(esxVI_##_type value, const char *element, \ - virBufferPtr output) \ - { \ - return esxVI_Enumeration_Serialize(&_esxVI_##_type##_Enumeration, \ - value, element, output); \ +#define ESX_VI__TEMPLATE__ENUMERATION__SERIALIZE(_type) \ + int \ + esxVI_##_type##_Serialize(esxVI_##_type value, const char *element, \ + virBufferPtr output) \ + { \ + return esxVI_Enumeration_Serialize(&_esxVI_##_type##_Enumeration, \ + value, element, output); \ } -#define ESX_VI__TEMPLATE__ENUMERATION__DESERIALIZE(_type) \ - int \ - esxVI_##_type##_Deserialize(xmlNodePtr node, esxVI_##_type *value) \ - { \ - return esxVI_Enumeration_Deserialize(&_esxVI_##_type##_Enumeration, \ - node, (int *)value); \ +#define ESX_VI__TEMPLATE__ENUMERATION__DESERIALIZE(_type) \ + int \ + esxVI_##_type##_Deserialize(xmlNodePtr node, esxVI_##_type *value) \ + { \ + return esxVI_Enumeration_Deserialize(&_esxVI_##_type##_Enumeration, \ + node, (int *)value); \ } @@ -542,167 +542,167 @@ VIR_LOG_INIT("esx.esx_vi_types"); * Macros to implement dynamic dispatched functions */ -#define ESX_VI__TEMPLATE__DISPATCH(_actual_type, _actual_type_name, __type, \ - _dispatch, _error_return) \ - switch (_actual_type) { \ - _dispatch \ - \ - case esxVI_Type_##__type: \ - break; \ - \ - default: \ - virReportError(VIR_ERR_INTERNAL_ERROR, \ - _("Call to %s for unexpected type '%s'"), \ - __FUNCTION__, _actual_type_name); \ - return _error_return; \ +#define ESX_VI__TEMPLATE__DISPATCH(_actual_type, _actual_type_name, __type, \ + _dispatch, _error_return) \ + switch (_actual_type) { \ + _dispatch \ + \ + case esxVI_Type_##__type: \ + break; \ + \ + default: \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + _("Call to %s for unexpected type '%s'"), \ + __FUNCTION__, _actual_type_name); \ + return _error_return; \ } -#define ESX_VI__TEMPLATE__DISPATCH__FREE(_type) \ - case esxVI_Type_##_type: \ - esxVI_##_type##_Free((esxVI_##_type **)ptrptr); \ +#define ESX_VI__TEMPLATE__DISPATCH__FREE(_type) \ + case esxVI_Type_##_type: \ + esxVI_##_type##_Free((esxVI_##_type **)ptrptr); \ return; -#define ESX_VI__TEMPLATE__DISPATCH__DEEP_COPY(_type) \ - case esxVI_Type_##_type: \ - return esxVI_##_type##_DeepCopy((esxVI_##_type **)dest, \ +#define ESX_VI__TEMPLATE__DISPATCH__DEEP_COPY(_type) \ + case esxVI_Type_##_type: \ + return esxVI_##_type##_DeepCopy((esxVI_##_type **)dest, \ (esxVI_##_type *)src); -#define ESX_VI__TEMPLATE__DISPATCH__CAST_FROM_ANY_TYPE(_type) \ - case esxVI_Type_##_type: \ - return esxVI_##_type##_Deserialize(anyType->node, \ +#define ESX_VI__TEMPLATE__DISPATCH__CAST_FROM_ANY_TYPE(_type) \ + case esxVI_Type_##_type: \ + return esxVI_##_type##_Deserialize(anyType->node, \ (esxVI_##_type **)ptrptr); -#define ESX_VI__TEMPLATE__DISPATCH__SERIALIZE(_type) \ - case esxVI_Type_##_type: \ - return esxVI_##_type##_Serialize((esxVI_##_type *)item, element, \ +#define ESX_VI__TEMPLATE__DISPATCH__SERIALIZE(_type) \ + case esxVI_Type_##_type: \ + return esxVI_##_type##_Serialize((esxVI_##_type *)item, element, \ output); -#define ESX_VI__TEMPLATE__DISPATCH__DESERIALIZE(_type) \ - case esxVI_Type_##_type: \ +#define ESX_VI__TEMPLATE__DISPATCH__DESERIALIZE(_type) \ + case esxVI_Type_##_type: \ return esxVI_##_type##_Deserialize(node, (esxVI_##_type **)ptrptr); -#define ESX_VI__TEMPLATE__DYNAMIC_FREE(__type, _dispatch, _body) \ - ESX_VI__TEMPLATE__FREE(__type, \ - ESX_VI__TEMPLATE__DISPATCH(item->_type, \ - esxVI_Type_ToString(item->_type), \ - __type, _dispatch, \ - /* nothing */) \ +#define ESX_VI__TEMPLATE__DYNAMIC_FREE(__type, _dispatch, _body) \ + ESX_VI__TEMPLATE__FREE(__type, \ + ESX_VI__TEMPLATE__DISPATCH(item->_type, \ + esxVI_Type_ToString(item->_type), \ + __type, _dispatch, \ + /* nothing */) \ _body) -#define ESX_VI__TEMPLATE__DYNAMIC_CAST__ACCEPT(__type) \ - if (((esxVI_Object *)item)->_type == esxVI_Type_##__type) { \ - return item; \ +#define ESX_VI__TEMPLATE__DYNAMIC_CAST__ACCEPT(__type) \ + if (((esxVI_Object *)item)->_type == esxVI_Type_##__type) { \ + return item; \ } -#define ESX_VI__TEMPLATE__DYNAMIC_CAST(__type, _accept) \ - esxVI_##__type * \ - esxVI_##__type##_DynamicCast(void *item) \ - { \ - if (!item) { \ - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", \ - _("Invalid argument")); \ - return NULL; \ - } \ - \ - ESX_VI__TEMPLATE__DYNAMIC_CAST__ACCEPT(__type) \ - \ - _accept \ - \ - return NULL; \ +#define ESX_VI__TEMPLATE__DYNAMIC_CAST(__type, _accept) \ + esxVI_##__type * \ + esxVI_##__type##_DynamicCast(void *item) \ + { \ + if (!item) { \ + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", \ + _("Invalid argument")); \ + return NULL; \ + } \ + \ + ESX_VI__TEMPLATE__DYNAMIC_CAST__ACCEPT(__type) \ + \ + _accept \ + \ + return NULL; \ } -#define ESX_VI__TEMPLATE__DYNAMIC_DEEP_COPY(__type, _dispatch, _deep_copy) \ - int \ - esxVI_##__type##_DeepCopy(esxVI_##__type **dest, esxVI_##__type *src) \ - { \ - if (!dest || *dest) { \ - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", \ - _("Invalid argument")); \ - return -1; \ - } \ - \ - if (!src) { \ - return 0; \ - } \ - \ - ESX_VI__TEMPLATE__DISPATCH(src->_type, \ - esxVI_Type_ToString(src->_type), \ - __type, _dispatch, -1) \ - \ - if (esxVI_##__type##_Alloc(dest) < 0) { \ - goto failure; \ - } \ - \ - _deep_copy \ - \ - return 0; \ - \ - failure: \ - esxVI_##__type##_Free(dest); \ - \ - return -1; \ +#define ESX_VI__TEMPLATE__DYNAMIC_DEEP_COPY(__type, _dispatch, _deep_copy) \ + int \ + esxVI_##__type##_DeepCopy(esxVI_##__type **dest, esxVI_##__type *src) \ + { \ + if (!dest || *dest) { \ + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", \ + _("Invalid argument")); \ + return -1; \ + } \ + \ + if (!src) { \ + return 0; \ + } \ + \ + ESX_VI__TEMPLATE__DISPATCH(src->_type, \ + esxVI_Type_ToString(src->_type), \ + __type, _dispatch, -1) \ + \ + if (esxVI_##__type##_Alloc(dest) < 0) { \ + goto failure; \ + } \ + \ + _deep_copy \ + \ + return 0; \ + \ + failure: \ + esxVI_##__type##_Free(dest); \ + \ + return -1; \ } -#define ESX_VI__TEMPLATE__DYNAMIC_CAST_FROM_ANY_TYPE(__type, _dispatch) \ - ESX_VI__TEMPLATE__CAST_FROM_ANY_TYPE_EXTRA(__type, esxVI_##__type, \ - ESX_VI__TEMPLATE__DISPATCH(anyType->type, \ - esxVI_AnyType_TypeToString(anyType), \ - __type, _dispatch, -1), \ +#define ESX_VI__TEMPLATE__DYNAMIC_CAST_FROM_ANY_TYPE(__type, _dispatch) \ + ESX_VI__TEMPLATE__CAST_FROM_ANY_TYPE_EXTRA(__type, esxVI_##__type, \ + ESX_VI__TEMPLATE__DISPATCH(anyType->type, \ + esxVI_AnyType_TypeToString(anyType), \ + __type, _dispatch, -1), \ /* nothing */) -#define ESX_VI__TEMPLATE__DYNAMIC_SERIALIZE(__type, _dispatch, _serialize) \ - ESX_VI__TEMPLATE__SERIALIZE_EXTRA(__type, \ - ESX_VI__TEMPLATE__DISPATCH(item->_type, \ - esxVI_Type_ToString(item->_type), \ - __type, _dispatch, -1), \ +#define ESX_VI__TEMPLATE__DYNAMIC_SERIALIZE(__type, _dispatch, _serialize) \ + ESX_VI__TEMPLATE__SERIALIZE_EXTRA(__type, \ + ESX_VI__TEMPLATE__DISPATCH(item->_type, \ + esxVI_Type_ToString(item->_type), \ + __type, _dispatch, -1), \ _serialize) -#define ESX_VI__TEMPLATE__DYNAMIC_DESERIALIZE(__type, _dispatch, \ - _deserialize) \ - ESX_VI__TEMPLATE__DESERIALIZE_EXTRA(__type, \ - esxVI_Type type = esxVI_Type_Undefined; \ - \ - if (esxVI_GetActualObjectType(node, esxVI_Type_##__type, &type) < 0) { \ - return -1; \ - } \ - \ - switch (type) { \ - _dispatch \ - \ - case esxVI_Type_##__type: \ - break; \ - \ - default: \ - virReportError(VIR_ERR_INTERNAL_ERROR, \ - _("Call to %s for unexpected type '%s'"), \ - __FUNCTION__, esxVI_Type_ToString(type)); \ - return -1; \ - }, \ - /* nothing */, \ +#define ESX_VI__TEMPLATE__DYNAMIC_DESERIALIZE(__type, _dispatch, \ + _deserialize) \ + ESX_VI__TEMPLATE__DESERIALIZE_EXTRA(__type, \ + esxVI_Type type = esxVI_Type_Undefined; \ + \ + if (esxVI_GetActualObjectType(node, esxVI_Type_##__type, &type) < 0) { \ + return -1; \ + } \ + \ + switch (type) { \ + _dispatch \ + \ + case esxVI_Type_##__type: \ + break; \ + \ + default: \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + _("Call to %s for unexpected type '%s'"), \ + __FUNCTION__, esxVI_Type_ToString(type)); \ + return -1; \ + }, \ + /* nothing */, \ _deserialize) @@ -752,36 +752,36 @@ esxVI_GetActualObjectType(xmlNodePtr node, esxVI_Type baseType, * Macros to implement managed objects */ -#define ESX_VI__TEMPLATE__PROPERTY__MANAGED_REQUIRE(_name) \ +#define ESX_VI__TEMPLATE__PROPERTY__MANAGED_REQUIRE(_name) \ /* FIXME: This results in O(n^2) runtime in case of missing required, but \ - * unselected properties. */ \ - if (item->_name == 0 && \ - esxVI_String_ListContainsValue(selectedPropertyNameList, #_name)) { \ - virReportError(VIR_ERR_INTERNAL_ERROR, \ - _("%s object is missing the required '%s' property"), \ - typeName, #_name); \ - return -1; \ + * unselected properties. */ \ + if (item->_name == 0 && \ + esxVI_String_ListContainsValue(selectedPropertyNameList, #_name)) { \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + _("%s object is missing the required '%s' property"), \ + typeName, #_name); \ + return -1; \ } -#define ESX_VI__TEMPLATE__MANAGED_VALIDATE(__type, _require) \ - int \ - esxVI_##__type##_Validate(esxVI_##__type *item, \ - esxVI_String *selectedPropertyNameList) \ - { \ - const char *typeName = esxVI_Type_ToString(esxVI_Type_##__type); \ - \ - if (item->_type <= esxVI_Type_Undefined || \ - item->_type >= esxVI_Type_Other) { \ - virReportError(VIR_ERR_INTERNAL_ERROR, \ +#define ESX_VI__TEMPLATE__MANAGED_VALIDATE(__type, _require) \ + int \ + esxVI_##__type##_Validate(esxVI_##__type *item, \ + esxVI_String *selectedPropertyNameList) \ + { \ + const char *typeName = esxVI_Type_ToString(esxVI_Type_##__type); \ + \ + if (item->_type <= esxVI_Type_Undefined || \ + item->_type >= esxVI_Type_Other) { \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ _("%s object has invalid dynamic type"), typeName);\ - return -1; \ - } \ - \ - _require \ - \ - return 0; \ + return -1; \ + } \ + \ + _require \ + \ + return 0; \ } @@ -1051,24 +1051,24 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType) if (!(*anyType)->value && VIR_STRDUP((*anyType)->value, "") < 0) goto failure; -#define _DESERIALIZE_NUMBER(_type, _xsdType, _name, _min, _max) \ - do { \ - if (virStrToLong_ll((*anyType)->value, NULL, 10, &number) < 0) { \ - virReportError(VIR_ERR_INTERNAL_ERROR, \ - _("Unknown value '%s' for %s"), \ - (*anyType)->value, _xsdType); \ - goto failure; \ - } \ - \ - if (((_min) != INT64_MIN && number < (_min)) \ - || ((_max) != INT64_MAX && number > (_max))) { \ - virReportError(VIR_ERR_INTERNAL_ERROR, \ - _("Value '%s' is out of %s range"), \ - (*anyType)->value, _xsdType); \ - goto failure; \ - } \ - \ - (*anyType)->_name = number; \ +#define _DESERIALIZE_NUMBER(_type, _xsdType, _name, _min, _max) \ + do { \ + if (virStrToLong_ll((*anyType)->value, NULL, 10, &number) < 0) { \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + _("Unknown value '%s' for %s"), \ + (*anyType)->value, _xsdType); \ + goto failure; \ + } \ + \ + if (((_min) != INT64_MIN && number < (_min)) \ + || ((_max) != INT64_MAX && number > (_max))) { \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + _("Value '%s' is out of %s range"), \ + (*anyType)->value, _xsdType); \ + goto failure; \ + } \ + \ + (*anyType)->_name = number; \ } while (0) switch ((*anyType)->type) { diff --git a/src/internal.h b/src/internal.h index c29f20f022..5895030415 100644 --- a/src/internal.h +++ b/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) diff --git a/src/libxl/libxl_domain.h b/src/libxl/libxl_domain.h index dc40139267..b5b6332151 100644 --- a/src/libxl/libxl_domain.h +++ b/src/libxl/libxl_domain.h @@ -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 diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index e4666c9213..951937f145 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -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); diff --git a/src/libxl/libxl_migration.h b/src/libxl/libxl_migration.h index fcea5581c2..3bc2d0eae7 100644 --- a/src/libxl/libxl_migration.h +++ b/src/libxl/libxl_migration.h @@ -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, \ diff --git a/src/locking/lock_driver.h b/src/locking/lock_driver.h index f8fd38edee..8b7cccc521 100644 --- a/src/locking/lock_driver.h +++ b/src/locking/lock_driver.h @@ -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)) diff --git a/src/locking/lock_manager.c b/src/locking/lock_manager.c index 6efaea9cdc..4ef9f9e692 100644 --- a/src/locking/lock_manager.c +++ b/src/locking/lock_manager.c @@ -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 { diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index b3f6f064f3..0069e5e92d 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -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 */ diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c index d48334b857..35df13b153 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -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; diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfilter_ebiptables_driver.c index 0ab7c08f3c..b8682a1130 100644 --- a/src/nwfilter/nwfilter_ebiptables_driver.c +++ b/src/nwfilter/nwfilter_ebiptables_driver.c @@ -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, ":") diff --git a/src/openvz/openvz_driver.h b/src/openvz/openvz_driver.h index 0c7a0701f7..fb120c987c 100644 --- a/src/openvz/openvz_driver.h +++ b/src/openvz/openvz_driver.h @@ -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, \ diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c index 662e2f7bbf..cce7448abc 100644 --- a/src/phyp/phyp_driver.c +++ b/src/phyp/phyp_driver.c @@ -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 diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index b1cfafa790..8708b79ed0 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -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"); diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index ec61c9c526..11b01598f2 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -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) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index f063faaa67..b248a3ddc4 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -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); diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 8d863e8949..e021da51fc 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -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; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 6c5ec5f558..be5cde7906 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -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); diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index e4e9e79ccb..69eb231dae 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -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) { diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h index f634138f4d..c83febf7bc 100644 --- a/src/qemu/qemu_migration.h +++ b/src/qemu/qemu_migration.h @@ -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 diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 611876ff89..473a527358 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -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) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index aa2599209b..64394f76fe 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -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, diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c index 737e8389bc..2db71548cb 100644 --- a/src/qemu/qemu_monitor_text.c +++ b/src/qemu/qemu_monitor_text.c @@ -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); diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c index 649c3b1ccf..5333163850 100644 --- a/src/qemu/qemu_parse_command.c +++ b/src/qemu/qemu_parse_command.c @@ -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 diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 06719bb825..f8fa64af99 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -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: diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c index eb46e34301..8aeacf8774 100644 --- a/src/rpc/virnetclient.c +++ b/src/rpc/virnetclient.c @@ -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, diff --git a/src/security/security_manager.h b/src/security/security_manager.h index 08fb89203a..6712112e76 100644 --- a/src/security/security_manager.h +++ b/src/security/security_manager.h @@ -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 | \ diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c index cdc8d3d572..5a8c4f7f6a 100644 --- a/src/storage/storage_backend.c +++ b/src/storage/storage_backend.c @@ -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 diff --git a/src/util/viralloc.h b/src/util/viralloc.h index 088f18f425..69d0f904f1 100644 --- a/src/util/viralloc.h +++ b/src/util/viralloc.h @@ -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) diff --git a/src/util/viratomic.h b/src/util/viratomic.h index 4d7f7e5825..febe401f77 100644 --- a/src/util/viratomic.h +++ b/src/util/viratomic.h @@ -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 diff --git a/src/util/viraudit.h b/src/util/viraudit.h index edaddf3c88..ed3d66ab5d 100644 --- a/src/util/viraudit.h +++ b/src/util/viraudit.h @@ -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) \ diff --git a/src/util/vircommand.c b/src/util/vircommand.c index 6cd76a560e..17cbdab7b7 100644 --- a/src/util/vircommand.c +++ b/src/util/vircommand.c @@ -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) diff --git a/src/util/virconf.c b/src/util/virconf.c index 5822ee45eb..39c2bd9175 100644 --- a/src/util/virconf.c +++ b/src/util/virconf.c @@ -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, diff --git a/src/util/virdbus.c b/src/util/virdbus.c index 02edc5690b..ba8b684f17 100644 --- a/src/util/virdbus.c +++ b/src/util/virdbus.c @@ -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) diff --git a/src/util/virdnsmasq.h b/src/util/virdnsmasq.h index f47bea3abe..efd8ee0f62 100644 --- a/src/util/virdnsmasq.h +++ b/src/util/virdnsmasq.h @@ -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__ */ diff --git a/src/util/virendian.h b/src/util/virendian.h index 97940bd33a..25c2f1ab1d 100644 --- a/src/util/virendian.h +++ b/src/util/virendian.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__ */ diff --git a/src/util/virerror.h b/src/util/virerror.h index 3201d5cec6..fba18ba589 100644 --- a/src/util/virerror.h +++ b/src/util/virerror.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); diff --git a/src/util/virfile.h b/src/util/virfile.h index 91d3186223..b9b6b3c223 100644 --- a/src/util/virfile.h +++ b/src/util/virfile.h @@ -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. */ diff --git a/src/util/virfirewall.c b/src/util/virfirewall.c index 66d1c72c95..ff1bb83073 100644 --- a/src/util/virfirewall.c +++ b/src/util/virfirewall.c @@ -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 diff --git a/src/util/virhash.c b/src/util/virhash.c index 7fa2992f18..0ffbfcce2c 100644 --- a/src/util/virhash.c +++ b/src/util/virhash.c @@ -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) /* diff --git a/src/util/virlog.c b/src/util/virlog.c index d45a451a75..68439b9194 100644 --- a/src/util/virlog.c +++ b/src/util/virlog.c @@ -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)) diff --git a/src/util/virlog.h b/src/util/virlog.h index cc09f484af..8973f83b20 100644 --- a/src/util/virlog.h +++ b/src/util/virlog.h @@ -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__) diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c index 41ef65d882..eb2d119bf6 100644 --- a/src/util/virnetdev.c +++ b/src/util/virnetdev.c @@ -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 diff --git a/src/util/virnetdevopenvswitch.c b/src/util/virnetdevopenvswitch.c index 06ce9d8ee5..f86f698430 100644 --- a/src/util/virnetdevopenvswitch.c +++ b/src/util/virnetdevopenvswitch.c @@ -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 diff --git a/src/util/virobject.c b/src/util/virobject.c index cfa821c4b0..1723df6b2f 100644 --- a/src/util/virobject.c +++ b/src/util/virobject.c @@ -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) diff --git a/src/util/virpci.c b/src/util/virpci.c index 501f7af4fc..fe57bef327 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -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 */ diff --git a/src/util/virprobe.h b/src/util/virprobe.h index 7565954af3..1baec98f78 100644 --- a/src/util/virprobe.h +++ b/src/util/virprobe.h @@ -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 diff --git a/src/util/virsocketaddr.h b/src/util/virsocketaddr.h index a0425864d5..80e792618d 100644 --- a/src/util/virsocketaddr.h +++ b/src/util/virsocketaddr.h @@ -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" diff --git a/src/util/virstring.h b/src/util/virstring.h index cfd91be314..b19abaf9fa 100644 --- a/src/util/virstring.h +++ b/src/util/virstring.h @@ -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__) diff --git a/src/util/virsysinfo.c b/src/util/virsysinfo.c index 8e40b2b5c5..ab81b1f7f0 100644 --- a/src/util/virsysinfo.c +++ b/src/util/virsysinfo.c @@ -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 diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c index 829b92d54d..3be963d704 100644 --- a/src/util/virsystemd.c +++ b/src/util/virsystemd.c @@ -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 == '.') { diff --git a/src/util/virthread.h b/src/util/virthread.h index e466d9bf01..e468ba941c 100644 --- a/src/util/virthread.h +++ b/src/util/virthread.h @@ -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 diff --git a/src/util/virtypedparam.c b/src/util/virtypedparam.c index 3b49ec82a4..2452628cdb 100644 --- a/src/util/virtypedparam.c +++ b/src/util/virtypedparam.c @@ -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) diff --git a/src/util/virtypedparam.h b/src/util/virtypedparam.h index 59d5fbc83f..120286a5a1 100644 --- a/src/util/virtypedparam.h +++ b/src/util/virtypedparam.h @@ -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 */ diff --git a/src/util/virutil.h b/src/util/virutil.h index a862a8a637..ff89d1aaaa 100644 --- a/src/util/virutil.h +++ b/src/util/virutil.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__ */ diff --git a/src/util/viruuid.h b/src/util/viruuid.h index 1d67e9ee57..40fabf41d6 100644 --- a/src/util/viruuid.h +++ b/src/util/viruuid.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) diff --git a/src/util/virxml.c b/src/util/virxml.c index 1ff1e36536..6e87605ea5 100644 --- a/src/util/virxml.c +++ b/src/util/virxml.c @@ -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. */ diff --git a/src/util/virxml.h b/src/util/virxml.h index 1a7d61a8bc..127560d9d1 100644 --- a/src/util/virxml.h +++ b/src/util/virxml.h @@ -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, diff --git a/src/vbox/vbox_CAPI_v4_0.h b/src/vbox/vbox_CAPI_v4_0.h index 1a4ed2a3f1..bdce91d02f 100644 --- a/src/vbox/vbox_CAPI_v4_0.h +++ b/src/vbox/vbox_CAPI_v4_0.h @@ -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} } /** diff --git a/src/vbox/vbox_CAPI_v4_1.h b/src/vbox/vbox_CAPI_v4_1.h index 77b2cc59f2..8756664ff6 100644 --- a/src/vbox/vbox_CAPI_v4_1.h +++ b/src/vbox/vbox_CAPI_v4_1.h @@ -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} } /** diff --git a/src/vbox/vbox_CAPI_v4_2.h b/src/vbox/vbox_CAPI_v4_2.h index 4e877089d2..003b9e3eef 100644 --- a/src/vbox/vbox_CAPI_v4_2.h +++ b/src/vbox/vbox_CAPI_v4_2.h @@ -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} } /** diff --git a/src/vbox/vbox_CAPI_v4_2_20.h b/src/vbox/vbox_CAPI_v4_2_20.h index c26fa94d01..26dcb0626f 100644 --- a/src/vbox/vbox_CAPI_v4_2_20.h +++ b/src/vbox/vbox_CAPI_v4_2_20.h @@ -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} } /** diff --git a/src/vbox/vbox_CAPI_v4_3.h b/src/vbox/vbox_CAPI_v4_3.h index fa614f53ac..c28f9902a1 100644 --- a/src/vbox/vbox_CAPI_v4_3.h +++ b/src/vbox/vbox_CAPI_v4_3.h @@ -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} } /** diff --git a/src/vbox/vbox_CAPI_v4_3_4.h b/src/vbox/vbox_CAPI_v4_3_4.h index 44e3426194..5187001bda 100644 --- a/src/vbox/vbox_CAPI_v4_3_4.h +++ b/src/vbox/vbox_CAPI_v4_3_4.h @@ -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} } /** diff --git a/src/vbox/vbox_CAPI_v5_0.h b/src/vbox/vbox_CAPI_v5_0.h index 1ac910711f..4fc881e54e 100644 --- a/src/vbox/vbox_CAPI_v5_0.h +++ b/src/vbox/vbox_CAPI_v5_0.h @@ -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); diff --git a/src/vbox/vbox_CAPI_v5_1.h b/src/vbox/vbox_CAPI_v5_1.h index 2cc8250781..20d7490352 100644 --- a/src/vbox/vbox_CAPI_v5_1.h +++ b/src/vbox/vbox_CAPI_v5_1.h @@ -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); diff --git a/src/vbox/vbox_common.h b/src/vbox/vbox_common.h index c6da8929d5..d88c637ac1 100644 --- a/src/vbox/vbox_common.h +++ b/src/vbox/vbox_common.h @@ -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 */ diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c index c7682f13c1..b5fb00606b 100644 --- a/src/vbox/vbox_tmpl.c +++ b/src/vbox/vbox_tmpl.c @@ -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) diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index 622f22f037..7a749f93ab 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -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, diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c index 3864d4323b..c1e2ab8eec 100644 --- a/src/vz/vz_driver.c +++ b/src/vz/vz_driver.c @@ -1749,7 +1749,7 @@ vzDomainBlockStatsImpl(virDomainObjPtr dom, } else { virDomainBlockStatsStruct s; -#define PARALLELS_ZERO_STATS(VAR, TYPE, NAME) \ +#define PARALLELS_ZERO_STATS(VAR, TYPE, NAME) \ stats->VAR = 0; PARALLELS_BLOCK_STATS_FOREACH(PARALLELS_ZERO_STATS) @@ -1763,8 +1763,8 @@ vzDomainBlockStatsImpl(virDomainObjPtr dom, IS_CT(dom->def)) < 0) return -1; -#define PARALLELS_SUM_STATS(VAR, TYPE, NAME) \ - if (s.VAR != -1) \ +#define PARALLELS_SUM_STATS(VAR, TYPE, NAME) \ + if (s.VAR != -1) \ stats->VAR += s.VAR; PARALLELS_BLOCK_STATS_FOREACH(PARALLELS_SUM_STATS) @@ -1809,8 +1809,8 @@ vzDomainBlockStatsToParams(virDomainBlockStatsPtr stats, size_t i; if (*nparams == 0) { -#define PARALLELS_COUNT_STATS(VAR, TYPE, NAME) \ - if ((stats->VAR) != -1) \ +#define PARALLELS_COUNT_STATS(VAR, TYPE, NAME) \ + if ((stats->VAR) != -1) \ ++*nparams; PARALLELS_BLOCK_STATS_FOREACH(PARALLELS_COUNT_STATS) @@ -1820,12 +1820,12 @@ vzDomainBlockStatsToParams(virDomainBlockStatsPtr stats, } i = 0; -#define PARALLELS_BLOCK_STATS_ASSIGN_PARAM(VAR, TYPE, NAME) \ - if (i < *nparams && (stats->VAR) != -1) { \ - if (virTypedParameterAssign(params + i, TYPE, \ - VIR_TYPED_PARAM_LLONG, (stats->VAR)) < 0) \ - return -1; \ - i++; \ +#define PARALLELS_BLOCK_STATS_ASSIGN_PARAM(VAR, TYPE, NAME) \ + if (i < *nparams && (stats->VAR) != -1) { \ + if (virTypedParameterAssign(params + i, TYPE, \ + VIR_TYPED_PARAM_LLONG, (stats->VAR)) < 0) \ + return -1; \ + i++; \ } PARALLELS_BLOCK_STATS_FOREACH(PARALLELS_BLOCK_STATS_ASSIGN_PARAM) @@ -2897,14 +2897,14 @@ vzEatCookie(const char *cookiein, int cookieinlen, unsigned int flags) goto cleanup; } -#define VZ_MIGRATION_FLAGS (VIR_MIGRATE_PAUSED | \ - VIR_MIGRATE_PEER2PEER | \ - VIR_MIGRATE_LIVE | \ +#define VZ_MIGRATION_FLAGS (VIR_MIGRATE_PAUSED | \ + VIR_MIGRATE_PEER2PEER | \ + VIR_MIGRATE_LIVE | \ VIR_MIGRATE_UNDEFINE_SOURCE | \ - VIR_MIGRATE_PERSIST_DEST | \ + VIR_MIGRATE_PERSIST_DEST | \ VIR_MIGRATE_NON_SHARED_INC) -#define VZ_MIGRATION_PARAMETERS \ +#define VZ_MIGRATION_PARAMETERS \ VIR_MIGRATE_PARAM_DEST_XML, VIR_TYPED_PARAM_STRING, \ VIR_MIGRATE_PARAM_URI, VIR_TYPED_PARAM_STRING, \ VIR_MIGRATE_PARAM_DEST_NAME, VIR_TYPED_PARAM_STRING, \ @@ -3509,18 +3509,18 @@ vzDomainGetJobStats(virDomainPtr domain, return ret; } -#define VZ_ADD_STAT_PARAM_UUL(group, field, counter) \ -do { \ - if (stat.field != -1) { \ - snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH, \ - group ".%zu." counter, i); \ - if (virTypedParamsAddULLong(&record->params, \ - &record->nparams, \ - maxparams, \ - param_name, \ - stat.field) < 0) \ - return -1; \ - } \ +#define VZ_ADD_STAT_PARAM_UUL(group, field, counter) \ +do { \ + if (stat.field != -1) { \ + snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH, \ + group ".%zu." counter, i); \ + if (virTypedParamsAddULLong(&record->params, \ + &record->nparams, \ + maxparams, \ + param_name, \ + stat.field) < 0) \ + return -1; \ + } \ } while (0) static int @@ -3710,13 +3710,13 @@ vzDomainGetBalloonStats(virDomainObjPtr dom, if (n < 0) return -1; -#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 < n; i++) { diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c index 3910deeb3a..819b02b1e4 100644 --- a/src/vz/vz_sdk.c +++ b/src/vz/vz_sdk.c @@ -92,24 +92,24 @@ logPrlErrorHelper(PRL_RESULT err, const char *filename, VIR_FREE(msg2); } -#define logPrlError(code) \ - logPrlErrorHelper(code, __FILE__, \ +#define logPrlError(code) \ + logPrlErrorHelper(code, __FILE__, \ __FUNCTION__, __LINE__) -#define prlsdkCheckRetGoto(ret, label) \ - do { \ - if (PRL_FAILED(ret)) { \ - logPrlError(ret); \ - goto label; \ - } \ +#define prlsdkCheckRetGoto(ret, label) \ + do { \ + if (PRL_FAILED(ret)) { \ + logPrlError(ret); \ + goto label; \ + } \ } while (0) -#define prlsdkCheckRetExit(ret, code) \ - do { \ - if (PRL_FAILED(ret)) { \ - logPrlError(ret); \ - return code; \ - } \ +#define prlsdkCheckRetExit(ret, code) \ + do { \ + if (PRL_FAILED(ret)) { \ + logPrlError(ret); \ + return code; \ + } \ } while (0) static void @@ -197,8 +197,8 @@ getJobResultHelper(PRL_HANDLE job, unsigned int timeout, PRL_HANDLE *result, return ret; } -#define getJobResult(job, result) \ - getJobResultHelper(job, JOB_INFINIT_WAIT_TIMEOUT, \ +#define getJobResult(job, result) \ + getJobResultHelper(job, JOB_INFINIT_WAIT_TIMEOUT, \ result, __FILE__, __FUNCTION__, __LINE__) static PRL_RESULT @@ -218,8 +218,8 @@ getDomainJobResultHelper(PRL_HANDLE job, virDomainObjPtr dom, return pret; } -#define getDomainJobResult(job, dom, result) \ - getDomainJobResultHelper(job, dom, JOB_INFINIT_WAIT_TIMEOUT, \ +#define getDomainJobResult(job, dom, result) \ + getDomainJobResultHelper(job, dom, JOB_INFINIT_WAIT_TIMEOUT, \ result, __FILE__, __FUNCTION__, __LINE__) static PRL_RESULT @@ -236,8 +236,8 @@ waitJobHelper(PRL_HANDLE job, unsigned int timeout, return ret; } -#define waitJob(job) \ - waitJobHelper(job, JOB_INFINIT_WAIT_TIMEOUT, __FILE__, \ +#define waitJob(job) \ + waitJobHelper(job, JOB_INFINIT_WAIT_TIMEOUT, __FILE__, \ __FUNCTION__, __LINE__) static PRL_RESULT @@ -265,8 +265,8 @@ waitDomainJobHelper(PRL_HANDLE job, virDomainObjPtr dom, unsigned int timeout, return ret; } -#define waitDomainJob(job, dom) \ - waitDomainJobHelper(job, dom, JOB_INFINIT_WAIT_TIMEOUT, __FILE__, \ +#define waitDomainJob(job, dom) \ + waitDomainJobHelper(job, dom, JOB_INFINIT_WAIT_TIMEOUT, __FILE__, \ __FUNCTION__, __LINE__) typedef PRL_RESULT (*prlsdkParamGetterType)(PRL_HANDLE, char*, PRL_UINT32*); @@ -4424,11 +4424,11 @@ prlsdkGetBlockStats(PRL_HANDLE sdkstats, } -#define PRLSDK_GET_STAT_PARAM(VAL, TYPE, NAME) \ - if (virAsprintf(&name, "devices.%s%d.%s", prefix, idx, NAME) < 0) \ - goto cleanup; \ - if (prlsdkExtractStatsParam(sdkstats, name, &stats->VAL) < 0) \ - goto cleanup; \ +#define PRLSDK_GET_STAT_PARAM(VAL, TYPE, NAME) \ + if (virAsprintf(&name, "devices.%s%d.%s", prefix, idx, NAME) < 0) \ + goto cleanup; \ + if (prlsdkExtractStatsParam(sdkstats, name, &stats->VAL) < 0) \ + goto cleanup; \ VIR_FREE(name); PARALLELS_BLOCK_STATS_FOREACH(PRLSDK_GET_STAT_PARAM) @@ -4505,11 +4505,11 @@ prlsdkGetNetStats(PRL_HANDLE sdkstats, PRL_HANDLE sdkdom, const char *device, pret = PrlVmDev_GetIndex(net, &net_index); prlsdkCheckRetGoto(pret, cleanup); -#define PRLSDK_GET_NET_COUNTER(VAL, NAME) \ - if (virAsprintf(&name, "net.nic%u.%s", net_index, NAME) < 0) \ - goto cleanup; \ - if (prlsdkExtractStatsParam(sdkstats, name, &stats->VAL) < 0) \ - goto cleanup; \ +#define PRLSDK_GET_NET_COUNTER(VAL, NAME) \ + if (virAsprintf(&name, "net.nic%u.%s", net_index, NAME) < 0) \ + goto cleanup; \ + if (prlsdkExtractStatsParam(sdkstats, name, &stats->VAL) < 0) \ + goto cleanup; \ VIR_FREE(name); PRLSDK_GET_NET_COUNTER(rx_bytes, "bytes_in") @@ -4559,15 +4559,15 @@ prlsdkGetMemoryStats(PRL_HANDLE sdkstats, long long v = 0, t = 0, u = 0; size_t i = 0; -#define PRLSDK_GET_COUNTER(NAME, VALUE) \ - if (prlsdkExtractStatsParam(sdkstats, NAME, &VALUE) < 0) \ - goto cleanup; \ +#define PRLSDK_GET_COUNTER(NAME, VALUE) \ + if (prlsdkExtractStatsParam(sdkstats, NAME, &VALUE) < 0) \ + goto cleanup; \ -#define PRLSDK_MEMORY_STAT_SET(TAG, VALUE) \ - if (i < nr_stats) { \ - stats[i].tag = (TAG); \ - stats[i].val = (VALUE); \ - i++; \ +#define PRLSDK_MEMORY_STAT_SET(TAG, VALUE) \ + if (i < nr_stats) { \ + stats[i].tag = (TAG); \ + stats[i].val = (VALUE); \ + i++; \ } i = 0; diff --git a/src/vz/vz_utils.h b/src/vz/vz_utils.h index d213183df4..f9e9dee42a 100644 --- a/src/vz/vz_utils.h +++ b/src/vz/vz_utils.h @@ -33,17 +33,17 @@ # include "virthread.h" # include "datatypes.h" -# define vzParseError() \ - virReportErrorHelper(VIR_FROM_TEST, VIR_ERR_OPERATION_FAILED, __FILE__, \ +# define vzParseError() \ + virReportErrorHelper(VIR_FROM_TEST, VIR_ERR_OPERATION_FAILED, __FILE__, \ __FUNCTION__, __LINE__, _("Can't parse prlctl output")) # define IS_CT(def) (def->os.type == VIR_DOMAIN_OSTYPE_EXE) -# define vzDomNotFoundError(domain) \ - do { \ - char uuidstr[VIR_UUID_STRING_BUFLEN]; \ - virUUIDFormat(domain->uuid, uuidstr); \ - virReportError(VIR_ERR_NO_DOMAIN, \ +# define vzDomNotFoundError(domain) \ + do { \ + char uuidstr[VIR_UUID_STRING_BUFLEN]; \ + virUUIDFormat(domain->uuid, uuidstr); \ + virReportError(VIR_ERR_NO_DOMAIN, \ _("no domain with matching uuid '%s'"), uuidstr); \ } while (0) @@ -146,10 +146,10 @@ vzGetDefaultSCSIModel(vzDriverPtr driver, int vzCheckUnsupportedGraphics(virDomainGraphicsDefPtr gr); -# define PARALLELS_BLOCK_STATS_FOREACH(OP) \ - OP(rd_req, VIR_DOMAIN_BLOCK_STATS_READ_REQ, "read_requests") \ - OP(rd_bytes, VIR_DOMAIN_BLOCK_STATS_READ_BYTES, "read_total") \ - OP(wr_req, VIR_DOMAIN_BLOCK_STATS_WRITE_REQ, "write_requests") \ +# define PARALLELS_BLOCK_STATS_FOREACH(OP) \ + OP(rd_req, VIR_DOMAIN_BLOCK_STATS_READ_REQ, "read_requests") \ + OP(rd_bytes, VIR_DOMAIN_BLOCK_STATS_READ_BYTES, "read_total") \ + OP(wr_req, VIR_DOMAIN_BLOCK_STATS_WRITE_REQ, "write_requests") \ OP(wr_bytes, VIR_DOMAIN_BLOCK_STATS_WRITE_BYTES, "write_total") #endif diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c index 901b6ba4b0..f521fd1f2c 100644 --- a/src/xen/xen_driver.c +++ b/src/xen/xen_driver.c @@ -593,8 +593,8 @@ xenUnifiedConnectClose(virConnectPtr conn) } -#define HV_VERSION ((DOM0_INTERFACE_VERSION >> 24) * 1000000 + \ - ((DOM0_INTERFACE_VERSION >> 16) & 0xFF) * 1000 + \ +#define HV_VERSION ((DOM0_INTERFACE_VERSION >> 24) * 1000000 + \ + ((DOM0_INTERFACE_VERSION >> 16) & 0xFF) * 1000 + \ (DOM0_INTERFACE_VERSION & 0xFFFF)) unsigned long xenUnifiedVersion(void) diff --git a/src/xen/xen_driver.h b/src/xen/xen_driver.h index 7ebda8f5e4..f95b5e7053 100644 --- a/src/xen/xen_driver.h +++ b/src/xen/xen_driver.h @@ -73,10 +73,10 @@ int xenRegister (void); # define XEN_SCHED_CRED_NPARAM 2 /* The set of migration flags explicitly supported by xen. */ -# define XEN_MIGRATION_FLAGS \ - (VIR_MIGRATE_LIVE | \ - VIR_MIGRATE_UNDEFINE_SOURCE | \ - VIR_MIGRATE_PAUSED | \ +# define XEN_MIGRATION_FLAGS \ + (VIR_MIGRATE_LIVE | \ + VIR_MIGRATE_UNDEFINE_SOURCE | \ + VIR_MIGRATE_PAUSED | \ VIR_MIGRATE_PERSIST_DEST) diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c index 7db61fade4..633ec9eeea 100644 --- a/src/xen/xen_hypervisor.c +++ b/src/xen/xen_hypervisor.c @@ -104,7 +104,7 @@ typedef struct v1_hypercall_struct uint64_t op; uint64_t arg[5]; } v1_hypercall_t; -# define XEN_V1_IOCTL_HYPERCALL_CMD \ +# define XEN_V1_IOCTL_HYPERCALL_CMD \ _IOC(_IOC_NONE, 'P', 0, sizeof(v1_hypercall_t)) typedef v1_hypercall_t hypercall_t; #elif defined(__sun) @@ -340,245 +340,245 @@ struct xen_v2s5_availheap { typedef struct xen_v2s5_availheap xen_v2s5_availheap; -#define XEN_GETDOMAININFOLIST_ALLOC(domlist, size) \ - (hv_versions.hypervisor < 2 ? \ - (VIR_ALLOC_N(domlist.v0, (size)) == 0) : \ - (hv_versions.dom_interface >= 9 ? \ - (VIR_ALLOC_N(domlist.v2d9, (size)) == 0) : \ - (hv_versions.dom_interface == 8 ? \ - (VIR_ALLOC_N(domlist.v2d8, (size)) == 0) : \ - (hv_versions.dom_interface == 7 ? \ - (VIR_ALLOC_N(domlist.v2d7, (size)) == 0) : \ - (hv_versions.dom_interface == 6 ? \ - (VIR_ALLOC_N(domlist.v2d6, (size)) == 0) : \ - (hv_versions.dom_interface == 5 ? \ - (VIR_ALLOC_N(domlist.v2d5, (size)) == 0) : \ +#define XEN_GETDOMAININFOLIST_ALLOC(domlist, size) \ + (hv_versions.hypervisor < 2 ? \ + (VIR_ALLOC_N(domlist.v0, (size)) == 0) : \ + (hv_versions.dom_interface >= 9 ? \ + (VIR_ALLOC_N(domlist.v2d9, (size)) == 0) : \ + (hv_versions.dom_interface == 8 ? \ + (VIR_ALLOC_N(domlist.v2d8, (size)) == 0) : \ + (hv_versions.dom_interface == 7 ? \ + (VIR_ALLOC_N(domlist.v2d7, (size)) == 0) : \ + (hv_versions.dom_interface == 6 ? \ + (VIR_ALLOC_N(domlist.v2d6, (size)) == 0) : \ + (hv_versions.dom_interface == 5 ? \ + (VIR_ALLOC_N(domlist.v2d5, (size)) == 0) : \ (VIR_ALLOC_N(domlist.v2, (size)) == 0))))))) -#define XEN_GETDOMAININFOLIST_FREE(domlist) \ - (hv_versions.hypervisor < 2 ? \ - VIR_FREE(domlist.v0) : \ - (hv_versions.dom_interface >= 9 ? \ - VIR_FREE(domlist.v2d9) : \ - (hv_versions.dom_interface == 8 ? \ - VIR_FREE(domlist.v2d8) : \ - (hv_versions.dom_interface == 7 ? \ - VIR_FREE(domlist.v2d7) : \ - (hv_versions.dom_interface == 6 ? \ - VIR_FREE(domlist.v2d6) : \ - (hv_versions.dom_interface == 5 ? \ - VIR_FREE(domlist.v2d5) : \ +#define XEN_GETDOMAININFOLIST_FREE(domlist) \ + (hv_versions.hypervisor < 2 ? \ + VIR_FREE(domlist.v0) : \ + (hv_versions.dom_interface >= 9 ? \ + VIR_FREE(domlist.v2d9) : \ + (hv_versions.dom_interface == 8 ? \ + VIR_FREE(domlist.v2d8) : \ + (hv_versions.dom_interface == 7 ? \ + VIR_FREE(domlist.v2d7) : \ + (hv_versions.dom_interface == 6 ? \ + VIR_FREE(domlist.v2d6) : \ + (hv_versions.dom_interface == 5 ? \ + VIR_FREE(domlist.v2d5) : \ VIR_FREE(domlist.v2))))))) -#define XEN_GETDOMAININFOLIST_CLEAR(domlist, size) \ - (hv_versions.hypervisor < 2 ? \ - memset(domlist.v0, 0, sizeof(*domlist.v0) * size) : \ - (hv_versions.dom_interface >= 9 ? \ +#define XEN_GETDOMAININFOLIST_CLEAR(domlist, size) \ + (hv_versions.hypervisor < 2 ? \ + memset(domlist.v0, 0, sizeof(*domlist.v0) * size) : \ + (hv_versions.dom_interface >= 9 ? \ memset(domlist.v2d9, 0, sizeof(*domlist.v2d9) * size) : \ - (hv_versions.dom_interface == 8 ? \ + (hv_versions.dom_interface == 8 ? \ memset(domlist.v2d8, 0, sizeof(*domlist.v2d8) * size) : \ - (hv_versions.dom_interface == 7 ? \ + (hv_versions.dom_interface == 7 ? \ memset(domlist.v2d7, 0, sizeof(*domlist.v2d7) * size) : \ - (hv_versions.dom_interface == 6 ? \ + (hv_versions.dom_interface == 6 ? \ memset(domlist.v2d6, 0, sizeof(*domlist.v2d6) * size) : \ - (hv_versions.dom_interface == 5 ? \ + (hv_versions.dom_interface == 5 ? \ memset(domlist.v2d5, 0, sizeof(*domlist.v2d5) * size) : \ memset(domlist.v2, 0, sizeof(*domlist.v2) * size))))))) -#define XEN_GETDOMAININFOLIST_DOMAIN(domlist, n) \ - (hv_versions.hypervisor < 2 ? \ - domlist.v0[n].domain : \ - (hv_versions.dom_interface >= 9 ? \ - domlist.v2d9[n].domain : \ - (hv_versions.dom_interface == 8 ? \ - domlist.v2d8[n].domain : \ - (hv_versions.dom_interface == 7 ? \ - domlist.v2d7[n].domain : \ - (hv_versions.dom_interface == 6 ? \ - domlist.v2d6[n].domain : \ - (hv_versions.dom_interface == 5 ? \ - domlist.v2d5[n].domain : \ +#define XEN_GETDOMAININFOLIST_DOMAIN(domlist, n) \ + (hv_versions.hypervisor < 2 ? \ + domlist.v0[n].domain : \ + (hv_versions.dom_interface >= 9 ? \ + domlist.v2d9[n].domain : \ + (hv_versions.dom_interface == 8 ? \ + domlist.v2d8[n].domain : \ + (hv_versions.dom_interface == 7 ? \ + domlist.v2d7[n].domain : \ + (hv_versions.dom_interface == 6 ? \ + domlist.v2d6[n].domain : \ + (hv_versions.dom_interface == 5 ? \ + domlist.v2d5[n].domain : \ domlist.v2[n].domain)))))) -#define XEN_GETDOMAININFOLIST_UUID(domlist, n) \ - (hv_versions.hypervisor < 2 ? \ - domlist.v0[n].handle : \ - (hv_versions.dom_interface >= 9 ? \ - domlist.v2d9[n].handle : \ - (hv_versions.dom_interface == 8 ? \ - domlist.v2d8[n].handle : \ - (hv_versions.dom_interface == 7 ? \ - domlist.v2d7[n].handle : \ - (hv_versions.dom_interface == 6 ? \ - domlist.v2d6[n].handle : \ - (hv_versions.dom_interface == 5 ? \ - domlist.v2d5[n].handle : \ +#define XEN_GETDOMAININFOLIST_UUID(domlist, n) \ + (hv_versions.hypervisor < 2 ? \ + domlist.v0[n].handle : \ + (hv_versions.dom_interface >= 9 ? \ + domlist.v2d9[n].handle : \ + (hv_versions.dom_interface == 8 ? \ + domlist.v2d8[n].handle : \ + (hv_versions.dom_interface == 7 ? \ + domlist.v2d7[n].handle : \ + (hv_versions.dom_interface == 6 ? \ + domlist.v2d6[n].handle : \ + (hv_versions.dom_interface == 5 ? \ + domlist.v2d5[n].handle : \ domlist.v2[n].handle)))))) -#define XEN_GETDOMAININFOLIST_DATA(domlist) \ - (hv_versions.hypervisor < 2 ? \ - (void*)(domlist->v0) : \ - (hv_versions.dom_interface >= 9 ? \ - (void*)(domlist->v2d9) : \ - (hv_versions.dom_interface == 8 ? \ - (void*)(domlist->v2d8) : \ - (hv_versions.dom_interface == 7 ? \ - (void*)(domlist->v2d7) : \ - (hv_versions.dom_interface == 6 ? \ - (void*)(domlist->v2d6) : \ - (hv_versions.dom_interface == 5 ? \ - (void*)(domlist->v2d5) : \ +#define XEN_GETDOMAININFOLIST_DATA(domlist) \ + (hv_versions.hypervisor < 2 ? \ + (void*)(domlist->v0) : \ + (hv_versions.dom_interface >= 9 ? \ + (void*)(domlist->v2d9) : \ + (hv_versions.dom_interface == 8 ? \ + (void*)(domlist->v2d8) : \ + (hv_versions.dom_interface == 7 ? \ + (void*)(domlist->v2d7) : \ + (hv_versions.dom_interface == 6 ? \ + (void*)(domlist->v2d6) : \ + (hv_versions.dom_interface == 5 ? \ + (void*)(domlist->v2d5) : \ (void*)(domlist->v2))))))) -#define XEN_GETDOMAININFO_SIZE \ - (hv_versions.hypervisor < 2 ? \ - sizeof(xen_v0_getdomaininfo) : \ - (hv_versions.dom_interface >= 9 ? \ - sizeof(xen_v2d9_getdomaininfo) : \ - (hv_versions.dom_interface == 8 ? \ - sizeof(xen_v2d8_getdomaininfo) : \ - (hv_versions.dom_interface == 7 ? \ - sizeof(xen_v2d7_getdomaininfo) : \ - (hv_versions.dom_interface == 6 ? \ - sizeof(xen_v2d6_getdomaininfo) : \ - (hv_versions.dom_interface == 5 ? \ - sizeof(xen_v2d5_getdomaininfo) : \ +#define XEN_GETDOMAININFO_SIZE \ + (hv_versions.hypervisor < 2 ? \ + sizeof(xen_v0_getdomaininfo) : \ + (hv_versions.dom_interface >= 9 ? \ + sizeof(xen_v2d9_getdomaininfo) : \ + (hv_versions.dom_interface == 8 ? \ + sizeof(xen_v2d8_getdomaininfo) : \ + (hv_versions.dom_interface == 7 ? \ + sizeof(xen_v2d7_getdomaininfo) : \ + (hv_versions.dom_interface == 6 ? \ + sizeof(xen_v2d6_getdomaininfo) : \ + (hv_versions.dom_interface == 5 ? \ + sizeof(xen_v2d5_getdomaininfo) : \ sizeof(xen_v2_getdomaininfo))))))) -#define XEN_GETDOMAININFO_CLEAR(dominfo) \ - (hv_versions.hypervisor < 2 ? \ - memset(&(dominfo.v0), 0, sizeof(xen_v0_getdomaininfo)) : \ - (hv_versions.dom_interface >= 9 ? \ +#define XEN_GETDOMAININFO_CLEAR(dominfo) \ + (hv_versions.hypervisor < 2 ? \ + memset(&(dominfo.v0), 0, sizeof(xen_v0_getdomaininfo)) : \ + (hv_versions.dom_interface >= 9 ? \ memset(&(dominfo.v2d9), 0, sizeof(xen_v2d9_getdomaininfo)) : \ - (hv_versions.dom_interface == 8 ? \ + (hv_versions.dom_interface == 8 ? \ memset(&(dominfo.v2d8), 0, sizeof(xen_v2d8_getdomaininfo)) : \ - (hv_versions.dom_interface == 7 ? \ + (hv_versions.dom_interface == 7 ? \ memset(&(dominfo.v2d7), 0, sizeof(xen_v2d7_getdomaininfo)) : \ - (hv_versions.dom_interface == 6 ? \ + (hv_versions.dom_interface == 6 ? \ memset(&(dominfo.v2d6), 0, sizeof(xen_v2d6_getdomaininfo)) : \ - (hv_versions.dom_interface == 5 ? \ + (hv_versions.dom_interface == 5 ? \ memset(&(dominfo.v2d5), 0, sizeof(xen_v2d5_getdomaininfo)) : \ memset(&(dominfo.v2), 0, sizeof(xen_v2_getdomaininfo)))))))) -#define XEN_GETDOMAININFO_DOMAIN(dominfo) \ - (hv_versions.hypervisor < 2 ? \ - dominfo.v0.domain : \ - (hv_versions.dom_interface >= 9 ? \ - dominfo.v2d9.domain : \ - (hv_versions.dom_interface == 8 ? \ - dominfo.v2d8.domain : \ - (hv_versions.dom_interface == 7 ? \ - dominfo.v2d7.domain : \ - (hv_versions.dom_interface == 6 ? \ - dominfo.v2d6.domain : \ - (hv_versions.dom_interface == 5 ? \ - dominfo.v2d5.domain : \ +#define XEN_GETDOMAININFO_DOMAIN(dominfo) \ + (hv_versions.hypervisor < 2 ? \ + dominfo.v0.domain : \ + (hv_versions.dom_interface >= 9 ? \ + dominfo.v2d9.domain : \ + (hv_versions.dom_interface == 8 ? \ + dominfo.v2d8.domain : \ + (hv_versions.dom_interface == 7 ? \ + dominfo.v2d7.domain : \ + (hv_versions.dom_interface == 6 ? \ + dominfo.v2d6.domain : \ + (hv_versions.dom_interface == 5 ? \ + dominfo.v2d5.domain : \ dominfo.v2.domain)))))) -#define XEN_GETDOMAININFO_CPUTIME(dominfo) \ - (hv_versions.hypervisor < 2 ? \ - dominfo.v0.cpu_time : \ - (hv_versions.dom_interface >= 9 ? \ - dominfo.v2d9.cpu_time : \ - (hv_versions.dom_interface == 8 ? \ - dominfo.v2d8.cpu_time : \ - (hv_versions.dom_interface == 7 ? \ - dominfo.v2d7.cpu_time : \ - (hv_versions.dom_interface == 6 ? \ - dominfo.v2d6.cpu_time : \ - (hv_versions.dom_interface == 5 ? \ - dominfo.v2d5.cpu_time : \ +#define XEN_GETDOMAININFO_CPUTIME(dominfo) \ + (hv_versions.hypervisor < 2 ? \ + dominfo.v0.cpu_time : \ + (hv_versions.dom_interface >= 9 ? \ + dominfo.v2d9.cpu_time : \ + (hv_versions.dom_interface == 8 ? \ + dominfo.v2d8.cpu_time : \ + (hv_versions.dom_interface == 7 ? \ + dominfo.v2d7.cpu_time : \ + (hv_versions.dom_interface == 6 ? \ + dominfo.v2d6.cpu_time : \ + (hv_versions.dom_interface == 5 ? \ + dominfo.v2d5.cpu_time : \ dominfo.v2.cpu_time)))))) -#define XEN_GETDOMAININFO_CPUCOUNT(dominfo) \ - (hv_versions.hypervisor < 2 ? \ - dominfo.v0.nr_online_vcpus : \ - (hv_versions.dom_interface >= 9 ? \ - dominfo.v2d9.nr_online_vcpus : \ - (hv_versions.dom_interface == 8 ? \ - dominfo.v2d8.nr_online_vcpus : \ - (hv_versions.dom_interface == 7 ? \ - dominfo.v2d7.nr_online_vcpus : \ - (hv_versions.dom_interface == 6 ? \ - dominfo.v2d6.nr_online_vcpus : \ - (hv_versions.dom_interface == 5 ? \ - dominfo.v2d5.nr_online_vcpus : \ +#define XEN_GETDOMAININFO_CPUCOUNT(dominfo) \ + (hv_versions.hypervisor < 2 ? \ + dominfo.v0.nr_online_vcpus : \ + (hv_versions.dom_interface >= 9 ? \ + dominfo.v2d9.nr_online_vcpus : \ + (hv_versions.dom_interface == 8 ? \ + dominfo.v2d8.nr_online_vcpus : \ + (hv_versions.dom_interface == 7 ? \ + dominfo.v2d7.nr_online_vcpus : \ + (hv_versions.dom_interface == 6 ? \ + dominfo.v2d6.nr_online_vcpus : \ + (hv_versions.dom_interface == 5 ? \ + dominfo.v2d5.nr_online_vcpus : \ dominfo.v2.nr_online_vcpus)))))) -#define XEN_GETDOMAININFO_MAXCPUID(dominfo) \ - (hv_versions.hypervisor < 2 ? \ - dominfo.v0.max_vcpu_id : \ - (hv_versions.dom_interface >= 9 ? \ - dominfo.v2d9.max_vcpu_id : \ - (hv_versions.dom_interface == 8 ? \ - dominfo.v2d8.max_vcpu_id : \ - (hv_versions.dom_interface == 7 ? \ - dominfo.v2d7.max_vcpu_id : \ - (hv_versions.dom_interface == 6 ? \ - dominfo.v2d6.max_vcpu_id : \ - (hv_versions.dom_interface == 5 ? \ - dominfo.v2d5.max_vcpu_id : \ +#define XEN_GETDOMAININFO_MAXCPUID(dominfo) \ + (hv_versions.hypervisor < 2 ? \ + dominfo.v0.max_vcpu_id : \ + (hv_versions.dom_interface >= 9 ? \ + dominfo.v2d9.max_vcpu_id : \ + (hv_versions.dom_interface == 8 ? \ + dominfo.v2d8.max_vcpu_id : \ + (hv_versions.dom_interface == 7 ? \ + dominfo.v2d7.max_vcpu_id : \ + (hv_versions.dom_interface == 6 ? \ + dominfo.v2d6.max_vcpu_id : \ + (hv_versions.dom_interface == 5 ? \ + dominfo.v2d5.max_vcpu_id : \ dominfo.v2.max_vcpu_id)))))) -#define XEN_GETDOMAININFO_FLAGS(dominfo) \ - (hv_versions.hypervisor < 2 ? \ - dominfo.v0.flags : \ - (hv_versions.dom_interface >= 9 ? \ - dominfo.v2d9.flags : \ - (hv_versions.dom_interface == 8 ? \ - dominfo.v2d8.flags : \ - (hv_versions.dom_interface == 7 ? \ - dominfo.v2d7.flags : \ - (hv_versions.dom_interface == 6 ? \ - dominfo.v2d6.flags : \ - (hv_versions.dom_interface == 5 ? \ - dominfo.v2d5.flags : \ +#define XEN_GETDOMAININFO_FLAGS(dominfo) \ + (hv_versions.hypervisor < 2 ? \ + dominfo.v0.flags : \ + (hv_versions.dom_interface >= 9 ? \ + dominfo.v2d9.flags : \ + (hv_versions.dom_interface == 8 ? \ + dominfo.v2d8.flags : \ + (hv_versions.dom_interface == 7 ? \ + dominfo.v2d7.flags : \ + (hv_versions.dom_interface == 6 ? \ + dominfo.v2d6.flags : \ + (hv_versions.dom_interface == 5 ? \ + dominfo.v2d5.flags : \ dominfo.v2.flags)))))) -#define XEN_GETDOMAININFO_TOT_PAGES(dominfo) \ - (hv_versions.hypervisor < 2 ? \ - dominfo.v0.tot_pages : \ - (hv_versions.dom_interface >= 9 ? \ - dominfo.v2d9.tot_pages : \ - (hv_versions.dom_interface == 8 ? \ - dominfo.v2d8.tot_pages : \ - (hv_versions.dom_interface == 7 ? \ - dominfo.v2d7.tot_pages : \ - (hv_versions.dom_interface == 6 ? \ - dominfo.v2d6.tot_pages : \ - (hv_versions.dom_interface == 5 ? \ - dominfo.v2d5.tot_pages : \ +#define XEN_GETDOMAININFO_TOT_PAGES(dominfo) \ + (hv_versions.hypervisor < 2 ? \ + dominfo.v0.tot_pages : \ + (hv_versions.dom_interface >= 9 ? \ + dominfo.v2d9.tot_pages : \ + (hv_versions.dom_interface == 8 ? \ + dominfo.v2d8.tot_pages : \ + (hv_versions.dom_interface == 7 ? \ + dominfo.v2d7.tot_pages : \ + (hv_versions.dom_interface == 6 ? \ + dominfo.v2d6.tot_pages : \ + (hv_versions.dom_interface == 5 ? \ + dominfo.v2d5.tot_pages : \ dominfo.v2.tot_pages)))))) -#define XEN_GETDOMAININFO_MAX_PAGES(dominfo) \ - (hv_versions.hypervisor < 2 ? \ - dominfo.v0.max_pages : \ - (hv_versions.dom_interface >= 9 ? \ - dominfo.v2d9.max_pages : \ - (hv_versions.dom_interface == 8 ? \ - dominfo.v2d8.max_pages : \ - (hv_versions.dom_interface == 7 ? \ - dominfo.v2d7.max_pages : \ - (hv_versions.dom_interface == 6 ? \ - dominfo.v2d6.max_pages : \ - (hv_versions.dom_interface == 5 ? \ - dominfo.v2d5.max_pages : \ +#define XEN_GETDOMAININFO_MAX_PAGES(dominfo) \ + (hv_versions.hypervisor < 2 ? \ + dominfo.v0.max_pages : \ + (hv_versions.dom_interface >= 9 ? \ + dominfo.v2d9.max_pages : \ + (hv_versions.dom_interface == 8 ? \ + dominfo.v2d8.max_pages : \ + (hv_versions.dom_interface == 7 ? \ + dominfo.v2d7.max_pages : \ + (hv_versions.dom_interface == 6 ? \ + dominfo.v2d6.max_pages : \ + (hv_versions.dom_interface == 5 ? \ + dominfo.v2d5.max_pages : \ dominfo.v2.max_pages)))))) -#define XEN_GETDOMAININFO_UUID(dominfo) \ - (hv_versions.hypervisor < 2 ? \ - dominfo.v0.handle : \ - (hv_versions.dom_interface >= 9 ? \ - dominfo.v2d9.handle : \ - (hv_versions.dom_interface == 8 ? \ - dominfo.v2d8.handle : \ - (hv_versions.dom_interface == 7 ? \ - dominfo.v2d7.handle : \ - (hv_versions.dom_interface == 6 ? \ - dominfo.v2d6.handle : \ - (hv_versions.dom_interface == 5 ? \ - dominfo.v2d5.handle : \ +#define XEN_GETDOMAININFO_UUID(dominfo) \ + (hv_versions.hypervisor < 2 ? \ + dominfo.v0.handle : \ + (hv_versions.dom_interface >= 9 ? \ + dominfo.v2d9.handle : \ + (hv_versions.dom_interface == 8 ? \ + dominfo.v2d8.handle : \ + (hv_versions.dom_interface == 7 ? \ + dominfo.v2d7.handle : \ + (hv_versions.dom_interface == 6 ? \ + dominfo.v2d6.handle : \ + (hv_versions.dom_interface == 5 ? \ + dominfo.v2d5.handle : \ dominfo.v2.handle)))))) diff --git a/tests/Makefile.am b/tests/Makefile.am index 0b2305d70b..effa259e3a 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -82,7 +82,7 @@ LDADDS = \ MOCKLIBS_LIBS = \ $(GNULIB_LIBS) -EXTRA_DIST = \ +EXTRA_DIST = \ .valgrind.supp \ bhyvexml2argvdata \ bhyveargv2xmldata \ @@ -140,7 +140,7 @@ EXTRA_DIST = \ storagevolxml2xmlin \ storagevolxml2xmlout \ sysinfodata \ - test-lib.sh \ + test-lib.sh \ vboxsnapshotxmldata \ vircaps2xmldata \ vircgroupdata \ @@ -393,28 +393,28 @@ test_programs += virusbtest \ endif WITH_LINUX test_scripts = -libvirtd_test_scripts = \ - libvirtd-fail \ - libvirtd-pool \ - virsh-cpuset \ - virsh-define-dev-segfault \ - virsh-int-overflow \ - virsh-optparse \ - virsh-read-bufsiz \ - virsh-read-non-seekable \ - virsh-schedinfo \ - virsh-self-test \ - virt-admin-self-test \ - virsh-start \ - virsh-undefine \ - virsh-uriprecedence \ - virsh-vcpupin \ +libvirtd_test_scripts = \ + libvirtd-fail \ + libvirtd-pool \ + virsh-cpuset \ + virsh-define-dev-segfault \ + virsh-int-overflow \ + virsh-optparse \ + virsh-read-bufsiz \ + virsh-read-non-seekable \ + virsh-schedinfo \ + virsh-self-test \ + virt-admin-self-test \ + virsh-start \ + virsh-undefine \ + virsh-uriprecedence \ + virsh-vcpupin \ $(NULL) if WITH_LIBVIRTD test_scripts += $(libvirtd_test_scripts) -test_programs += \ +test_programs += \ eventtest \ virdrivermoduletest else ! WITH_LIBVIRTD @@ -465,17 +465,17 @@ TESTS = $(test_programs) \ lv_abs_top_builddir=$(shell cd '$(top_builddir)' && pwd) VIR_TEST_EXPENSIVE ?= $(VIR_TEST_EXPENSIVE_DEFAULT) -TESTS_ENVIRONMENT = \ - abs_top_builddir=$(lv_abs_top_builddir) \ - abs_top_srcdir=`cd '$(top_srcdir)'; pwd` \ - abs_builddir=$(abs_builddir) \ - abs_srcdir=$(abs_srcdir) \ - CONFIG_HEADER="$(lv_abs_top_builddir)/config.h" \ - SHELL="$(SHELL)" \ +TESTS_ENVIRONMENT = \ + abs_top_builddir=$(lv_abs_top_builddir) \ + abs_top_srcdir=`cd '$(top_srcdir)'; pwd` \ + abs_builddir=$(abs_builddir) \ + abs_srcdir=$(abs_srcdir) \ + CONFIG_HEADER="$(lv_abs_top_builddir)/config.h" \ + SHELL="$(SHELL)" \ LIBVIRT_DRIVER_DIR="$(lv_abs_top_builddir)/src/.libs" \ - LIBVIRT_AUTOSTART=0 \ - LC_ALL=C \ - VIR_TEST_EXPENSIVE=$(VIR_TEST_EXPENSIVE) \ + LIBVIRT_AUTOSTART=0 \ + LC_ALL=C \ + VIR_TEST_EXPENSIVE=$(VIR_TEST_EXPENSIVE) \ $(VG) @@ -1180,20 +1180,20 @@ if WITH_NSS nsstest_SOURCES = \ nsstest.c testutils.h testutils.c nsstest_CFLAGS = \ - $(AM_CFLAGS) \ + $(AM_CFLAGS) \ -I$(top_srcdir)/tools/nss nsstest_LDADD = \ - $(LDADDS) \ + $(LDADDS) \ ../tools/nss/libnss_libvirt_impl.la nssguesttest_SOURCES = \ nsstest.c testutils.h testutils.c nssguesttest_CFLAGS = \ - -DLIBVIRT_NSS_GUEST \ - $(AM_CFLAGS) \ + -DLIBVIRT_NSS_GUEST \ + $(AM_CFLAGS) \ -I$(top_srcdir)/tools/nss nssguesttest_LDADD = \ - $(LDADDS) \ + $(LDADDS) \ ../tools/nss/libnss_libvirt_guest_impl.la nssmock_la_SOURCES = \ @@ -1205,16 +1205,16 @@ nssmock_la_LIBADD = $(MOCKLIBS_LIBS) ## Intentionaly not linking with anything else. ## See the test source for more detailed explanation. nsslinktest_SOURCES = nsslinktest.c -nsslinktest_CFLAGS = \ - $(AM_CFLAGS) \ +nsslinktest_CFLAGS = \ + $(AM_CFLAGS) \ -I$(top_srcdir)/tools/nss nsslinktest_LDADD = ../tools/nss/libnss_libvirt_impl.la nsslinktest_LDFLAGS = $(NULL) nssguestlinktest_SOURCES = nsslinktest.c -nssguestlinktest_CFLAGS = \ - -DLIBVIRT_NSS_GUEST \ - $(AM_CFLAGS) \ +nssguestlinktest_CFLAGS = \ + -DLIBVIRT_NSS_GUEST \ + $(AM_CFLAGS) \ -I$(top_srcdir)/tools/nss nssguestlinktest_LDADD = ../tools/nss/libnss_libvirt_guest_impl.la nssguestlinktest_LDFLAGS = $(NULL) diff --git a/tests/bhyveargv2xmltest.c b/tests/bhyveargv2xmltest.c index 6a56851151..e5d78530c5 100644 --- a/tests/bhyveargv2xmltest.c +++ b/tests/bhyveargv2xmltest.c @@ -134,29 +134,29 @@ mymain(void) NULL, NULL, NULL)) == NULL) return EXIT_FAILURE; -# define DO_TEST_FULL(name, flags) \ - do { \ - static struct testInfo info = { \ - name, (flags) \ - }; \ - if (virTestRun("BHYVE ARGV-2-XML " name, \ +# define DO_TEST_FULL(name, flags) \ + do { \ + static struct testInfo info = { \ + name, (flags) \ + }; \ + if (virTestRun("BHYVE ARGV-2-XML " name, \ testCompareXMLToArgvHelper, &info) < 0) \ - ret = -1; \ + ret = -1; \ } while (0) -# define DO_TEST(name) \ +# define DO_TEST(name) \ DO_TEST_FULL(name, 0) -# define DO_TEST_FAIL(name) \ +# define DO_TEST_FAIL(name) \ DO_TEST_FULL(name, 5) -# define DO_TEST_WARN(name) \ +# define DO_TEST_WARN(name) \ DO_TEST_FULL(name, 4) -# define DO_TEST_FAIL_SILENT(name) \ +# define DO_TEST_FAIL_SILENT(name) \ DO_TEST_FULL(name, 1) -# define DO_TEST_PARSE_ERROR(name) \ +# define DO_TEST_PARSE_ERROR(name) \ DO_TEST_FULL(name, 2) driver.grubcaps = BHYVE_GRUB_CAP_CONSDEV; diff --git a/tests/bhyvexml2argvtest.c b/tests/bhyvexml2argvtest.c index 5623044cbd..81285893eb 100644 --- a/tests/bhyvexml2argvtest.c +++ b/tests/bhyvexml2argvtest.c @@ -150,23 +150,23 @@ mymain(void) return EXIT_FAILURE; -# define DO_TEST_FULL(name, flags) \ - do { \ - static struct testInfo info = { \ - name, (flags) \ - }; \ - if (virTestRun("BHYVE XML-2-ARGV " name, \ +# define DO_TEST_FULL(name, flags) \ + do { \ + static struct testInfo info = { \ + name, (flags) \ + }; \ + if (virTestRun("BHYVE XML-2-ARGV " name, \ testCompareXMLToArgvHelper, &info) < 0) \ - ret = -1; \ + ret = -1; \ } while (0) -# define DO_TEST(name) \ +# define DO_TEST(name) \ DO_TEST_FULL(name, 0) -# define DO_TEST_FAILURE(name) \ +# define DO_TEST_FAILURE(name) \ DO_TEST_FULL(name, FLAG_EXPECT_FAILURE) -# define DO_TEST_PARSE_ERROR(name) \ +# define DO_TEST_PARSE_ERROR(name) \ DO_TEST_FULL(name, FLAG_EXPECT_PARSE_ERROR) driver.grubcaps = BHYVE_GRUB_CAP_CONSDEV; diff --git a/tests/bhyvexml2xmltest.c b/tests/bhyvexml2xmltest.c index 59feac055d..e483dac630 100644 --- a/tests/bhyvexml2xmltest.c +++ b/tests/bhyvexml2xmltest.c @@ -66,12 +66,12 @@ mymain(void) if ((driver.xmlopt = virBhyveDriverCreateXMLConf(&driver)) == NULL) return EXIT_FAILURE; -# define DO_TEST_FULL(name, flags) \ - do { \ - const struct testInfo info = {name, (flags)}; \ - if (virTestRun("BHYVE XML-2-XML " name, \ - testCompareXMLToXMLHelper, &info) < 0) \ - ret = -1; \ +# define DO_TEST_FULL(name, flags) \ + do { \ + const struct testInfo info = {name, (flags)}; \ + if (virTestRun("BHYVE XML-2-XML " name, \ + testCompareXMLToXMLHelper, &info) < 0) \ + ret = -1; \ } while (0) # define DO_TEST_DIFFERENT(name) \ diff --git a/tests/commandtest.c b/tests/commandtest.c index 7d73f638a2..1aa3e45187 100644 --- a/tests/commandtest.c +++ b/tests/commandtest.c @@ -1260,9 +1260,9 @@ mymain(void) environ = (char **)newenv; -# define DO_TEST(NAME) \ - if (virTestRun("Command Exec " #NAME " test", \ - NAME, NULL) < 0) \ +# define DO_TEST(NAME) \ + if (virTestRun("Command Exec " #NAME " test", \ + NAME, NULL) < 0) \ ret = -1 DO_TEST(test0); diff --git a/tests/cputest.c b/tests/cputest.c index 170d16018d..2cae261632 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -927,110 +927,110 @@ mymain(void) goto cleanup; } -#define DO_TEST(arch, api, name, host, cpu, \ - models, flags, result) \ - do { \ - struct data data = { \ - arch, host, cpu, models, \ - models == NULL ? NULL : #models, \ - flags, result \ - }; \ - char *testLabel; \ - char *tmp; \ - \ - tmp = virTestLogContentAndReset(); \ - VIR_FREE(tmp); \ - \ - if (virAsprintf(&testLabel, "%s(%s): %s", \ - #api, virArchToString(arch), name) < 0) { \ - ret = -1; \ - break; \ - } \ - \ - if (virTestRun(testLabel, api, &data) < 0) { \ - if (virTestGetDebug()) { \ - char *log; \ - if ((log = virTestLogContentAndReset()) && \ - strlen(log) > 0) \ - VIR_TEST_DEBUG("\n%s\n", log); \ - VIR_FREE(log); \ - } \ - ret = -1; \ - } \ - \ - VIR_FREE(testLabel); \ +#define DO_TEST(arch, api, name, host, cpu, \ + models, flags, result) \ + do { \ + struct data data = { \ + arch, host, cpu, models, \ + models == NULL ? NULL : #models, \ + flags, result \ + }; \ + char *testLabel; \ + char *tmp; \ + \ + tmp = virTestLogContentAndReset(); \ + VIR_FREE(tmp); \ + \ + if (virAsprintf(&testLabel, "%s(%s): %s", \ + #api, virArchToString(arch), name) < 0) { \ + ret = -1; \ + break; \ + } \ + \ + if (virTestRun(testLabel, api, &data) < 0) { \ + if (virTestGetDebug()) { \ + char *log; \ + if ((log = virTestLogContentAndReset()) && \ + strlen(log) > 0) \ + VIR_TEST_DEBUG("\n%s\n", log); \ + VIR_FREE(log); \ + } \ + ret = -1; \ + } \ + \ + VIR_FREE(testLabel); \ } while (0) -#define DO_TEST_COMPARE(arch, host, cpu, result) \ - DO_TEST(arch, cpuTestCompare, \ - host "/" cpu " (" #result ")", \ +#define DO_TEST_COMPARE(arch, host, cpu, result) \ + DO_TEST(arch, cpuTestCompare, \ + host "/" cpu " (" #result ")", \ host, cpu, NULL, 0, result) -#define DO_TEST_UPDATE_ONLY(arch, host, cpu) \ - DO_TEST(arch, cpuTestUpdate, \ - cpu " on " host, \ +#define DO_TEST_UPDATE_ONLY(arch, host, cpu) \ + DO_TEST(arch, cpuTestUpdate, \ + cpu " on " host, \ host, cpu, NULL, 0, 0) -#define DO_TEST_UPDATE(arch, host, cpu, result) \ - do { \ - DO_TEST_UPDATE_ONLY(arch, host, cpu); \ - DO_TEST_COMPARE(arch, host, host "+" cpu, result); \ +#define DO_TEST_UPDATE(arch, host, cpu, result) \ + do { \ + DO_TEST_UPDATE_ONLY(arch, host, cpu); \ + DO_TEST_COMPARE(arch, host, host "+" cpu, result); \ } while (0) -#define DO_TEST_BASELINE(arch, name, flags, result) \ - do { \ - const char *suffix = ""; \ - char *label; \ - if ((flags) & VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES) \ - suffix = " (expanded)"; \ - if ((flags) & VIR_CONNECT_BASELINE_CPU_MIGRATABLE) \ - suffix = " (migratable)"; \ - if (virAsprintf(&label, "%s%s", name, suffix) < 0) { \ - ret = -1; \ - } else { \ - DO_TEST(arch, cpuTestBaseline, label, NULL, \ - "baseline-" name, NULL, flags, result); \ - } \ - VIR_FREE(label); \ +#define DO_TEST_BASELINE(arch, name, flags, result) \ + do { \ + const char *suffix = ""; \ + char *label; \ + if ((flags) & VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES) \ + suffix = " (expanded)"; \ + if ((flags) & VIR_CONNECT_BASELINE_CPU_MIGRATABLE) \ + suffix = " (migratable)"; \ + if (virAsprintf(&label, "%s%s", name, suffix) < 0) { \ + ret = -1; \ + } else { \ + DO_TEST(arch, cpuTestBaseline, label, NULL, \ + "baseline-" name, NULL, flags, result); \ + } \ + VIR_FREE(label); \ } while (0) -#define DO_TEST_HASFEATURE(arch, host, feature, result) \ - DO_TEST(arch, cpuTestHasFeature, \ - host "/" feature " (" #result ")", \ +#define DO_TEST_HASFEATURE(arch, host, feature, result) \ + DO_TEST(arch, cpuTestHasFeature, \ + host "/" feature " (" #result ")", \ host, feature, NULL, 0, result) -#define DO_TEST_GUESTCPU(arch, host, cpu, models, result) \ - DO_TEST(arch, cpuTestGuestCPU, \ - host "/" cpu " (" #models ")", \ +#define DO_TEST_GUESTCPU(arch, host, cpu, models, result) \ + DO_TEST(arch, cpuTestGuestCPU, \ + host "/" cpu " (" #models ")", \ host, cpu, models, 0, result) #if WITH_QEMU && WITH_YAJL -# define DO_TEST_JSON(arch, host, json) \ - do { \ - if (json == JSON_MODELS) { \ - DO_TEST(arch, cpuTestGuestCPUID, host, host, \ - NULL, NULL, 0, 0); \ - } \ - if (json != JSON_NONE) { \ - DO_TEST(arch, cpuTestJSONCPUID, host, host, \ - NULL, NULL, json, 0); \ - } \ +# define DO_TEST_JSON(arch, host, json) \ + do { \ + if (json == JSON_MODELS) { \ + DO_TEST(arch, cpuTestGuestCPUID, host, host, \ + NULL, NULL, 0, 0); \ + } \ + if (json != JSON_NONE) { \ + DO_TEST(arch, cpuTestJSONCPUID, host, host, \ + NULL, NULL, json, 0); \ + } \ } while (0) #else # define DO_TEST_JSON(arch, host, json) #endif -#define DO_TEST_CPUID(arch, host, json) \ - do { \ - DO_TEST(arch, cpuTestHostCPUID, host, host, \ - NULL, NULL, 0, 0); \ - DO_TEST(arch, cpuTestGuestCPUID, host, host, \ - NULL, NULL, json, 0); \ - DO_TEST_JSON(arch, host, json); \ - if (json != JSON_NONE) { \ - DO_TEST(arch, cpuTestUpdateLive, host, host, \ - NULL, NULL, json, 0); \ - } \ +#define DO_TEST_CPUID(arch, host, json) \ + do { \ + DO_TEST(arch, cpuTestHostCPUID, host, host, \ + NULL, NULL, 0, 0); \ + DO_TEST(arch, cpuTestGuestCPUID, host, host, \ + NULL, NULL, json, 0); \ + DO_TEST_JSON(arch, host, json); \ + if (json != JSON_NONE) { \ + DO_TEST(arch, cpuTestUpdateLive, host, host, \ + NULL, NULL, json, 0); \ + } \ } while (0) /* host to host comparison */ diff --git a/tests/domaincapstest.c b/tests/domaincapstest.c index 7aeac4507f..b997e6542d 100644 --- a/tests/domaincapstest.c +++ b/tests/domaincapstest.c @@ -358,57 +358,57 @@ mymain(void) return EXIT_FAILURE; #endif -#define DO_TEST(Name, Emulator, Machine, Arch, Type, CapsType) \ - do { \ - struct testData data = { \ - .name = Name, \ - .emulator = Emulator, \ - .machine = Machine, \ - .arch = Arch, \ - .type = Type, \ - .capsType = CapsType, \ - }; \ - if (virTestRun(Name, test_virDomainCapsFormat, &data) < 0) \ - ret = -1; \ +#define DO_TEST(Name, Emulator, Machine, Arch, Type, CapsType) \ + do { \ + struct testData data = { \ + .name = Name, \ + .emulator = Emulator, \ + .machine = Machine, \ + .arch = Arch, \ + .type = Type, \ + .capsType = CapsType, \ + }; \ + if (virTestRun(Name, test_virDomainCapsFormat, &data) < 0) \ + ret = -1; \ } while (0) -#define DO_TEST_QEMU(Name, CapsName, Emulator, Machine, Arch, Type) \ - do { \ - char *name = NULL; \ - if (virAsprintf(&name, "qemu_%s%s%s.%s", \ - Name, \ - Machine ? "-" : "", Machine ? Machine : "", \ - Arch) < 0) { \ - ret = -1; \ - break; \ - } \ - struct testData data = { \ - .name = name, \ - .emulator = Emulator, \ - .machine = Machine, \ - .arch = Arch, \ - .type = Type, \ - .capsType = CAPS_QEMU, \ - .capsName = CapsName, \ - .capsOpaque = cfg, \ - }; \ - if (virTestRun(name, test_virDomainCapsFormat, &data) < 0) \ - ret = -1; \ - VIR_FREE(name); \ +#define DO_TEST_QEMU(Name, CapsName, Emulator, Machine, Arch, Type) \ + do { \ + char *name = NULL; \ + if (virAsprintf(&name, "qemu_%s%s%s.%s", \ + Name, \ + Machine ? "-" : "", Machine ? Machine : "", \ + Arch) < 0) { \ + ret = -1; \ + break; \ + } \ + struct testData data = { \ + .name = name, \ + .emulator = Emulator, \ + .machine = Machine, \ + .arch = Arch, \ + .type = Type, \ + .capsType = CAPS_QEMU, \ + .capsName = CapsName, \ + .capsOpaque = cfg, \ + }; \ + if (virTestRun(name, test_virDomainCapsFormat, &data) < 0) \ + ret = -1; \ + VIR_FREE(name); \ } while (0) -#define DO_TEST_LIBXL(Name, Emulator, Machine, Arch, Type) \ - do { \ - struct testData data = { \ - .name = Name, \ - .emulator = Emulator, \ - .machine = Machine, \ - .arch = Arch, \ - .type = Type, \ - .capsType = CAPS_LIBXL, \ - }; \ - if (virTestRun(Name, test_virDomainCapsFormat, &data) < 0) \ - ret = -1; \ +#define DO_TEST_LIBXL(Name, Emulator, Machine, Arch, Type) \ + do { \ + struct testData data = { \ + .name = Name, \ + .emulator = Emulator, \ + .machine = Machine, \ + .arch = Arch, \ + .type = Type, \ + .capsType = CAPS_LIBXL, \ + }; \ + if (virTestRun(Name, test_virDomainCapsFormat, &data) < 0) \ + ret = -1; \ } while (0) DO_TEST("basic", "/bin/emulatorbin", "my-machine-type", @@ -417,23 +417,23 @@ mymain(void) "x86_64", VIR_DOMAIN_VIRT_KVM, CAPS_ALL); #define DO_TEST_BHYVE(Name, Emulator, BhyveCaps, Type) \ - do { \ - char *name = NULL; \ - if (virAsprintf(&name, "bhyve_%s.x86_64", Name) < 0) { \ - ret = -1; \ - break; \ - } \ - struct testData data = { \ - .name = name, \ - .emulator = Emulator, \ - .arch = "x86_64", \ - .type = Type, \ - .capsType = CAPS_BHYVE, \ - .capsOpaque = BhyveCaps, \ - }; \ - if (virTestRun(name, test_virDomainCapsFormat, &data) < 0) \ - ret = -1; \ - VIR_FREE(name); \ + do { \ + char *name = NULL; \ + if (virAsprintf(&name, "bhyve_%s.x86_64", Name) < 0) { \ + ret = -1; \ + break; \ + } \ + struct testData data = { \ + .name = name, \ + .emulator = Emulator, \ + .arch = "x86_64", \ + .type = Type, \ + .capsType = CAPS_BHYVE, \ + .capsOpaque = BhyveCaps, \ + }; \ + if (virTestRun(name, test_virDomainCapsFormat, &data) < 0) \ + ret = -1; \ + VIR_FREE(name); \ } while (0) #if WITH_QEMU diff --git a/tests/domainconftest.c b/tests/domainconftest.c index 6e7526907a..42f6e28beb 100644 --- a/tests/domainconftest.c +++ b/tests/domainconftest.c @@ -90,15 +90,15 @@ mymain(void) if (!(xmlopt = virTestGenericDomainXMLConfInit())) goto cleanup; -#define DO_TEST_GET_FS(fspath, expect) \ - do { \ - struct testGetFilesystemData data = { \ - .filename = "getfilesystem", \ - .path = fspath, \ - .expectEntry = expect, \ - }; \ +#define DO_TEST_GET_FS(fspath, expect) \ + do { \ + struct testGetFilesystemData data = { \ + .filename = "getfilesystem", \ + .path = fspath, \ + .expectEntry = expect, \ + }; \ if (virTestRun("Get FS " fspath, testGetFilesystem, &data) < 0) \ - ret = -1; \ + ret = -1; \ } while (0) DO_TEST_GET_FS("/", true); diff --git a/tests/domainsnapshotxml2xmltest.c b/tests/domainsnapshotxml2xmltest.c index 3a6f86b4a3..9ddd1eca7f 100644 --- a/tests/domainsnapshotxml2xmltest.c +++ b/tests/domainsnapshotxml2xmltest.c @@ -171,14 +171,14 @@ mymain(void) } -# define DO_TEST(prefix, name, inpath, outpath, uuid, internal, redefine) \ - do { \ - const struct testInfo info = {abs_srcdir "/" inpath "/" name ".xml", \ +# define DO_TEST(prefix, name, inpath, outpath, uuid, internal, redefine) \ + do { \ + const struct testInfo info = {abs_srcdir "/" inpath "/" name ".xml", \ abs_srcdir "/" outpath "/" name ".xml", \ - uuid, internal, redefine}; \ - if (virTestRun("SNAPSHOT XML-2-XML " prefix " " name, \ - testCompareXMLToXMLHelper, &info) < 0) \ - ret = -1; \ + uuid, internal, redefine}; \ + if (virTestRun("SNAPSHOT XML-2-XML " prefix " " name, \ + testCompareXMLToXMLHelper, &info) < 0) \ + ret = -1; \ } while (0) # define DO_TEST_IN(name, uuid) DO_TEST("in->in", name,\ diff --git a/tests/esxutilstest.c b/tests/esxutilstest.c index 787da5169e..7941f89b9a 100644 --- a/tests/esxutilstest.c +++ b/tests/esxutilstest.c @@ -247,12 +247,12 @@ mymain(void) virTestQuiesceLibvirtErrors(true); -# define DO_TEST(_name) \ - do { \ - if (virTestRun("VMware "#_name, test##_name, \ - NULL) < 0) { \ - result = -1; \ - } \ +# define DO_TEST(_name) \ + do { \ + if (virTestRun("VMware "#_name, test##_name, \ + NULL) < 0) { \ + result = -1; \ + } \ } while (0) DO_TEST(ParseDatastorePath); diff --git a/tests/genericxml2xmltest.c b/tests/genericxml2xmltest.c index 0377a05e9c..a0900d9db7 100644 --- a/tests/genericxml2xmltest.c +++ b/tests/genericxml2xmltest.c @@ -60,13 +60,13 @@ mymain(void) if (!(xmlopt = virTestGenericDomainXMLConfInit())) return EXIT_FAILURE; -#define DO_TEST_FULL(name, is_different, inactive, expectResult) \ - do { \ - const struct testInfo info = {name, is_different, inactive, \ - expectResult}; \ - if (virTestRun("GENERIC XML-2-XML " name, \ - testCompareXMLToXMLHelper, &info) < 0) \ - ret = -1; \ +#define DO_TEST_FULL(name, is_different, inactive, expectResult) \ + do { \ + const struct testInfo info = {name, is_different, inactive, \ + expectResult}; \ + if (virTestRun("GENERIC XML-2-XML " name, \ + testCompareXMLToXMLHelper, &info) < 0) \ + ret = -1; \ } while (0) #define DO_TEST(name) \ diff --git a/tests/interfacexml2xmltest.c b/tests/interfacexml2xmltest.c index 1a1a919dfa..46dbecbea7 100644 --- a/tests/interfacexml2xmltest.c +++ b/tests/interfacexml2xmltest.c @@ -69,9 +69,9 @@ mymain(void) { int ret = 0; -#define DO_TEST(name) \ - if (virTestRun("Interface XML-2-XML " name, \ - testCompareXMLToXMLHelper, (name)) < 0) \ +#define DO_TEST(name) \ + if (virTestRun("Interface XML-2-XML " name, \ + testCompareXMLToXMLHelper, (name)) < 0) \ ret = -1 DO_TEST("ethernet-dhcp"); diff --git a/tests/libxlxml2domconfigtest.c b/tests/libxlxml2domconfigtest.c index 5eea6ff07d..564d95ed2c 100644 --- a/tests/libxlxml2domconfigtest.c +++ b/tests/libxlxml2domconfigtest.c @@ -176,14 +176,14 @@ mymain(void) if ((caps = testXLInitCaps()) == NULL) return EXIT_FAILURE; -# define DO_TEST(name) \ - do { \ - static struct testInfo info = { \ - name, \ - }; \ - if (virTestRun("LibXL XML-2-JSON " name, \ - testCompareXMLToDomConfigHelper, &info) < 0) \ - ret = -1; \ +# define DO_TEST(name) \ + do { \ + static struct testInfo info = { \ + name, \ + }; \ + if (virTestRun("LibXL XML-2-JSON " name, \ + testCompareXMLToDomConfigHelper, &info) < 0) \ + ret = -1; \ } while (0) DO_TEST("basic-pv"); diff --git a/tests/lxcconf2xmltest.c b/tests/lxcconf2xmltest.c index d2f1c1d45a..360d840e2e 100644 --- a/tests/lxcconf2xmltest.c +++ b/tests/lxcconf2xmltest.c @@ -98,13 +98,13 @@ mymain(void) return EXIT_FAILURE; } -# define DO_TEST(name, expectError) \ - do { \ +# define DO_TEST(name, expectError) \ + do { \ const struct testInfo info = { name, expectError }; \ - if (virTestRun("LXC Native-2-XML " name, \ - testCompareXMLToConfigHelper, \ - &info) < 0) \ - ret = EXIT_FAILURE; \ + if (virTestRun("LXC Native-2-XML " name, \ + testCompareXMLToConfigHelper, \ + &info) < 0) \ + ret = EXIT_FAILURE; \ } while (0) DO_TEST("simple", false); diff --git a/tests/lxcxml2xmltest.c b/tests/lxcxml2xmltest.c index 9b9314cf84..57751a5773 100644 --- a/tests/lxcxml2xmltest.c +++ b/tests/lxcxml2xmltest.c @@ -66,13 +66,13 @@ mymain(void) if (!(xmlopt = lxcDomainXMLConfInit())) return EXIT_FAILURE; -# define DO_TEST_FULL(name, is_different, inactive, parse_flags) \ - do { \ - const struct testInfo info = {name, is_different, inactive, \ - parse_flags}; \ - if (virTestRun("LXC XML-2-XML " name, \ - testCompareXMLToXMLHelper, &info) < 0) \ - ret = -1; \ +# define DO_TEST_FULL(name, is_different, inactive, parse_flags) \ + do { \ + const struct testInfo info = {name, is_different, inactive, \ + parse_flags}; \ + if (virTestRun("LXC XML-2-XML " name, \ + testCompareXMLToXMLHelper, &info) < 0) \ + ret = -1; \ } while (0) # define DO_TEST(name) \ diff --git a/tests/metadatatest.c b/tests/metadatatest.c index aed8e5a870..d5a6f37119 100644 --- a/tests/metadatatest.c +++ b/tests/metadatatest.c @@ -250,15 +250,15 @@ testTextMetadata(const void *data) return ret; } -#define TEST_TEXT_METADATA(INDEX, TYPE, DATA, FAIL) \ - do { \ - test.type = VIR_DOMAIN_METADATA_ ## TYPE; \ - test.data = DATA; \ - test.fail = FAIL; \ - \ - if (virTestRun("text metadata: " #TYPE " " INDEX " ", \ - testTextMetadata, &test) < 0) \ - ret = EXIT_FAILURE; \ +#define TEST_TEXT_METADATA(INDEX, TYPE, DATA, FAIL) \ + do { \ + test.type = VIR_DOMAIN_METADATA_ ## TYPE; \ + test.data = DATA; \ + test.fail = FAIL; \ + \ + if (virTestRun("text metadata: " #TYPE " " INDEX " ", \ + testTextMetadata, &test) < 0) \ + ret = EXIT_FAILURE; \ } while (0) #define TEST_TITLE(INDEX, DATA) TEST_TEXT_METADATA(INDEX, TITLE, DATA, false) diff --git a/tests/networkxml2conftest.c b/tests/networkxml2conftest.c index 4251a22f64..8e7751e36b 100644 --- a/tests/networkxml2conftest.c +++ b/tests/networkxml2conftest.c @@ -112,16 +112,16 @@ mymain(void) dnsmasqCapsPtr dhcpv6 = dnsmasqCapsNewFromBuffer("Dnsmasq version 2.64\n--bind-dynamic", DNSMASQ); -#define DO_TEST(xname, xcaps) \ - do { \ - static testInfo info; \ - \ - info.name = xname; \ - info.caps = xcaps; \ - if (virTestRun("Network XML-2-Conf " xname, \ - testCompareXMLToConfHelper, &info) < 0) { \ - ret = -1; \ - } \ +#define DO_TEST(xname, xcaps) \ + do { \ + static testInfo info; \ + \ + info.name = xname; \ + info.caps = xcaps; \ + if (virTestRun("Network XML-2-Conf " xname, \ + testCompareXMLToConfHelper, &info) < 0) { \ + ret = -1; \ + } \ } while (0) DO_TEST("isolated-network", restricted); diff --git a/tests/networkxml2firewalltest.c b/tests/networkxml2firewalltest.c index fed0e66391..242b645767 100644 --- a/tests/networkxml2firewalltest.c +++ b/tests/networkxml2firewalltest.c @@ -126,14 +126,14 @@ mymain(void) if (!abs_top_srcdir) abs_top_srcdir = abs_srcdir "/.."; -# define DO_TEST(name) \ - do { \ - static struct testInfo info = { \ - name, \ - }; \ - if (virTestRun("Network XML-2-iptables " name, \ - testCompareXMLToIPTablesHelper, &info) < 0) \ - ret = -1; \ +# define DO_TEST(name) \ + do { \ + static struct testInfo info = { \ + name, \ + }; \ + if (virTestRun("Network XML-2-iptables " name, \ + testCompareXMLToIPTablesHelper, &info) < 0) \ + ret = -1; \ } while (0) virFirewallSetLockOverride(true); diff --git a/tests/networkxml2xmltest.c b/tests/networkxml2xmltest.c index ea1a08988e..eb7db766fa 100644 --- a/tests/networkxml2xmltest.c +++ b/tests/networkxml2xmltest.c @@ -109,12 +109,12 @@ mymain(void) { int ret = 0; -#define DO_TEST_FULL(name, flags, expectResult) \ - do { \ - const struct testInfo info = {name, flags, expectResult}; \ - if (virTestRun("Network XML-2-XML " name, \ - testCompareXMLToXMLHelper, &info) < 0) \ - ret = -1; \ +#define DO_TEST_FULL(name, flags, expectResult) \ + do { \ + const struct testInfo info = {name, flags, expectResult}; \ + if (virTestRun("Network XML-2-XML " name, \ + testCompareXMLToXMLHelper, &info) < 0) \ + ret = -1; \ } while (0) #define DO_TEST(name) \ DO_TEST_FULL(name, 0, TEST_COMPARE_NET_XML2XML_RESULT_SUCCESS) diff --git a/tests/networkxml2xmlupdatetest.c b/tests/networkxml2xmlupdatetest.c index 1cbd811a2f..b4b44ceff3 100644 --- a/tests/networkxml2xmlupdatetest.c +++ b/tests/networkxml2xmlupdatetest.c @@ -112,29 +112,29 @@ mymain(void) int ret = 0; unsigned int section; -#define DO_TEST_FULL(name, updatexml, netxml, outxml, command, section, \ - parentIndex, flags, expectFailure) \ - do { \ - const struct testInfo info = {name, updatexml, netxml, outxml, \ - command, section, flags, \ - parentIndex, expectFailure}; \ - if (virTestRun("Network XML-2-XML " name, \ - testCompareXMLToXMLHelper, &info) < 0) \ - ret = -1; \ +#define DO_TEST_FULL(name, updatexml, netxml, outxml, command, section, \ + parentIndex, flags, expectFailure) \ + do { \ + const struct testInfo info = {name, updatexml, netxml, outxml, \ + command, section, flags, \ + parentIndex, expectFailure}; \ + if (virTestRun("Network XML-2-XML " name, \ + testCompareXMLToXMLHelper, &info) < 0) \ + ret = -1; \ } while (0) -#define DO_TEST(name, updatexml, netxml, outxml, command) \ +#define DO_TEST(name, updatexml, netxml, outxml, command) \ DO_TEST_FULL(name, updatexml, netxml, outxml, command, section, -12435, \ 0, false) -#define DO_TEST_FAIL(name, updatexml, netxml, command) \ - DO_TEST_FULL(name, updatexml, netxml, "n/a", command, section, -12345, \ +#define DO_TEST_FAIL(name, updatexml, netxml, command) \ + DO_TEST_FULL(name, updatexml, netxml, "n/a", command, section, -12345, \ 0, true) -#define DO_TEST_INDEX(name, updatexml, netxml, outxml, command, index) \ - DO_TEST_FULL(name, updatexml, netxml, outxml, command, section, index, \ +#define DO_TEST_INDEX(name, updatexml, netxml, outxml, command, index) \ + DO_TEST_FULL(name, updatexml, netxml, outxml, command, section, index, \ 0, false) -#define DO_TEST_INDEX_FAIL(name, updatexml, netxml, command, index) \ - DO_TEST_FULL(name, updatexml, netxml, "n/a", command, section, index, \ +#define DO_TEST_INDEX_FAIL(name, updatexml, netxml, command, index) \ + DO_TEST_FULL(name, updatexml, netxml, "n/a", command, section, index, \ 0, true) diff --git a/tests/nodedevxml2xmltest.c b/tests/nodedevxml2xmltest.c index 5d9f4724db..41ed5c01c2 100644 --- a/tests/nodedevxml2xmltest.c +++ b/tests/nodedevxml2xmltest.c @@ -69,9 +69,9 @@ mymain(void) { int ret = 0; -#define DO_TEST(name) \ - if (virTestRun("Node device XML-2-XML " name, \ - testCompareXMLToXMLHelper, (name)) < 0) \ +#define DO_TEST(name) \ + if (virTestRun("Node device XML-2-XML " name, \ + testCompareXMLToXMLHelper, (name)) < 0) \ ret = -1 DO_TEST("computer"); diff --git a/tests/nsstest.c b/tests/nsstest.c index ca5b47527b..720ffc487b 100644 --- a/tests/nsstest.c +++ b/tests/nsstest.c @@ -174,14 +174,14 @@ mymain(void) { int ret = 0; -# define DO_TEST(name, family, ...) \ - do { \ - const char *addr[] = { __VA_ARGS__, NULL}; \ - struct testNSSData data = { \ - .hostname = name, .ipAddr = addr, .af = family, \ - }; \ - if (virTestRun(name, testGetHostByName, &data) < 0) \ - ret = -1; \ +# define DO_TEST(name, family, ...) \ + do { \ + const char *addr[] = { __VA_ARGS__, NULL}; \ + struct testNSSData data = { \ + .hostname = name, .ipAddr = addr, .af = family, \ + }; \ + if (virTestRun(name, testGetHostByName, &data) < 0) \ + ret = -1; \ } while (0) # if !defined(LIBVIRT_NSS_GUEST) diff --git a/tests/nwfilterxml2firewalltest.c b/tests/nwfilterxml2firewalltest.c index 3d6e792b70..b5eec538c4 100644 --- a/tests/nwfilterxml2firewalltest.c +++ b/tests/nwfilterxml2firewalltest.c @@ -463,14 +463,14 @@ mymain(void) if (!abs_top_srcdir) abs_top_srcdir = abs_srcdir "/.."; -# define DO_TEST(name) \ - do { \ - static struct testInfo info = { \ - name, \ - }; \ - if (virTestRun("NWFilter XML-2-firewall " name, \ - testCompareXMLToIPTablesHelper, &info) < 0) \ - ret = -1; \ +# define DO_TEST(name) \ + do { \ + static struct testInfo info = { \ + name, \ + }; \ + if (virTestRun("NWFilter XML-2-firewall " name, \ + testCompareXMLToIPTablesHelper, &info) < 0) \ + ret = -1; \ } while (0) virFirewallSetLockOverride(true); diff --git a/tests/nwfilterxml2xmltest.c b/tests/nwfilterxml2xmltest.c index d7457a0687..89f809ca8f 100644 --- a/tests/nwfilterxml2xmltest.c +++ b/tests/nwfilterxml2xmltest.c @@ -86,15 +86,15 @@ mymain(void) { int ret = 0; -#define DO_TEST(NAME, EXPECT_WARN) \ - do { \ - test_parms tp = { \ - .name = NAME, \ - .expect_warning = EXPECT_WARN, \ - }; \ - if (virTestRun("NWFilter XML-2-XML " NAME, \ - testCompareXMLToXMLHelper, (&tp)) < 0) \ - ret = -1; \ +#define DO_TEST(NAME, EXPECT_WARN) \ + do { \ + test_parms tp = { \ + .name = NAME, \ + .expect_warning = EXPECT_WARN, \ + }; \ + if (virTestRun("NWFilter XML-2-XML " NAME, \ + testCompareXMLToXMLHelper, (&tp)) < 0) \ + ret = -1; \ } while (0) DO_TEST("mac-test", true); diff --git a/tests/openvzutilstest.c b/tests/openvzutilstest.c index 8250277caf..cdf96a18ed 100644 --- a/tests/openvzutilstest.c +++ b/tests/openvzutilstest.c @@ -141,12 +141,12 @@ mymain(void) openvzLocateConfFile = testLocateConfFile; -# define DO_TEST(_name) \ - do { \ - if (virTestRun("OpenVZ "#_name, test##_name, \ - NULL) < 0) { \ - result = -1; \ - } \ +# define DO_TEST(_name) \ + do { \ + if (virTestRun("OpenVZ "#_name, test##_name, \ + NULL) < 0) { \ + result = -1; \ + } \ } while (0) DO_TEST(ReadConfigParam); diff --git a/tests/qemuagenttest.c b/tests/qemuagenttest.c index af7c936c8b..8d7aaf8a66 100644 --- a/tests/qemuagenttest.c +++ b/tests/qemuagenttest.c @@ -918,8 +918,8 @@ mymain(void) virEventRegisterDefaultImpl(); -#define DO_TEST(name) \ - if (virTestRun(# name, testQemuAgent ## name, driver.xmlopt) < 0) \ +#define DO_TEST(name) \ + if (virTestRun(# name, testQemuAgent ## name, driver.xmlopt) < 0) \ ret = -1 DO_TEST(FSFreeze); diff --git a/tests/qemuargv2xmltest.c b/tests/qemuargv2xmltest.c index 8e47c00418..481c65a901 100644 --- a/tests/qemuargv2xmltest.c +++ b/tests/qemuargv2xmltest.c @@ -155,15 +155,15 @@ mymain(void) return EXIT_FAILURE; -# define DO_TEST_FULL(name, flags) \ - do { \ - const struct testInfo info = { name, (flags) }; \ - if (virTestRun("QEMU ARGV-2-XML " name, \ - testCompareXMLToArgvHelper, &info) < 0) \ - ret = -1; \ +# define DO_TEST_FULL(name, flags) \ + do { \ + const struct testInfo info = { name, (flags) }; \ + if (virTestRun("QEMU ARGV-2-XML " name, \ + testCompareXMLToArgvHelper, &info) < 0) \ + ret = -1; \ } while (0) -# define DO_TEST(name) \ +# define DO_TEST(name) \ DO_TEST_FULL(name, 0) setenv("PATH", "/bin", 1); diff --git a/tests/qemucapabilitiestest.c b/tests/qemucapabilitiestest.c index df3a9de516..d32a5c2fa4 100644 --- a/tests/qemucapabilitiestest.c +++ b/tests/qemucapabilitiestest.c @@ -146,15 +146,15 @@ mymain(void) data.xmlopt = driver.xmlopt; -#define DO_TEST(arch, name) \ - do { \ - data.archName = arch; \ - data.base = name; \ - if (virTestRun(name "(" arch ")", testQemuCaps, &data) < 0) \ - ret = -1; \ - if (virTestRun("copy " name "(" arch ")", \ - testQemuCapsCopy, &data) < 0) \ - ret = -1; \ +#define DO_TEST(arch, name) \ + do { \ + data.archName = arch; \ + data.base = name; \ + if (virTestRun(name "(" arch ")", testQemuCaps, &data) < 0) \ + ret = -1; \ + if (virTestRun("copy " name "(" arch ")", \ + testQemuCapsCopy, &data) < 0) \ + ret = -1; \ } while (0) DO_TEST("x86_64", "caps_1.2.2"); diff --git a/tests/qemucaps2xmltest.c b/tests/qemucaps2xmltest.c index 65ba27048f..f4838f7980 100644 --- a/tests/qemucaps2xmltest.c +++ b/tests/qemucaps2xmltest.c @@ -175,10 +175,10 @@ mymain(void) virEventRegisterDefaultImpl(); -#define DO_TEST_FULL(name, guest) \ - data.base = name; \ - data.guestarch = guest; \ - if (virTestRun(name, testQemuCapsXML, &data) < 0) \ +#define DO_TEST_FULL(name, guest) \ + data.base = name; \ + data.guestarch = guest; \ + if (virTestRun(name, testQemuCapsXML, &data) < 0) \ ret = -1 #define DO_TEST(name) DO_TEST_FULL(name, VIR_ARCH_I686) diff --git a/tests/qemucapsprobemock.c b/tests/qemucapsprobemock.c index bad69bb1fe..97497eb438 100644 --- a/tests/qemucapsprobemock.c +++ b/tests/qemucapsprobemock.c @@ -28,13 +28,13 @@ #include "qemu/qemu_monitor.h" #include "qemu/qemu_monitor_json.h" -#define REAL_SYM(realFunc) \ - do { \ - if (!realFunc && !(realFunc = dlsym(RTLD_NEXT, __FUNCTION__))) { \ - fprintf(stderr, "Cannot find real '%s' symbol\n", \ - __FUNCTION__); \ - abort(); \ - } \ +#define REAL_SYM(realFunc) \ + do { \ + if (!realFunc && !(realFunc = dlsym(RTLD_NEXT, __FUNCTION__))) { \ + fprintf(stderr, "Cannot find real '%s' symbol\n", \ + __FUNCTION__); \ + abort(); \ + } \ } while (0) diff --git a/tests/qemucommandutiltest.c b/tests/qemucommandutiltest.c index b11dfbc730..eb155e7e16 100644 --- a/tests/qemucommandutiltest.c +++ b/tests/qemucommandutiltest.c @@ -83,21 +83,21 @@ mymain(void) virTestCounterReset("testQemuCommandBuildFromJSON"); -#define DO_TEST_COMMAND_FROM_JSON(PROPS, ARRAYFUNC, EXPECT) \ - do { \ - data1.props = PROPS; \ - data1.expectprops = EXPECT; \ - data1.arrayfunc = ARRAYFUNC; \ - if (virTestRun(virTestCounterNext(), \ - testQemuCommandBuildFromJSON, \ - &data1) < 0) \ - ret = -1; \ +#define DO_TEST_COMMAND_FROM_JSON(PROPS, ARRAYFUNC, EXPECT) \ + do { \ + data1.props = PROPS; \ + data1.expectprops = EXPECT; \ + data1.arrayfunc = ARRAYFUNC; \ + if (virTestRun(virTestCounterNext(), \ + testQemuCommandBuildFromJSON, \ + &data1) < 0) \ + ret = -1; \ } while (0) -#define DO_TEST_COMMAND_OBJECT_FROM_JSON(PROPS, EXPECT) \ +#define DO_TEST_COMMAND_OBJECT_FROM_JSON(PROPS, EXPECT) \ DO_TEST_COMMAND_FROM_JSON(PROPS, virQEMUBuildCommandLineJSONArrayBitmap, EXPECT) -#define DO_TEST_COMMAND_DRIVE_FROM_JSON(PROPS, EXPECT) \ +#define DO_TEST_COMMAND_DRIVE_FROM_JSON(PROPS, EXPECT) \ DO_TEST_COMMAND_FROM_JSON(PROPS, virQEMUBuildCommandLineJSONArrayNumbered, EXPECT) DO_TEST_COMMAND_OBJECT_FROM_JSON("{}", NULL); diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c index 1a6e7092fd..2280e96a3e 100644 --- a/tests/qemuhelptest.c +++ b/tests/qemuhelptest.c @@ -128,18 +128,18 @@ mymain(void) { int ret = 0; -# define DO_TEST_FULL(name, version, is_kvm, kvm_version, error, ...) \ - do { \ - struct testInfo info = { \ - name, NULL, version, is_kvm, kvm_version, error \ - }; \ - if (!(info.flags = virQEMUCapsNew())) \ - return EXIT_FAILURE; \ - virQEMUCapsSetList(info.flags, __VA_ARGS__, QEMU_CAPS_LAST); \ - if (virTestRun("QEMU Help String Parsing " name, \ - testHelpStrParsing, &info) < 0) \ - ret = -1; \ - virObjectUnref(info.flags); \ +# define DO_TEST_FULL(name, version, is_kvm, kvm_version, error, ...) \ + do { \ + struct testInfo info = { \ + name, NULL, version, is_kvm, kvm_version, error \ + }; \ + if (!(info.flags = virQEMUCapsNew())) \ + return EXIT_FAILURE; \ + virQEMUCapsSetList(info.flags, __VA_ARGS__, QEMU_CAPS_LAST); \ + if (virTestRun("QEMU Help String Parsing " name, \ + testHelpStrParsing, &info) < 0) \ + ret = -1; \ + virObjectUnref(info.flags); \ } while (0) # define DO_TEST(name, version, is_kvm, kvm_version, ...) \ diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index bdde7e45f3..63bfe44145 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -616,34 +616,34 @@ mymain(void) /* wait only 100ms for DEVICE_DELETED event */ qemuDomainRemoveDeviceWaitTime = 100; -#define DO_TEST(file, ACTION, dev, event, fial, kep, ...) \ - do { \ - const char *my_mon[] = { __VA_ARGS__, NULL}; \ - const char *name = file " " #ACTION " " dev; \ - data.action = ACTION; \ - data.domain_filename = file; \ - data.device_filename = dev; \ - data.fail = fial; \ - data.mon = my_mon; \ - data.keep = kep; \ - data.deviceDeletedEvent = event; \ - if (virTestRun(name, testQemuHotplug, &data) < 0) \ - ret = -1; \ +#define DO_TEST(file, ACTION, dev, event, fial, kep, ...) \ + do { \ + const char *my_mon[] = { __VA_ARGS__, NULL}; \ + const char *name = file " " #ACTION " " dev; \ + data.action = ACTION; \ + data.domain_filename = file; \ + data.device_filename = dev; \ + data.fail = fial; \ + data.mon = my_mon; \ + data.keep = kep; \ + data.deviceDeletedEvent = event; \ + if (virTestRun(name, testQemuHotplug, &data) < 0) \ + ret = -1; \ } while (0) -#define DO_TEST_ATTACH(file, dev, fial, kep, ...) \ +#define DO_TEST_ATTACH(file, dev, fial, kep, ...) \ DO_TEST(file, ATTACH, dev, false, fial, kep, __VA_ARGS__) -#define DO_TEST_DETACH(file, dev, fial, kep, ...) \ +#define DO_TEST_DETACH(file, dev, fial, kep, ...) \ DO_TEST(file, DETACH, dev, false, fial, kep, __VA_ARGS__) -#define DO_TEST_ATTACH_EVENT(file, dev, fial, kep, ...) \ +#define DO_TEST_ATTACH_EVENT(file, dev, fial, kep, ...) \ DO_TEST(file, ATTACH, dev, true, fial, kep, __VA_ARGS__) -#define DO_TEST_DETACH_EVENT(file, dev, fial, kep, ...) \ +#define DO_TEST_DETACH_EVENT(file, dev, fial, kep, ...) \ DO_TEST(file, DETACH, dev, true, fial, kep, __VA_ARGS__) -#define DO_TEST_UPDATE(file, dev, fial, kep, ...) \ +#define DO_TEST_UPDATE(file, dev, fial, kep, ...) \ DO_TEST(file, UPDATE, dev, false, fial, kep, __VA_ARGS__) @@ -651,16 +651,16 @@ mymain(void) #define HMP(msg) "{\"return\": \"" msg "\"}" #define QMP_DEVICE_DELETED(dev) \ - "{" \ - " \"timestamp\": {" \ - " \"seconds\": 1374137171," \ - " \"microseconds\": 2659" \ - " }," \ - " \"event\": \"DEVICE_DELETED\"," \ - " \"data\": {" \ - " \"device\": \"" dev "\"," \ - " \"path\": \"/machine/peripheral/" dev "\"" \ - " }" \ + "{" \ + " \"timestamp\": {" \ + " \"seconds\": 1374137171," \ + " \"microseconds\": 2659" \ + " }," \ + " \"event\": \"DEVICE_DELETED\"," \ + " \"data\": {" \ + " \"device\": \"" dev "\"," \ + " \"path\": \"/machine/peripheral/" dev "\"" \ + " }" \ "}\r\n" DO_TEST_UPDATE("graphics-spice", "graphics-spice-nochange", false, false, NULL); @@ -834,15 +834,15 @@ mymain(void) DO_TEST_DETACH("base-live", "watchdog-user-alias-full", false, false, "device_del", QMP_OK); -#define DO_TEST_CPU_GROUP(prefix, vcpus, modernhp, expectfail) \ - do { \ - cpudata.test = prefix; \ - cpudata.newcpus = vcpus; \ - cpudata.modern = modernhp; \ - cpudata.fail = expectfail; \ - if (virTestRun("hotplug vcpus group " prefix, \ - testQemuHotplugCpuGroup, &cpudata) < 0) \ - ret = -1; \ +#define DO_TEST_CPU_GROUP(prefix, vcpus, modernhp, expectfail) \ + do { \ + cpudata.test = prefix; \ + cpudata.newcpus = vcpus; \ + cpudata.modern = modernhp; \ + cpudata.fail = expectfail; \ + if (virTestRun("hotplug vcpus group " prefix, \ + testQemuHotplugCpuGroup, &cpudata) < 0) \ + ret = -1; \ } while (0) DO_TEST_CPU_GROUP("x86-modern-bulk", 7, true, false); @@ -852,16 +852,16 @@ mymain(void) DO_TEST_CPU_GROUP("ppc64-modern-bulk", 23, true, true); DO_TEST_CPU_GROUP("ppc64-modern-bulk", 25, true, true); -#define DO_TEST_CPU_INDIVIDUAL(prefix, mapstr, statefl, modernhp, expectfail) \ - do { \ - cpudata.test = prefix; \ - cpudata.cpumap = mapstr; \ - cpudata.state = statefl; \ - cpudata.modern = modernhp; \ - cpudata.fail = expectfail; \ - if (virTestRun("hotplug vcpus group " prefix, \ - testQemuHotplugCpuIndividual, &cpudata) < 0) \ - ret = -1; \ +#define DO_TEST_CPU_INDIVIDUAL(prefix, mapstr, statefl, modernhp, expectfail) \ + do { \ + cpudata.test = prefix; \ + cpudata.cpumap = mapstr; \ + cpudata.state = statefl; \ + cpudata.modern = modernhp; \ + cpudata.fail = expectfail; \ + if (virTestRun("hotplug vcpus group " prefix, \ + testQemuHotplugCpuIndividual, &cpudata) < 0) \ + ret = -1; \ } while (0) DO_TEST_CPU_INDIVIDUAL("x86-modern-individual-add", "7", true, true, false); diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index aa2f679472..fe46a33eb0 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -374,26 +374,26 @@ testQemuMonitorJSONGetMachines(const void *data) goto cleanup; } -#define CHECK(i, wantname, wantisDefault, wantalias) \ - do { \ - if (STRNEQ(info[i]->name, (wantname))) { \ - virReportError(VIR_ERR_INTERNAL_ERROR, \ - "name %s is not %s", \ - info[i]->name, (wantname)); \ - goto cleanup; \ - } \ - if (info[i]->isDefault != (wantisDefault)) { \ - virReportError(VIR_ERR_INTERNAL_ERROR, \ - "isDefault %d is not %d", \ - info[i]->isDefault, (wantisDefault)); \ - goto cleanup; \ - } \ - if (STRNEQ_NULLABLE(info[i]->alias, (wantalias))) { \ - virReportError(VIR_ERR_INTERNAL_ERROR, \ - "alias %s is not %s", \ - info[i]->alias, NULLSTR(wantalias)); \ - goto cleanup; \ - } \ +#define CHECK(i, wantname, wantisDefault, wantalias) \ + do { \ + if (STRNEQ(info[i]->name, (wantname))) { \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + "name %s is not %s", \ + info[i]->name, (wantname)); \ + goto cleanup; \ + } \ + if (info[i]->isDefault != (wantisDefault)) { \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + "isDefault %d is not %d", \ + info[i]->isDefault, (wantisDefault)); \ + goto cleanup; \ + } \ + if (STRNEQ_NULLABLE(info[i]->alias, (wantalias))) { \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + "alias %s is not %s", \ + info[i]->alias, NULLSTR(wantalias)); \ + goto cleanup; \ + } \ } while (0) CHECK(0, "pc-1.0", false, null); @@ -455,27 +455,27 @@ testQemuMonitorJSONGetCPUDefinitions(const void *data) goto cleanup; } -#define CHECK_FULL(i, wantname, Usable) \ - do { \ - if (STRNEQ(cpus[i]->name, (wantname))) { \ - virReportError(VIR_ERR_INTERNAL_ERROR, \ - "name %s is not %s", \ - cpus[i]->name, (wantname)); \ - goto cleanup; \ - } \ - if (cpus[i]->usable != (Usable)) { \ - virReportError(VIR_ERR_INTERNAL_ERROR, \ - "%s: expecting usable flag %d, got %d", \ - cpus[i]->name, Usable, cpus[i]->usable); \ - goto cleanup; \ - } \ +#define CHECK_FULL(i, wantname, Usable) \ + do { \ + if (STRNEQ(cpus[i]->name, (wantname))) { \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + "name %s is not %s", \ + cpus[i]->name, (wantname)); \ + goto cleanup; \ + } \ + if (cpus[i]->usable != (Usable)) { \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + "%s: expecting usable flag %d, got %d", \ + cpus[i]->name, Usable, cpus[i]->usable); \ + goto cleanup; \ + } \ } while (0) -#define CHECK(i, wantname) \ +#define CHECK(i, wantname) \ CHECK_FULL(i, wantname, VIR_TRISTATE_BOOL_ABSENT) -#define CHECK_USABLE(i, wantname, usable) \ - CHECK_FULL(i, wantname, \ +#define CHECK_USABLE(i, wantname, usable) \ + CHECK_FULL(i, wantname, \ usable ? VIR_TRISTATE_BOOL_YES : VIR_TRISTATE_BOOL_NO) CHECK(0, "qemu64"); @@ -536,14 +536,14 @@ testQemuMonitorJSONGetCommands(const void *data) goto cleanup; } -#define CHECK(i, wantname) \ - do { \ - if (STRNEQ(commands[i], (wantname))) { \ - virReportError(VIR_ERR_INTERNAL_ERROR, \ - "name %s is not %s", \ - commands[i], (wantname)); \ - goto cleanup; \ - } \ +#define CHECK(i, wantname) \ + do { \ + if (STRNEQ(commands[i], (wantname))) { \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + "name %s is not %s", \ + commands[i], (wantname)); \ + goto cleanup; \ + } \ } while (0) CHECK(0, "system_wakeup"); @@ -592,14 +592,14 @@ testQemuMonitorJSONGetTPMModels(const void *data) goto cleanup; } -#define CHECK(i, wantname) \ - do { \ - if (STRNEQ(tpmmodels[i], (wantname))) { \ - virReportError(VIR_ERR_INTERNAL_ERROR, \ - "name %s is not %s", \ - tpmmodels[i], (wantname)); \ - goto cleanup; \ - } \ +#define CHECK(i, wantname) \ + do { \ + if (STRNEQ(tpmmodels[i], (wantname))) { \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + "name %s is not %s", \ + tpmmodels[i], (wantname)); \ + goto cleanup; \ + } \ } while (0) CHECK(0, "passthrough"); @@ -655,14 +655,14 @@ testQemuMonitorJSONGetCommandLineOptionParameters(const void *data) goto cleanup; } -#define CHECK(i, wantname) \ - do { \ - if (STRNEQ(params[i], (wantname))) { \ - virReportError(VIR_ERR_INTERNAL_ERROR, \ - "name was %s, expected %s", \ - params[i], (wantname)); \ - goto cleanup; \ - } \ +#define CHECK(i, wantname) \ + do { \ + if (STRNEQ(params[i], (wantname))) { \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + "name was %s, expected %s", \ + params[i], (wantname)); \ + goto cleanup; \ + } \ } while (0) CHECK(0, "romfile"); @@ -820,9 +820,9 @@ qemuMonitorJSONTestAttachChardev(virDomainXMLOptionPtr xmlopt) virDomainChrSourceDef chr; int ret = 0; -#define CHECK(label, fail, expectargs) \ - if (qemuMonitorJSONTestAttachOneChardev(xmlopt, label, &chr, expectargs, \ - NULL, NULL, fail) < 0) \ +#define CHECK(label, fail, expectargs) \ + if (qemuMonitorJSONTestAttachOneChardev(xmlopt, label, &chr, expectargs, \ + NULL, NULL, fail) < 0) \ ret = -1 chr = (virDomainChrSourceDef) { .type = VIR_DOMAIN_CHR_TYPE_NULL }; @@ -1003,20 +1003,20 @@ testQemuMonitorJSONGetListPaths(const void *data) goto cleanup; } -#define CHECK(i, wantname, wanttype) \ - do { \ - if (STRNEQ(paths[i]->name, (wantname))) { \ - virReportError(VIR_ERR_INTERNAL_ERROR, \ - "name was %s, expected %s", \ - paths[i]->name, (wantname)); \ - goto cleanup; \ - } \ - if (STRNEQ_NULLABLE(paths[i]->type, (wanttype))) { \ - virReportError(VIR_ERR_INTERNAL_ERROR, \ - "type was %s, expected %s", \ - NULLSTR(paths[i]->type), (wanttype)); \ - goto cleanup; \ - } \ +#define CHECK(i, wantname, wanttype) \ + do { \ + if (STRNEQ(paths[i]->name, (wantname))) { \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + "name was %s, expected %s", \ + paths[i]->name, (wantname)); \ + goto cleanup; \ + } \ + if (STRNEQ_NULLABLE(paths[i]->type, (wanttype))) { \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + "type was %s, expected %s", \ + NULLSTR(paths[i]->type), (wanttype)); \ + goto cleanup; \ + } \ } while (0) CHECK(0, "machine", "child"); @@ -1286,32 +1286,32 @@ testQemuMonitorJSONSimpleFunc(const void *opaque) return ret; } -#define GEN_TEST_FUNC(funcName, ...) \ -static int \ -testQemuMonitorJSON ## funcName(const void *opaque) \ -{ \ - const testQemuMonitorJSONSimpleFuncData *data = opaque; \ - virDomainXMLOptionPtr xmlopt = data->xmlopt; \ - qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt); \ - const char *reply = data->reply; \ - int ret = -1; \ - \ - if (!test) \ - return -1; \ - \ - if (!reply) \ - reply = "{\"return\":{}}"; \ - \ - if (qemuMonitorTestAddItem(test, data->cmd, reply) < 0) \ - goto cleanup; \ - \ - if (funcName(qemuMonitorTestGetMonitor(test), __VA_ARGS__) < 0) \ - goto cleanup; \ - \ - ret = 0; \ -cleanup: \ - qemuMonitorTestFree(test); \ - return ret; \ +#define GEN_TEST_FUNC(funcName, ...) \ +static int \ +testQemuMonitorJSON ## funcName(const void *opaque) \ +{ \ + const testQemuMonitorJSONSimpleFuncData *data = opaque; \ + virDomainXMLOptionPtr xmlopt = data->xmlopt; \ + qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt); \ + const char *reply = data->reply; \ + int ret = -1; \ + \ + if (!test) \ + return -1; \ + \ + if (!reply) \ + reply = "{\"return\":{}}"; \ + \ + if (qemuMonitorTestAddItem(test, data->cmd, reply) < 0) \ + goto cleanup; \ + \ + if (funcName(qemuMonitorTestGetMonitor(test), __VA_ARGS__) < 0) \ + goto cleanup; \ + \ + ret = 0; \ +cleanup: \ + qemuMonitorTestFree(test); \ + return ret; \ } GEN_TEST_FUNC(qemuMonitorJSONSetLink, "vnet0", VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DOWN) @@ -1738,14 +1738,14 @@ testQemuMonitorJSONqemuMonitorJSONGetBlockStatsInfo(const void *data) #define CHECK0(var, value) CHECK0FULL(var, value, "%lld", "%d") -#define CHECK(NAME, RD_REQ, RD_BYTES, RD_TOTAL_TIMES, WR_REQ, WR_BYTES, \ - WR_TOTAL_TIMES, FLUSH_REQ, FLUSH_TOTAL_TIMES, \ - WR_HIGHEST_OFFSET, WR_HIGHEST_OFFSET_VALID) \ - if (!(stats = virHashLookup(blockstats, NAME))) { \ - virReportError(VIR_ERR_INTERNAL_ERROR, \ - "block stats for device '%s' is missing", NAME); \ - goto cleanup; \ - } \ +#define CHECK(NAME, RD_REQ, RD_BYTES, RD_TOTAL_TIMES, WR_REQ, WR_BYTES, \ + WR_TOTAL_TIMES, FLUSH_REQ, FLUSH_TOTAL_TIMES, \ + WR_HIGHEST_OFFSET, WR_HIGHEST_OFFSET_VALID) \ + if (!(stats = virHashLookup(blockstats, NAME))) { \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + "block stats for device '%s' is missing", NAME); \ + goto cleanup; \ + } \ CHECK0(rd_req, RD_REQ) \ CHECK0(rd_bytes, RD_BYTES) \ CHECK0(rd_total_times, RD_TOTAL_TIMES) \ @@ -1816,41 +1816,41 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationParams(const void *data) ¶ms) < 0) goto cleanup; -#define CHECK_NUM(VAR, FIELD, VALUE, FMT) \ - do { \ - if (!params.VAR ## _set) { \ +#define CHECK_NUM(VAR, FIELD, VALUE, FMT) \ + do { \ + if (!params.VAR ## _set) { \ virReportError(VIR_ERR_INTERNAL_ERROR, "%s is not set", FIELD); \ - goto cleanup; \ - } \ - if (params.VAR != VALUE) { \ - virReportError(VIR_ERR_INTERNAL_ERROR, \ - "Invalid %s: " FMT ", expected " FMT, \ - FIELD, params.VAR, VALUE); \ - goto cleanup; \ - } \ + goto cleanup; \ + } \ + if (params.VAR != VALUE) { \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + "Invalid %s: " FMT ", expected " FMT, \ + FIELD, params.VAR, VALUE); \ + goto cleanup; \ + } \ } while (0) -#define CHECK_INT(VAR, FIELD, VALUE) \ +#define CHECK_INT(VAR, FIELD, VALUE) \ CHECK_NUM(VAR, FIELD, VALUE, "%d") -#define CHECK_ULONG(VAR, FIELD, VALUE) \ +#define CHECK_ULONG(VAR, FIELD, VALUE) \ CHECK_NUM(VAR, FIELD, VALUE, "%llu") -#define CHECK_BOOL(VAR, FIELD, VALUE) \ +#define CHECK_BOOL(VAR, FIELD, VALUE) \ CHECK_NUM(VAR, FIELD, VALUE, "%d") -#define CHECK_STR(VAR, FIELD, VALUE) \ - do { \ - if (!params.VAR) { \ +#define CHECK_STR(VAR, FIELD, VALUE) \ + do { \ + if (!params.VAR) { \ virReportError(VIR_ERR_INTERNAL_ERROR, "%s is not set", FIELD); \ - goto cleanup; \ - } \ - if (STRNEQ(params.VAR, VALUE)) { \ - virReportError(VIR_ERR_INTERNAL_ERROR, \ - "Invalid %s:'%s', expected '%s'", \ - FIELD, params.VAR, VALUE); \ - goto cleanup; \ - } \ + goto cleanup; \ + } \ + if (STRNEQ(params.VAR, VALUE)) { \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + "Invalid %s:'%s', expected '%s'", \ + FIELD, params.VAR, VALUE); \ + goto cleanup; \ + } \ } while (0) CHECK_INT(compressLevel, "compress-level", 1); @@ -2091,19 +2091,19 @@ testValidateGetBlockIoThrottle(const virDomainBlockIoTuneInfo *info, #define VALIDATE_IOTUNE(field) \ if (info->field != expectedInfo->field) { \ virReportError(VIR_ERR_INTERNAL_ERROR, \ - "info->%s=%llu != expected=%llu", \ + "info->%s=%llu != expected=%llu", \ #field, info->field, expectedInfo->field); \ return -1; \ } \ if (info->field##_max != expectedInfo->field##_max) { \ virReportError(VIR_ERR_INTERNAL_ERROR, \ - "info->%s_max=%llu != expected=%llu", \ + "info->%s_max=%llu != expected=%llu", \ #field, info->field##_max, expectedInfo->field##_max); \ return -1; \ } \ if (info->field##_max_length != expectedInfo->field##_max_length) { \ virReportError(VIR_ERR_INTERNAL_ERROR, \ - "info->%s_max_length=%llu != expected=%llu", \ + "info->%s_max_length=%llu != expected=%llu", \ #field, info->field##_max_length, \ expectedInfo->field##_max_length); \ return -1; \ @@ -2575,20 +2575,20 @@ testQemuMonitorJSONGetIOThreads(const void *data) goto cleanup; } -#define CHECK(i, wantiothread_id, wantthread_id) \ - do { \ - if (info[i]->iothread_id != (wantiothread_id)) { \ - virReportError(VIR_ERR_INTERNAL_ERROR, \ - "iothread_id %u is not %u", \ - info[i]->iothread_id, (wantiothread_id)); \ - goto cleanup; \ - } \ - if (info[i]->thread_id != (wantthread_id)) { \ - virReportError(VIR_ERR_INTERNAL_ERROR, \ - "thread_id %d is not %d", \ - info[i]->thread_id, (wantthread_id)); \ - goto cleanup; \ - } \ +#define CHECK(i, wantiothread_id, wantthread_id) \ + do { \ + if (info[i]->iothread_id != (wantiothread_id)) { \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + "iothread_id %u is not %u", \ + info[i]->iothread_id, (wantiothread_id)); \ + goto cleanup; \ + } \ + if (info[i]->thread_id != (wantthread_id)) { \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + "thread_id %d is not %d", \ + info[i]->thread_id, (wantthread_id)); \ + goto cleanup; \ + } \ } while (0) CHECK(0, 1, 30992); @@ -2845,36 +2845,36 @@ mymain(void) virEventRegisterDefaultImpl(); -#define DO_TEST(name) \ - if (virTestRun(# name, testQemuMonitorJSON ## name, driver.xmlopt) < 0) \ +#define DO_TEST(name) \ + if (virTestRun(# name, testQemuMonitorJSON ## name, driver.xmlopt) < 0) \ ret = -1 -#define DO_TEST_SIMPLE(CMD, FNC, ...) \ +#define DO_TEST_SIMPLE(CMD, FNC, ...) \ simpleFunc = (testQemuMonitorJSONSimpleFuncData) {.cmd = CMD, .func = FNC, \ .xmlopt = driver.xmlopt, __VA_ARGS__ }; \ - if (virTestRun(# FNC, testQemuMonitorJSONSimpleFunc, &simpleFunc) < 0) \ + if (virTestRun(# FNC, testQemuMonitorJSONSimpleFunc, &simpleFunc) < 0) \ ret = -1 #define DO_TEST_GEN(name, ...) \ simpleFunc = (testQemuMonitorJSONSimpleFuncData) {.xmlopt = driver.xmlopt, \ - __VA_ARGS__ }; \ - if (virTestRun(# name, testQemuMonitorJSON ## name, &simpleFunc) < 0) \ + __VA_ARGS__ }; \ + if (virTestRun(# name, testQemuMonitorJSON ## name, &simpleFunc) < 0) \ ret = -1 #define DO_TEST_CPU_DATA(name) \ - do { \ - struct testCPUData data = { name, driver.xmlopt }; \ - const char *label = "GetCPUData(" name ")"; \ - if (virTestRun(label, testQemuMonitorJSONGetCPUData, &data) < 0) \ - ret = -1; \ + do { \ + struct testCPUData data = { name, driver.xmlopt }; \ + const char *label = "GetCPUData(" name ")"; \ + if (virTestRun(label, testQemuMonitorJSONGetCPUData, &data) < 0) \ + ret = -1; \ } while (0) -#define DO_TEST_CPU_INFO(name, maxvcpus) \ - do { \ - struct testCPUInfoData data = {name, maxvcpus, driver.xmlopt}; \ - if (virTestRun("GetCPUInfo(" name ")", testQemuMonitorCPUInfo, \ - &data) < 0) \ - ret = -1; \ +#define DO_TEST_CPU_INFO(name, maxvcpus) \ + do { \ + struct testCPUInfoData data = {name, maxvcpus, driver.xmlopt}; \ + if (virTestRun("GetCPUInfo(" name ")", testQemuMonitorCPUInfo, \ + &data) < 0) \ + ret = -1; \ } while (0) DO_TEST(GetStatus); @@ -2962,11 +2962,11 @@ mymain(void) DO_TEST_CPU_INFO("ppc64-hotplug-4", 24); DO_TEST_CPU_INFO("ppc64-no-threads", 16); -#define DO_TEST_BLOCK_NODE_DETECT(testname) \ - do { \ - if (virTestRun("node-name-detect(" testname ")", \ - testBlockNodeNameDetect, testname) < 0) \ - ret = -1; \ +#define DO_TEST_BLOCK_NODE_DETECT(testname) \ + do { \ + if (virTestRun("node-name-detect(" testname ")", \ + testBlockNodeNameDetect, testname) < 0) \ + ret = -1; \ } while (0) DO_TEST_BLOCK_NODE_DETECT("basic"); diff --git a/tests/qemumonitortest.c b/tests/qemumonitortest.c index cfb55143e1..0231ce083e 100644 --- a/tests/qemumonitortest.c +++ b/tests/qemumonitortest.c @@ -174,12 +174,12 @@ mymain(void) virEventRegisterDefaultImpl(); -# define DO_TEST(_name) \ - do { \ - if (virTestRun("qemu monitor "#_name, test##_name, \ - driver.xmlopt) < 0) { \ - result = -1; \ - } \ +# define DO_TEST(_name) \ + do { \ + if (virTestRun("qemu monitor "#_name, test##_name, \ + driver.xmlopt) < 0) { \ + result = -1; \ + } \ } while (0) DO_TEST(EscapeArg); diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 03b1bcbcf7..2e07b85aa6 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -620,44 +620,44 @@ mymain(void) if (VIR_STRDUP_QUIET(driver.config->memoryBackingDir, "/var/lib/libvirt/qemu/ram") < 0) return EXIT_FAILURE; -# define DO_TEST_FULL(name, migrateFrom, migrateFd, flags, \ - parseFlags, gic, ...) \ - do { \ - static struct testInfo info = { \ - name, NULL, migrateFrom, migrateFd, (flags), parseFlags, \ - false \ - }; \ - info.skipLegacyCPUs = skipLegacyCPUs; \ - if (testInitQEMUCaps(&info, gic) < 0) \ - return EXIT_FAILURE; \ - virQEMUCapsSetList(info.qemuCaps, __VA_ARGS__, QEMU_CAPS_LAST); \ - if (virTestRun("QEMU XML-2-ARGV " name, \ - testCompareXMLToArgv, &info) < 0) \ - ret = -1; \ - virObjectUnref(info.qemuCaps); \ +# define DO_TEST_FULL(name, migrateFrom, migrateFd, flags, \ + parseFlags, gic, ...) \ + do { \ + static struct testInfo info = { \ + name, NULL, migrateFrom, migrateFd, (flags), parseFlags, \ + false \ + }; \ + info.skipLegacyCPUs = skipLegacyCPUs; \ + if (testInitQEMUCaps(&info, gic) < 0) \ + return EXIT_FAILURE; \ + virQEMUCapsSetList(info.qemuCaps, __VA_ARGS__, QEMU_CAPS_LAST); \ + if (virTestRun("QEMU XML-2-ARGV " name, \ + testCompareXMLToArgv, &info) < 0) \ + ret = -1; \ + virObjectUnref(info.qemuCaps); \ } while (0) -# define DO_TEST(name, ...) \ +# define DO_TEST(name, ...) \ DO_TEST_FULL(name, NULL, -1, 0, 0, GIC_NONE, __VA_ARGS__) -# define DO_TEST_GIC(name, gic, ...) \ +# define DO_TEST_GIC(name, gic, ...) \ DO_TEST_FULL(name, NULL, -1, 0, 0, gic, __VA_ARGS__) -# define DO_TEST_FAILURE(name, ...) \ - DO_TEST_FULL(name, NULL, -1, FLAG_EXPECT_FAILURE, \ +# define DO_TEST_FAILURE(name, ...) \ + DO_TEST_FULL(name, NULL, -1, FLAG_EXPECT_FAILURE, \ 0, GIC_NONE, __VA_ARGS__) -# define DO_TEST_PARSE_ERROR(name, ...) \ - DO_TEST_FULL(name, NULL, -1, \ - FLAG_EXPECT_PARSE_ERROR | FLAG_EXPECT_FAILURE, \ +# define DO_TEST_PARSE_ERROR(name, ...) \ + DO_TEST_FULL(name, NULL, -1, \ + FLAG_EXPECT_PARSE_ERROR | FLAG_EXPECT_FAILURE, \ 0, GIC_NONE, __VA_ARGS__) -# define DO_TEST_PARSE_FLAGS_ERROR(name, parseFlags, ...) \ - DO_TEST_FULL(name, NULL, -1, \ - FLAG_EXPECT_PARSE_ERROR | FLAG_EXPECT_FAILURE, \ +# define DO_TEST_PARSE_FLAGS_ERROR(name, parseFlags, ...) \ + DO_TEST_FULL(name, NULL, -1, \ + FLAG_EXPECT_PARSE_ERROR | FLAG_EXPECT_FAILURE, \ parseFlags, GIC_NONE, __VA_ARGS__) -# define DO_TEST_LINUX(name, ...) \ +# define DO_TEST_LINUX(name, ...) \ DO_TEST_LINUX_FULL(name, NULL, -1, 0, 0, GIC_NONE, __VA_ARGS__) # ifdef __linux__ @@ -666,12 +666,12 @@ mymain(void) * cooperation is expected (e.g. we need a fixed time, * predictable NUMA topology and so on). On non-Linux * platforms the macro just consume its argument. */ -# define DO_TEST_LINUX_FULL(name, ...) \ +# define DO_TEST_LINUX_FULL(name, ...) \ DO_TEST_FULL(name, __VA_ARGS__) # else /* __linux__ */ -# define DO_TEST_LINUX_FULL(name, ...) \ - do { \ - const char *tmp ATTRIBUTE_UNUSED = name; \ +# define DO_TEST_LINUX_FULL(name, ...) \ + do { \ + const char *tmp ATTRIBUTE_UNUSED = name; \ } while (0) # endif /* __linux__ */ diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index fdba2adb98..5a282e5ff4 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -381,30 +381,30 @@ mymain(void) /* TODO: test with format probing disabled too */ driver.config->allowDiskFormatProbing = true; -# define DO_TEST_FULL(name, when, gic, ...) \ - do { \ - if (testInfoSet(&info, name, when, gic) < 0) { \ - VIR_TEST_DEBUG("Failed to generate test data for '%s'", name); \ - return -1; \ - } \ - virQEMUCapsSetList(info.qemuCaps, __VA_ARGS__, QEMU_CAPS_LAST); \ - \ - if (info.outInactiveName) { \ - if (virTestRun("QEMU XML-2-XML-inactive " name, \ - testXML2XMLInactive, &info) < 0) \ - ret = -1; \ - } \ - \ - if (info.outActiveName) { \ - if (virTestRun("QEMU XML-2-XML-active " name, \ - testXML2XMLActive, &info) < 0) \ - ret = -1; \ - \ - if (virTestRun("QEMU XML-2-XML-status " name, \ - testCompareStatusXMLToXMLFiles, &info) < 0) \ - ret = -1; \ - } \ - testInfoFree(&info); \ +# define DO_TEST_FULL(name, when, gic, ...) \ + do { \ + if (testInfoSet(&info, name, when, gic) < 0) { \ + VIR_TEST_DEBUG("Failed to generate test data for '%s'", name); \ + return -1; \ + } \ + virQEMUCapsSetList(info.qemuCaps, __VA_ARGS__, QEMU_CAPS_LAST); \ + \ + if (info.outInactiveName) { \ + if (virTestRun("QEMU XML-2-XML-inactive " name, \ + testXML2XMLInactive, &info) < 0) \ + ret = -1; \ + } \ + \ + if (info.outActiveName) { \ + if (virTestRun("QEMU XML-2-XML-active " name, \ + testXML2XMLActive, &info) < 0) \ + ret = -1; \ + \ + if (virTestRun("QEMU XML-2-XML-status " name, \ + testCompareStatusXMLToXMLFiles, &info) < 0) \ + ret = -1; \ + } \ + testInfoFree(&info); \ } while (0) # define NONE QEMU_CAPS_LAST diff --git a/tests/secretxml2xmltest.c b/tests/secretxml2xmltest.c index 19bd60a911..306f64c236 100644 --- a/tests/secretxml2xmltest.c +++ b/tests/secretxml2xmltest.c @@ -68,12 +68,12 @@ mymain(void) { int ret = 0; -#define DO_TEST(name) \ - do { \ - const struct testInfo info = {name, false}; \ - if (virTestRun("Secret XML->XML " name, \ - testCompareXMLToXMLHelper, &info) < 0) \ - ret = -1; \ +#define DO_TEST(name) \ + do { \ + const struct testInfo info = {name, false}; \ + if (virTestRun("Secret XML->XML " name, \ + testCompareXMLToXMLHelper, &info) < 0) \ + ret = -1; \ } while (0) DO_TEST("ephemeral-usage-volume"); diff --git a/tests/securityselinuxlabeltest.c b/tests/securityselinuxlabeltest.c index ddcc954429..c684989fd2 100644 --- a/tests/securityselinuxlabeltest.c +++ b/tests/securityselinuxlabeltest.c @@ -360,8 +360,8 @@ mymain(void) if (qemuTestDriverInit(&driver) < 0) return EXIT_FAILURE; -#define DO_TEST_LABELING(name) \ - if (virTestRun("Labelling " # name, testSELinuxLabeling, name) < 0) \ +#define DO_TEST_LABELING(name) \ + if (virTestRun("Labelling " # name, testSELinuxLabeling, name) < 0) \ ret = -1; setcon((security_context_t)"system_r:system_u:libvirtd_t:s0:c0.c1023"); diff --git a/tests/securityselinuxtest.c b/tests/securityselinuxtest.c index 0ac28288f1..a785e9a7da 100644 --- a/tests/securityselinuxtest.c +++ b/tests/securityselinuxtest.c @@ -283,19 +283,19 @@ mymain(void) return EXIT_FAILURE; } -#define DO_TEST_GEN_LABEL(desc, pidcon, \ - dynamic, label, baselabel, \ - user, role, imageRole, \ - type, imageType, \ - sensMin, sensMax, catMin, catMax) \ - do { \ - struct testSELinuxGenLabelData data = { \ - mgr, pidcon, dynamic, label, baselabel, \ - user, role, imageRole, type, imageType, \ - sensMin, sensMax, catMin, catMax \ - }; \ +#define DO_TEST_GEN_LABEL(desc, pidcon, \ + dynamic, label, baselabel, \ + user, role, imageRole, \ + type, imageType, \ + sensMin, sensMax, catMin, catMax) \ + do { \ + struct testSELinuxGenLabelData data = { \ + mgr, pidcon, dynamic, label, baselabel, \ + user, role, imageRole, type, imageType, \ + sensMin, sensMax, catMin, catMax \ + }; \ if (virTestRun("GenLabel " # desc, testSELinuxGenLabel, &data) < 0) \ - ret = -1; \ + ret = -1; \ } while (0) DO_TEST_GEN_LABEL("dynamic unconfined, s0, c0.c1023", diff --git a/tests/sexpr2xmltest.c b/tests/sexpr2xmltest.c index 5dfc45d7d3..e1986e425f 100644 --- a/tests/sexpr2xmltest.c +++ b/tests/sexpr2xmltest.c @@ -121,13 +121,13 @@ mymain(void) return EXIT_FAILURE; } -#define DO_TEST(in, out) \ - do { \ - struct testInfo info = { in, out }; \ - virResetLastError(); \ - if (virTestRun("Xen SEXPR-2-XML " in " -> " out, \ - testCompareHelper, &info) < 0) \ - ret = -1; \ +#define DO_TEST(in, out) \ + do { \ + struct testInfo info = { in, out }; \ + virResetLastError(); \ + if (virTestRun("Xen SEXPR-2-XML " in " -> " out, \ + testCompareHelper, &info) < 0) \ + ret = -1; \ } while (0) DO_TEST("pv", "pv"); diff --git a/tests/sockettest.c b/tests/sockettest.c index 2db90bd02e..30b16b4e4d 100644 --- a/tests/sockettest.c +++ b/tests/sockettest.c @@ -274,91 +274,91 @@ mymain(void) */ virTestQuiesceLibvirtErrors(false); -#define DO_TEST_PARSE_AND_FORMAT(addrstr, family, pass) \ - do { \ - virSocketAddr addr; \ - struct testParseData data = { &addr, addrstr, family, pass }; \ - memset(&addr, 0, sizeof(addr)); \ - if (virTestRun("Test parse " addrstr " family " #family, \ - testParseHelper, &data) < 0) \ - ret = -1; \ - struct testFormatData data2 = { &addr, addrstr, pass }; \ - if (virTestRun("Test format " addrstr " family " #family, \ - testFormatHelper, &data2) < 0) \ - ret = -1; \ +#define DO_TEST_PARSE_AND_FORMAT(addrstr, family, pass) \ + do { \ + virSocketAddr addr; \ + struct testParseData data = { &addr, addrstr, family, pass }; \ + memset(&addr, 0, sizeof(addr)); \ + if (virTestRun("Test parse " addrstr " family " #family, \ + testParseHelper, &data) < 0) \ + ret = -1; \ + struct testFormatData data2 = { &addr, addrstr, pass }; \ + if (virTestRun("Test format " addrstr " family " #family, \ + testFormatHelper, &data2) < 0) \ + ret = -1; \ } while (0) #define DO_TEST_PARSE_AND_CHECK_FORMAT(addrstr, addrformated, family, pass) \ - do { \ - virSocketAddr addr; \ - struct testParseData data = { &addr, addrstr, family, true}; \ - memset(&addr, 0, sizeof(addr)); \ - if (virTestRun("Test parse " addrstr " family " #family, \ - testParseHelper, &data) < 0) \ - ret = -1; \ - struct testFormatData data2 = { &addr, addrformated, pass }; \ - if (virTestRun("Test format " addrstr " family " #family, \ - testFormatHelper, &data2) < 0) \ - ret = -1; \ + do { \ + virSocketAddr addr; \ + struct testParseData data = { &addr, addrstr, family, true}; \ + memset(&addr, 0, sizeof(addr)); \ + if (virTestRun("Test parse " addrstr " family " #family, \ + testParseHelper, &data) < 0) \ + ret = -1; \ + struct testFormatData data2 = { &addr, addrformated, pass }; \ + if (virTestRun("Test format " addrstr " family " #family, \ + testFormatHelper, &data2) < 0) \ + ret = -1; \ } while (0) -#define DO_TEST_RANGE(saddr, eaddr, netaddr, prefix, size, pass) \ - do { \ - struct testRangeData data \ - = { saddr, eaddr, netaddr, prefix, size, pass }; \ - if (virTestRun("Test range " saddr " -> " eaddr "(" netaddr \ - "/" #prefix") size " #size, \ - testRangeHelper, &data) < 0) \ - ret = -1; \ +#define DO_TEST_RANGE(saddr, eaddr, netaddr, prefix, size, pass) \ + do { \ + struct testRangeData data \ + = { saddr, eaddr, netaddr, prefix, size, pass }; \ + if (virTestRun("Test range " saddr " -> " eaddr "(" netaddr \ + "/" #prefix") size " #size, \ + testRangeHelper, &data) < 0) \ + ret = -1; \ } while (0) -#define DO_TEST_RANGE_SIMPLE(saddr, eaddr, size, pass) \ - do { \ - struct testRangeData data \ - = { saddr, eaddr, NULL, 0, size, pass }; \ - if (virTestRun("Test range " saddr " -> " eaddr "size " #size, \ - testRangeHelper, &data) < 0) \ - ret = -1; \ +#define DO_TEST_RANGE_SIMPLE(saddr, eaddr, size, pass) \ + do { \ + struct testRangeData data \ + = { saddr, eaddr, NULL, 0, size, pass }; \ + if (virTestRun("Test range " saddr " -> " eaddr "size " #size, \ + testRangeHelper, &data) < 0) \ + ret = -1; \ } while (0) -#define DO_TEST_NETMASK(addr1, addr2, netmask, pass) \ - do { \ - struct testNetmaskData data = { addr1, addr2, netmask, pass }; \ +#define DO_TEST_NETMASK(addr1, addr2, netmask, pass) \ + do { \ + struct testNetmaskData data = { addr1, addr2, netmask, pass }; \ if (virTestRun("Test netmask " addr1 " + " addr2 " in " netmask, \ - testNetmaskHelper, &data) < 0) \ - ret = -1; \ + testNetmaskHelper, &data) < 0) \ + ret = -1; \ } while (0) -#define DO_TEST_MASK_NETWORK(addr1, prefix, network) \ - do { \ - struct testMaskNetworkData data = { addr1, prefix, network }; \ +#define DO_TEST_MASK_NETWORK(addr1, prefix, network) \ + do { \ + struct testMaskNetworkData data = { addr1, prefix, network }; \ if (virTestRun("Test mask network " addr1 " / " #prefix " == " network, \ - testMaskNetworkHelper, &data) < 0) \ - ret = -1; \ + testMaskNetworkHelper, &data) < 0) \ + ret = -1; \ } while (0) -#define DO_TEST_WILDCARD(addr, pass) \ - do { \ - struct testWildcardData data = { addr, pass}; \ - if (virTestRun("Test wildcard " addr, \ - testWildcardHelper, &data) < 0) \ - ret = -1; \ +#define DO_TEST_WILDCARD(addr, pass) \ + do { \ + struct testWildcardData data = { addr, pass}; \ + if (virTestRun("Test wildcard " addr, \ + testWildcardHelper, &data) < 0) \ + ret = -1; \ } while (0) -#define DO_TEST_NUMERIC_FAMILY(addr, pass) \ - do { \ - struct testNumericData data = { addr, pass }; \ - if (virTestRun("Test Numeric Family" addr, \ - testNumericHelper, &data) < 0) \ - ret = -1; \ +#define DO_TEST_NUMERIC_FAMILY(addr, pass) \ + do { \ + struct testNumericData data = { addr, pass }; \ + if (virTestRun("Test Numeric Family" addr, \ + testNumericHelper, &data) < 0) \ + ret = -1; \ } while (0) -#define DO_TEST_LOCALHOST(addr, pass) \ - do { \ - struct testIsLocalhostData data = { addr, pass }; \ - if (virTestRun("Test localhost " addr, \ - testIsLocalhostHelper, &data) < 0) \ - ret = -1; \ +#define DO_TEST_LOCALHOST(addr, pass) \ + do { \ + struct testIsLocalhostData data = { addr, pass }; \ + if (virTestRun("Test localhost " addr, \ + testIsLocalhostHelper, &data) < 0) \ + ret = -1; \ } while (0) DO_TEST_PARSE_AND_FORMAT("127.0.0.1", AF_UNSPEC, true); diff --git a/tests/storagebackendsheepdogtest.c b/tests/storagebackendsheepdogtest.c index 75c3dd5dda..cc7b163241 100644 --- a/tests/storagebackendsheepdogtest.c +++ b/tests/storagebackendsheepdogtest.c @@ -185,15 +185,15 @@ mymain(void) abs_srcdir) < 0) goto cleanup; -#define DO_TEST_NODE(collie) \ - do { \ - struct testNodeInfoParserData data = { \ - .data = collie, \ - .poolxml = poolxml, \ - }; \ - if (virTestRun("node_info_parser", test_node_info_parser, \ - &data) < 0) \ - ret = -1; \ +#define DO_TEST_NODE(collie) \ + do { \ + struct testNodeInfoParserData data = { \ + .data = collie, \ + .poolxml = poolxml, \ + }; \ + if (virTestRun("node_info_parser", test_node_info_parser, \ + &data) < 0) \ + ret = -1; \ } while (0) while (test->output != NULL) { @@ -202,16 +202,16 @@ mymain(void) } -#define DO_TEST_VDI(collie) \ - do { \ - struct testVDIListParserData data = { \ - .data = collie, \ - .poolxml = poolxml, \ - .volxml = volxml, \ - }; \ - if (virTestRun("vdi_list_parser", test_vdi_list_parser, \ - &data) < 0) \ - ret = -1; \ +#define DO_TEST_VDI(collie) \ + do { \ + struct testVDIListParserData data = { \ + .data = collie, \ + .poolxml = poolxml, \ + .volxml = volxml, \ + }; \ + if (virTestRun("vdi_list_parser", test_vdi_list_parser, \ + &data) < 0) \ + ret = -1; \ } while (0) test = vdi_list_tests; diff --git a/tests/storagepoolxml2xmltest.c b/tests/storagepoolxml2xmltest.c index 2f44c3f342..974f0afe39 100644 --- a/tests/storagepoolxml2xmltest.c +++ b/tests/storagepoolxml2xmltest.c @@ -68,9 +68,9 @@ mymain(void) { int ret = 0; -#define DO_TEST(name) \ - if (virTestRun("Storage Pool XML-2-XML " name, \ - testCompareXMLToXMLHelper, (name)) < 0) \ +#define DO_TEST(name) \ + if (virTestRun("Storage Pool XML-2-XML " name, \ + testCompareXMLToXMLHelper, (name)) < 0) \ ret = -1 DO_TEST("pool-dir"); diff --git a/tests/storagevolxml2argvtest.c b/tests/storagevolxml2argvtest.c index 73d9c4bc6b..7b62243df3 100644 --- a/tests/storagevolxml2argvtest.c +++ b/tests/storagevolxml2argvtest.c @@ -187,20 +187,20 @@ mymain(void) unsigned int flags = VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA; #define DO_TEST_FULL(shouldFail, parseflags, pool, vol, inputpool, inputvol, \ - cmdline, flags, imgformat) \ - do { \ + cmdline, flags, imgformat) \ + do { \ struct testInfo info = { shouldFail, pool, vol, inputpool, inputvol, \ - cmdline, flags, imgformat, parseflags }; \ - if (virTestRun("Storage Vol XML-2-argv " cmdline, \ - testCompareXMLToArgvHelper, &info) < 0) \ - ret = -1; \ - } \ + cmdline, flags, imgformat, parseflags }; \ + if (virTestRun("Storage Vol XML-2-argv " cmdline, \ + testCompareXMLToArgvHelper, &info) < 0) \ + ret = -1; \ + } \ while (0); -#define DO_TEST(pool, ...) \ +#define DO_TEST(pool, ...) \ DO_TEST_FULL(false, 0, pool, __VA_ARGS__) -#define DO_TEST_FAIL(pool, ...) \ +#define DO_TEST_FAIL(pool, ...) \ DO_TEST_FULL(true, 0, pool, __VA_ARGS__) DO_TEST("pool-dir", "vol-qcow2", diff --git a/tests/storagevolxml2xmltest.c b/tests/storagevolxml2xmltest.c index 8521adf966..426b100c27 100644 --- a/tests/storagevolxml2xmltest.c +++ b/tests/storagevolxml2xmltest.c @@ -86,13 +86,13 @@ mymain(void) { int ret = 0; -#define DO_TEST_FULL(pool, name, flags) \ - do { \ - struct testInfo info = { pool, name, flags }; \ - if (virTestRun("Storage Vol XML-2-XML " name, \ - testCompareXMLToXMLHelper, &info) < 0) \ - ret = -1; \ - } \ +#define DO_TEST_FULL(pool, name, flags) \ + do { \ + struct testInfo info = { pool, name, flags }; \ + if (virTestRun("Storage Vol XML-2-XML " name, \ + testCompareXMLToXMLHelper, &info) < 0) \ + ret = -1; \ + } \ while (0); #define DO_TEST(pool, name) DO_TEST_FULL(pool, name, 0) diff --git a/tests/testutils.h b/tests/testutils.h index 49649c4f5a..668a79d95c 100644 --- a/tests/testutils.h +++ b/tests/testutils.h @@ -91,16 +91,16 @@ unsigned int virTestGetVerbose(void); unsigned int virTestGetExpensive(void); unsigned int virTestGetRegenerate(void); -# define VIR_TEST_DEBUG(...) \ - do { \ - if (virTestGetDebug()) \ - fprintf(stderr, __VA_ARGS__); \ +# define VIR_TEST_DEBUG(...) \ + do { \ + if (virTestGetDebug()) \ + fprintf(stderr, __VA_ARGS__); \ } while (0) -# define VIR_TEST_VERBOSE(...) \ - do { \ - if (virTestGetVerbose()) \ - fprintf(stderr, __VA_ARGS__); \ +# define VIR_TEST_VERBOSE(...) \ + do { \ + if (virTestGetVerbose()) \ + fprintf(stderr, __VA_ARGS__); \ } while (0) char *virTestLogContentAndReset(void); @@ -116,34 +116,34 @@ int virTestMain(int argc, ...); /* Setup, then call func() */ -# define VIR_TEST_MAIN(func) \ - int main(int argc, char **argv) { \ - return virTestMain(argc, argv, func, NULL); \ +# define VIR_TEST_MAIN(func) \ + int main(int argc, char **argv) { \ + return virTestMain(argc, argv, func, NULL); \ } -# define VIR_TEST_PRELOAD(lib) \ - do { \ - const char *preload = getenv("LD_PRELOAD"); \ - if (preload == NULL || strstr(preload, lib) == NULL) { \ - char *newenv; \ - if (!virFileIsExecutable(lib)) { \ - perror(lib); \ - return EXIT_FAILURE; \ - } \ - if (!preload) { \ - newenv = (char *) lib; \ - } else if (virAsprintf(&newenv, "%s:%s", lib, preload) < 0) { \ - perror("virAsprintf"); \ - return EXIT_FAILURE; \ - } \ - setenv("LD_PRELOAD", newenv, 1); \ - execv(argv[0], argv); \ - } \ +# define VIR_TEST_PRELOAD(lib) \ + do { \ + const char *preload = getenv("LD_PRELOAD"); \ + if (preload == NULL || strstr(preload, lib) == NULL) { \ + char *newenv; \ + if (!virFileIsExecutable(lib)) { \ + perror(lib); \ + return EXIT_FAILURE; \ + } \ + if (!preload) { \ + newenv = (char *) lib; \ + } else if (virAsprintf(&newenv, "%s:%s", lib, preload) < 0) { \ + perror("virAsprintf"); \ + return EXIT_FAILURE; \ + } \ + setenv("LD_PRELOAD", newenv, 1); \ + execv(argv[0], argv); \ + } \ } while (0) -# define VIR_TEST_MAIN_PRELOAD(func, ...) \ - int main(int argc, char **argv) { \ - return virTestMain(argc, argv, func, __VA_ARGS__, NULL); \ +# define VIR_TEST_MAIN_PRELOAD(func, ...) \ + int main(int argc, char **argv) { \ + return virTestMain(argc, argv, func, __VA_ARGS__, NULL); \ } virCapsPtr virTestGenericCapsInit(void); diff --git a/tests/utiltest.c b/tests/utiltest.c index f80329b30e..4479b0e0e0 100644 --- a/tests/utiltest.c +++ b/tests/utiltest.c @@ -228,12 +228,12 @@ testRoundValueToPowerOfTwo(const void *data ATTRIBUTE_UNUSED) } -#define TEST_OVERFLOW(var, val, expect) \ - tmp = val; \ - if (VIR_ASSIGN_IS_OVERFLOW(var, tmp) != expect) { \ - fprintf(stderr, "\noverflow check failed: " \ - "var: " #var " val: " #val "\n"); \ - return -1; \ +#define TEST_OVERFLOW(var, val, expect) \ + tmp = val; \ + if (VIR_ASSIGN_IS_OVERFLOW(var, tmp) != expect) { \ + fprintf(stderr, "\noverflow check failed: " \ + "var: " #var " val: " #val "\n"); \ + return -1; \ } static int @@ -266,12 +266,12 @@ mymain(void) virTestQuiesceLibvirtErrors(true); -#define DO_TEST(_name) \ - do { \ - if (virTestRun("Util "#_name, test##_name, \ - NULL) < 0) { \ - result = -1; \ - } \ +#define DO_TEST(_name) \ + do { \ + if (virTestRun("Util "#_name, test##_name, \ + NULL) < 0) { \ + result = -1; \ + } \ } while (0) DO_TEST(IndexToDiskName); diff --git a/tests/vboxsnapshotxmltest.c b/tests/vboxsnapshotxmltest.c index 1faac50652..6db258ea02 100644 --- a/tests/vboxsnapshotxmltest.c +++ b/tests/vboxsnapshotxmltest.c @@ -134,9 +134,9 @@ mymain(void) goto cleanup; } -# define DO_TEST(name) \ - if (virTestRun("VBox Snapshot XML-2-XML " name, \ - testCompareXMLToXMLHelper, (name)) < 0) \ +# define DO_TEST(name) \ + if (virTestRun("VBox Snapshot XML-2-XML " name, \ + testCompareXMLToXMLHelper, (name)) < 0) \ ret = -1 DO_TEST("2disks-nosnap"); diff --git a/tests/virauthconfigtest.c b/tests/virauthconfigtest.c index cf40ec4659..1209aa0e30 100644 --- a/tests/virauthconfigtest.c +++ b/tests/virauthconfigtest.c @@ -92,14 +92,14 @@ mymain(void) signal(SIGPIPE, SIG_IGN); -#define TEST_LOOKUP(config, hostname, service, credname, expect) \ - do { \ - const struct ConfigLookupData data = { \ - config, hostname, service, credname, expect \ - }; \ +#define TEST_LOOKUP(config, hostname, service, credname, expect) \ + do { \ + const struct ConfigLookupData data = { \ + config, hostname, service, credname, expect \ + }; \ if (virTestRun("Test Lookup " hostname "-" service "-" credname, \ - testAuthLookup, &data) < 0) \ - ret = -1; \ + testAuthLookup, &data) < 0) \ + ret = -1; \ } while (0) const char *confdata = diff --git a/tests/virbitmaptest.c b/tests/virbitmaptest.c index 76005117e7..c24d4a72f7 100644 --- a/tests/virbitmaptest.c +++ b/tests/virbitmaptest.c @@ -608,24 +608,24 @@ test11(const void *opaque) return ret; } -#define TEST_MAP(sz, expect) \ - do { \ - char *actual; \ - if (virBitmapSize(map) != sz) { \ - fprintf(stderr, "\n expected bitmap size: '%d' actual size: " \ - "'%zu'\n", sz, virBitmapSize(map)); \ - goto cleanup; \ - } \ - \ - actual = virBitmapFormat(map); \ - \ - if (STRNEQ_NULLABLE(expect, actual)) { \ +#define TEST_MAP(sz, expect) \ + do { \ + char *actual; \ + if (virBitmapSize(map) != sz) { \ + fprintf(stderr, "\n expected bitmap size: '%d' actual size: " \ + "'%zu'\n", sz, virBitmapSize(map)); \ + goto cleanup; \ + } \ + \ + actual = virBitmapFormat(map); \ + \ + if (STRNEQ_NULLABLE(expect, actual)) { \ fprintf(stderr, "\n expected bitmap contents '%s' actual contents "\ - "'%s'\n", NULLSTR(expect), NULLSTR(actual)); \ - VIR_FREE(actual); \ - goto cleanup; \ - } \ - VIR_FREE(actual); \ + "'%s'\n", NULLSTR(expect), NULLSTR(actual)); \ + VIR_FREE(actual); \ + goto cleanup; \ + } \ + VIR_FREE(actual); \ } while (0) /* test self-expanding bitmap APIs */ @@ -666,11 +666,11 @@ test12(const void *opaque ATTRIBUTE_UNUSED) #undef TEST_MAP -#define TESTBINARYOP(A, B, RES, FUNC) \ - testBinaryOpData.a = A; \ - testBinaryOpData.b = B; \ - testBinaryOpData.res = RES; \ - if (virTestRun(virTestCounterNext(), FUNC, &testBinaryOpData) < 0) \ +#define TESTBINARYOP(A, B, RES, FUNC) \ + testBinaryOpData.a = A; \ + testBinaryOpData.b = B; \ + testBinaryOpData.res = RES; \ + if (virTestRun(virTestCounterNext(), FUNC, &testBinaryOpData) < 0) \ ret = -1; static int diff --git a/tests/virbuftest.c b/tests/virbuftest.c index 940e4c1c61..5fd8f6c969 100644 --- a/tests/virbuftest.c +++ b/tests/virbuftest.c @@ -202,18 +202,18 @@ static int testBufAddBuffer(const void *data ATTRIBUTE_UNUSED) char *result = NULL; const char *expected = \ " A long time ago, in a galaxy far,\n" \ -" far away...\n" \ -" It is a period of civil war.\n" \ -" Rebel spaceships, striking\n" \ -" from a hidden base, have won\n" \ -" their first victory against\n" \ -" the evil Galactic Empire.\n" \ -" During the battle, rebel\n" \ -" spies managed to steal secret\n" \ -" plans to the Empire's\n" \ -" ultimate weapon, the DEATH\n" \ -" STAR, an armored space\n" \ -" station with enough power to\n" \ +" far away...\n" \ +" It is a period of civil war.\n" \ +" Rebel spaceships, striking\n" \ +" from a hidden base, have won\n" \ +" their first victory against\n" \ +" the evil Galactic Empire.\n" \ +" During the battle, rebel\n" \ +" spies managed to steal secret\n" \ +" plans to the Empire's\n" \ +" ultimate weapon, the DEATH\n" \ +" STAR, an armored space\n" \ +" station with enough power to\n" \ " destroy an entire planet.\n"; if (virBufferUse(&buf1)) { @@ -467,11 +467,11 @@ mymain(void) int ret = 0; -#define DO_TEST(msg, cb, data) \ - do { \ - struct testInfo info = { data }; \ - if (virTestRun("Buf: " msg, cb, &info) < 0) \ - ret = -1; \ +#define DO_TEST(msg, cb, data) \ + do { \ + struct testInfo info = { data }; \ + if (virTestRun("Buf: " msg, cb, &info) < 0) \ + ret = -1; \ } while (0) DO_TEST("EscapeString infinite loop", testBufInfiniteLoop, 1); @@ -481,11 +481,11 @@ mymain(void) DO_TEST("AddBuffer", testBufAddBuffer, 0); DO_TEST("set indent", testBufSetIndent, 0); -#define DO_TEST_ADD_STR(DATA, EXPECT) \ - do { \ - struct testBufAddStrData info = { DATA, EXPECT }; \ - if (virTestRun("Buf: AddStr", testBufAddStr, &info) < 0) \ - ret = -1; \ +#define DO_TEST_ADD_STR(DATA, EXPECT) \ + do { \ + struct testBufAddStrData info = { DATA, EXPECT }; \ + if (virTestRun("Buf: AddStr", testBufAddStr, &info) < 0) \ + ret = -1; \ } while (0) DO_TEST_ADD_STR("", "\n"); @@ -493,11 +493,11 @@ mymain(void) DO_TEST_ADD_STR("\n", "\n \n"); DO_TEST_ADD_STR("\n \n\n", "\n \n \n \n"); -#define DO_TEST_ESCAPE(data, expect) \ - do { \ - struct testBufAddStrData info = { data, expect }; \ +#define DO_TEST_ESCAPE(data, expect) \ + do { \ + struct testBufAddStrData info = { data, expect }; \ if (virTestRun("Buf: EscapeStr", testBufEscapeStr, &info) < 0) \ - ret = -1; \ + ret = -1; \ } while (0) DO_TEST_ESCAPE("", @@ -509,11 +509,11 @@ mymain(void) DO_TEST_ESCAPE("\x01\x01\x02\x03\x05\x08", "\n \n"); -#define DO_TEST_ESCAPEN(data, expect) \ - do { \ - struct testBufAddStrData info = { data, expect }; \ - if (virTestRun("Buf: EscapeN", testBufEscapeN, &info) < 0) \ - ret = -1; \ +#define DO_TEST_ESCAPEN(data, expect) \ + do { \ + struct testBufAddStrData info = { data, expect }; \ + if (virTestRun("Buf: EscapeN", testBufEscapeN, &info) < 0) \ + ret = -1; \ } while (0) DO_TEST_ESCAPEN("noescape", "noescape"); @@ -521,11 +521,11 @@ mymain(void) DO_TEST_ESCAPEN("equal=escape", "equal\\=escape"); DO_TEST_ESCAPEN("comma,equal=escape", "comma,,equal\\=escape"); -#define DO_TEST_ESCAPE_REGEX(data, expect) \ - do { \ - struct testBufAddStrData info = { data, expect }; \ - if (virTestRun("Buf: EscapeRegex", testBufEscapeRegex, &info) < 0) \ - ret = -1; \ +#define DO_TEST_ESCAPE_REGEX(data, expect) \ + do { \ + struct testBufAddStrData info = { data, expect }; \ + if (virTestRun("Buf: EscapeRegex", testBufEscapeRegex, &info) < 0) \ + ret = -1; \ } while (0) DO_TEST_ESCAPE_REGEX("noescape", "noescape"); diff --git a/tests/vircaps2xmltest.c b/tests/vircaps2xmltest.c index c0a67858fe..5e8f650c71 100644 --- a/tests/vircaps2xmltest.c +++ b/tests/vircaps2xmltest.c @@ -103,12 +103,12 @@ mymain(void) int ret = 0; #define DO_TEST_FULL(filename, arch, offlineMigrate, liveMigrate, resctrl) \ - do { \ - struct virCapabilitiesData data = {filename, arch, \ - offlineMigrate, \ - liveMigrate, resctrl}; \ - if (virTestRun(filename, test_virCapabilities, &data) < 0) \ - ret = -1; \ + do { \ + struct virCapabilitiesData data = {filename, arch, \ + offlineMigrate, \ + liveMigrate, resctrl}; \ + if (virTestRun(filename, test_virCapabilities, &data) < 0) \ + ret = -1; \ } while (0) #define DO_TEST(filename, arch) DO_TEST_FULL(filename, arch, true, true, false) diff --git a/tests/vircgroupmock.c b/tests/vircgroupmock.c index 9eb989ad7e..56337c2f3e 100644 --- a/tests/vircgroupmock.c +++ b/tests/vircgroupmock.c @@ -205,10 +205,10 @@ static int make_controller(const char *path, mode_t mode) if (real_mkdir(path, mode) < 0) goto cleanup; -# define MAKE_FILE(name, value) \ - do { \ - if (make_file(path, name, value) < 0) \ - goto cleanup; \ +# define MAKE_FILE(name, value) \ + do { \ + if (make_file(path, name, value) < 0) \ + goto cleanup; \ } while (0) if (STRPREFIX(controller, "cpu,cpuacct")) { @@ -422,17 +422,17 @@ static void init_sysfs(void) abort(); } -# define MAKE_CONTROLLER(subpath) \ - do { \ - char *path; \ +# define MAKE_CONTROLLER(subpath) \ + do { \ + char *path; \ if (asprintf(&path, "%s/%s", fakesysfscgroupdir, subpath) < 0) \ - abort(); \ - if (make_controller(path, 0755) < 0) { \ - fprintf(stderr, "Cannot initialize %s\n", path); \ - free(path); \ - abort(); \ - } \ - free(path); \ + abort(); \ + if (make_controller(path, 0755) < 0) { \ + fprintf(stderr, "Cannot initialize %s\n", path); \ + free(path); \ + abort(); \ + } \ + free(path); \ } while (0) MAKE_CONTROLLER("cpu"); diff --git a/tests/vircgrouptest.c b/tests/vircgrouptest.c index 1e551cfc7b..be50f3e73c 100644 --- a/tests/vircgrouptest.c +++ b/tests/vircgrouptest.c @@ -232,13 +232,13 @@ static int testCgroupNewForSelf(const void *args ATTRIBUTE_UNUSED) } -# define ENSURE_ERRNO(en) \ - do { \ - if (!virLastErrorIsSystemErrno(en)) { \ - virErrorPtr err = virGetLastError(); \ - fprintf(stderr, "Did not get " #en " error code: %d:%d\n", \ - err ? err->code : 0, err ? err->int1 : 0); \ - goto cleanup; \ +# define ENSURE_ERRNO(en) \ + do { \ + if (!virLastErrorIsSystemErrno(en)) { \ + virErrorPtr err = virGetLastError(); \ + fprintf(stderr, "Did not get " #en " error code: %d:%d\n", \ + err ? err->code : 0, err ? err->int1 : 0); \ + goto cleanup; \ } } while (0) /* Asking for impossible combination since CPU is co-mounted */ @@ -586,13 +586,13 @@ static int testCgroupControllerAvailable(const void *args ATTRIBUTE_UNUSED) { int ret = 0; -# define CHECK_CONTROLLER(c, present) \ - if ((present && !virCgroupControllerAvailable(c)) || \ - (!present && virCgroupControllerAvailable(c))) { \ - fprintf(stderr, present ? \ - "Expected controller %s not available\n" : \ - "Unexpected controller %s available\n", #c); \ - ret = -1; \ +# define CHECK_CONTROLLER(c, present) \ + if ((present && !virCgroupControllerAvailable(c)) || \ + (!present && virCgroupControllerAvailable(c))) { \ + fprintf(stderr, present ? \ + "Expected controller %s not available\n" : \ + "Unexpected controller %s available\n", #c); \ + ret = -1; \ } CHECK_CONTROLLER(VIR_CGROUP_CONTROLLER_CPU, true) @@ -870,12 +870,12 @@ mymain(void) setenv("LIBVIRT_FAKE_ROOT_DIR", fakerootdir, 1); -# define DETECT_MOUNTS(file) \ - do { \ - if (virTestRun("Detect cgroup mounts for " file, \ - testCgroupDetectMounts, \ - file) < 0) \ - ret = -1; \ +# define DETECT_MOUNTS(file) \ + do { \ + if (virTestRun("Detect cgroup mounts for " file, \ + testCgroupDetectMounts, \ + file) < 0) \ + ret = -1; \ } while (0) DETECT_MOUNTS("ovirt-node-6.6"); diff --git a/tests/virconftest.c b/tests/virconftest.c index 9d43465a7a..a8b18bae0f 100644 --- a/tests/virconftest.c +++ b/tests/virconftest.c @@ -79,13 +79,13 @@ static int testConfRoundTrip(const void *opaque) static int testConfParseInt(const void *opaque ATTRIBUTE_UNUSED) { - const char *srcdata = \ - "int = -1729\n" \ - "uint = 1729\n" \ - "llong = -6963472309248\n" \ - "ullong = 6963472309248\n" \ - "size_t = 87539319\n" \ - "ssize_t = -87539319\n" \ + const char *srcdata = \ + "int = -1729\n" \ + "uint = 1729\n" \ + "llong = -6963472309248\n" \ + "ullong = 6963472309248\n" \ + "size_t = 87539319\n" \ + "ssize_t = -87539319\n" \ "string = \"foo\"\n"; int ret = -1; @@ -231,10 +231,10 @@ static int testConfParseInt(const void *opaque ATTRIBUTE_UNUSED) static int testConfParseBool(const void *opaque ATTRIBUTE_UNUSED) { - const char *srcdata = \ - "false = 0\n" \ - "true = 1\n" \ - "int = 6963472309248\n" \ + const char *srcdata = \ + "false = 0\n" \ + "true = 1\n" \ + "int = 6963472309248\n" \ "string = \"foo\"\n"; int ret = -1; @@ -297,8 +297,8 @@ static int testConfParseBool(const void *opaque ATTRIBUTE_UNUSED) static int testConfParseString(const void *opaque ATTRIBUTE_UNUSED) { - const char *srcdata = \ - "int = 6963472309248\n" \ + const char *srcdata = \ + "int = 6963472309248\n" \ "string = \"foo\"\n"; int ret = -1; @@ -337,8 +337,8 @@ static int testConfParseString(const void *opaque ATTRIBUTE_UNUSED) static int testConfParseStringList(const void *opaque ATTRIBUTE_UNUSED) { - const char *srcdata = \ - "string_list = [\"foo\", \"bar\"]\n" \ + const char *srcdata = \ + "string_list = [\"foo\", \"bar\"]\n" \ "string = \"foo\"\n"; int ret = -1; diff --git a/tests/vircryptotest.c b/tests/vircryptotest.c index b702b70b5e..e24834c16e 100644 --- a/tests/vircryptotest.c +++ b/tests/vircryptotest.c @@ -129,15 +129,15 @@ mymain(void) 0x1b, 0x8c, 0x3f, 0x48, 0x27, 0xae, 0xb6, 0x7a}; -#define VIR_CRYPTO_HASH(h, i, o) \ - do { \ - struct testCryptoHashData data = { \ - .hash = h, \ - .input = i, \ - .output = o, \ - }; \ - if (virTestRun("Hash " i, testCryptoHash, &data) < 0) \ - ret = -1; \ +#define VIR_CRYPTO_HASH(h, i, o) \ + do { \ + struct testCryptoHashData data = { \ + .hash = h, \ + .input = i, \ + .output = o, \ + }; \ + if (virTestRun("Hash " i, testCryptoHash, &data) < 0) \ + ret = -1; \ } while (0) VIR_CRYPTO_HASH(VIR_CRYPTO_HASH_MD5, "", "d41d8cd98f00b204e9800998ecf8427e"); @@ -154,17 +154,17 @@ mymain(void) #undef VIR_CRYPTO_HASH -#define VIR_CRYPTO_ENCRYPT(a, n, i, il, c, cl) \ - do { \ - struct testCryptoEncryptData data = { \ - .algorithm = a, \ - .input = i, \ - .inputlen = il, \ - .ciphertext = c, \ - .ciphertextlen = cl, \ - }; \ - if (virTestRun("Encrypt " n, testCryptoEncrypt, &data) < 0) \ - ret = -1; \ +#define VIR_CRYPTO_ENCRYPT(a, n, i, il, c, cl) \ + do { \ + struct testCryptoEncryptData data = { \ + .algorithm = a, \ + .input = i, \ + .inputlen = il, \ + .ciphertext = c, \ + .ciphertextlen = cl, \ + }; \ + if (virTestRun("Encrypt " n, testCryptoEncrypt, &data) < 0) \ + ret = -1; \ } while (0) memset(&secretdata, 0, 8); diff --git a/tests/virdbustest.c b/tests/virdbustest.c index b7ddd77915..af58cfaf4b 100644 --- a/tests/virdbustest.c +++ b/tests/virdbustest.c @@ -28,26 +28,26 @@ VIR_LOG_INIT("tests.dbustest"); -#define VERIFY(typname, valorig, valnew, fmt) \ - do { \ - VIR_DEBUG("Compare " typname " '" fmt "' to '" \ - fmt "'", valorig, valnew); \ - if (valorig != valnew) { \ - fprintf(stderr, "Failed to round-trip " typname " '" \ - fmt "' to '" fmt "'\n", valorig, valnew); \ - goto cleanup; \ - } \ +#define VERIFY(typname, valorig, valnew, fmt) \ + do { \ + VIR_DEBUG("Compare " typname " '" fmt "' to '" \ + fmt "'", valorig, valnew); \ + if (valorig != valnew) { \ + fprintf(stderr, "Failed to round-trip " typname " '" \ + fmt "' to '" fmt "'\n", valorig, valnew); \ + goto cleanup; \ + } \ } while (0) -#define VERIFY_STR(typname, valorig, valnew, fmt) \ - do { \ - VIR_DEBUG("Compare " typname " '" fmt "' to '" \ - fmt "'", valorig, valnew); \ - if (STRNEQ(valorig, valnew)) { \ - fprintf(stderr, "Failed to round-trip " typname " '" \ - fmt "' to '" fmt "'\n", valorig, valnew); \ - goto cleanup; \ - } \ +#define VERIFY_STR(typname, valorig, valnew, fmt) \ + do { \ + VIR_DEBUG("Compare " typname " '" fmt "' to '" \ + fmt "'", valorig, valnew); \ + if (STRNEQ(valorig, valnew)) { \ + fprintf(stderr, "Failed to round-trip " typname " '" \ + fmt "' to '" fmt "'\n", valorig, valnew); \ + goto cleanup; \ + } \ } while (0) static int testMessageSimple(const void *args ATTRIBUTE_UNUSED) diff --git a/tests/virdrivermoduletest.c b/tests/virdrivermoduletest.c index cfb2dbdb4d..95e946d492 100644 --- a/tests/virdrivermoduletest.c +++ b/tests/virdrivermoduletest.c @@ -54,12 +54,12 @@ mymain(void) int ret = 0; struct testDriverModuleData data; -#define TEST_FULL(name, fnc) \ - do { \ - data.module = name; \ - data.regfunc = fnc; \ - if (virTestRun("Test driver " # name, testDriverModule, &data) < 0) \ - ret = -1; \ +#define TEST_FULL(name, fnc) \ + do { \ + data.module = name; \ + data.regfunc = fnc; \ + if (virTestRun("Test driver " # name, testDriverModule, &data) < 0) \ + ret = -1; \ } while (0) #define TEST(name) TEST_FULL(name, name "Register") diff --git a/tests/virfilecachetest.c b/tests/virfilecachetest.c index 9aa01ddb3a..ae7d08d257 100644 --- a/tests/virfilecachetest.c +++ b/tests/virfilecachetest.c @@ -215,13 +215,13 @@ mymain(void) virFileCacheSetPriv(cache, &testPriv); -#define TEST_RUN(name, newData, expectData, expectSave) \ - do { \ - testFileCacheData data = { \ - cache, name, newData, expectData, expectSave \ - }; \ - if (virTestRun(name, testFileCache, &data) < 0) \ - ret = -1; \ +#define TEST_RUN(name, newData, expectData, expectSave) \ + do { \ + testFileCacheData data = { \ + cache, name, newData, expectData, expectSave \ + }; \ + if (virTestRun(name, testFileCache, &data) < 0) \ + ret = -1; \ } while (0) /* The cache file name is created using: diff --git a/tests/virfiletest.c b/tests/virfiletest.c index 8ea07c5ce0..a15495e9e8 100644 --- a/tests/virfiletest.c +++ b/tests/virfiletest.c @@ -333,13 +333,13 @@ mymain(void) "/etc/aliases.db" }; -# define DO_TEST_MOUNT_SUBTREE(name, path, prefix, mounts, rev) \ - do { \ - struct testFileGetMountSubtreeData data = { \ - path, prefix, mounts, ARRAY_CARDINALITY(mounts), rev \ - }; \ - if (virTestRun(name, testFileGetMountSubtree, &data) < 0) \ - ret = -1; \ +# define DO_TEST_MOUNT_SUBTREE(name, path, prefix, mounts, rev) \ + do { \ + struct testFileGetMountSubtreeData data = { \ + path, prefix, mounts, ARRAY_CARDINALITY(mounts), rev \ + }; \ + if (virTestRun(name, testFileGetMountSubtree, &data) < 0) \ + ret = -1; \ } while (0) DO_TEST_MOUNT_SUBTREE("/proc normal", MTAB_PATH1, "/proc", wantmounts1, false); @@ -348,13 +348,13 @@ mymain(void) DO_TEST_MOUNT_SUBTREE("/etc/aliases.db", MTAB_PATH2, "/etc/aliases.db", wantmounts2b, false); #endif /* ! defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R */ -#define DO_TEST_SANITIZE_PATH(PATH, EXPECT) \ - do { \ - data1.path = PATH; \ - data1.expect = EXPECT; \ - if (virTestRun(virTestCounterNext(), testFileSanitizePath, \ - &data1) < 0) \ - ret = -1; \ +#define DO_TEST_SANITIZE_PATH(PATH, EXPECT) \ + do { \ + data1.path = PATH; \ + data1.expect = EXPECT; \ + if (virTestRun(virTestCounterNext(), testFileSanitizePath, \ + &data1) < 0) \ + ret = -1; \ } while (0) #define DO_TEST_SANITIZE_PATH_SAME(PATH) DO_TEST_SANITIZE_PATH(PATH, PATH) @@ -378,14 +378,14 @@ mymain(void) DO_TEST_SANITIZE_PATH_SAME("gluster://bar.baz/fooo//hoo"); DO_TEST_SANITIZE_PATH_SAME("gluster://bar.baz/fooo///////hoo"); -#define DO_TEST_IN_DATA(inData, ...) \ - do { \ - off_t offsets[] = {__VA_ARGS__, -1}; \ - struct testFileInData data = { \ - .startData = inData, .offsets = offsets, \ - }; \ - if (virTestRun(virTestCounterNext(), testFileInData, &data) < 0) \ - ret = -1; \ +#define DO_TEST_IN_DATA(inData, ...) \ + do { \ + off_t offsets[] = {__VA_ARGS__, -1}; \ + struct testFileInData data = { \ + .startData = inData, .offsets = offsets, \ + }; \ + if (virTestRun(virTestCounterNext(), testFileInData, &data) < 0) \ + ret = -1; \ } while (0) if (holesSupported()) { diff --git a/tests/virfilewrapper.c b/tests/virfilewrapper.c index 3fd7f7aa8f..062ae63a49 100644 --- a/tests/virfilewrapper.c +++ b/tests/virfilewrapper.c @@ -141,13 +141,13 @@ virFileWrapperOverridePrefix(const char *path) } -# define PATH_OVERRIDE(newpath, path) \ - do { \ - init_syms(); \ - \ - newpath = virFileWrapperOverridePrefix(path); \ - if (!newpath) \ - abort(); \ +# define PATH_OVERRIDE(newpath, path) \ + do { \ + init_syms(); \ + \ + newpath = virFileWrapperOverridePrefix(path); \ + if (!newpath) \ + abort(); \ } while (0) diff --git a/tests/virfirewalltest.c b/tests/virfirewalltest.c index ac99b82437..e6d68745ae 100644 --- a/tests/virfirewalltest.c +++ b/tests/virfirewalltest.c @@ -43,27 +43,27 @@ static bool fwDisabled = true; static virBufferPtr fwBuf; static bool fwError; -# define TEST_FILTER_TABLE_LIST \ - "Chain INPUT (policy ACCEPT)\n" \ - "target prot opt source destination\n" \ - "\n" \ - "Chain FORWARD (policy ACCEPT)\n" \ - "target prot opt source destination\n" \ - "\n" \ - "Chain OUTPUT (policy ACCEPT)\n" \ +# define TEST_FILTER_TABLE_LIST \ + "Chain INPUT (policy ACCEPT)\n" \ + "target prot opt source destination\n" \ + "\n" \ + "Chain FORWARD (policy ACCEPT)\n" \ + "target prot opt source destination\n" \ + "\n" \ + "Chain OUTPUT (policy ACCEPT)\n" \ "target prot opt source destination\n" -# define TEST_NAT_TABLE_LIST \ - "Chain PREROUTING (policy ACCEPT)\n" \ - "target prot opt source destination\n" \ - "\n" \ - "Chain INPUT (policy ACCEPT)\n" \ - "target prot opt source destination\n" \ - "\n" \ - "Chain OUTPUT (policy ACCEPT)\n" \ - "target prot opt source destination\n" \ - "\n" \ - "Chain POSTROUTING (policy ACCEPT)\n" \ +# define TEST_NAT_TABLE_LIST \ + "Chain PREROUTING (policy ACCEPT)\n" \ + "target prot opt source destination\n" \ + "\n" \ + "Chain INPUT (policy ACCEPT)\n" \ + "target prot opt source destination\n" \ + "\n" \ + "Chain OUTPUT (policy ACCEPT)\n" \ + "target prot opt source destination\n" \ + "\n" \ + "Chain POSTROUTING (policy ACCEPT)\n" \ "target prot opt source destination\n" # if WITH_DBUS @@ -1141,42 +1141,42 @@ mymain(void) return EXIT_AM_SKIP; } -# define RUN_TEST_DIRECT(name, method) \ - do { \ - struct testFirewallData data; \ - data.tryBackend = VIR_FIREWALL_BACKEND_AUTOMATIC; \ - data.expectBackend = VIR_FIREWALL_BACKEND_DIRECT; \ - data.fwDisabled = true; \ - if (virTestRun(name " auto direct", method, &data) < 0) \ - ret = -1; \ - data.tryBackend = VIR_FIREWALL_BACKEND_DIRECT; \ - data.expectBackend = VIR_FIREWALL_BACKEND_DIRECT; \ - data.fwDisabled = true; \ - if (virTestRun(name " manual direct", method, &data) < 0) \ - ret = -1; \ +# define RUN_TEST_DIRECT(name, method) \ + do { \ + struct testFirewallData data; \ + data.tryBackend = VIR_FIREWALL_BACKEND_AUTOMATIC; \ + data.expectBackend = VIR_FIREWALL_BACKEND_DIRECT; \ + data.fwDisabled = true; \ + if (virTestRun(name " auto direct", method, &data) < 0) \ + ret = -1; \ + data.tryBackend = VIR_FIREWALL_BACKEND_DIRECT; \ + data.expectBackend = VIR_FIREWALL_BACKEND_DIRECT; \ + data.fwDisabled = true; \ + if (virTestRun(name " manual direct", method, &data) < 0) \ + ret = -1; \ } while (0) # if WITH_DBUS -# define RUN_TEST_FIREWALLD(name, method) \ - do { \ - struct testFirewallData data; \ - data.tryBackend = VIR_FIREWALL_BACKEND_AUTOMATIC; \ - data.expectBackend = VIR_FIREWALL_BACKEND_FIREWALLD; \ - data.fwDisabled = false; \ - if (virTestRun(name " auto firewalld", method, &data) < 0) \ - ret = -1; \ - data.tryBackend = VIR_FIREWALL_BACKEND_FIREWALLD; \ - data.expectBackend = VIR_FIREWALL_BACKEND_FIREWALLD; \ - data.fwDisabled = false; \ - if (virTestRun(name " manual firewalld", method, &data) < 0) \ - ret = -1; \ +# define RUN_TEST_FIREWALLD(name, method) \ + do { \ + struct testFirewallData data; \ + data.tryBackend = VIR_FIREWALL_BACKEND_AUTOMATIC; \ + data.expectBackend = VIR_FIREWALL_BACKEND_FIREWALLD; \ + data.fwDisabled = false; \ + if (virTestRun(name " auto firewalld", method, &data) < 0) \ + ret = -1; \ + data.tryBackend = VIR_FIREWALL_BACKEND_FIREWALLD; \ + data.expectBackend = VIR_FIREWALL_BACKEND_FIREWALLD; \ + data.fwDisabled = false; \ + if (virTestRun(name " manual firewalld", method, &data) < 0) \ + ret = -1; \ } while (0) -# define RUN_TEST(name, method) \ - RUN_TEST_DIRECT(name, method); \ +# define RUN_TEST(name, method) \ + RUN_TEST_DIRECT(name, method); \ RUN_TEST_FIREWALLD(name, method) # else /* ! WITH_DBUS */ -# define RUN_TEST(name, method) \ +# define RUN_TEST(name, method) \ RUN_TEST_DIRECT(name, method) # endif /* ! WITH_DBUS */ diff --git a/tests/virhashtest.c b/tests/virhashtest.c index 9407f98c4b..3b85b62c30 100644 --- a/tests/virhashtest.c +++ b/tests/virhashtest.c @@ -602,23 +602,23 @@ mymain(void) { int ret = 0; -#define DO_TEST_FULL(name, cmd, data, count) \ - do { \ - struct testInfo info = { data, count }; \ - if (virTestRun(name, testHash ## cmd, &info) < 0) \ - ret = -1; \ +#define DO_TEST_FULL(name, cmd, data, count) \ + do { \ + struct testInfo info = { data, count }; \ + if (virTestRun(name, testHash ## cmd, &info) < 0) \ + ret = -1; \ } while (0) -#define DO_TEST_DATA(name, cmd, data) \ - DO_TEST_FULL(name "(" #data ")", \ - cmd, \ - testHash ## cmd ## data, \ +#define DO_TEST_DATA(name, cmd, data) \ + DO_TEST_FULL(name "(" #data ")", \ + cmd, \ + testHash ## cmd ## data, \ testHashCount ## cmd ## data) -#define DO_TEST_COUNT(name, cmd, count) \ +#define DO_TEST_COUNT(name, cmd, count) \ DO_TEST_FULL(name "(" #count ")", cmd, NULL, count) -#define DO_TEST(name, cmd) \ +#define DO_TEST(name, cmd) \ DO_TEST_FULL(name, cmd, NULL, -1) DO_TEST_COUNT("Grow", Grow, 1); diff --git a/tests/virhostdevtest.c b/tests/virhostdevtest.c index 0ad58ddf3d..54aa470968 100644 --- a/tests/virhostdevtest.c +++ b/tests/virhostdevtest.c @@ -38,15 +38,15 @@ VIR_LOG_INIT("tests.hostdevtest"); -# define CHECK_LIST_COUNT(list, cnt) \ - do { \ - size_t actualCount; \ - if ((actualCount = virPCIDeviceListCount(list)) != cnt) { \ - virReportError(VIR_ERR_INTERNAL_ERROR, \ - "Unexpected count of items in " #list ": %zu, " \ - "expecting %zu", actualCount, (size_t) cnt); \ - goto cleanup; \ - } \ +# define CHECK_LIST_COUNT(list, cnt) \ + do { \ + size_t actualCount; \ + if ((actualCount = virPCIDeviceListCount(list)) != cnt) { \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + "Unexpected count of items in " #list ": %zu, " \ + "expecting %zu", actualCount, (size_t) cnt); \ + goto cleanup; \ + } \ } while (0) # define TEST_STATE_DIR abs_builddir "/hostdevmgr" @@ -608,11 +608,11 @@ mymain(void) setenv("LIBVIRT_FAKE_ROOT_DIR", fakerootdir, 1); -# define DO_TEST(fnc) \ - do { \ - VIR_DEBUG("Testing: %s", #fnc); \ - if (virTestRun(#fnc, fnc, NULL) < 0) \ - ret = -1; \ +# define DO_TEST(fnc) \ + do { \ + VIR_DEBUG("Testing: %s", #fnc); \ + if (virTestRun(#fnc, fnc, NULL) < 0) \ + ret = -1; \ } while (0) if (myInit() < 0) diff --git a/tests/viriscsitest.c b/tests/viriscsitest.c index c95171aa31..aa4ba57707 100644 --- a/tests/viriscsitest.c +++ b/tests/viriscsitest.c @@ -179,16 +179,16 @@ mymain(void) { int rv = 0; -# define DO_SESSION_TEST(name, session) \ - do { \ - struct testSessionInfo info = {name, 0, session}; \ - if (virTestRun("ISCSI get session test" name, \ - testISCSIGetSession, &info) < 0) \ - rv = -1; \ - info.output_version = 1; \ - if (virTestRun("ISCSI get (non-flash) session test" name, \ - testISCSIGetSession, &info) < 0) \ - rv = -1; \ +# define DO_SESSION_TEST(name, session) \ + do { \ + struct testSessionInfo info = {name, 0, session}; \ + if (virTestRun("ISCSI get session test" name, \ + testISCSIGetSession, &info) < 0) \ + rv = -1; \ + info.output_version = 1; \ + if (virTestRun("ISCSI get (non-flash) session test" name, \ + testISCSIGetSession, &info) < 0) \ + rv = -1; \ } while (0) DO_SESSION_TEST("iqn.2004-06.example:example1:iscsi.test", "1"); diff --git a/tests/virjsontest.c b/tests/virjsontest.c index 30457d1187..685df7276e 100644 --- a/tests/virjsontest.c +++ b/tests/virjsontest.c @@ -434,11 +434,11 @@ mymain(void) { int ret = 0; -#define DO_TEST_FULL(name, cmd, doc, expect, pass) \ - do { \ - struct testInfo info = { doc, expect, pass }; \ - if (virTestRun(name, testJSON ## cmd, &info) < 0) \ - ret = -1; \ +#define DO_TEST_FULL(name, cmd, doc, expect, pass) \ + do { \ + struct testInfo info = { doc, expect, pass }; \ + if (virTestRun(name, testJSON ## cmd, &info) < 0) \ + ret = -1; \ } while (0) /** @@ -450,10 +450,10 @@ mymain(void) * Parses @doc and formats it back. If @expect is NULL the result has to be * identical to @doc. */ -#define DO_TEST_PARSE(name, doc, expect) \ +#define DO_TEST_PARSE(name, doc, expect) \ DO_TEST_FULL(name, FromString, doc, expect, true) -#define DO_TEST_PARSE_FAIL(name, doc) \ +#define DO_TEST_PARSE_FAIL(name, doc) \ DO_TEST_FULL(name, FromString, doc, NULL, false) diff --git a/tests/virkeycodetest.c b/tests/virkeycodetest.c index d754385bec..dec1ee8427 100644 --- a/tests/virkeycodetest.c +++ b/tests/virkeycodetest.c @@ -41,15 +41,15 @@ static int testKeycodeMapping(const void *data ATTRIBUTE_UNUSED) int ret = -1; int got; -#define TRANSLATE(from, to, val, want) \ - do { \ - if ((got = virKeycodeValueTranslate(VIR_KEYCODE_SET_##from, \ - VIR_KEYCODE_SET_##to, \ - val)) != want) { \ +#define TRANSLATE(from, to, val, want) \ + do { \ + if ((got = virKeycodeValueTranslate(VIR_KEYCODE_SET_##from, \ + VIR_KEYCODE_SET_##to, \ + val)) != want) { \ fprintf(stderr, "Translating %d from %s to %s, got %d want %d\n", \ - val, #from, #to, got, want); \ - goto cleanup; \ - } \ + val, #from, #to, got, want); \ + goto cleanup; \ + } \ } while (0) TRANSLATE(LINUX, LINUX, 111, 111); @@ -74,14 +74,14 @@ static int testKeycodeStrings(const void *data ATTRIBUTE_UNUSED) int ret = -1; int got; -#define TRANSLATE(from, str, want) \ - do { \ - if ((got = virKeycodeValueFromString(VIR_KEYCODE_SET_##from, \ - str)) != want) { \ - fprintf(stderr, "Converting %s from %s, got %d want %d\n", \ - str, #from, got, want); \ - goto cleanup; \ - } \ +#define TRANSLATE(from, str, want) \ + do { \ + if ((got = virKeycodeValueFromString(VIR_KEYCODE_SET_##from, \ + str)) != want) { \ + fprintf(stderr, "Converting %s from %s, got %d want %d\n", \ + str, #from, got, want); \ + goto cleanup; \ + } \ } while (0) TRANSLATE(LINUX, "KEY_DELETE", 111); diff --git a/tests/virkmodtest.c b/tests/virkmodtest.c index 47ca181fae..b153e071d7 100644 --- a/tests/virkmodtest.c +++ b/tests/virkmodtest.c @@ -157,13 +157,13 @@ mymain(void) * the output of the created command against what we'd expect to be * created. So let's at least do that. */ -# define DO_TEST(_name, _cb, _blkflag, _exp_cmd) \ - do { \ - struct testInfo data = {.module = "vfio-pci", \ - .exp_cmd = _exp_cmd, \ - .useBlacklist = _blkflag}; \ - if (virTestRun(_name, _cb, &data) < 0) \ - ret = -1; \ +# define DO_TEST(_name, _cb, _blkflag, _exp_cmd) \ + do { \ + struct testInfo data = {.module = "vfio-pci", \ + .exp_cmd = _exp_cmd, \ + .useBlacklist = _blkflag}; \ + if (virTestRun(_name, _cb, &data) < 0) \ + ret = -1; \ } while (0) DO_TEST("load", testKModLoad, false, MODPROBE " vfio-pci\n"); diff --git a/tests/virlogtest.c b/tests/virlogtest.c index eb07fab902..62b4b75300 100644 --- a/tests/virlogtest.c +++ b/tests/virlogtest.c @@ -112,27 +112,27 @@ mymain(void) { int ret = 0; -#define DO_TEST_FULL(name, test, str, count, pass) \ - do { \ - struct testLogData data = { \ - str, count, pass \ - }; \ - if (virTestRun(name, test, &data) < 0) \ - ret = -1; \ +#define DO_TEST_FULL(name, test, str, count, pass) \ + do { \ + struct testLogData data = { \ + str, count, pass \ + }; \ + if (virTestRun(name, test, &data) < 0) \ + ret = -1; \ } while (0) -#define TEST_LOG_MATCH_FAIL(str) \ +#define TEST_LOG_MATCH_FAIL(str) \ DO_TEST_FULL("testLogMatch " # str, testLogMatch, str, 0, false) -#define TEST_LOG_MATCH(str) \ +#define TEST_LOG_MATCH(str) \ DO_TEST_FULL("testLogMatch " # str, testLogMatch, str, 0, true) -#define TEST_PARSE_OUTPUTS_FAIL(str, count) \ +#define TEST_PARSE_OUTPUTS_FAIL(str, count) \ DO_TEST_FULL("testLogParseOutputs " # str, testLogParseOutputs, str, count, false) -#define TEST_PARSE_OUTPUTS(str, count) \ +#define TEST_PARSE_OUTPUTS(str, count) \ DO_TEST_FULL("testLogParseOutputs " # str, testLogParseOutputs, str, count, true) -#define TEST_PARSE_FILTERS_FAIL(str, count) \ +#define TEST_PARSE_FILTERS_FAIL(str, count) \ DO_TEST_FULL("testLogParseFilters " # str, testLogParseFilters, str, count, false) -#define TEST_PARSE_FILTERS(str, count) \ +#define TEST_PARSE_FILTERS(str, count) \ DO_TEST_FULL("testLogParseFilters " # str, testLogParseFilters, str, count, true) diff --git a/tests/virmacmaptest.c b/tests/virmacmaptest.c index 0627fb37a5..6e3e9984d1 100644 --- a/tests/virmacmaptest.c +++ b/tests/virmacmaptest.c @@ -157,47 +157,47 @@ mymain(void) int ret = 0; virMacMapPtr mgr = NULL; -#define DO_TEST_BASIC(f, d, ...) \ - do { \ - const char * const m[] = {__VA_ARGS__, NULL }; \ +#define DO_TEST_BASIC(f, d, ...) \ + do { \ + const char * const m[] = {__VA_ARGS__, NULL }; \ struct testData data = {.file = f, .domain = d, .macs = m}; \ - if (virTestRun("Lookup " #d " in " #f, \ - testMACLookup, &data) < 0) \ - ret = -1; \ - if (virTestRun("Remove " #d " in " #f, \ - testMACRemove, &data) < 0) \ - ret = -1; \ + if (virTestRun("Lookup " #d " in " #f, \ + testMACLookup, &data) < 0) \ + ret = -1; \ + if (virTestRun("Remove " #d " in " #f, \ + testMACRemove, &data) < 0) \ + ret = -1; \ } while (0) -#define DO_TEST_FLUSH_PROLOGUE \ - do { \ - if (!(mgr = virMacMapNew(NULL))) { \ - ret = -1; \ - goto cleanup; \ - } \ +#define DO_TEST_FLUSH_PROLOGUE \ + do { \ + if (!(mgr = virMacMapNew(NULL))) { \ + ret = -1; \ + goto cleanup; \ + } \ } while (0) -#define DO_TEST_FLUSH(d, ...) \ - do { \ - const char * const m[] = {__VA_ARGS__, NULL }; \ - size_t i; \ - for (i = 0; m[i]; i++) { \ - if (virMacMapAdd(mgr, d, m[i]) < 0) { \ - virObjectUnref(mgr); \ - mgr = NULL; \ - ret = -1; \ - } \ - } \ +#define DO_TEST_FLUSH(d, ...) \ + do { \ + const char * const m[] = {__VA_ARGS__, NULL }; \ + size_t i; \ + for (i = 0; m[i]; i++) { \ + if (virMacMapAdd(mgr, d, m[i]) < 0) { \ + virObjectUnref(mgr); \ + mgr = NULL; \ + ret = -1; \ + } \ + } \ } while (0) -#define DO_TEST_FLUSH_EPILOGUE(f) \ - do { \ - struct testData data = {.file = f, .mgr = mgr}; \ - if (virTestRun("Flush " #f, testMACFlush, &data) < 0) \ - ret = -1; \ - virObjectUnref(mgr); \ - mgr = NULL; \ +#define DO_TEST_FLUSH_EPILOGUE(f) \ + do { \ + struct testData data = {.file = f, .mgr = mgr}; \ + if (virTestRun("Flush " #f, testMACFlush, &data) < 0) \ + ret = -1; \ + virObjectUnref(mgr); \ + mgr = NULL; \ } while (0) DO_TEST_BASIC("empty", "none", NULL); diff --git a/tests/virmock.h b/tests/virmock.h index 62a7c8fed4..914d5141c9 100644 --- a/tests/virmock.h +++ b/tests/virmock.h @@ -62,19 +62,19 @@ # define VIR_MOCK_ARGNAMES_EXPAND(a, b, ...) VIR_MOCK_ARG_PASTE(a, b, __VA_ARGS__) -# define VIR_MOCK_ARGNAMES(...) \ +# define VIR_MOCK_ARGNAMES(...) \ VIR_MOCK_ARGNAMES_EXPAND(VIR_MOCK_GET_ARG, VIR_MOCK_COUNT_ARGS(__VA_ARGS__), VIR_MOCK_ARGNAME, __VA_ARGS__) # define VIR_MOCK_ARGTYPES_EXPAND(a, b, ...) VIR_MOCK_ARG_PASTE(a, b, __VA_ARGS__) -# define VIR_MOCK_ARGTYPES(...) \ +# define VIR_MOCK_ARGTYPES(...) \ VIR_MOCK_ARGTYPES_EXPAND(VIR_MOCK_GET_ARG, VIR_MOCK_COUNT_ARGS(__VA_ARGS__), VIR_MOCK_ARGTYPE, __VA_ARGS__) # define VIR_MOCK_ARGTYPENAMES_EXPAND(a, b, ...) VIR_MOCK_ARG_PASTE(a, b, __VA_ARGS__) -# define VIR_MOCK_ARGTYPENAMES(...) \ +# define VIR_MOCK_ARGTYPENAMES(...) \ VIR_MOCK_ARGTYPENAMES_EXPAND(VIR_MOCK_GET_ARG, VIR_MOCK_COUNT_ARGS(__VA_ARGS__), VIR_MOCK_ARGTYPENAME, __VA_ARGS__) # define VIR_MOCK_ARGTYPENAMES_UNUSED_EXPAND(a, b, ...) VIR_MOCK_ARG_PASTE(a, b, __VA_ARGS__) -# define VIR_MOCK_ARGTYPENAMES_UNUSED(...) \ +# define VIR_MOCK_ARGTYPENAMES_UNUSED(...) \ VIR_MOCK_ARGTYPENAMES_UNUSED_EXPAND(VIR_MOCK_GET_ARG, VIR_MOCK_COUNT_ARGS(__VA_ARGS__), VIR_MOCK_ARGTYPENAME_UNUSED, __VA_ARGS__) @@ -100,18 +100,18 @@ * Define a replacement for @name which invokes wrap_@name * forwarding on all args, and passing back the return value. */ -# define VIR_MOCK_LINK_RET_ARGS(name, rettype, ...) \ - rettype name(VIR_MOCK_ARGTYPENAMES(__VA_ARGS__)) \ - { \ - static rettype (*wrap_##name)(VIR_MOCK_ARGTYPES(__VA_ARGS__)); \ - if (wrap_##name == NULL && \ - !(wrap_##name = dlsym(RTLD_DEFAULT, \ - "wrap_" #name))) { \ - fprintf(stderr, "Missing symbol 'wrap_" #name "'\n"); \ - abort(); \ - } \ - \ - return wrap_##name(VIR_MOCK_ARGNAMES(__VA_ARGS__)); \ +# define VIR_MOCK_LINK_RET_ARGS(name, rettype, ...) \ + rettype name(VIR_MOCK_ARGTYPENAMES(__VA_ARGS__)) \ + { \ + static rettype (*wrap_##name)(VIR_MOCK_ARGTYPES(__VA_ARGS__)); \ + if (wrap_##name == NULL && \ + !(wrap_##name = dlsym(RTLD_DEFAULT, \ + "wrap_" #name))) { \ + fprintf(stderr, "Missing symbol 'wrap_" #name "'\n"); \ + abort(); \ + } \ + \ + return wrap_##name(VIR_MOCK_ARGNAMES(__VA_ARGS__)); \ } /** @@ -122,18 +122,18 @@ * Define a replacement for @name which invokes wrap_@name * with no arguments, and passing back the return value. */ -# define VIR_MOCK_LINK_RET_VOID(name, rettype) \ - rettype name(void) \ - { \ - static rettype (*wrap_##name)(void); \ - if (wrap_##name == NULL && \ - !(wrap_##name = dlsym(RTLD_DEFAULT, \ - "wrap_" #name))) { \ - fprintf(stderr, "Missing symbol 'wrap_" #name "'\n"); \ - abort(); \ - } \ - \ - return wrap_##name(); \ +# define VIR_MOCK_LINK_RET_VOID(name, rettype) \ + rettype name(void) \ + { \ + static rettype (*wrap_##name)(void); \ + if (wrap_##name == NULL && \ + !(wrap_##name = dlsym(RTLD_DEFAULT, \ + "wrap_" #name))) { \ + fprintf(stderr, "Missing symbol 'wrap_" #name "'\n"); \ + abort(); \ + } \ + \ + return wrap_##name(); \ } /** @@ -144,18 +144,18 @@ * Define a replacement for @name which invokes wrap_@name * forwarding on all args, but with no return value. */ -# define VIR_MOCK_LINK_VOID_ARGS(name, ...) \ - void name(VIR_MOCK_ARGTYPENAMES(__VA_ARGS__)) \ - { \ +# define VIR_MOCK_LINK_VOID_ARGS(name, ...) \ + void name(VIR_MOCK_ARGTYPENAMES(__VA_ARGS__)) \ + { \ static void (*wrap_##name)(VIR_MOCK_ARGTYPES(__VA_ARGS__)); \ - if (wrap_##name == NULL && \ - !(wrap_##name = dlsym(RTLD_DEFAULT, \ - "wrap_" #name))) { \ - fprintf(stderr, "Missing symbol 'wrap_" #name "'\n"); \ - abort(); \ - } \ - \ - wrap_##name(VIR_MOCK_ARGNAMES(__VA_ARGS__)); \ + if (wrap_##name == NULL && \ + !(wrap_##name = dlsym(RTLD_DEFAULT, \ + "wrap_" #name))) { \ + fprintf(stderr, "Missing symbol 'wrap_" #name "'\n"); \ + abort(); \ + } \ + \ + wrap_##name(VIR_MOCK_ARGNAMES(__VA_ARGS__)); \ } @@ -178,10 +178,10 @@ * Define a replacement for @name which doesn't invoke anything, just * returns @retval. */ -# define VIR_MOCK_STUB_RET_ARGS(name, rettype, retval, ...) \ - rettype name(VIR_MOCK_ARGTYPENAMES_UNUSED(__VA_ARGS__)) \ - { \ - return retval; \ +# define VIR_MOCK_STUB_RET_ARGS(name, rettype, retval, ...) \ + rettype name(VIR_MOCK_ARGTYPENAMES_UNUSED(__VA_ARGS__)) \ + { \ + return retval; \ } /** @@ -193,10 +193,10 @@ * Define a replacement for @name which doesn't invoke anything, just * returns @retval. */ -# define VIR_MOCK_STUB_RET_VOID(name, rettype, retval) \ - rettype name(void) \ - { \ - return retval; \ +# define VIR_MOCK_STUB_RET_VOID(name, rettype, retval) \ + rettype name(void) \ + { \ + return retval; \ } /** @@ -207,9 +207,9 @@ * Define a replacement for @name which doesn't invoke or return * anything. */ -# define VIR_MOCK_STUB_VOID_ARGS(name, ...) \ - void name(VIR_MOCK_ARGTYPENAMES_UNUSED(__VA_ARGS__)) \ - { \ +# define VIR_MOCK_STUB_VOID_ARGS(name, ...) \ + void name(VIR_MOCK_ARGTYPENAMES_UNUSED(__VA_ARGS__)) \ + { \ } @@ -221,9 +221,9 @@ * Define a replacement for @name which doesn't invoke or return * anything. */ -# define VIR_MOCK_STUB_VOID_VOID(name) \ - void name(void) \ - { \ +# define VIR_MOCK_STUB_VOID_VOID(name) \ + void name(void) \ + { \ } @@ -234,24 +234,24 @@ * as the body of the method. */ -# define VIR_MOCK_IMPL_RET_ARGS(name, rettype, ...) \ - rettype name(VIR_MOCK_ARGTYPENAMES(__VA_ARGS__)); \ - static rettype (*real_##name)(VIR_MOCK_ARGTYPES(__VA_ARGS__)); \ +# define VIR_MOCK_IMPL_RET_ARGS(name, rettype, ...) \ + rettype name(VIR_MOCK_ARGTYPENAMES(__VA_ARGS__)); \ + static rettype (*real_##name)(VIR_MOCK_ARGTYPES(__VA_ARGS__)); \ rettype name(VIR_MOCK_ARGTYPENAMES_UNUSED(__VA_ARGS__)) -# define VIR_MOCK_IMPL_RET_VOID(name, rettype) \ - rettype name(void); \ - static rettype (*real_##name)(void); \ +# define VIR_MOCK_IMPL_RET_VOID(name, rettype) \ + rettype name(void); \ + static rettype (*real_##name)(void); \ rettype name(void) -# define VIR_MOCK_IMPL_VOID_ARGS(name, ...) \ - void name(VIR_MOCK_ARGTYPENAMES(__VA_ARGS__)); \ - static void (*real_##name)(VIR_MOCK_ARGTYPES(__VA_ARGS__)); \ +# define VIR_MOCK_IMPL_VOID_ARGS(name, ...) \ + void name(VIR_MOCK_ARGTYPENAMES(__VA_ARGS__)); \ + static void (*real_##name)(VIR_MOCK_ARGTYPES(__VA_ARGS__)); \ void name(VIR_MOCK_ARGTYPENAMES_UNUSED(__VA_ARGS__)) -# define VIR_MOCK_IMPL_VOID_VOID(name) \ - void name(void); \ - static void (*real_##name)(void); \ +# define VIR_MOCK_IMPL_VOID_VOID(name) \ + void name(void); \ + static void (*real_##name)(void); \ void name(void) /* @@ -261,45 +261,45 @@ * as the body of the method. */ -# define VIR_MOCK_WRAP_RET_ARGS(name, rettype, ...) \ - rettype wrap_##name(VIR_MOCK_ARGTYPENAMES(__VA_ARGS__)); \ - static rettype (*real_##name)(VIR_MOCK_ARGTYPES(__VA_ARGS__)); \ +# define VIR_MOCK_WRAP_RET_ARGS(name, rettype, ...) \ + rettype wrap_##name(VIR_MOCK_ARGTYPENAMES(__VA_ARGS__)); \ + static rettype (*real_##name)(VIR_MOCK_ARGTYPES(__VA_ARGS__)); \ rettype wrap_##name(VIR_MOCK_ARGTYPENAMES_UNUSED(__VA_ARGS__)) -# define VIR_MOCK_WRAP_RET_VOID(name, rettype) \ - rettype wrap_##name(void); \ - static rettype (*real_##name)(void); \ +# define VIR_MOCK_WRAP_RET_VOID(name, rettype) \ + rettype wrap_##name(void); \ + static rettype (*real_##name)(void); \ rettype wrap_##name(void) -# define VIR_MOCK_WRAP_VOID_ARGS(name, ...) \ - void wrap_##name(VIR_MOCK_ARGTYPENAMES(__VA_ARGS__)); \ - static void (*real_##name)(VIR_MOCK_ARGTYPES(__VA_ARGS__)); \ +# define VIR_MOCK_WRAP_VOID_ARGS(name, ...) \ + void wrap_##name(VIR_MOCK_ARGTYPENAMES(__VA_ARGS__)); \ + static void (*real_##name)(VIR_MOCK_ARGTYPES(__VA_ARGS__)); \ void wrap_##name(VIR_MOCK_ARGTYPENAMES_UNUSED(__VA_ARGS__)) -# define VIR_MOCK_WRAP_VOID_VOID(name) \ - void wrap_##name(void); \ - static void (*real_##name)(void); \ +# define VIR_MOCK_WRAP_VOID_VOID(name) \ + void wrap_##name(void); \ + static void (*real_##name)(void); \ void wrap_##name(void) -# define VIR_MOCK_REAL_INIT(name) \ - do { \ - if (real_##name == NULL && \ - !(real_##name = dlsym(RTLD_NEXT, \ - #name))) { \ - fprintf(stderr, "Missing symbol '" #name "'\n"); \ - abort(); \ - } \ +# define VIR_MOCK_REAL_INIT(name) \ + do { \ + if (real_##name == NULL && \ + !(real_##name = dlsym(RTLD_NEXT, \ + #name))) { \ + fprintf(stderr, "Missing symbol '" #name "'\n"); \ + abort(); \ + } \ } while (0) -# define VIR_MOCK_REAL_INIT_ALT(name1, name2) \ - do { \ - if (!(real_ ## name1 = dlsym(RTLD_NEXT, #name1)) && \ - !(real_ ## name2 = dlsym(RTLD_NEXT, #name2))) { \ - fprintf(stderr, "Cannot find real '%s' or '%s' symbol\n", \ - #name1, #name2); \ - abort(); \ - } \ +# define VIR_MOCK_REAL_INIT_ALT(name1, name2) \ + do { \ + if (!(real_ ## name1 = dlsym(RTLD_NEXT, #name1)) && \ + !(real_ ## name2 = dlsym(RTLD_NEXT, #name2))) { \ + fprintf(stderr, "Cannot find real '%s' or '%s' symbol\n", \ + #name1, #name2); \ + abort(); \ + } \ } while (0) #endif /* __VIR_MOCK_H__ */ diff --git a/tests/virnetdaemontest.c b/tests/virnetdaemontest.c index b86eea0ae3..2835d9f96f 100644 --- a/tests/virnetdaemontest.c +++ b/tests/virnetdaemontest.c @@ -316,14 +316,14 @@ mymain(void) return ret; } -# define EXEC_RESTART_TEST_FULL(file, nservers, pass) \ - do { \ - struct testExecRestartData data = { \ - file, server_names, nservers, pass \ - }; \ - if (virTestRun("ExecRestart " file, \ - testExecRestart, &data) < 0) \ - ret = -1; \ +# define EXEC_RESTART_TEST_FULL(file, nservers, pass) \ + do { \ + struct testExecRestartData data = { \ + file, server_names, nservers, pass \ + }; \ + if (virTestRun("ExecRestart " file, \ + testExecRestart, &data) < 0) \ + ret = -1; \ } while (0) # define EXEC_RESTART_TEST(file, N) EXEC_RESTART_TEST_FULL(file, N, true) diff --git a/tests/virnetdevbandwidthtest.c b/tests/virnetdevbandwidthtest.c index 2b031d55e6..72bfeff979 100644 --- a/tests/virnetdevbandwidthtest.c +++ b/tests/virnetdevbandwidthtest.c @@ -41,27 +41,27 @@ struct testSetStruct { const bool hierarchical_class; }; -#define PARSE(xml, var) \ - do { \ - int rc; \ - xmlDocPtr doc; \ - xmlXPathContextPtr ctxt = NULL; \ - \ - if (!xml) \ - break; \ - \ - if (!(doc = virXMLParseStringCtxt((xml), \ - "bandwidth definition", \ - &ctxt))) \ - goto cleanup; \ - \ - rc = virNetDevBandwidthParse(&(var), \ - ctxt->node, \ - VIR_DOMAIN_NET_TYPE_NETWORK); \ - xmlFreeDoc(doc); \ - xmlXPathFreeContext(ctxt); \ - if (rc < 0) \ - goto cleanup; \ +#define PARSE(xml, var) \ + do { \ + int rc; \ + xmlDocPtr doc; \ + xmlXPathContextPtr ctxt = NULL; \ + \ + if (!xml) \ + break; \ + \ + if (!(doc = virXMLParseStringCtxt((xml), \ + "bandwidth definition", \ + &ctxt))) \ + goto cleanup; \ + \ + rc = virNetDevBandwidthParse(&(var), \ + ctxt->node, \ + VIR_DOMAIN_NET_TYPE_NETWORK); \ + xmlFreeDoc(doc); \ + xmlXPathFreeContext(ctxt); \ + if (rc < 0) \ + goto cleanup; \ } while (0) static int @@ -115,15 +115,15 @@ mymain(void) { int ret = 0; -#define DO_TEST_SET(Band, Exp_cmd, ...) \ - do { \ - struct testSetStruct data = {.band = Band, \ - .exp_cmd = Exp_cmd, \ - __VA_ARGS__}; \ - if (virTestRun("virNetDevBandwidthSet", \ - testVirNetDevBandwidthSet, \ - &data) < 0) \ - ret = -1; \ +#define DO_TEST_SET(Band, Exp_cmd, ...) \ + do { \ + struct testSetStruct data = {.band = Band, \ + .exp_cmd = Exp_cmd, \ + __VA_ARGS__}; \ + if (virTestRun("virNetDevBandwidthSet", \ + testVirNetDevBandwidthSet, \ + &data) < 0) \ + ret = -1; \ } while (0) diff --git a/tests/virnetdevtest.c b/tests/virnetdevtest.c index 06e4a03a9b..93152e89d3 100644 --- a/tests/virnetdevtest.c +++ b/tests/virnetdevtest.c @@ -69,12 +69,12 @@ mymain(void) { int ret = 0; -# define DO_TEST_LINK(ifname, state, speed) \ - do { \ - struct testVirNetDevGetLinkInfoData data = {ifname, state, speed}; \ - if (virTestRun("Link info: " # ifname, \ - testVirNetDevGetLinkInfo, &data) < 0) \ - ret = -1; \ +# define DO_TEST_LINK(ifname, state, speed) \ + do { \ + struct testVirNetDevGetLinkInfoData data = {ifname, state, speed}; \ + if (virTestRun("Link info: " # ifname, \ + testVirNetDevGetLinkInfo, &data) < 0) \ + ret = -1; \ } while (0) DO_TEST_LINK("eth0", VIR_NETDEV_IF_STATE_UP, 1000); diff --git a/tests/virnettlscontexttest.c b/tests/virnettlscontexttest.c index a5583bdfc2..089c10e964 100644 --- a/tests/virnettlscontexttest.c +++ b/tests/virnettlscontexttest.c @@ -118,36 +118,36 @@ mymain(void) testTLSInit(KEYFILE); -# define DO_CTX_TEST(_isServer, _caCrt, _crt, _expectFail) \ - do { \ - static struct testTLSContextData data; \ - data.isServer = _isServer; \ - data.cacrt = _caCrt; \ - data.crt = _crt; \ - data.expectFail = _expectFail; \ - if (virTestRun("TLS Context " #_caCrt " + " #_crt, \ - testTLSContextInit, &data) < 0) \ - ret = -1; \ +# define DO_CTX_TEST(_isServer, _caCrt, _crt, _expectFail) \ + do { \ + static struct testTLSContextData data; \ + data.isServer = _isServer; \ + data.cacrt = _caCrt; \ + data.crt = _crt; \ + data.expectFail = _expectFail; \ + if (virTestRun("TLS Context " #_caCrt " + " #_crt, \ + testTLSContextInit, &data) < 0) \ + ret = -1; \ } while (0) -# define TLS_CERT_REQ(varname, cavarname, \ - co, cn, an1, an2, ia1, ia2, bce, bcc, bci, \ - kue, kuc, kuv, kpe, kpc, kpo1, kpo2, so, eo) \ - static struct testTLSCertReq varname = { \ - NULL, #varname "-ctx.pem", \ - co, cn, an1, an2, ia1, ia2, bce, bcc, bci, \ - kue, kuc, kuv, kpe, kpc, kpo1, kpo2, so, eo \ - }; \ +# define TLS_CERT_REQ(varname, cavarname, \ + co, cn, an1, an2, ia1, ia2, bce, bcc, bci, \ + kue, kuc, kuv, kpe, kpc, kpo1, kpo2, so, eo) \ + static struct testTLSCertReq varname = { \ + NULL, #varname "-ctx.pem", \ + co, cn, an1, an2, ia1, ia2, bce, bcc, bci, \ + kue, kuc, kuv, kpe, kpc, kpo1, kpo2, so, eo \ + }; \ testTLSGenerateCert(&varname, cavarname.crt) -# define TLS_ROOT_REQ(varname, \ - co, cn, an1, an2, ia1, ia2, bce, bcc, bci, \ - kue, kuc, kuv, kpe, kpc, kpo1, kpo2, so, eo) \ - static struct testTLSCertReq varname = { \ - NULL, #varname "-ctx.pem", \ - co, cn, an1, an2, ia1, ia2, bce, bcc, bci, \ - kue, kuc, kuv, kpe, kpc, kpo1, kpo2, so, eo \ - }; \ +# define TLS_ROOT_REQ(varname, \ + co, cn, an1, an2, ia1, ia2, bce, bcc, bci, \ + kue, kuc, kuv, kpe, kpc, kpo1, kpo2, so, eo) \ + static struct testTLSCertReq varname = { \ + NULL, #varname "-ctx.pem", \ + co, cn, an1, an2, ia1, ia2, bce, bcc, bci, \ + kue, kuc, kuv, kpe, kpc, kpo1, kpo2, so, eo \ + }; \ testTLSGenerateCert(&varname, NULL) diff --git a/tests/virnettlshelpers.c b/tests/virnettlshelpers.c index f66205ef78..5c94f89977 100644 --- a/tests/virnettlshelpers.c +++ b/tests/virnettlshelpers.c @@ -48,24 +48,24 @@ extern const ASN1_ARRAY_TYPE pkix_asn1_tab[]; * here's one we prepared earlier :-) */ gnutls_x509_privkey_t privkey; -# define PRIVATE_KEY \ - "-----BEGIN PRIVATE KEY-----\n" \ - "MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBALVcr\n" \ - "BL40Tm6yq88FBhJNw1aaoCjmtg0l4dWQZ/e9Fimx4ARxFpT+ji4FE\n" \ - "Cgl9s/SGqC+1nvlkm9ViSo0j7MKDbnDB+VRHDvMAzQhA2X7e8M0n9\n" \ - "rPolUY2lIVC83q0BBaOBkCj2RSmT2xTEbbC2xLukSrg2WP/ihVOxc\n" \ - "kXRuyFtzAgMBAAECgYB7slBexDwXrtItAMIH6m/U+LUpNe0Xx48OL\n" \ - "IOn4a4whNgO/o84uIwygUK27ZGFZT0kAGAk8CdF9hA6ArcbQ62s1H\n" \ - "myxrUbF9/mrLsQw1NEqpuUk9Ay2Tx5U/wPx35S3W/X2AvR/ZpTnCn\n" \ - "2q/7ym9fyiSoj86drD7BTvmKXlOnOwQJBAPOFMp4mMa9NGpGuEssO\n" \ - "m3Uwbp6lhcP0cA9MK+iOmeANpoKWfBdk5O34VbmeXnGYWEkrnX+9J\n" \ - "bM4wVhnnBWtgBMCQQC+qAEmvwcfhauERKYznMVUVksyeuhxhCe7EK\n" \ - "mPh+U2+g0WwdKvGDgO0PPt1gq0ILEjspMDeMHVdTwkaVBo/uMhAkA\n" \ - "Z5SsZyCP2aTOPFDypXRdI4eqRcjaEPOUBq27r3uYb/jeboVb2weLa\n" \ - "L1MmVuHiIHoa5clswPdWVI2y0em2IGoDAkBPSp/v9VKJEZabk9Frd\n" \ - "a+7u4fanrM9QrEjY3KhduslSilXZZSxrWjjAJPyPiqFb3M8XXA26W\n" \ - "nz1KYGnqYKhLcBAkB7dt57n9xfrhDpuyVEv+Uv1D3VVAhZlsaZ5Pp\n" \ - "dcrhrkJn2sa/+O8OKvdrPSeeu/N5WwYhJf61+CPoenMp7IFci\n" \ +# define PRIVATE_KEY \ + "-----BEGIN PRIVATE KEY-----\n" \ + "MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBALVcr\n" \ + "BL40Tm6yq88FBhJNw1aaoCjmtg0l4dWQZ/e9Fimx4ARxFpT+ji4FE\n" \ + "Cgl9s/SGqC+1nvlkm9ViSo0j7MKDbnDB+VRHDvMAzQhA2X7e8M0n9\n" \ + "rPolUY2lIVC83q0BBaOBkCj2RSmT2xTEbbC2xLukSrg2WP/ihVOxc\n" \ + "kXRuyFtzAgMBAAECgYB7slBexDwXrtItAMIH6m/U+LUpNe0Xx48OL\n" \ + "IOn4a4whNgO/o84uIwygUK27ZGFZT0kAGAk8CdF9hA6ArcbQ62s1H\n" \ + "myxrUbF9/mrLsQw1NEqpuUk9Ay2Tx5U/wPx35S3W/X2AvR/ZpTnCn\n" \ + "2q/7ym9fyiSoj86drD7BTvmKXlOnOwQJBAPOFMp4mMa9NGpGuEssO\n" \ + "m3Uwbp6lhcP0cA9MK+iOmeANpoKWfBdk5O34VbmeXnGYWEkrnX+9J\n" \ + "bM4wVhnnBWtgBMCQQC+qAEmvwcfhauERKYznMVUVksyeuhxhCe7EK\n" \ + "mPh+U2+g0WwdKvGDgO0PPt1gq0ILEjspMDeMHVdTwkaVBo/uMhAkA\n" \ + "Z5SsZyCP2aTOPFDypXRdI4eqRcjaEPOUBq27r3uYb/jeboVb2weLa\n" \ + "L1MmVuHiIHoa5clswPdWVI2y0em2IGoDAkBPSp/v9VKJEZabk9Frd\n" \ + "a+7u4fanrM9QrEjY3KhduslSilXZZSxrWjjAJPyPiqFb3M8XXA26W\n" \ + "nz1KYGnqYKhLcBAkB7dt57n9xfrhDpuyVEv+Uv1D3VVAhZlsaZ5Pp\n" \ + "dcrhrkJn2sa/+O8OKvdrPSeeu/N5WwYhJf61+CPoenMp7IFci\n" \ "-----END PRIVATE KEY-----\n" /* diff --git a/tests/virnettlssessiontest.c b/tests/virnettlssessiontest.c index 47be5a0243..6d639e5b16 100644 --- a/tests/virnettlssessiontest.c +++ b/tests/virnettlssessiontest.c @@ -247,58 +247,58 @@ mymain(void) testTLSInit(KEYFILE); # define DO_SESS_TEST(_caCrt, _serverCrt, _clientCrt, _expectServerFail, \ - _expectClientFail, _hostname, _wildcards) \ - do { \ - static struct testTLSSessionData data; \ - data.servercacrt = _caCrt; \ - data.clientcacrt = _caCrt; \ - data.servercrt = _serverCrt; \ - data.clientcrt = _clientCrt; \ - data.expectServerFail = _expectServerFail; \ - data.expectClientFail = _expectClientFail; \ - data.hostname = _hostname; \ - data.wildcards = _wildcards; \ - if (virTestRun("TLS Session " #_serverCrt " + " #_clientCrt, \ - testTLSSessionInit, &data) < 0) \ - ret = -1; \ + _expectClientFail, _hostname, _wildcards) \ + do { \ + static struct testTLSSessionData data; \ + data.servercacrt = _caCrt; \ + data.clientcacrt = _caCrt; \ + data.servercrt = _serverCrt; \ + data.clientcrt = _clientCrt; \ + data.expectServerFail = _expectServerFail; \ + data.expectClientFail = _expectClientFail; \ + data.hostname = _hostname; \ + data.wildcards = _wildcards; \ + if (virTestRun("TLS Session " #_serverCrt " + " #_clientCrt, \ + testTLSSessionInit, &data) < 0) \ + ret = -1; \ } while (0) # define DO_SESS_TEST_EXT(_serverCaCrt, _clientCaCrt, _serverCrt, _clientCrt, \ - _expectServerFail, _expectClientFail, \ - _hostname, _wildcards) \ - do { \ - static struct testTLSSessionData data; \ - data.servercacrt = _serverCaCrt; \ - data.clientcacrt = _clientCaCrt; \ - data.servercrt = _serverCrt; \ - data.clientcrt = _clientCrt; \ - data.expectServerFail = _expectServerFail; \ - data.expectClientFail = _expectClientFail; \ - data.hostname = _hostname; \ - data.wildcards = _wildcards; \ - if (virTestRun("TLS Session " #_serverCrt " + " #_clientCrt, \ - testTLSSessionInit, &data) < 0) \ - ret = -1; \ + _expectServerFail, _expectClientFail, \ + _hostname, _wildcards) \ + do { \ + static struct testTLSSessionData data; \ + data.servercacrt = _serverCaCrt; \ + data.clientcacrt = _clientCaCrt; \ + data.servercrt = _serverCrt; \ + data.clientcrt = _clientCrt; \ + data.expectServerFail = _expectServerFail; \ + data.expectClientFail = _expectClientFail; \ + data.hostname = _hostname; \ + data.wildcards = _wildcards; \ + if (virTestRun("TLS Session " #_serverCrt " + " #_clientCrt, \ + testTLSSessionInit, &data) < 0) \ + ret = -1; \ } while (0) -# define TLS_CERT_REQ(varname, cavarname, \ - co, cn, an1, an2, ia1, ia2, bce, bcc, bci, \ - kue, kuc, kuv, kpe, kpc, kpo1, kpo2, so, eo) \ - static struct testTLSCertReq varname = { \ - NULL, #varname "-sess.pem", \ - co, cn, an1, an2, ia1, ia2, bce, bcc, bci, \ - kue, kuc, kuv, kpe, kpc, kpo1, kpo2, so, so \ - }; \ +# define TLS_CERT_REQ(varname, cavarname, \ + co, cn, an1, an2, ia1, ia2, bce, bcc, bci, \ + kue, kuc, kuv, kpe, kpc, kpo1, kpo2, so, eo) \ + static struct testTLSCertReq varname = { \ + NULL, #varname "-sess.pem", \ + co, cn, an1, an2, ia1, ia2, bce, bcc, bci, \ + kue, kuc, kuv, kpe, kpc, kpo1, kpo2, so, so \ + }; \ testTLSGenerateCert(&varname, cavarname.crt) -# define TLS_ROOT_REQ(varname, \ - co, cn, an1, an2, ia1, ia2, bce, bcc, bci, \ - kue, kuc, kuv, kpe, kpc, kpo1, kpo2, so, eo) \ - static struct testTLSCertReq varname = { \ - NULL, #varname "-sess.pem", \ - co, cn, an1, an2, ia1, ia2, bce, bcc, bci, \ - kue, kuc, kuv, kpe, kpc, kpo1, kpo2, so, so \ - }; \ +# define TLS_ROOT_REQ(varname, \ + co, cn, an1, an2, ia1, ia2, bce, bcc, bci, \ + kue, kuc, kuv, kpe, kpc, kpo1, kpo2, so, eo) \ + static struct testTLSCertReq varname = { \ + NULL, #varname "-sess.pem", \ + co, cn, an1, an2, ia1, ia2, bce, bcc, bci, \ + kue, kuc, kuv, kpe, kpc, kpo1, kpo2, so, so \ + }; \ testTLSGenerateCert(&varname, NULL) /* A perfect CA, perfect client & perfect server */ diff --git a/tests/virpcimock.c b/tests/virpcimock.c index b7f4c11f80..176c64d654 100644 --- a/tests/virpcimock.c +++ b/tests/virpcimock.c @@ -53,18 +53,18 @@ char *fakesysfspcidir; # define SYSFS_PCI_PREFIX "/sys/bus/pci/" -# define STDERR(...) \ - fprintf(stderr, "%s %zu: ", __FUNCTION__, (size_t) __LINE__); \ - fprintf(stderr, __VA_ARGS__); \ - fprintf(stderr, "\n"); \ +# define STDERR(...) \ + fprintf(stderr, "%s %zu: ", __FUNCTION__, (size_t) __LINE__); \ + fprintf(stderr, __VA_ARGS__); \ + fprintf(stderr, "\n"); \ -# define ABORT(...) \ - do { \ - STDERR(__VA_ARGS__); \ - abort(); \ +# define ABORT(...) \ + do { \ + STDERR(__VA_ARGS__); \ + abort(); \ } while (0) -# define ABORT_OOM() \ +# define ABORT_OOM() \ ABORT("Out of memory") /* * The plan: @@ -834,7 +834,7 @@ init_env(void) make_file(fakesysfspcidir, "drivers_probe", NULL, -1); -# define MAKE_PCI_DRIVER(name, ...) \ +# define MAKE_PCI_DRIVER(name, ...) \ pci_driver_new(name, 0, __VA_ARGS__, -1, -1) MAKE_PCI_DRIVER("iwlwifi", 0x8086, 0x0044); @@ -842,11 +842,11 @@ init_env(void) MAKE_PCI_DRIVER("pci-stub", -1, -1); pci_driver_new("vfio-pci", PCI_ACTION_BIND, -1, -1); -# define MAKE_PCI_DEVICE(Id, Vendor, Device, ...) \ - do { \ - struct pciDevice dev = {.id = (char *)Id, .vendor = Vendor, \ - .device = Device, __VA_ARGS__}; \ - pci_device_new_from_stub(&dev); \ +# define MAKE_PCI_DEVICE(Id, Vendor, Device, ...) \ + do { \ + struct pciDevice dev = {.id = (char *)Id, .vendor = Vendor, \ + .device = Device, __VA_ARGS__}; \ + pci_device_new_from_stub(&dev); \ } while (0) MAKE_PCI_DEVICE("0000:00:00.0", 0x8086, 0x0044); diff --git a/tests/virpcitest.c b/tests/virpcitest.c index fba6189767..80e994ae52 100644 --- a/tests/virpcitest.c +++ b/tests/virpcitest.c @@ -82,12 +82,12 @@ testVirPCIDeviceNew(const void *opaque ATTRIBUTE_UNUSED) return ret; } -# define CHECK_LIST_COUNT(list, cnt) \ - if ((count = virPCIDeviceListCount(list)) != cnt) { \ - virReportError(VIR_ERR_INTERNAL_ERROR, \ - "Unexpected count of items in " #list ": %d, " \ - "expecting %zu", count, (size_t) cnt); \ - goto cleanup; \ +# define CHECK_LIST_COUNT(list, cnt) \ + if ((count = virPCIDeviceListCount(list)) != cnt) { \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + "Unexpected count of items in " #list ": %d, " \ + "expecting %zu", count, (size_t) cnt); \ + goto cleanup; \ } static int @@ -374,44 +374,44 @@ mymain(void) setenv("LIBVIRT_FAKE_ROOT_DIR", fakerootdir, 1); -# define DO_TEST(fnc) \ - do { \ - if (virTestRun(#fnc, fnc, NULL) < 0) \ - ret = -1; \ +# define DO_TEST(fnc) \ + do { \ + if (virTestRun(#fnc, fnc, NULL) < 0) \ + ret = -1; \ } while (0) -# define DO_TEST_PCI(fnc, domain, bus, slot, function) \ - do { \ - struct testPCIDevData data = { \ - domain, bus, slot, function, NULL \ - }; \ - char *label = NULL; \ - if (virAsprintf(&label, "%s(%04x:%02x:%02x.%x)", \ - #fnc, domain, bus, slot, function) < 0) { \ - ret = -1; \ - break; \ - } \ - if (virTestRun(label, fnc, &data) < 0) \ - ret = -1; \ - VIR_FREE(label); \ +# define DO_TEST_PCI(fnc, domain, bus, slot, function) \ + do { \ + struct testPCIDevData data = { \ + domain, bus, slot, function, NULL \ + }; \ + char *label = NULL; \ + if (virAsprintf(&label, "%s(%04x:%02x:%02x.%x)", \ + #fnc, domain, bus, slot, function) < 0) { \ + ret = -1; \ + break; \ + } \ + if (virTestRun(label, fnc, &data) < 0) \ + ret = -1; \ + VIR_FREE(label); \ } while (0) -# define DO_TEST_PCI_DRIVER(domain, bus, slot, function, driver) \ - do { \ - struct testPCIDevData data = { \ - domain, bus, slot, function, driver \ - }; \ - char *label = NULL; \ - if (virAsprintf(&label, "PCI driver %04x:%02x:%02x.%x is %s", \ - domain, bus, slot, function, \ - NULLSTR(driver)) < 0) { \ - ret = -1; \ - break; \ - } \ - if (virTestRun(label, testVirPCIDeviceCheckDriverTest, \ - &data) < 0) \ - ret = -1; \ - VIR_FREE(label); \ +# define DO_TEST_PCI_DRIVER(domain, bus, slot, function, driver) \ + do { \ + struct testPCIDevData data = { \ + domain, bus, slot, function, driver \ + }; \ + char *label = NULL; \ + if (virAsprintf(&label, "PCI driver %04x:%02x:%02x.%x is %s", \ + domain, bus, slot, function, \ + NULLSTR(driver)) < 0) { \ + ret = -1; \ + break; \ + } \ + if (virTestRun(label, testVirPCIDeviceCheckDriverTest, \ + &data) < 0) \ + ret = -1; \ + VIR_FREE(label); \ } while (0) /* Changes made to individual devices are persistent and the diff --git a/tests/virschematest.c b/tests/virschematest.c index ffed2175fd..9dc4dc5ed8 100644 --- a/tests/virschematest.c +++ b/tests/virschematest.c @@ -171,48 +171,48 @@ mymain(void) memset(&data, 0, sizeof(data)); -#define DO_TEST_DIR(sch, ...) \ - do { \ - data.schema = sch; \ - if (virTestRun("test schema grammar file: " sch, \ - testSchemaGrammar, &data) == 0) { \ - /* initialize the validator even if the schema test \ - * was skipped because of VIR_TEST_RANGE */ \ - if (!data.validator && testSchemaGrammar(&data) < 0) { \ - ret = -1; \ - break; \ - } \ - if (testSchemaDirs(sch, data.validator, __VA_ARGS__, NULL) < 0) \ - ret = -1; \ - \ - virXMLValidatorFree(data.validator); \ - data.validator = NULL; \ - } else { \ - ret = -1; \ - } \ +#define DO_TEST_DIR(sch, ...) \ + do { \ + data.schema = sch; \ + if (virTestRun("test schema grammar file: " sch, \ + testSchemaGrammar, &data) == 0) { \ + /* initialize the validator even if the schema test \ + * was skipped because of VIR_TEST_RANGE */ \ + if (!data.validator && testSchemaGrammar(&data) < 0) { \ + ret = -1; \ + break; \ + } \ + if (testSchemaDirs(sch, data.validator, __VA_ARGS__, NULL) < 0) \ + ret = -1; \ + \ + virXMLValidatorFree(data.validator); \ + data.validator = NULL; \ + } else { \ + ret = -1; \ + } \ } while (0) -#define DO_TEST_FILE(sch, xmlfile) \ - do { \ - data.schema = sch; \ - data.xml_path = abs_srcdir "/" xmlfile; \ - if (virTestRun("test schema grammar file: " sch, \ - testSchemaGrammar, &data) == 0) { \ - /* initialize the validator even if the schema test \ - * was skipped because of VIR_TEST_RANGE */ \ - if (!data.validator && testSchemaGrammar(&data) < 0) { \ - ret = -1; \ - break; \ - } \ - if (virTestRun("Checking " xmlfile " against " sch, \ - testSchemaFile, &data) < 0) \ - ret = -1; \ - \ - virXMLValidatorFree(data.validator); \ - data.validator = NULL; \ - } else { \ - ret = -1; \ - } \ +#define DO_TEST_FILE(sch, xmlfile) \ + do { \ + data.schema = sch; \ + data.xml_path = abs_srcdir "/" xmlfile; \ + if (virTestRun("test schema grammar file: " sch, \ + testSchemaGrammar, &data) == 0) { \ + /* initialize the validator even if the schema test \ + * was skipped because of VIR_TEST_RANGE */ \ + if (!data.validator && testSchemaGrammar(&data) < 0) { \ + ret = -1; \ + break; \ + } \ + if (virTestRun("Checking " xmlfile " against " sch, \ + testSchemaFile, &data) < 0) \ + ret = -1; \ + \ + virXMLValidatorFree(data.validator); \ + data.validator = NULL; \ + } else { \ + ret = -1; \ + } \ } while (0) DO_TEST_DIR("capability.rng", "capabilityschemadata", "xencapsdata", diff --git a/tests/virscsitest.c b/tests/virscsitest.c index dd1689c7f1..1215adbfab 100644 --- a/tests/virscsitest.c +++ b/tests/virscsitest.c @@ -215,12 +215,12 @@ mymain(void) goto cleanup; } -#define CREATE_SYMLINK(src_name, dst_name) \ - do { \ +#define CREATE_SYMLINK(src_name, dst_name) \ + do { \ if (create_symlink(tmpdir, src_name, dst_name) < 0) { \ - ret = -1; \ - goto cleanup; \ - } \ + ret = -1; \ + goto cleanup; \ + } \ } while (0) CREATE_SYMLINK("0-0-0-0", "0:0:0:0"); diff --git a/tests/virshtest.c b/tests/virshtest.c index 16a584d74a..67453bd952 100644 --- a/tests/virshtest.c +++ b/tests/virshtest.c @@ -324,13 +324,13 @@ mymain(void) /* It's a bit awkward listing result before argument, but that's a * limitation of C99 vararg macros. */ -# define DO_TEST(i, result, ...) \ - do { \ - const char *myargv[] = { VIRSH_DEFAULT, __VA_ARGS__, NULL }; \ - const struct testInfo info = { myargv, result }; \ - if (virTestRun("virsh echo " #i, \ - testCompareEcho, &info) < 0) \ - ret = -1; \ +# define DO_TEST(i, result, ...) \ + do { \ + const char *myargv[] = { VIRSH_DEFAULT, __VA_ARGS__, NULL }; \ + const struct testInfo info = { myargv, result }; \ + if (virTestRun("virsh echo " #i, \ + testCompareEcho, &info) < 0) \ + ret = -1; \ } while (0) /* Arg parsing quote removal tests. */ diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c index e1d8751728..cfcd8a79c1 100644 --- a/tests/virstoragetest.c +++ b/tests/virstoragetest.c @@ -740,28 +740,28 @@ mymain(void) if ((ret = testPrepImages()) != 0) return ret; -#define TEST_ONE_CHAIN(start, format, flags, ...) \ - do { \ - size_t i; \ - memset(&data, 0, sizeof(data)); \ - data = (struct testChainData){ \ - start, format, { __VA_ARGS__ }, 0, flags, \ - }; \ - for (i = 0; i < ARRAY_CARDINALITY(data.files); i++) \ - if (data.files[i]) \ - data.nfiles++; \ - if (virTestRun(virTestCounterNext(), \ - testStorageChain, &data) < 0) \ - ret = -1; \ +#define TEST_ONE_CHAIN(start, format, flags, ...) \ + do { \ + size_t i; \ + memset(&data, 0, sizeof(data)); \ + data = (struct testChainData){ \ + start, format, { __VA_ARGS__ }, 0, flags, \ + }; \ + for (i = 0; i < ARRAY_CARDINALITY(data.files); i++) \ + if (data.files[i]) \ + data.nfiles++; \ + if (virTestRun(virTestCounterNext(), \ + testStorageChain, &data) < 0) \ + ret = -1; \ } while (0) #define VIR_FLATTEN_2(...) __VA_ARGS__ #define VIR_FLATTEN_1(_1) VIR_FLATTEN_2 _1 -#define TEST_CHAIN(path, format, chain1, flags1, chain2, flags2) \ - do { \ - TEST_ONE_CHAIN(path, format, flags1, VIR_FLATTEN_1(chain1)); \ - TEST_ONE_CHAIN(path, format, flags2, VIR_FLATTEN_1(chain2)); \ +#define TEST_CHAIN(path, format, chain1, flags1, chain2, flags2) \ + do { \ + TEST_ONE_CHAIN(path, format, flags1, VIR_FLATTEN_1(chain1)); \ + TEST_ONE_CHAIN(path, format, flags2, VIR_FLATTEN_1(chain2)); \ } while (0) /* The actual tests, in several groups. */ @@ -1110,17 +1110,17 @@ mymain(void) chain2 = chain->backingStore; chain3 = chain2->backingStore; -#define TEST_LOOKUP_TARGET(id, target, from, name, index, result, \ - meta, parent) \ - do { \ - data2 = (struct testLookupData){ \ - chain, target, from, name, index, \ - result, meta, parent, }; \ - if (virTestRun("Chain lookup " #id, \ - testStorageLookup, &data2) < 0) \ - ret = -1; \ +#define TEST_LOOKUP_TARGET(id, target, from, name, index, result, \ + meta, parent) \ + do { \ + data2 = (struct testLookupData){ \ + chain, target, from, name, index, \ + result, meta, parent, }; \ + if (virTestRun("Chain lookup " #id, \ + testStorageLookup, &data2) < 0) \ + ret = -1; \ } while (0) -#define TEST_LOOKUP(id, from, name, result, meta, parent) \ +#define TEST_LOOKUP(id, from, name, result, meta, parent) \ TEST_LOOKUP_TARGET(id, NULL, from, name, 0, result, meta, parent) TEST_LOOKUP(0, NULL, "bogus", NULL, NULL, NULL); @@ -1251,13 +1251,13 @@ mymain(void) TEST_LOOKUP_TARGET(80, "vda", chain3, "vda[2]", 2, NULL, NULL, NULL); TEST_LOOKUP_TARGET(81, "vda", NULL, "vda[3]", 3, NULL, NULL, NULL); -#define TEST_PATH_CANONICALIZE(id, PATH, EXPECT) \ - do { \ - data3.path = PATH; \ - data3.expect = EXPECT; \ - if (virTestRun("Path canonicalize " #id, \ - testPathCanonicalize, &data3) < 0) \ - ret = -1; \ +#define TEST_PATH_CANONICALIZE(id, PATH, EXPECT) \ + do { \ + data3.path = PATH; \ + data3.expect = EXPECT; \ + if (virTestRun("Path canonicalize " #id, \ + testPathCanonicalize, &data3) < 0) \ + ret = -1; \ } while (0) TEST_PATH_CANONICALIZE(1, "/", "/"); @@ -1294,14 +1294,14 @@ mymain(void) TEST_PATH_CANONICALIZE(30, "/cycle2/link", NULL); TEST_PATH_CANONICALIZE(31, "///", "/"); -#define TEST_RELATIVE_BACKING(id, TOP, BASE, EXPECT) \ - do { \ - data4.top = &TOP; \ - data4.base = &BASE; \ - data4.expect = EXPECT; \ - if (virTestRun("Path relative resolve " #id, \ - testPathRelative, &data4) < 0) \ - ret = -1; \ +#define TEST_RELATIVE_BACKING(id, TOP, BASE, EXPECT) \ + do { \ + data4.top = &TOP; \ + data4.base = &BASE; \ + data4.expect = EXPECT; \ + if (virTestRun("Path relative resolve " #id, \ + testPathRelative, &data4) < 0) \ + ret = -1; \ } while (0) testPathRelativePrepare(); @@ -1344,13 +1344,13 @@ mymain(void) virTestCounterReset("Backing store parse "); -#define TEST_BACKING_PARSE(bck, xml) \ - do { \ - data5.backing = bck; \ - data5.expect = xml; \ - if (virTestRun(virTestCounterNext(), \ - testBackingParse, &data5) < 0) \ - ret = -1; \ +#define TEST_BACKING_PARSE(bck, xml) \ + do { \ + data5.backing = bck; \ + data5.expect = xml; \ + if (virTestRun(virTestCounterNext(), \ + testBackingParse, &data5) < 0) \ + ret = -1; \ } while (0) TEST_BACKING_PARSE("path", "\n"); diff --git a/tests/virstorageutiltest.c b/tests/virstorageutiltest.c index cc860a3056..b76ee202a8 100644 --- a/tests/virstorageutiltest.c +++ b/tests/virstorageutiltest.c @@ -79,24 +79,24 @@ mymain(void) { int ret = 0; -#define DO_TEST_GLUSTER_EXTRACT_POOL_SOURCES_FULL(testname, sffx, pooltype) \ - do { \ - struct testGlusterExtractPoolSourcesData data; \ - data.srcxml = abs_srcdir "/virstorageutildata/" \ - "gluster-parse-" testname "-src.xml"; \ - data.dstxml = abs_srcdir "/virstorageutildata/" \ - "gluster-parse-" testname "-" sffx ".xml"; \ - data.type = pooltype; \ - if (virTestRun("gluster-parse-" testname "-" sffx, \ - testGlusterExtractPoolSources, &data) < 0) \ - ret = -1; \ +#define DO_TEST_GLUSTER_EXTRACT_POOL_SOURCES_FULL(testname, sffx, pooltype) \ + do { \ + struct testGlusterExtractPoolSourcesData data; \ + data.srcxml = abs_srcdir "/virstorageutildata/" \ + "gluster-parse-" testname "-src.xml"; \ + data.dstxml = abs_srcdir "/virstorageutildata/" \ + "gluster-parse-" testname "-" sffx ".xml"; \ + data.type = pooltype; \ + if (virTestRun("gluster-parse-" testname "-" sffx, \ + testGlusterExtractPoolSources, &data) < 0) \ + ret = -1; \ } while (0) -#define DO_TEST_GLUSTER_EXTRACT_POOL_SOURCES_NATIVE(testname) \ - DO_TEST_GLUSTER_EXTRACT_POOL_SOURCES_FULL(testname, "native", \ +#define DO_TEST_GLUSTER_EXTRACT_POOL_SOURCES_NATIVE(testname) \ + DO_TEST_GLUSTER_EXTRACT_POOL_SOURCES_FULL(testname, "native", \ VIR_STORAGE_POOL_GLUSTER) -#define DO_TEST_GLUSTER_EXTRACT_POOL_SOURCES_NETFS(testname) \ - DO_TEST_GLUSTER_EXTRACT_POOL_SOURCES_FULL(testname, "netfs", \ +#define DO_TEST_GLUSTER_EXTRACT_POOL_SOURCES_NETFS(testname) \ + DO_TEST_GLUSTER_EXTRACT_POOL_SOURCES_FULL(testname, "netfs", \ VIR_STORAGE_POOL_NETFS) DO_TEST_GLUSTER_EXTRACT_POOL_SOURCES_NATIVE("basic"); diff --git a/tests/virstringtest.c b/tests/virstringtest.c index cc95d3c67d..320f7a3983 100644 --- a/tests/virstringtest.c +++ b/tests/virstringtest.c @@ -583,32 +583,32 @@ testStringToLong(const void *opaque) else negative = !!strchr(data->str, '-'); -#define TEST_ONE(Str, Suff, Type, Fn, Fmt, Exp, Exp_ret) \ - do { \ - Type value = 5; \ - int result; \ - end = (char *) "oops"; \ - result = virStrToLong_ ## Fn(Str, Suff ? &end : NULL, \ - 0, &value); \ - /* On failure, end is modified, value is unchanged */ \ - if (result != (Exp_ret)) { \ - fprintf(stderr, \ - "type " #Fn " returned %d expected %d\n", \ - result, Exp_ret); \ - ret = -1; \ - } \ - if (value != ((Exp_ret) ? 5 : Exp)) { \ - fprintf(stderr, \ - "type " #Fn " value " Fmt " expected " Fmt "\n", \ - value, ((Exp_ret) ? 5 : Exp)); \ - ret = -1; \ - } \ - if (Suff && STRNEQ_NULLABLE(Suff, end)) { \ - fprintf(stderr, \ - "type " #Fn " end '%s' expected '%s'\n", \ - NULLSTR(end), Suff); \ - ret = -1; \ - } \ +#define TEST_ONE(Str, Suff, Type, Fn, Fmt, Exp, Exp_ret) \ + do { \ + Type value = 5; \ + int result; \ + end = (char *) "oops"; \ + result = virStrToLong_ ## Fn(Str, Suff ? &end : NULL, \ + 0, &value); \ + /* On failure, end is modified, value is unchanged */ \ + if (result != (Exp_ret)) { \ + fprintf(stderr, \ + "type " #Fn " returned %d expected %d\n", \ + result, Exp_ret); \ + ret = -1; \ + } \ + if (value != ((Exp_ret) ? 5 : Exp)) { \ + fprintf(stderr, \ + "type " #Fn " value " Fmt " expected " Fmt "\n", \ + value, ((Exp_ret) ? 5 : Exp)); \ + ret = -1; \ + } \ + if (Suff && STRNEQ_NULLABLE(Suff, end)) { \ + fprintf(stderr, \ + "type " #Fn " end '%s' expected '%s'\n", \ + NULLSTR(end), Suff); \ + ret = -1; \ + } \ } while (0) TEST_ONE(data->str, data->suffix, int, i, "%d", @@ -772,11 +772,11 @@ mymain(void) { int ret = 0; -#define TEST_STREQ(aa, bb) \ - do { \ - struct testStreqData streqData = {.a = aa, .b = bb}; \ - if (virTestRun("Streq", testStreq, &streqData) < 0) \ - ret = -1; \ +#define TEST_STREQ(aa, bb) \ + do { \ + struct testStreqData streqData = {.a = aa, .b = bb}; \ + if (virTestRun("Streq", testStreq, &streqData) < 0) \ + ret = -1; \ } while (0) TEST_STREQ("hello", "world"); @@ -786,27 +786,27 @@ mymain(void) TEST_STREQ("", ""); TEST_STREQ("hello", "hello"); -#define TEST_SPLIT(str, del, max, toks) \ - do { \ - struct testSplitData splitData = { \ - .string = str, \ - .delim = del, \ - .max_tokens = max, \ - .tokens = toks, \ - }; \ - struct testJoinData joinData = { \ - .string = str, \ - .delim = del, \ - .tokens = toks, \ - }; \ - if (virTestRun("Split " #str, testSplit, &splitData) < 0) \ - ret = -1; \ - if (virTestRun("Join " #str, testJoin, &joinData) < 0) \ - ret = -1; \ - if (virTestRun("Add " #str, testAdd, &joinData) < 0) \ - ret = -1; \ - if (virTestRun("Remove " #str, testRemove, &splitData) < 0) \ - ret = -1; \ +#define TEST_SPLIT(str, del, max, toks) \ + do { \ + struct testSplitData splitData = { \ + .string = str, \ + .delim = del, \ + .max_tokens = max, \ + .tokens = toks, \ + }; \ + struct testJoinData joinData = { \ + .string = str, \ + .delim = del, \ + .tokens = toks, \ + }; \ + if (virTestRun("Split " #str, testSplit, &splitData) < 0) \ + ret = -1; \ + if (virTestRun("Join " #str, testJoin, &joinData) < 0) \ + ret = -1; \ + if (virTestRun("Add " #str, testAdd, &joinData) < 0) \ + ret = -1; \ + if (virTestRun("Remove " #str, testRemove, &splitData) < 0) \ + ret = -1; \ } while (0) const char *tokens1[] = { NULL }; @@ -842,18 +842,18 @@ mymain(void) if (virTestRun("virStringSortCompare", testStringSortCompare, NULL) < 0) ret = -1; -#define TEST_SEARCH(s, r, x, n, m, e) \ - do { \ - struct stringSearchData data = { \ - .str = s, \ - .maxMatches = x, \ - .regexp = r, \ - .expectNMatches = n, \ - .expectMatches = m, \ - .expectError = e, \ - }; \ +#define TEST_SEARCH(s, r, x, n, m, e) \ + do { \ + struct stringSearchData data = { \ + .str = s, \ + .maxMatches = x, \ + .regexp = r, \ + .expectNMatches = n, \ + .expectMatches = m, \ + .expectError = e, \ + }; \ if (virTestRun("virStringSearch " s, testStringSearch, &data) < 0) \ - ret = -1; \ + ret = -1; \ } while (0) /* error due to missing () in regexp */ @@ -877,31 +877,31 @@ mymain(void) const char *matches3[] = { "foo", "bar" }; TEST_SEARCH("1foo2bar3eek", "([a-z]+)", 2, 2, matches3, false); -#define TEST_MATCH(s, r, m) \ - do { \ - struct stringMatchData data = { \ - .str = s, \ - .regexp = r, \ - .expectMatch = m, \ - }; \ - if (virTestRun("virStringMatch " s, testStringMatch, &data) < 0) \ - ret = -1; \ +#define TEST_MATCH(s, r, m) \ + do { \ + struct stringMatchData data = { \ + .str = s, \ + .regexp = r, \ + .expectMatch = m, \ + }; \ + if (virTestRun("virStringMatch " s, testStringMatch, &data) < 0) \ + ret = -1; \ } while (0) TEST_MATCH("foo", "foo", true); TEST_MATCH("foobar", "f[o]+", true); TEST_MATCH("foobar", "^f[o]+$", false); -#define TEST_REPLACE(h, o, n, r) \ - do { \ - struct stringReplaceData data = { \ - .haystack = h, \ - .oldneedle = o, \ - .newneedle = n, \ - .result = r \ - }; \ +#define TEST_REPLACE(h, o, n, r) \ + do { \ + struct stringReplaceData data = { \ + .haystack = h, \ + .oldneedle = o, \ + .newneedle = n, \ + .result = r \ + }; \ if (virTestRun("virStringReplace " h, testStringReplace, &data) < 0) \ - ret = -1; \ + ret = -1; \ } while (0) /* no matches */ @@ -923,15 +923,15 @@ mymain(void) TEST_REPLACE("fooooofoooo", "foo", "barwizzeek", "barwizzeekooobarwizzeekoo"); TEST_REPLACE("fooooofoooo", "foooo", "foo", "fooofoo"); -#define TEST_STRTOL(str, suff, i, i_ret, u, u_ret, \ - ll, ll_ret, ull, ull_ret) \ - do { \ - struct stringToLongData data = { \ - str, suff, i, i_ret, u, u_ret, ll, ll_ret, ull, ull_ret, \ - }; \ - if (virTestRun("virStringToLong '" str "'", testStringToLong, \ - &data) < 0) \ - ret = -1; \ +#define TEST_STRTOL(str, suff, i, i_ret, u, u_ret, \ + ll, ll_ret, ull, ull_ret) \ + do { \ + struct stringToLongData data = { \ + str, suff, i, i_ret, u, u_ret, ll, ll_ret, ull, ull_ret, \ + }; \ + if (virTestRun("virStringToLong '" str "'", testStringToLong, \ + &data) < 0) \ + ret = -1; \ } while (0) /* Start simple */ @@ -1007,14 +1007,14 @@ mymain(void) TEST_STRTOL("-18446744073709551616", NULL, 0, -1, 0U, -1, 0LL, -1, 0ULL, -1); -#define TEST_STRTOD(str, end_ptr, res) \ - do { \ - struct stringToDoubleData data = { \ - str, end_ptr, res, \ - }; \ - if (virTestRun("virStringToDouble '" str "'", \ - testStringToDouble, &data) < 0) \ - ret = -1; \ +#define TEST_STRTOD(str, end_ptr, res) \ + do { \ + struct stringToDoubleData data = { \ + str, end_ptr, res, \ + }; \ + if (virTestRun("virStringToDouble '" str "'", \ + testStringToDouble, &data) < 0) \ + ret = -1; \ } while (0) /* Simple numbers. */ @@ -1050,15 +1050,15 @@ mymain(void) NULL) < 0) ret = -1; -#define TEST_STRIP_IPV6_BRACKETS(str, res) \ - do { \ - struct testStripData stripData = { \ - .string = str, \ - .result = res, \ - }; \ - if (virTestRun("Strip brackets from IPv6 " #str, \ - testStripIPv6Brackets, &stripData) < 0) \ - ret = -1; \ +#define TEST_STRIP_IPV6_BRACKETS(str, res) \ + do { \ + struct testStripData stripData = { \ + .string = str, \ + .result = res, \ + }; \ + if (virTestRun("Strip brackets from IPv6 " #str, \ + testStripIPv6Brackets, &stripData) < 0) \ + ret = -1; \ } while (0) TEST_STRIP_IPV6_BRACKETS(NULL, NULL); @@ -1069,15 +1069,15 @@ mymain(void) TEST_STRIP_IPV6_BRACKETS(":hello]", ":hello]"); TEST_STRIP_IPV6_BRACKETS(":[]:", ":[]:"); -#define TEST_STRIP_CONTROL_CHARS(str, res) \ - do { \ - struct testStripData stripData = { \ - .string = str, \ - .result = res, \ - }; \ - if (virTestRun("Strip control chars from " #str, \ - testStripControlChars, &stripData) < 0) \ - ret = -1; \ +#define TEST_STRIP_CONTROL_CHARS(str, res) \ + do { \ + struct testStripData stripData = { \ + .string = str, \ + .result = res, \ + }; \ + if (virTestRun("Strip control chars from " #str, \ + testStripControlChars, &stripData) < 0) \ + ret = -1; \ } while (0) TEST_STRIP_CONTROL_CHARS(NULL, NULL); diff --git a/tests/virsystemdtest.c b/tests/virsystemdtest.c index 4f4f29bfac..5b6ef12a70 100644 --- a/tests/virsystemdtest.c +++ b/tests/virsystemdtest.c @@ -521,13 +521,13 @@ mymain(void) if (virUUIDParse("c7a5fdbd-edaf-9455-926a-d65c16db1809", uuid) < 0) return EXIT_FAILURE; -# define DO_TEST(_name, func) \ - do { \ - if (virTestRun(_name, func, NULL) < 0) \ - ret = -1; \ - if (virTestRun(_name "again ", func, NULL) < 0) \ - ret = -1; \ - virSystemdHasMachinedResetCachedValue(); \ +# define DO_TEST(_name, func) \ + do { \ + if (virTestRun(_name, func, NULL) < 0) \ + ret = -1; \ + if (virTestRun(_name "again ", func, NULL) < 0) \ + ret = -1; \ + virSystemdHasMachinedResetCachedValue(); \ } while (0) DO_TEST("Test create container ", testCreateContainer); @@ -540,18 +540,18 @@ mymain(void) DO_TEST("Test create with network ", testCreateNetwork); DO_TEST("Test getting machine name ", testGetMachineName); -# define TEST_SCOPE(_name, unitname, _legacy) \ - do { \ - struct testNameData data = { \ - .name = _name, .expected = unitname, .legacy = _legacy, \ - }; \ - if (virTestRun("Test scopename", testScopeName, &data) < 0) \ - ret = -1; \ +# define TEST_SCOPE(_name, unitname, _legacy) \ + do { \ + struct testNameData data = { \ + .name = _name, .expected = unitname, .legacy = _legacy, \ + }; \ + if (virTestRun("Test scopename", testScopeName, &data) < 0) \ + ret = -1; \ } while (0) -# define TEST_SCOPE_OLD(name, unitname) \ +# define TEST_SCOPE_OLD(name, unitname) \ TEST_SCOPE(name, unitname, true) -# define TEST_SCOPE_NEW(name, unitname) \ +# define TEST_SCOPE_NEW(name, unitname) \ TEST_SCOPE(name, unitname, false) TEST_SCOPE_OLD("demo", "machine-lxc\\x2ddemo.scope"); @@ -562,13 +562,13 @@ mymain(void) TEST_SCOPE_NEW("qemu-3-demo", "machine-qemu\\x2d3\\x2ddemo.scope"); -# define TEST_MACHINE(_name, _id, machinename) \ - do { \ - struct testNameData data = { \ - .name = _name, .expected = machinename, .id = _id, \ - }; \ - if (virTestRun("Test scopename", testMachineName, &data) < 0) \ - ret = -1; \ +# define TEST_MACHINE(_name, _id, machinename) \ + do { \ + struct testNameData data = { \ + .name = _name, .expected = machinename, .id = _id, \ + }; \ + if (virTestRun("Test scopename", testMachineName, &data) < 0) \ + ret = -1; \ } while (0) TEST_MACHINE("demo", 1, "qemu-1-demo"); @@ -582,19 +582,19 @@ mymain(void) TEST_MACHINE("123456789012345678901234567890123456789012345678901234567890", 8, "qemu-8-123456789012345678901234567890123456789012345678901234567"); -# define TESTS_PM_SUPPORT_HELPER(name, function) \ - do { \ - struct testPMSupportData data = { \ - function \ - }; \ - if (virTestRun("Test " name " ", testPMSupportHelper, &data) < 0) \ - ret = -1; \ - if (virTestRun("Test " name " no systemd ", \ - testPMSupportHelperNoSystemd, &data) < 0) \ - ret = -1; \ - if (virTestRun("Test systemd " name " not running ", \ - testPMSupportSystemdNotRunning, &data) < 0) \ - ret = -1; \ +# define TESTS_PM_SUPPORT_HELPER(name, function) \ + do { \ + struct testPMSupportData data = { \ + function \ + }; \ + if (virTestRun("Test " name " ", testPMSupportHelper, &data) < 0) \ + ret = -1; \ + if (virTestRun("Test " name " no systemd ", \ + testPMSupportHelperNoSystemd, &data) < 0) \ + ret = -1; \ + if (virTestRun("Test systemd " name " not running ", \ + testPMSupportSystemdNotRunning, &data) < 0) \ + ret = -1; \ } while (0) TESTS_PM_SUPPORT_HELPER("canSuspend", &virSystemdCanSuspend); diff --git a/tests/virt-aa-helper-test b/tests/virt-aa-helper-test index d2a557e360..1e96b8e81e 100755 --- a/tests/virt-aa-helper-test +++ b/tests/virt-aa-helper-test @@ -150,7 +150,7 @@ testfw() { fwpath="$2" if [ -f "$fwpath" ]; then - sed -e "s,###UUID###,$uuid,g" \ + sed -e "s,###UUID###,$uuid,g" \ -e "s,###DISK###,$disk1,g" \ -e "s,,$fwpath,g" "$template_xml" > "$test_xml" testme "0" "$title" "-r -u $valid_uuid" "$test_xml" diff --git a/tests/virtimetest.c b/tests/virtimetest.c index 93be91f62d..d4f6d8e15d 100644 --- a/tests/virtimetest.c +++ b/tests/virtimetest.c @@ -46,13 +46,13 @@ static int testTimeFields(const void *args) virTimeFieldsThen(data->when, &actual); -#define COMPARE(field) \ - do { \ - if (data->fields.field != actual.field) { \ - VIR_DEBUG("Expect " #field " %d got %d", \ - data->fields.field, actual.field); \ - return -1; \ - } \ +#define COMPARE(field) \ + do { \ + if (data->fields.field != actual.field) { \ + VIR_DEBUG("Expect " #field " %d got %d", \ + data->fields.field, actual.field); \ + return -1; \ + } \ } while (0) /* tm_year value 0 is based off epoch 1900 */ @@ -128,24 +128,24 @@ mymain(void) signal(SIGPIPE, SIG_IGN); -#define TEST_FIELDS(ts, year, mon, day, hour, min, sec) \ - do { \ - struct testTimeFieldsData data = { \ - .when = ts, \ - .fields = { \ - .tm_year = year, \ - .tm_mon = mon, \ - .tm_mday = day, \ - .tm_hour = hour, \ - .tm_min = min, \ - .tm_sec = sec, \ - .tm_wday = 0, \ - .tm_yday = 0, \ - .tm_isdst = 0, \ - }, \ - }; \ +#define TEST_FIELDS(ts, year, mon, day, hour, min, sec) \ + do { \ + struct testTimeFieldsData data = { \ + .when = ts, \ + .fields = { \ + .tm_year = year, \ + .tm_mon = mon, \ + .tm_mday = day, \ + .tm_hour = hour, \ + .tm_min = min, \ + .tm_sec = sec, \ + .tm_wday = 0, \ + .tm_yday = 0, \ + .tm_isdst = 0, \ + }, \ + }; \ if (virTestRun("Test fields " #ts " " #year " ", testTimeFields, &data) < 0) \ - ret = -1; \ + ret = -1; \ } while (0) TEST_FIELDS(0ull, 1970, 1, 1, 0, 0, 0); @@ -168,15 +168,15 @@ mymain(void) TEST_FIELDS(2147483648000ull, 2038, 1, 19, 3, 14, 8); -#define TEST_LOCALOFFSET(tz, off) \ - do { \ - testTimeLocalOffsetData data = { \ - .zone = tz, \ - .offset = off, \ - }; \ - if (virTestRun("Test localtime offset for " #tz, \ - testTimeLocalOffset, &data) < 0) \ - ret = -1; \ +#define TEST_LOCALOFFSET(tz, off) \ + do { \ + testTimeLocalOffsetData data = { \ + .zone = tz, \ + .offset = off, \ + }; \ + if (virTestRun("Test localtime offset for " #tz, \ + testTimeLocalOffset, &data) < 0) \ + ret = -1; \ } while (0) TEST_LOCALOFFSET("VIR00:30", -30 * 60); diff --git a/tests/viruritest.c b/tests/viruritest.c index c297574bd7..838f050980 100644 --- a/tests/viruritest.c +++ b/tests/viruritest.c @@ -144,21 +144,21 @@ mymain(void) signal(SIGPIPE, SIG_IGN); -#define TEST_FULL(uri, uri_out, scheme, server, port, path, query, \ - fragment, user, params) \ - do { \ - const struct URIParseData data = { \ - uri, (uri_out) ? (uri_out) : (uri), scheme, server, port, \ - path, query, fragment, user, params \ - }; \ - if (virTestRun("Test URI " # uri, testURIParse, &data) < 0) \ - ret = -1; \ +#define TEST_FULL(uri, uri_out, scheme, server, port, path, query, \ + fragment, user, params) \ + do { \ + const struct URIParseData data = { \ + uri, (uri_out) ? (uri_out) : (uri), scheme, server, port, \ + path, query, fragment, user, params \ + }; \ + if (virTestRun("Test URI " # uri, testURIParse, &data) < 0) \ + ret = -1; \ } while (0) #define TEST_PARSE(uri, scheme, server, port, path, query, fragment, user, params) \ TEST_FULL(uri, NULL, scheme, server, port, path, query, fragment, user, params) -#define TEST_PARAMS(query_in, query_out, params) \ - TEST_FULL("test://example.com/?" query_in, \ - *query_out ? "test://example.com/?" query_out : NULL, \ +#define TEST_PARAMS(query_in, query_out, params) \ + TEST_FULL("test://example.com/?" query_in, \ + *query_out ? "test://example.com/?" query_out : NULL, \ "test", "example.com", 0, "/", query_in, NULL, NULL, params) virURIParam params[] = { diff --git a/tests/virusbtest.c b/tests/virusbtest.c index 1a2ad56510..8728fe9092 100644 --- a/tests/virusbtest.c +++ b/tests/virusbtest.c @@ -241,33 +241,33 @@ mymain(void) int rv = 0; #define DO_TEST_FIND_FULL(name, vend, prod, bus, devno, vroot, mand, how, fail) \ - do { \ - struct findTestInfo data = { name, vend, prod, bus, \ - devno, vroot, mand, how, fail \ - }; \ - if (virTestRun("USBDeviceFind " name, testDeviceFind, &data) < 0) \ - rv = -1; \ + do { \ + struct findTestInfo data = { name, vend, prod, bus, \ + devno, vroot, mand, how, fail \ + }; \ + if (virTestRun("USBDeviceFind " name, testDeviceFind, &data) < 0) \ + rv = -1; \ } while (0) -#define DO_TEST_FIND(name, vend, prod, bus, devno) \ - DO_TEST_FIND_FULL(name, vend, prod, bus, devno, NULL, true, \ +#define DO_TEST_FIND(name, vend, prod, bus, devno) \ + DO_TEST_FIND_FULL(name, vend, prod, bus, devno, NULL, true, \ FIND_BY_ALL, false) -#define DO_TEST_FIND_FAIL(name, vend, prod, bus, devno) \ - DO_TEST_FIND_FULL(name, vend, prod, bus, devno, NULL, true, \ +#define DO_TEST_FIND_FAIL(name, vend, prod, bus, devno) \ + DO_TEST_FIND_FULL(name, vend, prod, bus, devno, NULL, true, \ FIND_BY_ALL, true) -#define DO_TEST_FIND_BY_BUS(name, bus, devno) \ - DO_TEST_FIND_FULL(name, 101, 202, bus, devno, NULL, true, \ +#define DO_TEST_FIND_BY_BUS(name, bus, devno) \ + DO_TEST_FIND_FULL(name, 101, 202, bus, devno, NULL, true, \ FIND_BY_BUS, false) -#define DO_TEST_FIND_BY_BUS_FAIL(name, bus, devno) \ - DO_TEST_FIND_FULL(name, 101, 202, bus, devno, NULL, true, \ +#define DO_TEST_FIND_BY_BUS_FAIL(name, bus, devno) \ + DO_TEST_FIND_FULL(name, 101, 202, bus, devno, NULL, true, \ FIND_BY_BUS, true) -#define DO_TEST_FIND_BY_VENDOR(name, vend, prod) \ - DO_TEST_FIND_FULL(name, vend, prod, 123, 456, NULL, true, \ +#define DO_TEST_FIND_BY_VENDOR(name, vend, prod) \ + DO_TEST_FIND_FULL(name, vend, prod, 123, 456, NULL, true, \ FIND_BY_VENDOR, false) -#define DO_TEST_FIND_BY_VENDOR_FAIL(name, vend, prod) \ - DO_TEST_FIND_FULL(name, vend, prod, 123, 456, NULL, true, \ +#define DO_TEST_FIND_BY_VENDOR_FAIL(name, vend, prod) \ + DO_TEST_FIND_FULL(name, vend, prod, 123, 456, NULL, true, \ FIND_BY_VENDOR, true) DO_TEST_FIND("Nexus", 0x18d1, 0x4e22, 1, 20); diff --git a/tests/vmwarevertest.c b/tests/vmwarevertest.c index 3dbe08b389..579fe06a5e 100644 --- a/tests/vmwarevertest.c +++ b/tests/vmwarevertest.c @@ -77,14 +77,14 @@ mymain(void) { int ret = 0; -# define DO_TEST(vmware_type, name, version) \ - do { \ - struct testInfo info = { \ - vmware_type, name, version \ - }; \ - if (virTestRun("VMware Version String Parsing " name, \ - testVerStrParse, &info) < 0) \ - ret = -1; \ +# define DO_TEST(vmware_type, name, version) \ + do { \ + struct testInfo info = { \ + vmware_type, name, version \ + }; \ + if (virTestRun("VMware Version String Parsing " name, \ + testVerStrParse, &info) < 0) \ + ret = -1; \ } while (0) DO_TEST("ws", "workstation-7.0.0", 7000000); diff --git a/tests/vmx2xmltest.c b/tests/vmx2xmltest.c index 00385dfa71..e0be642257 100644 --- a/tests/vmx2xmltest.c +++ b/tests/vmx2xmltest.c @@ -180,14 +180,14 @@ mymain(void) { int ret = 0; -# define DO_TEST(_in, _out) \ - do { \ - struct testInfo info = { _in, _out }; \ - virResetLastError(); \ - if (virTestRun("VMware VMX-2-XML "_in" -> "_out, \ - testCompareHelper, &info) < 0) { \ - ret = -1; \ - } \ +# define DO_TEST(_in, _out) \ + do { \ + struct testInfo info = { _in, _out }; \ + virResetLastError(); \ + if (virTestRun("VMware VMX-2-XML "_in" -> "_out, \ + testCompareHelper, &info) < 0) { \ + ret = -1; \ + } \ } while (0) testCapsInit(); diff --git a/tests/xlconfigtest.c b/tests/xlconfigtest.c index 30468c905e..1697a61101 100644 --- a/tests/xlconfigtest.c +++ b/tests/xlconfigtest.c @@ -225,32 +225,32 @@ mymain(void) if (!(xmlopt = libxlCreateXMLConf())) return EXIT_FAILURE; -#define DO_TEST_PARSE(name, replace) \ - do { \ - struct testInfo info0 = { name, 0, replace }; \ - if (virTestRun("Xen XL-2-XML Parse " name, \ - testCompareHelper, &info0) < 0) \ - ret = -1; \ +#define DO_TEST_PARSE(name, replace) \ + do { \ + struct testInfo info0 = { name, 0, replace }; \ + if (virTestRun("Xen XL-2-XML Parse " name, \ + testCompareHelper, &info0) < 0) \ + ret = -1; \ } while (0) -#define DO_TEST_FORMAT(name, replace) \ - do { \ - struct testInfo info1 = { name, 1, replace }; \ - if (virTestRun("Xen XL-2-XML Format " name, \ - testCompareHelper, &info1) < 0) \ - ret = -1; \ +#define DO_TEST_FORMAT(name, replace) \ + do { \ + struct testInfo info1 = { name, 1, replace }; \ + if (virTestRun("Xen XL-2-XML Format " name, \ + testCompareHelper, &info1) < 0) \ + ret = -1; \ } while (0) -#define DO_TEST(name) \ - do { \ - DO_TEST_PARSE(name, false); \ - DO_TEST_FORMAT(name, false); \ +#define DO_TEST(name) \ + do { \ + DO_TEST_PARSE(name, false); \ + DO_TEST_FORMAT(name, false); \ } while (0) -#define DO_TEST_REPLACE_VARS(name) \ - do { \ - DO_TEST_PARSE(name, true); \ - DO_TEST_FORMAT(name, true); \ +#define DO_TEST_REPLACE_VARS(name) \ + do { \ + DO_TEST_PARSE(name, true); \ + DO_TEST_FORMAT(name, true); \ } while (0) DO_TEST_REPLACE_VARS("fullvirt-ovmf"); diff --git a/tests/xmconfigtest.c b/tests/xmconfigtest.c index d8455da669..90ccce0b05 100644 --- a/tests/xmconfigtest.c +++ b/tests/xmconfigtest.c @@ -186,28 +186,28 @@ mymain(void) if (!(xmlopt = xenDomainXMLConfInit())) return EXIT_FAILURE; -#define DO_TEST_PARSE(name) \ - do { \ - struct testInfo info0 = { name, 0 }; \ - if (virTestRun("Xen XM-2-XML Parse " name, \ - testCompareHelper, &info0) < 0) \ - ret = -1; \ +#define DO_TEST_PARSE(name) \ + do { \ + struct testInfo info0 = { name, 0 }; \ + if (virTestRun("Xen XM-2-XML Parse " name, \ + testCompareHelper, &info0) < 0) \ + ret = -1; \ } while (0) -#define DO_TEST_FORMAT(name) \ - do { \ - struct testInfo info1 = { name, 1 }; \ - if (virTestRun("Xen XM-2-XML Format " name, \ - testCompareHelper, &info1) < 0) \ - ret = -1; \ +#define DO_TEST_FORMAT(name) \ + do { \ + struct testInfo info1 = { name, 1 }; \ + if (virTestRun("Xen XM-2-XML Format " name, \ + testCompareHelper, &info1) < 0) \ + ret = -1; \ } while (0) -#define DO_TEST(name) \ - do { \ - DO_TEST_PARSE(name); \ - DO_TEST_FORMAT(name); \ +#define DO_TEST(name) \ + do { \ + DO_TEST_PARSE(name); \ + DO_TEST_FORMAT(name); \ } while (0) DO_TEST("paravirt-new-pvfb"); diff --git a/tests/xml2sexprtest.c b/tests/xml2sexprtest.c index 0ba8a765bf..977f5bdff2 100644 --- a/tests/xml2sexprtest.c +++ b/tests/xml2sexprtest.c @@ -86,13 +86,13 @@ mymain(void) { int ret = 0; -#define DO_TEST(in, out, name) \ - do { \ - struct testInfo info = { in, out, name }; \ - virResetLastError(); \ - if (virTestRun("Xen XML-2-SEXPR " in " -> " out, \ - testCompareHelper, &info) < 0) \ - ret = -1; \ +#define DO_TEST(in, out, name) \ + do { \ + struct testInfo info = { in, out, name }; \ + virResetLastError(); \ + if (virTestRun("Xen XML-2-SEXPR " in " -> " out, \ + testCompareHelper, &info) < 0) \ + ret = -1; \ } while (0) if (!(caps = testXenCapsInit())) diff --git a/tests/xml2vmxtest.c b/tests/xml2vmxtest.c index 13f53e7d2d..7b01151974 100644 --- a/tests/xml2vmxtest.c +++ b/tests/xml2vmxtest.c @@ -199,14 +199,14 @@ mymain(void) { int result = 0; -# define DO_TEST(_in, _out, _version) \ - do { \ - struct testInfo info = { _in, _out, _version }; \ - virResetLastError(); \ - if (virTestRun("VMware XML-2-VMX "_in" -> "_out, \ - testCompareHelper, &info) < 0) { \ - result = -1; \ - } \ +# define DO_TEST(_in, _out, _version) \ + do { \ + struct testInfo info = { _in, _out, _version }; \ + virResetLastError(); \ + if (virTestRun("VMware XML-2-VMX "_in" -> "_out, \ + testCompareHelper, &info) < 0) { \ + result = -1; \ + } \ } while (0) testCapsInit(); diff --git a/tools/Makefile.am b/tools/Makefile.am index ffa8c3e19b..7513a73ac0 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -16,18 +16,18 @@ ## . INCLUDES = \ - -I$(top_builddir)/include -I$(top_srcdir)/include \ - -I$(top_builddir)/gnulib/lib -I$(top_srcdir)/gnulib/lib \ - -I$(top_builddir)/src -I$(top_srcdir)/src \ - -I$(top_srcdir)/src/util \ - -I$(top_srcdir) \ + -I$(top_builddir)/include -I$(top_srcdir)/include \ + -I$(top_builddir)/gnulib/lib -I$(top_srcdir)/gnulib/lib \ + -I$(top_builddir)/src -I$(top_srcdir)/src \ + -I$(top_srcdir)/src/util \ + -I$(top_srcdir) \ $(GETTEXT_CPPFLAGS) WARN_CFLAGS += $(STRICT_FRAME_LIMIT_CFLAGS) AM_LDFLAGS = \ - $(RELRO_LDFLAGS) \ - $(NO_INDIRECT_LDFLAGS) \ + $(RELRO_LDFLAGS) \ + $(NO_INDIRECT_LDFLAGS) \ $(NULL) ICON_FILES = \ @@ -58,16 +58,16 @@ MANINFILES = \ $(NULL) EXTRA_DIST = \ - $(ICON_FILES) \ - $(conf_DATA) \ - virt-xml-validate.in \ - virt-pki-validate.in \ - virt-sanlock-cleanup.in \ - libvirt-guests.sysconf \ - virt-login-shell.conf \ - virsh-edit.c \ - $(PODFILES) \ - $(MANINFILES) \ + $(ICON_FILES) \ + $(conf_DATA) \ + virt-xml-validate.in \ + virt-pki-validate.in \ + virt-sanlock-cleanup.in \ + libvirt-guests.sysconf \ + virt-login-shell.conf \ + virsh-edit.c \ + $(PODFILES) \ + $(MANINFILES) \ $(NULL) @@ -121,21 +121,21 @@ virt-sanlock-cleanup: virt-sanlock-cleanup.in Makefile noinst_LTLIBRARIES = libvirt_shell.la libvirt_shell_la_CFLAGS = \ - $(AM_CFLAGS) \ - $(PIE_CFLAGS) \ - $(READLINE_CFLAGS) \ - $(LIBXML_CFLAGS) \ + $(AM_CFLAGS) \ + $(PIE_CFLAGS) \ + $(READLINE_CFLAGS) \ + $(LIBXML_CFLAGS) \ $(NULL) libvirt_shell_la_LDFLAGS = \ - $(AM_LDFLAGS) \ - $(PIE_LDFLAGS) \ - $(COVERAGE_LDFLAGS) \ + $(AM_LDFLAGS) \ + $(PIE_LDFLAGS) \ + $(COVERAGE_LDFLAGS) \ $(NULL) libvirt_shell_la_LIBADD = \ - $(LIBXML_LIBS) \ - $(READLINE_LIBS) \ - ../src/libvirt.la \ - ../gnulib/lib/libgnu.la \ + $(LIBXML_LIBS) \ + $(READLINE_LIBS) \ + ../src/libvirt.la \ + ../gnulib/lib/libgnu.la \ $(NULL) libvirt_shell_la_SOURCES = vsh.c vsh.h @@ -177,15 +177,15 @@ virt_host_validate_LDFLAGS = \ $(NULL) virt_host_validate_LDADD = \ - ../src/libvirt.la \ - ../gnulib/lib/libgnu.la \ + ../src/libvirt.la \ + ../gnulib/lib/libgnu.la \ $(NULL) virt_host_validate_CFLAGS = \ - $(LIBXML_CFLAGS) \ - $(WARN_CFLAGS) \ - $(PIE_CFLAGS) \ - $(COVERAGE_CFLAGS) \ + $(LIBXML_CFLAGS) \ + $(WARN_CFLAGS) \ + $(PIE_CFLAGS) \ + $(COVERAGE_CFLAGS) \ $(NULL) # Since virt-login-shell will be setuid, we must do everything @@ -193,80 +193,80 @@ virt_host_validate_CFLAGS = \ # unsafe things in functions marked __atttribute__((constructor)). # This we statically link to a library containing only the minimal # libvirt client code, not libvirt.so itself. -virt_login_shell_SOURCES = \ +virt_login_shell_SOURCES = \ virt-login-shell.c virt_login_shell_LDFLAGS = \ - $(AM_LDFLAGS) \ - $(PIE_LDFLAGS) \ - $(COVERAGE_LDFLAGS) \ + $(AM_LDFLAGS) \ + $(PIE_LDFLAGS) \ + $(COVERAGE_LDFLAGS) \ $(NULL) -virt_login_shell_LDADD = \ - $(STATIC_BINARIES) \ - ../src/libvirt-setuid-rpc-client.la \ +virt_login_shell_LDADD = \ + $(STATIC_BINARIES) \ + ../src/libvirt-setuid-rpc-client.la \ ../gnulib/lib/libgnu.la -virt_login_shell_CFLAGS = \ - -DLIBVIRT_SETUID_RPC_CLIENT \ - $(LIBXML_CFLAGS) \ - $(WARN_CFLAGS) \ - $(PIE_CFLAGS) \ +virt_login_shell_CFLAGS = \ + -DLIBVIRT_SETUID_RPC_CLIENT \ + $(LIBXML_CFLAGS) \ + $(WARN_CFLAGS) \ + $(PIE_CFLAGS) \ $(COVERAGE_CFLAGS) -virsh_SOURCES = \ - virsh.c virsh.h \ - virsh-console.c virsh-console.h \ - virsh-domain.c virsh-domain.h \ - virsh-domain-monitor.c virsh-domain-monitor.h \ - virsh-host.c virsh-host.h \ - virsh-interface.c virsh-interface.h \ - virsh-network.c virsh-network.h \ - virsh-nodedev.c virsh-nodedev.h \ - virsh-nwfilter.c virsh-nwfilter.h \ - virsh-pool.c virsh-pool.h \ - virsh-secret.c virsh-secret.h \ - virsh-snapshot.c virsh-snapshot.h \ - virsh-util.c virsh-util.h \ - virsh-volume.c virsh-volume.h \ +virsh_SOURCES = \ + virsh.c virsh.h \ + virsh-console.c virsh-console.h \ + virsh-domain.c virsh-domain.h \ + virsh-domain-monitor.c virsh-domain-monitor.h \ + virsh-host.c virsh-host.h \ + virsh-interface.c virsh-interface.h \ + virsh-network.c virsh-network.h \ + virsh-nodedev.c virsh-nodedev.h \ + virsh-nwfilter.c virsh-nwfilter.h \ + virsh-pool.c virsh-pool.h \ + virsh-secret.c virsh-secret.h \ + virsh-snapshot.c virsh-snapshot.h \ + virsh-util.c virsh-util.h \ + virsh-volume.c virsh-volume.h \ $(NULL) virsh_LDFLAGS = \ - $(AM_LDFLAGS) \ - $(PIE_LDFLAGS) \ - $(COVERAGE_LDFLAGS) \ + $(AM_LDFLAGS) \ + $(PIE_LDFLAGS) \ + $(COVERAGE_LDFLAGS) \ $(NULL) -virsh_LDADD = \ - $(STATIC_BINARIES) \ - ../src/libvirt-lxc.la \ - ../src/libvirt-qemu.la \ +virsh_LDADD = \ + $(STATIC_BINARIES) \ + ../src/libvirt-lxc.la \ + ../src/libvirt-qemu.la \ libvirt_shell.la -virsh_CFLAGS = \ - $(WARN_CFLAGS) \ - $(PIE_CFLAGS) \ - $(COVERAGE_CFLAGS) \ - $(LIBXML_CFLAGS) \ +virsh_CFLAGS = \ + $(WARN_CFLAGS) \ + $(PIE_CFLAGS) \ + $(COVERAGE_CFLAGS) \ + $(LIBXML_CFLAGS) \ $(READLINE_CFLAGS) -virt_admin_SOURCES = \ - virt-admin.c virt-admin.h \ +virt_admin_SOURCES = \ + virt-admin.c virt-admin.h \ $(NULL) -virt_admin_LDFLAGS = \ - $(AM_LDFLAGS) \ - $(COVERAGE_LDFLAGS) \ - $(STATIC_BINARIES) \ - $(PIE_LDFLAGS) \ +virt_admin_LDFLAGS = \ + $(AM_LDFLAGS) \ + $(COVERAGE_LDFLAGS) \ + $(STATIC_BINARIES) \ + $(PIE_LDFLAGS) \ $(NULL) -virt_admin_LDADD = \ - ../src/libvirt-admin.la \ - libvirt_shell.la \ - $(LIBXML_LIBS) \ +virt_admin_LDADD = \ + ../src/libvirt-admin.la \ + libvirt_shell.la \ + $(LIBXML_LIBS) \ $(NULL) -virt_admin_CFLAGS = \ - $(WARN_CFLAGS) \ - $(PIE_CFLAGS) \ - $(COVERAGE_CFLAGS) \ - $(LIBXML_CFLAGS) \ +virt_admin_CFLAGS = \ + $(WARN_CFLAGS) \ + $(PIE_CFLAGS) \ + $(COVERAGE_CFLAGS) \ + $(LIBXML_CFLAGS) \ $(READLINE_CFLAGS) BUILT_SOURCES = @@ -367,15 +367,15 @@ uninstall-init: endif ! LIBVIRT_INIT_SCRIPT_RED_HAT libvirt-guests.sh: libvirt-guests.sh.in $(top_builddir)/config.status - $(AM_V_GEN)sed \ - -e 's|[@]PACKAGE[@]|$(PACKAGE)|g' \ - -e 's|[@]bindir[@]|$(bindir)|g' \ - -e 's|[@]localedir[@]|$(localedir)|g' \ - -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|[@]PACKAGE[@]|$(PACKAGE)|g' \ + -e 's|[@]bindir[@]|$(bindir)|g' \ + -e 's|[@]localedir[@]|$(localedir)|g' \ + -e 's|[@]localstatedir[@]|$(localstatedir)|g' \ + -e 's|[@]sbindir[@]|$(sbindir)|g' \ + -e 's|[@]sysconfdir[@]|$(sysconfdir)|g' \ + < $< > $@-t && \ + chmod a+x $@-t && \ mv $@-t $@ BUILT_SOURCES += libvirt-guests.sh @@ -408,15 +408,15 @@ uninstall-systemd: endif ! LIBVIRT_INIT_SCRIPT_SYSTEMD libvirt-guests.service: libvirt-guests.service.in $(top_builddir)/config.status - $(AM_V_GEN)sed \ - -e 's|[@]PACKAGE[@]|$(PACKAGE)|g' \ - -e 's|[@]bindir[@]|$(bindir)|g' \ - -e 's|[@]localedir[@]|$(localedir)|g' \ - -e 's|[@]localstatedir[@]|$(localstatedir)|g' \ - -e 's|[@]sbindir[@]|$(sbindir)|g' \ - -e 's|[@]sysconfdir[@]|$(sysconfdir)|g' \ - -e 's|[@]libexecdir[@]|$(libexecdir)|g' \ - < $< > $@-t && \ + $(AM_V_GEN)sed \ + -e 's|[@]PACKAGE[@]|$(PACKAGE)|g' \ + -e 's|[@]bindir[@]|$(bindir)|g' \ + -e 's|[@]localedir[@]|$(localedir)|g' \ + -e 's|[@]localstatedir[@]|$(localstatedir)|g' \ + -e 's|[@]sbindir[@]|$(sbindir)|g' \ + -e 's|[@]sysconfdir[@]|$(sysconfdir)|g' \ + -e 's|[@]libexecdir[@]|$(libexecdir)|g' \ + < $< > $@-t && \ mv $@-t $@ @@ -491,7 +491,7 @@ uninstall-nss: endif ! WITH_BSD_NSS LIBVIRT_NSS_SOURCES = \ - nss/libvirt_nss.c \ + nss/libvirt_nss.c \ nss/libvirt_nss.h if WITH_NSS @@ -500,20 +500,20 @@ nss_libnss_libvirt_impl_la_SOURCES = \ $(LIBVIRT_NSS_SOURCES) nss_libnss_libvirt_impl_la_CFLAGS = \ - -DLIBVIRT_NSS \ - $(AM_CFLAGS) \ - $(WARN_CFLAGS) \ - $(PIE_CFLAGS) \ - $(COVERAGE_CFLAGS) \ + -DLIBVIRT_NSS \ + $(AM_CFLAGS) \ + $(WARN_CFLAGS) \ + $(PIE_CFLAGS) \ + $(COVERAGE_CFLAGS) \ $(LIBXML_CFLAGS) nss_libnss_libvirt_impl_la_LIBADD = \ - ../gnulib/lib/libgnu.la \ + ../gnulib/lib/libgnu.la \ ../src/libvirt-nss.la nss_libnss_libvirt_la_SOURCES = nss_libnss_libvirt_la_LDFLAGS = \ - $(VERSION_SCRIPT_FLAGS)$(LIBVIRT_NSS_SYMBOL_FILE) \ + $(VERSION_SCRIPT_FLAGS)$(LIBVIRT_NSS_SYMBOL_FILE) \ $(AM_LDFLAGS) \ -module \ -export-dynamic \ @@ -521,7 +521,7 @@ nss_libnss_libvirt_la_LDFLAGS = \ -shared \ -shrext .so.$(NSS_SO_VER) -nss_libnss_libvirt_la_LIBADD = \ +nss_libnss_libvirt_la_LIBADD = \ nss/libnss_libvirt_impl.la noinst_LTLIBRARIES += nss/libnss_libvirt_guest_impl.la @@ -529,21 +529,21 @@ nss_libnss_libvirt_guest_impl_la_SOURCES = \ $(LIBVIRT_NSS_SOURCES) nss_libnss_libvirt_guest_impl_la_CFLAGS = \ - -DLIBVIRT_NSS \ - -DLIBVIRT_NSS_GUEST \ - $(AM_CFLAGS) \ - $(WARN_CFLAGS) \ - $(PIE_CFLAGS) \ - $(COVERAGE_CFLAGS) \ + -DLIBVIRT_NSS \ + -DLIBVIRT_NSS_GUEST \ + $(AM_CFLAGS) \ + $(WARN_CFLAGS) \ + $(PIE_CFLAGS) \ + $(COVERAGE_CFLAGS) \ $(LIBXML_CFLAGS) nss_libnss_libvirt_guest_impl_la_LIBADD = \ - ../gnulib/lib/libgnu.la \ + ../gnulib/lib/libgnu.la \ ../src/libvirt-nss.la nss_libnss_libvirt_guest_la_SOURCES = nss_libnss_libvirt_guest_la_LDFLAGS = \ - $(VERSION_SCRIPT_FLAGS)$(LIBVIRT_GUEST_NSS_SYMBOL_FILE) \ + $(VERSION_SCRIPT_FLAGS)$(LIBVIRT_GUEST_NSS_SYMBOL_FILE) \ $(AM_LDFLAGS) \ -module \ -export-dynamic \ @@ -551,7 +551,7 @@ nss_libnss_libvirt_guest_la_LDFLAGS = \ -shared \ -shrext .so.$(NSS_SO_VER) -nss_libnss_libvirt_guest_la_LIBADD = \ +nss_libnss_libvirt_guest_la_LIBADD = \ nss/libnss_libvirt_guest_impl.la lib_LTLIBRARIES = \ @@ -562,7 +562,7 @@ endif WITH_NSS EXTRA_DIST += $(LIBVIRT_NSS_SOURCES) \ $(srcdir)/nss/libvirt_nss.syms \ - $(srcdir)/nss/libvirt_nss_bsd.syms \ + $(srcdir)/nss/libvirt_nss_bsd.syms \ $(srcdir)/nss/libvirt_guest_nss.syms clean-local: diff --git a/tools/nss/libvirt_nss.c b/tools/nss/libvirt_nss.c index 49dc621ab7..62fe589bed 100644 --- a/tools/nss/libvirt_nss.c +++ b/tools/nss/libvirt_nss.c @@ -51,20 +51,20 @@ #include "virobject.h" #if 0 -# define ERROR(...) \ -do { \ - char ebuf[1024]; \ - fprintf(stderr, "ERROR %s:%d : ", __FUNCTION__, __LINE__); \ - fprintf(stderr, __VA_ARGS__); \ +# define ERROR(...) \ +do { \ + char ebuf[1024]; \ + fprintf(stderr, "ERROR %s:%d : ", __FUNCTION__, __LINE__); \ + fprintf(stderr, __VA_ARGS__); \ fprintf(stderr, " : %s\n", virStrerror(errno, ebuf, sizeof(ebuf))); \ - fprintf(stderr, "\n"); \ + fprintf(stderr, "\n"); \ } while (0) -# define DEBUG(...) \ -do { \ - fprintf(stderr, "DEBUG %s:%d : ", __FUNCTION__, __LINE__); \ - fprintf(stderr, __VA_ARGS__); \ - fprintf(stderr, "\n"); \ +# define DEBUG(...) \ +do { \ + fprintf(stderr, "DEBUG %s:%d : ", __FUNCTION__, __LINE__); \ + fprintf(stderr, __VA_ARGS__); \ + fprintf(stderr, "\n"); \ } while (0) #else # define ERROR(...) do { } while (0) diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index 35d04b22af..83927eaccd 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -40,7 +40,7 @@ #include "virxml.h" #include "virstring.h" -#define VIRSH_COMMON_OPT_DOMAIN_FULL \ +#define VIRSH_COMMON_OPT_DOMAIN_FULL \ VIRSH_COMMON_OPT_DOMAIN(N_("domain name, id or uuid")) \ VIR_ENUM_DECL(virshDomainIOError) @@ -848,12 +848,12 @@ static const struct _domblkstat_sequence domblkstat_output[] = { { NULL, NULL, NULL } }; -#define DOMBLKSTAT_LEGACY_PRINT(ID, VALUE) \ - if (VALUE >= 0) \ - vshPrint(ctl, "%s %-*s %lld\n", device, \ - human ? 31 : 0, \ +#define DOMBLKSTAT_LEGACY_PRINT(ID, VALUE) \ + if (VALUE >= 0) \ + vshPrint(ctl, "%s %-*s %lld\n", device, \ + human ? 31 : 0, \ human ? _(domblkstat_output[ID].human) \ - : domblkstat_output[ID].legacy, \ + : domblkstat_output[ID].legacy, \ VALUE); static bool @@ -1775,8 +1775,8 @@ static const vshCmdOptDef opts_list[] = { {.name = NULL} }; -#define FILTER(NAME, FLAG) \ - if (vshCommandOptBool(cmd, NAME)) \ +#define FILTER(NAME, FLAG) \ + if (vshCommandOptBool(cmd, NAME)) \ flags |= (FLAG) static bool cmdList(vshControl *ctl, const vshCmd *cmd) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 1e33e82959..2491d5b194 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -65,22 +65,22 @@ # define SA_SIGINFO 0 #endif -#define VIRSH_COMMON_OPT_DOMAIN_FULL \ +#define VIRSH_COMMON_OPT_DOMAIN_FULL \ VIRSH_COMMON_OPT_DOMAIN(N_("domain name, id or uuid")) \ -#define VIRSH_COMMON_OPT_DOMAIN_PERSISTENT \ - {.name = "persistent", \ - .type = VSH_OT_BOOL, \ - .help = N_("make live change persistent") \ - } \ +#define VIRSH_COMMON_OPT_DOMAIN_PERSISTENT \ + {.name = "persistent", \ + .type = VSH_OT_BOOL, \ + .help = N_("make live change persistent") \ + } \ -#define VIRSH_COMMON_OPT_DOMAIN_CONFIG \ - VIRSH_COMMON_OPT_CONFIG(N_("affect next boot")) \ +#define VIRSH_COMMON_OPT_DOMAIN_CONFIG \ + VIRSH_COMMON_OPT_CONFIG(N_("affect next boot")) \ -#define VIRSH_COMMON_OPT_DOMAIN_LIVE \ +#define VIRSH_COMMON_OPT_DOMAIN_LIVE \ VIRSH_COMMON_OPT_LIVE(N_("affect running domain")) \ -#define VIRSH_COMMON_OPT_DOMAIN_CURRENT \ +#define VIRSH_COMMON_OPT_DOMAIN_CURRENT \ VIRSH_COMMON_OPT_CURRENT(N_("affect current domain")) \ @@ -781,14 +781,14 @@ static const vshCmdOptDef opts_attach_interface[] = { * 'average,peak,burst,floor', in which peak and burst are optional, * thus 'average,,burst' and 'average,peak' are also legal. */ -#define VIRSH_PARSE_RATE_FIELD(index, name) \ - do { \ - if (index < ntok && \ - *tok[index] != '\0' && \ - virStrToLong_ullp(tok[index], NULL, 10, &rate->name) < 0) { \ - vshError(ctl, _("field '%s' is malformed"), #name); \ - goto cleanup; \ - } \ +#define VIRSH_PARSE_RATE_FIELD(index, name) \ + do { \ + if (index < ntok && \ + *tok[index] != '\0' && \ + virStrToLong_ullp(tok[index], NULL, 10, &rate->name) < 0) { \ + vshError(ctl, _("field '%s' is malformed"), #name); \ + goto cleanup; \ + } \ } while (0) static int @@ -1293,16 +1293,16 @@ cmdBlkdeviotune(vshControl *ctl, const vshCmd *cmd) if (vshCommandOptStringReq(ctl, cmd, "device", &disk) < 0) goto cleanup; -#define VSH_ADD_IOTUNE_SCALED(PARAM, CONST) \ - if ((rv = vshCommandOptScaledInt(ctl, cmd, #PARAM, &value, \ - 1, ULLONG_MAX)) < 0) { \ - goto interror; \ - } else if (rv > 0) { \ - if (virTypedParamsAddULLong(¶ms, &nparams, &maxparams, \ - VIR_DOMAIN_BLOCK_IOTUNE_##CONST, \ - value) < 0) \ - goto save_error; \ - } \ +#define VSH_ADD_IOTUNE_SCALED(PARAM, CONST) \ + if ((rv = vshCommandOptScaledInt(ctl, cmd, #PARAM, &value, \ + 1, ULLONG_MAX)) < 0) { \ + goto interror; \ + } else if (rv > 0) { \ + if (virTypedParamsAddULLong(¶ms, &nparams, &maxparams, \ + VIR_DOMAIN_BLOCK_IOTUNE_##CONST, \ + value) < 0) \ + goto save_error; \ + } \ VSH_ADD_IOTUNE_SCALED(total-bytes-sec, TOTAL_BYTES_SEC); VSH_ADD_IOTUNE_SCALED(read-bytes-sec, READ_BYTES_SEC); @@ -1312,15 +1312,15 @@ cmdBlkdeviotune(vshControl *ctl, const vshCmd *cmd) VSH_ADD_IOTUNE_SCALED(write-bytes-sec-max, WRITE_BYTES_SEC_MAX); #undef VSH_ADD_IOTUNE_SCALED -#define VSH_ADD_IOTUNE(PARAM, CONST) \ - if ((rv = vshCommandOptULongLong(ctl, cmd, #PARAM, &value)) < 0) { \ - goto interror; \ - } else if (rv > 0) { \ - if (virTypedParamsAddULLong(¶ms, &nparams, &maxparams, \ - VIR_DOMAIN_BLOCK_IOTUNE_##CONST, \ - value) < 0) \ - goto save_error; \ - } \ +#define VSH_ADD_IOTUNE(PARAM, CONST) \ + if ((rv = vshCommandOptULongLong(ctl, cmd, #PARAM, &value)) < 0) { \ + goto interror; \ + } else if (rv > 0) { \ + if (virTypedParamsAddULLong(¶ms, &nparams, &maxparams, \ + VIR_DOMAIN_BLOCK_IOTUNE_##CONST, \ + value) < 0) \ + goto save_error; \ + } \ VSH_ADD_IOTUNE(total-iops-sec, TOTAL_IOPS_SEC); VSH_ADD_IOTUNE(read-iops-sec, READ_IOPS_SEC); @@ -4509,12 +4509,12 @@ cmdSaveImageEdit(vshControl *ctl, const vshCmd *cmd) #define EDIT_GET_XML \ virDomainSaveImageGetXMLDesc(priv->conn, file, getxml_flags) -#define EDIT_NOT_CHANGED \ - do { \ - vshPrintExtra(ctl, _("Saved image %s XML configuration " \ - "not changed.\n"), file); \ - ret = true; \ - goto edit_cleanup; \ +#define EDIT_NOT_CHANGED \ + do { \ + vshPrintExtra(ctl, _("Saved image %s XML configuration " \ + "not changed.\n"), file); \ + ret = true; \ + goto edit_cleanup; \ } while (0) #define EDIT_DEFINE \ (virDomainSaveImageDefineXML(priv->conn, file, doc_edited, define_flags) == 0) @@ -4750,12 +4750,12 @@ cmdManagedSaveEdit(vshControl *ctl, const vshCmd *cmd) goto cleanup; #define EDIT_GET_XML virDomainManagedSaveGetXMLDesc(dom, getxml_flags) -#define EDIT_NOT_CHANGED \ - do { \ +#define EDIT_NOT_CHANGED \ + do { \ vshPrintExtra(ctl, _("Managed save image of domain %s XML configuration " \ - "not changed.\n"), virDomainGetName(dom)); \ - ret = true; \ - goto edit_cleanup; \ + "not changed.\n"), virDomainGetName(dom)); \ + ret = true; \ + goto edit_cleanup; \ } while (0) #define EDIT_DEFINE \ (virDomainManagedSaveDefineXML(dom, doc_edited, define_flags) == 0) @@ -8554,14 +8554,14 @@ cmdMetadata(vshControl *ctl, const vshCmd *cmd) } else if (edit) { #define EDIT_GET_XML \ virshDomainGetEditMetadata(ctl, dom, uri, flags) -#define EDIT_NOT_CHANGED \ - do { \ +#define EDIT_NOT_CHANGED \ + do { \ vshPrintExtra(ctl, "%s", _("Metadata not changed")); \ - ret = true; \ - goto edit_cleanup; \ + ret = true; \ + goto edit_cleanup; \ } while (0) -#define EDIT_DEFINE \ +#define EDIT_DEFINE \ (virDomainSetMetadata(dom, VIR_DOMAIN_METADATA_ELEMENT, doc_edited, \ key, uri, flags) == 0) #include "virsh-edit.c" @@ -9095,16 +9095,16 @@ cmdMemtune(vshControl *ctl, const vshCmd *cmd) if (!(dom = virshCommandOptDomain(ctl, cmd, NULL))) return false; -#define PARSE_MEMTUNE_PARAM(NAME, FIELD) \ - if ((rc = virshMemtuneGetSize(ctl, cmd, NAME, &tmpVal)) < 0) { \ - vshError(ctl, _("Unable to parse integer parameter %s"), NAME); \ - goto cleanup; \ - } \ - if (rc == 1) { \ - if (virTypedParamsAddULLong(¶ms, &nparams, &maxparams, \ - FIELD, tmpVal) < 0) \ - goto save_error; \ - } \ +#define PARSE_MEMTUNE_PARAM(NAME, FIELD) \ + if ((rc = virshMemtuneGetSize(ctl, cmd, NAME, &tmpVal)) < 0) { \ + vshError(ctl, _("Unable to parse integer parameter %s"), NAME); \ + goto cleanup; \ + } \ + if (rc == 1) { \ + if (virTypedParamsAddULLong(¶ms, &nparams, &maxparams, \ + FIELD, tmpVal) < 0) \ + goto save_error; \ + } \ PARSE_MEMTUNE_PARAM("hard-limit", VIR_DOMAIN_MEMORY_HARD_LIMIT); @@ -12542,18 +12542,18 @@ cmdEdit(vshControl *ctl, const vshCmd *cmd) define_flags &= ~VIR_DOMAIN_DEFINE_VALIDATE; #define EDIT_GET_XML virDomainGetXMLDesc(dom, query_flags) -#define EDIT_NOT_CHANGED \ - do { \ - vshPrintExtra(ctl, _("Domain %s XML configuration not changed.\n"), \ - virDomainGetName(dom)); \ - ret = true; \ - goto edit_cleanup; \ +#define EDIT_NOT_CHANGED \ + do { \ + vshPrintExtra(ctl, _("Domain %s XML configuration not changed.\n"), \ + virDomainGetName(dom)); \ + ret = true; \ + goto edit_cleanup; \ } while (0) #define EDIT_DEFINE \ (dom_edited = virshDomainDefine(priv->conn, doc_edited, define_flags)) -#define EDIT_RELAX \ - do { \ - define_flags &= ~VIR_DOMAIN_DEFINE_VALIDATE; \ +#define EDIT_RELAX \ + do { \ + define_flags &= ~VIR_DOMAIN_DEFINE_VALIDATE; \ } while (0); #include "virsh-edit.c" diff --git a/tools/virsh-interface.c b/tools/virsh-interface.c index 25e21710f6..63bad72789 100644 --- a/tools/virsh-interface.c +++ b/tools/virsh-interface.c @@ -23,12 +23,12 @@ * */ -#define VIRSH_COMMON_OPT_INTERFACE \ - {.name = "interface", \ - .type = VSH_OT_DATA, \ - .flags = VSH_OFLAG_REQ, \ - .help = N_("interface name or MAC address") \ - } \ +#define VIRSH_COMMON_OPT_INTERFACE \ + {.name = "interface", \ + .type = VSH_OT_DATA, \ + .flags = VSH_OFLAG_REQ, \ + .help = N_("interface name or MAC address") \ + } \ #include #include "virsh-interface.h" @@ -125,12 +125,12 @@ cmdInterfaceEdit(vshControl *ctl, const vshCmd *cmd) goto cleanup; #define EDIT_GET_XML virInterfaceGetXMLDesc(iface, flags) -#define EDIT_NOT_CHANGED \ - do { \ +#define EDIT_NOT_CHANGED \ + do { \ vshPrintExtra(ctl, _("Interface %s XML configuration not changed.\n"), \ - virInterfaceGetName(iface)); \ - ret = true; \ - goto edit_cleanup; \ + virInterfaceGetName(iface)); \ + ret = true; \ + goto edit_cleanup; \ } while (0) #define EDIT_DEFINE \ (iface_edited = virInterfaceDefineXML(priv->conn, doc_edited, 0)) diff --git a/tools/virsh-interface.h b/tools/virsh-interface.h index 44bf5e4650..f02bbdbc94 100644 --- a/tools/virsh-interface.h +++ b/tools/virsh-interface.h @@ -33,8 +33,8 @@ virInterfacePtr virshCommandOptInterfaceBy(vshControl *ctl, const vshCmd *cmd, const char **name, unsigned int flags); /* default is lookup by Name and MAC */ -# define virshCommandOptInterface(_ctl, _cmd, _name) \ - virshCommandOptInterfaceBy(_ctl, _cmd, NULL, _name, \ +# define virshCommandOptInterface(_ctl, _cmd, _name) \ + virshCommandOptInterfaceBy(_ctl, _cmd, NULL, _name, \ VIRSH_BYMAC | VIRSH_BYNAME) extern const vshCmdDef ifaceCmds[]; diff --git a/tools/virsh-network.c b/tools/virsh-network.c index eacc2771b3..6a04b8de31 100644 --- a/tools/virsh-network.c +++ b/tools/virsh-network.c @@ -34,12 +34,12 @@ #include "virtime.h" #include "conf/network_conf.h" -#define VIRSH_COMMON_OPT_NETWORK \ - {.name = "network", \ - .type = VSH_OT_DATA, \ - .flags = VSH_OFLAG_REQ, \ - .help = N_("network name or uuid") \ - } \ +#define VIRSH_COMMON_OPT_NETWORK \ + {.name = "network", \ + .type = VSH_OT_DATA, \ + .flags = VSH_OFLAG_REQ, \ + .help = N_("network name or uuid") \ + } \ virNetworkPtr virshCommandOptNetworkBy(vshControl *ctl, const vshCmd *cmd, @@ -647,8 +647,8 @@ static const vshCmdOptDef opts_network_list[] = { {.name = NULL} }; -#define FILTER(NAME, FLAG) \ - if (vshCommandOptBool(cmd, NAME)) \ +#define FILTER(NAME, FLAG) \ + if (vshCommandOptBool(cmd, NAME)) \ flags |= (FLAG) static bool cmdNetworkList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED) @@ -1090,12 +1090,12 @@ cmdNetworkEdit(vshControl *ctl, const vshCmd *cmd) goto cleanup; #define EDIT_GET_XML virshNetworkGetXMLDesc(network) -#define EDIT_NOT_CHANGED \ - do { \ +#define EDIT_NOT_CHANGED \ + do { \ vshPrintExtra(ctl, _("Network %s XML configuration not changed.\n"), \ - virNetworkGetName(network)); \ - ret = true; \ - goto edit_cleanup; \ + virNetworkGetName(network)); \ + ret = true; \ + goto edit_cleanup; \ } while (0) #define EDIT_DEFINE \ (network_edited = virNetworkDefineXML(priv->conn, doc_edited)) diff --git a/tools/virsh-network.h b/tools/virsh-network.h index 92bb4b5b53..0e11749467 100644 --- a/tools/virsh-network.h +++ b/tools/virsh-network.h @@ -33,8 +33,8 @@ virshCommandOptNetworkBy(vshControl *ctl, const vshCmd *cmd, const char **name, unsigned int flags); /* default is lookup by Name and UUID */ -# define virshCommandOptNetwork(_ctl, _cmd, _name) \ - virshCommandOptNetworkBy(_ctl, _cmd, _name, \ +# define virshCommandOptNetwork(_ctl, _cmd, _name) \ + virshCommandOptNetworkBy(_ctl, _cmd, _name, \ VIRSH_BYUUID | VIRSH_BYNAME) extern const vshCmdDef networkCmds[]; diff --git a/tools/virsh-nwfilter.c b/tools/virsh-nwfilter.c index d4a88b23ef..0f64c446f3 100644 --- a/tools/virsh-nwfilter.c +++ b/tools/virsh-nwfilter.c @@ -414,13 +414,13 @@ cmdNWFilterEdit(vshControl *ctl, const vshCmd *cmd) goto cleanup; #define EDIT_GET_XML virNWFilterGetXMLDesc(nwfilter, 0) -#define EDIT_NOT_CHANGED \ - do { \ - vshPrintExtra(ctl, _("Network filter %s XML " \ - "configuration not changed.\n"), \ - virNWFilterGetName(nwfilter)); \ - ret = true; \ - goto edit_cleanup; \ +#define EDIT_NOT_CHANGED \ + do { \ + vshPrintExtra(ctl, _("Network filter %s XML " \ + "configuration not changed.\n"), \ + virNWFilterGetName(nwfilter)); \ + ret = true; \ + goto edit_cleanup; \ } while (0) #define EDIT_DEFINE \ (nwfilter_edited = virNWFilterDefineXML(priv->conn, doc_edited)) diff --git a/tools/virsh-nwfilter.h b/tools/virsh-nwfilter.h index 1e4250e34f..2b76a7c849 100644 --- a/tools/virsh-nwfilter.h +++ b/tools/virsh-nwfilter.h @@ -33,8 +33,8 @@ virshCommandOptNWFilterBy(vshControl *ctl, const vshCmd *cmd, const char **name, unsigned int flags); /* default is lookup by Name and UUID */ -# define virshCommandOptNWFilter(_ctl, _cmd, _name) \ - virshCommandOptNWFilterBy(_ctl, _cmd, _name, \ +# define virshCommandOptNWFilter(_ctl, _cmd, _name) \ + virshCommandOptNWFilterBy(_ctl, _cmd, _name, \ VIRSH_BYUUID | VIRSH_BYNAME) extern const vshCmdDef nwfilterCmds[]; diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c index 96a623284d..d6fc99dcbd 100644 --- a/tools/virsh-pool.c +++ b/tools/virsh-pool.c @@ -34,101 +34,101 @@ #include "virstring.h" #include "virtime.h" -#define VIRSH_COMMON_OPT_POOL_FULL \ - VIRSH_COMMON_OPT_POOL(N_("pool name or uuid")) \ +#define VIRSH_COMMON_OPT_POOL_FULL \ + VIRSH_COMMON_OPT_POOL(N_("pool name or uuid")) \ -#define VIRSH_COMMON_OPT_POOL_BUILD \ - {.name = "build", \ - .type = VSH_OT_BOOL, \ - .flags = 0, \ - .help = N_("build the pool as normal") \ - } \ +#define VIRSH_COMMON_OPT_POOL_BUILD \ + {.name = "build", \ + .type = VSH_OT_BOOL, \ + .flags = 0, \ + .help = N_("build the pool as normal") \ + } \ -#define VIRSH_COMMON_OPT_POOL_NO_OVERWRITE \ - {.name = "no-overwrite", \ - .type = VSH_OT_BOOL, \ - .flags = 0, \ - .help = N_("do not overwrite any existing data") \ - } \ +#define VIRSH_COMMON_OPT_POOL_NO_OVERWRITE \ + {.name = "no-overwrite", \ + .type = VSH_OT_BOOL, \ + .flags = 0, \ + .help = N_("do not overwrite any existing data") \ + } \ -#define VIRSH_COMMON_OPT_POOL_OVERWRITE \ - {.name = "overwrite", \ - .type = VSH_OT_BOOL, \ - .flags = 0, \ - .help = N_("overwrite any existing data") \ - } \ +#define VIRSH_COMMON_OPT_POOL_OVERWRITE \ + {.name = "overwrite", \ + .type = VSH_OT_BOOL, \ + .flags = 0, \ + .help = N_("overwrite any existing data") \ + } \ -#define VIRSH_COMMON_OPT_POOL_X_AS \ - {.name = "name", \ - .type = VSH_OT_DATA, \ - .flags = VSH_OFLAG_REQ, \ - .help = N_("name of the pool") \ - }, \ - {.name = "type", \ - .type = VSH_OT_DATA, \ - .flags = VSH_OFLAG_REQ, \ - .help = N_("type of the pool") \ - }, \ - {.name = "print-xml", \ - .type = VSH_OT_BOOL, \ - .help = N_("print XML document, but don't define/create") \ - }, \ - {.name = "source-host", \ - .type = VSH_OT_STRING, \ - .help = N_("source-host for underlying storage") \ - }, \ - {.name = "source-path", \ - .type = VSH_OT_STRING, \ - .help = N_("source path for underlying storage") \ - }, \ - {.name = "source-dev", \ - .type = VSH_OT_STRING, \ - .help = N_("source device for underlying storage") \ - }, \ - {.name = "source-name", \ - .type = VSH_OT_STRING, \ - .help = N_("source name for underlying storage") \ - }, \ - {.name = "target", \ - .type = VSH_OT_STRING, \ - .help = N_("target for underlying storage") \ - }, \ - {.name = "source-format", \ - .type = VSH_OT_STRING, \ - .help = N_("format for underlying storage") \ - }, \ - {.name = "auth-type", \ - .type = VSH_OT_STRING, \ - .help = N_("auth type to be used for underlying storage") \ - }, \ - {.name = "auth-username", \ - .type = VSH_OT_STRING, \ - .help = N_("auth username to be used for underlying storage") \ - }, \ - {.name = "secret-usage", \ - .type = VSH_OT_STRING, \ +#define VIRSH_COMMON_OPT_POOL_X_AS \ + {.name = "name", \ + .type = VSH_OT_DATA, \ + .flags = VSH_OFLAG_REQ, \ + .help = N_("name of the pool") \ + }, \ + {.name = "type", \ + .type = VSH_OT_DATA, \ + .flags = VSH_OFLAG_REQ, \ + .help = N_("type of the pool") \ + }, \ + {.name = "print-xml", \ + .type = VSH_OT_BOOL, \ + .help = N_("print XML document, but don't define/create") \ + }, \ + {.name = "source-host", \ + .type = VSH_OT_STRING, \ + .help = N_("source-host for underlying storage") \ + }, \ + {.name = "source-path", \ + .type = VSH_OT_STRING, \ + .help = N_("source path for underlying storage") \ + }, \ + {.name = "source-dev", \ + .type = VSH_OT_STRING, \ + .help = N_("source device for underlying storage") \ + }, \ + {.name = "source-name", \ + .type = VSH_OT_STRING, \ + .help = N_("source name for underlying storage") \ + }, \ + {.name = "target", \ + .type = VSH_OT_STRING, \ + .help = N_("target for underlying storage") \ + }, \ + {.name = "source-format", \ + .type = VSH_OT_STRING, \ + .help = N_("format for underlying storage") \ + }, \ + {.name = "auth-type", \ + .type = VSH_OT_STRING, \ + .help = N_("auth type to be used for underlying storage") \ + }, \ + {.name = "auth-username", \ + .type = VSH_OT_STRING, \ + .help = N_("auth username to be used for underlying storage") \ + }, \ + {.name = "secret-usage", \ + .type = VSH_OT_STRING, \ .help = N_("auth secret usage to be used for underlying storage") \ - }, \ - {.name = "secret-uuid", \ - .type = VSH_OT_STRING, \ - .help = N_("auth secret UUID to be used for underlying storage") \ - }, \ - {.name = "adapter-name", \ - .type = VSH_OT_STRING, \ - .help = N_("adapter name to be used for underlying storage") \ - }, \ - {.name = "adapter-wwnn", \ - .type = VSH_OT_STRING, \ - .help = N_("adapter wwnn to be used for underlying storage") \ - }, \ - {.name = "adapter-wwpn", \ - .type = VSH_OT_STRING, \ - .help = N_("adapter wwpn to be used for underlying storage") \ - }, \ - {.name = "adapter-parent", \ - .type = VSH_OT_STRING, \ - .help = N_("adapter parent to be used for underlying storage") \ - } \ + }, \ + {.name = "secret-uuid", \ + .type = VSH_OT_STRING, \ + .help = N_("auth secret UUID to be used for underlying storage") \ + }, \ + {.name = "adapter-name", \ + .type = VSH_OT_STRING, \ + .help = N_("adapter name to be used for underlying storage") \ + }, \ + {.name = "adapter-wwnn", \ + .type = VSH_OT_STRING, \ + .help = N_("adapter wwnn to be used for underlying storage") \ + }, \ + {.name = "adapter-wwpn", \ + .type = VSH_OT_STRING, \ + .help = N_("adapter wwpn to be used for underlying storage") \ + }, \ + {.name = "adapter-parent", \ + .type = VSH_OT_STRING, \ + .help = N_("adapter parent to be used for underlying storage") \ + } \ virStoragePoolPtr virshCommandOptPoolBy(vshControl *ctl, const vshCmd *cmd, const char *optname, @@ -1928,12 +1928,12 @@ cmdPoolEdit(vshControl *ctl, const vshCmd *cmd) } #define EDIT_GET_XML virStoragePoolGetXMLDesc(pool, flags) -#define EDIT_NOT_CHANGED \ - do { \ - vshPrintExtra(ctl, _("Pool %s XML configuration not changed.\n"), \ - virStoragePoolGetName(pool)); \ - ret = true; \ - goto edit_cleanup; \ +#define EDIT_NOT_CHANGED \ + do { \ + vshPrintExtra(ctl, _("Pool %s XML configuration not changed.\n"), \ + virStoragePoolGetName(pool)); \ + ret = true; \ + goto edit_cleanup; \ } while (0) #define EDIT_DEFINE \ (pool_edited = virStoragePoolDefineXML(priv->conn, doc_edited, 0)) diff --git a/tools/virsh-pool.h b/tools/virsh-pool.h index feee176a43..5f2671ae63 100644 --- a/tools/virsh-pool.h +++ b/tools/virsh-pool.h @@ -33,8 +33,8 @@ virshCommandOptPoolBy(vshControl *ctl, const vshCmd *cmd, const char *optname, const char **name, unsigned int flags); /* default is lookup by Name and UUID */ -# define virshCommandOptPool(_ctl, _cmd, _optname, _name) \ - virshCommandOptPoolBy(_ctl, _cmd, _optname, _name, \ +# define virshCommandOptPool(_ctl, _cmd, _optname, _name) \ + virshCommandOptPoolBy(_ctl, _cmd, _optname, _name, \ VIRSH_BYUUID | VIRSH_BYNAME) extern const vshCmdDef storagePoolCmds[]; diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index 24cd4abd9d..ec06fc708e 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -42,7 +42,7 @@ #include "virxml.h" #include "conf/snapshot_conf.h" -#define VIRSH_COMMON_OPT_DOMAIN_FULL \ +#define VIRSH_COMMON_OPT_DOMAIN_FULL \ VIRSH_COMMON_OPT_DOMAIN(N_("domain name, id or uuid")) \ /* Helper for snapshot-create and snapshot-create-as */ @@ -554,16 +554,16 @@ cmdSnapshotEdit(vshControl *ctl, const vshCmd *cmd) #define EDIT_GET_XML \ virDomainSnapshotGetXMLDesc(snapshot, getxml_flags) -#define EDIT_NOT_CHANGED \ - do { \ - /* Depending on flags, we re-edit even if XML is unchanged. */ \ - if (!(define_flags & VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT)) { \ - vshPrintExtra(ctl, \ +#define EDIT_NOT_CHANGED \ + do { \ + /* Depending on flags, we re-edit even if XML is unchanged. */ \ + if (!(define_flags & VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT)) { \ + vshPrintExtra(ctl, \ _("Snapshot %s XML configuration not changed.\n"), \ - name); \ - ret = true; \ - goto edit_cleanup; \ - } \ + name); \ + ret = true; \ + goto edit_cleanup; \ + } \ } while (0) #define EDIT_DEFINE \ (strstr(doc, "disk-snapshot") ? \ @@ -1501,17 +1501,17 @@ cmdSnapshotList(vshControl *ctl, const vshCmd *cmd) VSH_EXCLUSIVE_OPTIONS_VAR(roots, from); VSH_EXCLUSIVE_OPTIONS_VAR(roots, current); -#define FILTER(option, flag) \ - do { \ - if (vshCommandOptBool(cmd, option)) { \ - if (tree) { \ - vshError(ctl, \ +#define FILTER(option, flag) \ + do { \ + if (vshCommandOptBool(cmd, option)) { \ + if (tree) { \ + vshError(ctl, \ _("--%s and --tree are mutually exclusive"), \ - option); \ - return false; \ - } \ - flags |= VIR_DOMAIN_SNAPSHOT_LIST_ ## flag; \ - } \ + option); \ + return false; \ + } \ + flags |= VIR_DOMAIN_SNAPSHOT_LIST_ ## flag; \ + } \ } while (0) FILTER("leaves", LEAVES); diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c index 0736bdcdb2..f540a3240f 100644 --- a/tools/virsh-volume.c +++ b/tools/virsh-volume.c @@ -43,24 +43,24 @@ #include "virxml.h" #include "virstring.h" -#define VIRSH_COMMON_OPT_POOL_FULL \ - VIRSH_COMMON_OPT_POOL(N_("pool name or uuid")) \ +#define VIRSH_COMMON_OPT_POOL_FULL \ + VIRSH_COMMON_OPT_POOL(N_("pool name or uuid")) \ -#define VIRSH_COMMON_OPT_POOL_NAME \ - VIRSH_COMMON_OPT_POOL(N_("pool name")) \ +#define VIRSH_COMMON_OPT_POOL_NAME \ + VIRSH_COMMON_OPT_POOL(N_("pool name")) \ -#define VIRSH_COMMON_OPT_POOL_OPTIONAL \ - {.name = "pool", \ - .type = VSH_OT_STRING, \ - .help = N_("pool name or uuid") \ - } \ +#define VIRSH_COMMON_OPT_POOL_OPTIONAL \ + {.name = "pool", \ + .type = VSH_OT_STRING, \ + .help = N_("pool name or uuid") \ + } \ -#define VIRSH_COMMON_OPT_VOLUME_VOL \ - {.name = "vol", \ - .type = VSH_OT_DATA, \ - .flags = VSH_OFLAG_REQ, \ - .help = N_("vol name, key or path") \ - } \ +#define VIRSH_COMMON_OPT_VOLUME_VOL \ + {.name = "vol", \ + .type = VSH_OT_DATA, \ + .flags = VSH_OFLAG_REQ, \ + .help = N_("vol name, key or path") \ + } \ virStorageVolPtr virshCommandOptVolBy(vshControl *ctl, const vshCmd *cmd, diff --git a/tools/virsh-volume.h b/tools/virsh-volume.h index e01ede4619..60f647776e 100644 --- a/tools/virsh-volume.h +++ b/tools/virsh-volume.h @@ -34,8 +34,8 @@ virStorageVolPtr virshCommandOptVolBy(vshControl *ctl, const vshCmd *cmd, const char **name, unsigned int flags); /* default is lookup by Name and UUID */ -# define virshCommandOptVol(_ctl, _cmd, _optname, _pooloptname, _name) \ - virshCommandOptVolBy(_ctl, _cmd, _optname, _pooloptname, _name, \ +# define virshCommandOptVol(_ctl, _cmd, _optname, _pooloptname, _name) \ + virshCommandOptVolBy(_ctl, _cmd, _optname, _pooloptname, _name, \ VIRSH_BYUUID | VIRSH_BYNAME) extern const vshCmdDef storageVolCmds[]; diff --git a/tools/virsh.h b/tools/virsh.h index 9e42ef9bb7..8aef83b6fe 100644 --- a/tools/virsh.h +++ b/tools/virsh.h @@ -63,44 +63,44 @@ /* * Common command options */ -# define VIRSH_COMMON_OPT_POOL(_helpstr) \ - {.name = "pool", \ - .type = VSH_OT_DATA, \ - .flags = VSH_OFLAG_REQ, \ - .help = _helpstr \ - } \ +# define VIRSH_COMMON_OPT_POOL(_helpstr) \ + {.name = "pool", \ + .type = VSH_OT_DATA, \ + .flags = VSH_OFLAG_REQ, \ + .help = _helpstr \ + } \ -# define VIRSH_COMMON_OPT_DOMAIN(_helpstr) \ - {.name = "domain", \ - .type = VSH_OT_DATA, \ - .flags = VSH_OFLAG_REQ, \ - .help = _helpstr \ - } \ +# define VIRSH_COMMON_OPT_DOMAIN(_helpstr) \ + {.name = "domain", \ + .type = VSH_OT_DATA, \ + .flags = VSH_OFLAG_REQ, \ + .help = _helpstr \ + } \ -# define VIRSH_COMMON_OPT_CONFIG(_helpstr) \ - {.name = "config", \ - .type = VSH_OT_BOOL, \ - .help = _helpstr \ - } \ +# define VIRSH_COMMON_OPT_CONFIG(_helpstr) \ + {.name = "config", \ + .type = VSH_OT_BOOL, \ + .help = _helpstr \ + } \ -# define VIRSH_COMMON_OPT_LIVE(_helpstr) \ - {.name = "live", \ - .type = VSH_OT_BOOL, \ - .help = _helpstr \ - } \ +# define VIRSH_COMMON_OPT_LIVE(_helpstr) \ + {.name = "live", \ + .type = VSH_OT_BOOL, \ + .help = _helpstr \ + } \ -# define VIRSH_COMMON_OPT_CURRENT(_helpstr) \ - {.name = "current", \ - .type = VSH_OT_BOOL, \ - .help = _helpstr \ - } \ +# define VIRSH_COMMON_OPT_CURRENT(_helpstr) \ + {.name = "current", \ + .type = VSH_OT_BOOL, \ + .help = _helpstr \ + } \ -# define VIRSH_COMMON_OPT_FILE(_helpstr) \ - {.name = "file", \ - .type = VSH_OT_DATA, \ - .flags = VSH_OFLAG_REQ, \ - .help = _helpstr \ - } \ +# define VIRSH_COMMON_OPT_FILE(_helpstr) \ + {.name = "file", \ + .type = VSH_OT_DATA, \ + .flags = VSH_OFLAG_REQ, \ + .help = _helpstr \ + } \ typedef struct _virshControl virshControl; typedef virshControl *virshControlPtr; diff --git a/tools/virt-admin.c b/tools/virt-admin.c index 6b3426ef6f..e529a28916 100644 --- a/tools/virt-admin.c +++ b/tools/virt-admin.c @@ -522,14 +522,14 @@ cmdSrvThreadpoolSet(vshControl *ctl, const vshCmd *cmd) if (vshCommandOptStringReq(ctl, cmd, "server", &srvname) < 0) return false; -#define PARSE_CMD_TYPED_PARAM(NAME, FIELD) \ - if ((rv = vshCommandOptUInt(ctl, cmd, NAME, &val)) < 0) { \ - vshError(ctl, _("Unable to parse integer parameter '%s'"), NAME); \ - goto cleanup; \ - } else if (rv > 0) { \ - if (virTypedParamsAddUInt(¶ms, &nparams, &maxparams, \ - FIELD, val) < 0) \ - goto save_error; \ +#define PARSE_CMD_TYPED_PARAM(NAME, FIELD) \ + if ((rv = vshCommandOptUInt(ctl, cmd, NAME, &val)) < 0) { \ + vshError(ctl, _("Unable to parse integer parameter '%s'"), NAME); \ + goto cleanup; \ + } else if (rv > 0) { \ + if (virTypedParamsAddUInt(¶ms, &nparams, &maxparams, \ + FIELD, val) < 0) \ + goto save_error; \ } PARSE_CMD_TYPED_PARAM("max-workers", VIR_THREADPOOL_WORKERS_MAX); @@ -918,14 +918,14 @@ cmdSrvClientsSet(vshControl *ctl, const vshCmd *cmd) if (vshCommandOptStringReq(ctl, cmd, "server", &srvname) < 0) return false; -#define PARSE_CMD_TYPED_PARAM(NAME, FIELD) \ - if ((rv = vshCommandOptUInt(ctl, cmd, NAME, &val)) < 0) { \ - vshError(ctl, _("Unable to parse integer parameter '%s'"), NAME); \ - goto cleanup; \ - } else if (rv > 0) { \ - if (virTypedParamsAddUInt(¶ms, &nparams, &maxparams, \ - FIELD, val) < 0) \ - goto save_error; \ +#define PARSE_CMD_TYPED_PARAM(NAME, FIELD) \ + if ((rv = vshCommandOptUInt(ctl, cmd, NAME, &val)) < 0) { \ + vshError(ctl, _("Unable to parse integer parameter '%s'"), NAME); \ + goto cleanup; \ + } else if (rv > 0) { \ + if (virTypedParamsAddUInt(¶ms, &nparams, &maxparams, \ + FIELD, val) < 0) \ + goto save_error; \ } PARSE_CMD_TYPED_PARAM("max-clients", VIR_SERVER_CLIENTS_MAX); diff --git a/tools/virt-host-validate-bhyve.c b/tools/virt-host-validate-bhyve.c index c7bf96f051..2ab8e45e6e 100644 --- a/tools/virt-host-validate-bhyve.c +++ b/tools/virt-host-validate-bhyve.c @@ -28,16 +28,16 @@ #include "virt-host-validate-bhyve.h" #include "virt-host-validate-common.h" -#define MODULE_STATUS(mod, err_msg, err_code) \ - virHostMsgCheck("BHYVE", _("for %s module"), #mod); \ - if (mod ## _loaded) { \ - virHostMsgPass(); \ - } else { \ - virHostMsgFail(err_code, \ +#define MODULE_STATUS(mod, err_msg, err_code) \ + virHostMsgCheck("BHYVE", _("for %s module"), #mod); \ + if (mod ## _loaded) { \ + virHostMsgPass(); \ + } else { \ + virHostMsgFail(err_code, \ _("%s module is not loaded, " err_msg), \ - #mod); \ - ret = -1; \ - } \ + #mod); \ + ret = -1; \ + } \ #define MODULE_STATUS_FAIL(mod, err_msg) \ MODULE_STATUS(mod, err_msg, VIR_HOST_VALIDATE_FAIL) diff --git a/tools/vsh.h b/tools/vsh.h index 2f686eba6a..ab755bccff 100644 --- a/tools/vsh.h +++ b/tools/vsh.h @@ -387,68 +387,68 @@ bool cmdPwd(vshControl *ctl, const vshCmd *cmd); bool cmdQuit(vshControl *ctl, const vshCmd *cmd); bool cmdSelfTest(vshControl *ctl, const vshCmd *cmd); -# define VSH_CMD_CD \ - { \ - .name = "cd", \ - .handler = cmdCd, \ - .opts = opts_cd, \ - .info = info_cd, \ - .flags = VSH_CMD_FLAG_NOCONNECT \ +# define VSH_CMD_CD \ + { \ + .name = "cd", \ + .handler = cmdCd, \ + .opts = opts_cd, \ + .info = info_cd, \ + .flags = VSH_CMD_FLAG_NOCONNECT \ } -# define VSH_CMD_ECHO \ - { \ - .name = "echo", \ - .handler = cmdEcho, \ - .opts = opts_echo, \ - .info = info_echo, \ - .flags = VSH_CMD_FLAG_NOCONNECT \ +# define VSH_CMD_ECHO \ + { \ + .name = "echo", \ + .handler = cmdEcho, \ + .opts = opts_echo, \ + .info = info_echo, \ + .flags = VSH_CMD_FLAG_NOCONNECT \ } -# define VSH_CMD_EXIT \ - { \ - .name = "exit", \ - .handler = cmdQuit, \ - .opts = NULL, \ - .info = info_quit, \ - .flags = VSH_CMD_FLAG_NOCONNECT \ +# define VSH_CMD_EXIT \ + { \ + .name = "exit", \ + .handler = cmdQuit, \ + .opts = NULL, \ + .info = info_quit, \ + .flags = VSH_CMD_FLAG_NOCONNECT \ } -# define VSH_CMD_HELP \ - { \ - .name = "help", \ - .handler = cmdHelp, \ - .opts = opts_help, \ - .info = info_help, \ - .flags = VSH_CMD_FLAG_NOCONNECT \ +# define VSH_CMD_HELP \ + { \ + .name = "help", \ + .handler = cmdHelp, \ + .opts = opts_help, \ + .info = info_help, \ + .flags = VSH_CMD_FLAG_NOCONNECT \ } -# define VSH_CMD_PWD \ - { \ - .name = "pwd", \ - .handler = cmdPwd, \ - .opts = NULL, \ - .info = info_pwd, \ - .flags = VSH_CMD_FLAG_NOCONNECT \ +# define VSH_CMD_PWD \ + { \ + .name = "pwd", \ + .handler = cmdPwd, \ + .opts = NULL, \ + .info = info_pwd, \ + .flags = VSH_CMD_FLAG_NOCONNECT \ } -# define VSH_CMD_QUIT \ - { \ - .name = "quit", \ - .handler = cmdQuit, \ - .opts = NULL, \ - .info = info_quit, \ - .flags = VSH_CMD_FLAG_NOCONNECT \ +# define VSH_CMD_QUIT \ + { \ + .name = "quit", \ + .handler = cmdQuit, \ + .opts = NULL, \ + .info = info_quit, \ + .flags = VSH_CMD_FLAG_NOCONNECT \ } -# define VSH_CMD_SELF_TEST \ - { \ - .name = "self-test", \ - .handler = cmdSelfTest, \ - .opts = NULL, \ - .info = info_selftest, \ - .flags = VSH_CMD_FLAG_NOCONNECT | VSH_CMD_FLAG_ALIAS, \ - .alias = "self-test" \ +# define VSH_CMD_SELF_TEST \ + { \ + .name = "self-test", \ + .handler = cmdSelfTest, \ + .opts = NULL, \ + .info = info_selftest, \ + .flags = VSH_CMD_FLAG_NOCONNECT | VSH_CMD_FLAG_ALIAS, \ + .alias = "self-test" \ } @@ -483,11 +483,11 @@ char *_vshStrdup(vshControl *ctl, const char *s, const char *filename, * This helper does an early return and therefore it has to be called * before anything that would require cleanup. */ -# define VSH_EXCLUSIVE_OPTIONS_EXPR(NAME1, EXPR1, NAME2, EXPR2) \ - if ((EXPR1) && (EXPR2)) { \ - vshError(ctl, _("Options --%s and --%s are mutually exclusive"), \ - NAME1, NAME2); \ - return false; \ +# define VSH_EXCLUSIVE_OPTIONS_EXPR(NAME1, EXPR1, NAME2, EXPR2) \ + if ((EXPR1) && (EXPR2)) { \ + vshError(ctl, _("Options --%s and --%s are mutually exclusive"), \ + NAME1, NAME2); \ + return false; \ } /* VSH_EXCLUSIVE_OPTIONS: @@ -501,8 +501,8 @@ char *_vshStrdup(vshControl *ctl, const char *s, const char *filename, * This helper does an early return and therefore it has to be called * before anything that would require cleanup. */ -# define VSH_EXCLUSIVE_OPTIONS(NAME1, NAME2) \ - VSH_EXCLUSIVE_OPTIONS_EXPR(NAME1, vshCommandOptBool(cmd, NAME1), \ +# define VSH_EXCLUSIVE_OPTIONS(NAME1, NAME2) \ + VSH_EXCLUSIVE_OPTIONS_EXPR(NAME1, vshCommandOptBool(cmd, NAME1), \ NAME2, vshCommandOptBool(cmd, NAME2)) /* VSH_EXCLUSIVE_OPTIONS_VAR: @@ -516,7 +516,7 @@ char *_vshStrdup(vshControl *ctl, const char *s, const char *filename, * This helper does an early return and therefore it has to be called * before anything that would require cleanup. */ -# define VSH_EXCLUSIVE_OPTIONS_VAR(VARNAME1, VARNAME2) \ +# define VSH_EXCLUSIVE_OPTIONS_VAR(VARNAME1, VARNAME2) \ VSH_EXCLUSIVE_OPTIONS_EXPR(#VARNAME1, VARNAME1, #VARNAME2, VARNAME2) /* Macros to help dealing with required options. */ @@ -534,13 +534,13 @@ char *_vshStrdup(vshControl *ctl, const char *s, const char *filename, * This helper does an early return and therefore it has to be called * before anything that would require cleanup. */ -# define VSH_REQUIRE_OPTION_EXPR(NAME1, EXPR1, NAME2, EXPR2) \ - do { \ - if ((EXPR1) && !(EXPR2)) { \ - vshError(ctl, _("Option --%s is required by option --%s"), \ - NAME2, NAME1); \ - return false; \ - } \ +# define VSH_REQUIRE_OPTION_EXPR(NAME1, EXPR1, NAME2, EXPR2) \ + do { \ + if ((EXPR1) && !(EXPR2)) { \ + vshError(ctl, _("Option --%s is required by option --%s"), \ + NAME2, NAME1); \ + return false; \ + } \ } while (0) /* VSH_REQUIRE_OPTION: @@ -554,8 +554,8 @@ char *_vshStrdup(vshControl *ctl, const char *s, const char *filename, * This helper does an early return and therefore it has to be called * before anything that would require cleanup. */ -# define VSH_REQUIRE_OPTION(NAME1, NAME2) \ - VSH_REQUIRE_OPTION_EXPR(NAME1, vshCommandOptBool(cmd, NAME1), \ +# define VSH_REQUIRE_OPTION(NAME1, NAME2) \ + VSH_REQUIRE_OPTION_EXPR(NAME1, vshCommandOptBool(cmd, NAME1), \ NAME2, vshCommandOptBool(cmd, NAME2)) /* VSH_REQUIRE_OPTION_VAR: @@ -570,7 +570,7 @@ char *_vshStrdup(vshControl *ctl, const char *s, const char *filename, * This helper does an early return and therefore it has to be called * before anything that would require cleanup. */ -# define VSH_REQUIRE_OPTION_VAR(VARNAME1, VARNAME2) \ +# define VSH_REQUIRE_OPTION_VAR(VARNAME1, VARNAME2) \ VSH_REQUIRE_OPTION_EXPR(#VARNAME1, VARNAME1, #VARNAME2, VARNAME2) #endif /* VSH_H */ diff --git a/tools/wireshark/src/packet-libvirt.c b/tools/wireshark/src/packet-libvirt.c index c15e9c3402..71f0f6114a 100644 --- a/tools/wireshark/src/packet-libvirt.c +++ b/tools/wireshark/src/packet-libvirt.c @@ -35,9 +35,9 @@ #include "internal.h" /* Wireshark 1.12 brings API change */ -#define WIRESHARK_VERSION \ - ((VERSION_MAJOR * 1000 * 1000) + \ - (VERSION_MINOR * 1000) + \ +#define WIRESHARK_VERSION \ + ((VERSION_MAJOR * 1000 * 1000) + \ + (VERSION_MINOR * 1000) + \ (VERSION_MICRO)) static int proto_libvirt = -1; @@ -57,20 +57,20 @@ int hf_libvirt_unknown = -1; static gint ett_libvirt = -1; static gint ett_libvirt_stream_hole = -1; -#define XDR_PRIMITIVE_DISSECTOR(xtype, ctype, ftype) \ - static gboolean \ - dissect_xdr_##xtype(tvbuff_t *tvb, proto_tree *tree, XDR *xdrs, int hf) \ - { \ - goffset start; \ - ctype val; \ - start = xdr_getpos(xdrs); \ - if (xdr_##xtype(xdrs, &val)) { \ +#define XDR_PRIMITIVE_DISSECTOR(xtype, ctype, ftype) \ + static gboolean \ + dissect_xdr_##xtype(tvbuff_t *tvb, proto_tree *tree, XDR *xdrs, int hf) \ + { \ + goffset start; \ + ctype val; \ + start = xdr_getpos(xdrs); \ + if (xdr_##xtype(xdrs, &val)) { \ proto_tree_add_##ftype(tree, hf, tvb, start, xdr_getpos(xdrs) - start, val); \ - return TRUE; \ - } else { \ + return TRUE; \ + } else { \ proto_tree_add_item(tree, hf_libvirt_unknown, tvb, start, -1, ENC_NA); \ - return FALSE; \ - } \ + return FALSE; \ + } \ } XDR_PRIMITIVE_DISSECTOR(int, gint32, int)