I'm only 80% convinced that this patch is a good idea
because in some cases I'm not entirely happy about
commenting out macros that may well be used in the near
future. On the plus side it has identified a reasonable
number of unused legacy crufty macros
This enables the -Wunused-macros GCC flag to identify
historical macros which are no longer used due to
code refactoring.
* m4/virt-compile-warnings.m4: Enable -Wunused-macros
* daemon/libvirtd.c: Remove MAX_LISTEN
* daemon/remote.c: Remove VIR_FROM_THIS
* examples/domain-events/events-c/event-test.c: Remove VIR_DEBUG
* python/libvirt-override.c: Put NAME() inside DEBUG_ERROR
* src/esx/esx*.c: Comment out unused VIR_FROM_THIS
* src/node_device/node_device_hal.c: Remove pointless macros
for accessing privateData
* src/openvz/openvz_driver.c: Remove CMDBUF_LEN/CMDOP_LEN
* src/qemu/qemu_monitor_text.c: Remove QEMU_CMD_PROMPT
and QEMU_PASSWD_PROMPT
* src/remote/remote_driver.c: Remove UNIX_PATH_MAX
* src/security/security_stack.c: Remove VIR_FROM_THIS
* src/uml/uml_conf.c: Remove umlLog()
* src/uml/uml_driver.c: Remove TEMPDIR
* src/util/bridge.c: Remove JIFFIES_TO_MS/MS_TO_JIFFIES
* src/util/hooks.c: Ensure VIR_FROM_THIS is used
* src/util/logging.c: Remove VIR_FROM_THIS
* src/util/macvtap.c: Disable unused constants
* src/util/storage_file.c: Disable QCOW1_HDR_TOTAL_SIZE
* src/vbox/vbox_driver.c: Remove duplicated VIR_FROM_THIS
and make sure it is used
* src/util/pci.c: Disable some unused constants
* src/xen/xen_hypervisor.c: Remove XEN_V0_IOCTL_HYPERCALL_CMD
and unused DOMFLAGS_CPUMASK/DOMFLAGS_CPUSHIFT
* src/xen/xm_internal.c: Remove XM_XML_ERROR,
XEND_CONFIG_MAX_VERS_NET_TYPE_IOEMU and
XEND_CONFIG_MIN_VERS_PVFB_NEWCONF
* tools/virsh.c: Remove DIR_MODE/LOCK_MODE, LVL_NOTICE constants
* tests/sockettest.c: Remove DO_TEST_PARSE
---
daemon/libvirtd.c | 2 +-
daemon/remote.c | 8 ++++++--
m4/virt-compile-warnings.m4 | 1 -
python/libvirt-override.c | 4 +++-
src/driver.c | 3 +--
src/esx/esx_device_monitor.c | 2 +-
src/esx/esx_interface_driver.c | 2 +-
src/esx/esx_network_driver.c | 2 +-
src/esx/esx_nwfilter_driver.c | 2 +-
src/esx/esx_secret_driver.c | 2 +-
src/esx/esx_vi.c | 12 +++---------
src/esx/esx_vi_methods.c | 11 ++++++-----
src/esx/esx_vi_types.c | 5 +++--
src/libvirt.c | 3 ---
src/locking/domain_lock.c | 2 --
src/node_device/node_device_hal.c | 17 ++++-------------
src/openvz/openvz_driver.c | 2 --
src/qemu/qemu_monitor_text.c | 3 ---
src/remote/remote_driver.c | 8 ++++++--
src/security/security_stack.c | 2 --
src/uml/uml_conf.c | 2 --
src/uml/uml_driver.c | 3 ---
src/util/bridge.c | 3 ---
src/util/hooks.c | 2 +-
src/util/logging.c | 2 --
src/util/macvtap.c | 6 ++++--
src/util/netlink.c | 8 +++++---
src/util/pci.c | 4 ++--
src/util/storage_file.c | 4 +++-
src/vbox/vbox_driver.c | 4 +---
src/xen/xen_hypervisor.c | 14 +++++---------
src/xen/xm_internal.c | 9 ---------
tests/sockettest.c | 10 ----------
tools/virsh.c | 16 +++-------------
34 files changed, 62 insertions(+), 118 deletions(-)
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 06d2077..3c3ebe1 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -1263,7 +1263,7 @@ enum {
OPT_VERSION = 129
};
-#define MAX_LISTEN 5
+
int main(int argc, char **argv) {
virNetServerPtr srv = NULL;
char *remote_config_file = NULL;
diff --git a/daemon/remote.c b/daemon/remote.c
index 2889908..5f089ce 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -65,10 +65,14 @@
(_to) = (_from); \
} while (0)
-# define HYPER_TO_LONG(_to, _from) HYPER_TO_TYPE(long, _to, _from)
+# if 0
+# define HYPER_TO_LONG(_to, _from) HYPER_TO_TYPE(long, _to, _from)
+# endif
# define HYPER_TO_ULONG(_to, _from) HYPER_TO_TYPE(unsigned long, _to, _from)
#else
-# define HYPER_TO_LONG(_to, _from) (_to) = (_from)
+# if 0
+# define HYPER_TO_LONG(_to, _from) (_to) = (_from)
+# endif
# define HYPER_TO_ULONG(_to, _from) (_to) = (_from)
#endif
diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4
index 305036f..4e98bc1 100644
--- a/m4/virt-compile-warnings.m4
+++ b/m4/virt-compile-warnings.m4
@@ -63,7 +63,6 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
dontwarn="$dontwarn -Wconversion"
dontwarn="$dontwarn -Wsign-conversion"
dontwarn="$dontwarn -Wpacked"
- dontwarn="$dontwarn -Wunused-macros"
dontwarn="$dontwarn -Woverlength-strings"
dontwarn="$dontwarn -Wstack-protector"
diff --git a/python/libvirt-override.c b/python/libvirt-override.c
index 8be9af7..4bf0bfb 100644
--- a/python/libvirt-override.c
+++ b/python/libvirt-override.c
@@ -2663,7 +2663,9 @@ static char *updateTimeoutName = NULL;
static PyObject *removeTimeoutObj = NULL;
static char *removeTimeoutName = NULL;
-#define NAME(fn) ( fn ## Name ? fn ## Name : # fn )
+#if DEBUG_ERROR
+# define NAME(fn) ( fn ## Name ? fn ## Name : # fn )
+#endif
static int
libvirt_virEventAddHandleFunc (int fd,
diff --git a/src/driver.c b/src/driver.c
index 579c2b3..16c9661 100644
--- a/src/driver.c
+++ b/src/driver.c
@@ -30,13 +30,12 @@
#include "util.h"
#include "configmake.h"
-#define DEFAULT_DRIVER_DIR LIBDIR "/libvirt/connection-driver"
-
/* Make sure ... INTERNAL_CALL cannot be set by the caller */
verify((VIR_SECRET_GET_VALUE_INTERNAL_CALL &
VIR_SECRET_GET_VALUE_FLAGS_MASK) == 0);
#ifdef WITH_DRIVER_MODULES
+# define DEFAULT_DRIVER_DIR LIBDIR "/libvirt/connection-driver"
/* XXX re-implment this for other OS, or use libtools helper lib ? */
diff --git a/src/esx/esx_device_monitor.c b/src/esx/esx_device_monitor.c
index 4bc8e7f..fc7b4de 100644
--- a/src/esx/esx_device_monitor.c
+++ b/src/esx/esx_device_monitor.c
@@ -35,7 +35,7 @@
#include "esx_vi_methods.h"
#include "esx_util.h"
-#define VIR_FROM_THIS VIR_FROM_ESX
+/* #define VIR_FROM_THIS VIR_FROM_ESX */
diff --git a/src/esx/esx_interface_driver.c b/src/esx/esx_interface_driver.c
index a468976..f324f0f 100644
--- a/src/esx/esx_interface_driver.c
+++ b/src/esx/esx_interface_driver.c
@@ -35,7 +35,7 @@
#include "esx_vi_methods.h"
#include "esx_util.h"
-#define VIR_FROM_THIS VIR_FROM_ESX
+/* #define VIR_FROM_THIS VIR_FROM_ESX */
diff --git a/src/esx/esx_network_driver.c b/src/esx/esx_network_driver.c
index 3c76fae..3a72f27 100644
--- a/src/esx/esx_network_driver.c
+++ b/src/esx/esx_network_driver.c
@@ -35,7 +35,7 @@
#include "esx_vi_methods.h"
#include "esx_util.h"
-#define VIR_FROM_THIS VIR_FROM_ESX
+/* #define VIR_FROM_THIS VIR_FROM_ESX */
diff --git a/src/esx/esx_nwfilter_driver.c b/src/esx/esx_nwfilter_driver.c
index 13cacd4..80bf5ff 100644
--- a/src/esx/esx_nwfilter_driver.c
+++ b/src/esx/esx_nwfilter_driver.c
@@ -34,7 +34,7 @@
#include "esx_vi_methods.h"
#include "esx_util.h"
-#define VIR_FROM_THIS VIR_FROM_ESX
+/* #define VIR_FROM_THIS VIR_FROM_ESX */
diff --git a/src/esx/esx_secret_driver.c b/src/esx/esx_secret_driver.c
index 656224e..68dd2bb 100644
--- a/src/esx/esx_secret_driver.c
+++ b/src/esx/esx_secret_driver.c
@@ -34,7 +34,7 @@
#include "esx_vi_methods.h"
#include "esx_util.h"
-#define VIR_FROM_THIS VIR_FROM_ESX
+/* #define VIR_FROM_THIS VIR_FROM_ESX */
diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
index 64e5b73..fd3b447 100644
--- a/src/esx/esx_vi.c
+++ b/src/esx/esx_vi.c
@@ -40,13 +40,6 @@
#define VIR_FROM_THIS VIR_FROM_ESX
-
-#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) \
@@ -3928,11 +3921,12 @@ esxVI_ProductVersionToDefaultVirtualHWVersion(esxVI_ProductVersion
productVersio
-
-#define ESX_VI__TEMPLATE__PROPERTY__CAST_FROM_ANY_TYPE_IGNORE(_name) \
+#if 0
+# define ESX_VI__TEMPLATE__PROPERTY__CAST_FROM_ANY_TYPE_IGNORE(_name) \
if (STREQ(dynamicProperty->name, #_name)) { \
continue; \
}
+#endif
diff --git a/src/esx/esx_vi_methods.c b/src/esx/esx_vi_methods.c
index 1f1780f..0284ba7 100644
--- a/src/esx/esx_vi_methods.c
+++ b/src/esx/esx_vi_methods.c
@@ -1,4 +1,3 @@
-
/*
* esx_vi_methods.c: client for the VMware VI API 2.5 to manage ESX hosts
*
@@ -52,8 +51,10 @@
-#define ESX_VI__METHOD__CHECK_OUTPUT__RequiredList \
+#if 0
+# define ESX_VI__METHOD__CHECK_OUTPUT__RequiredList \
ESX_VI__METHOD__CHECK_OUTPUT__NotNone
+#endif
@@ -78,12 +79,12 @@
}
-
-#define ESX_VI__METHOD__DESERIALIZE_OUTPUT__RequiredList(_type, _suffix) \
+#if 0
+# define ESX_VI__METHOD__DESERIALIZE_OUTPUT__RequiredList(_type) \
if (esxVI_##_type##_DeserializeList(response->node, output) < 0) { \
goto cleanup; \
}
-
+#endif
#define ESX_VI__METHOD__DESERIALIZE_OUTPUT__OptionalItem(_type, _suffix) \
diff --git a/src/esx/esx_vi_types.c b/src/esx/esx_vi_types.c
index 2332fde..5d07103 100644
--- a/src/esx/esx_vi_types.c
+++ b/src/esx/esx_vi_types.c
@@ -557,11 +557,12 @@
-#define ESX_VI__TEMPLATE__DISPATCH__DEEP_COPY(_type) \
+#if 0
+# define ESX_VI__TEMPLATE__DISPATCH__DEEP_COPY(_type) \
case esxVI_Type_##_type: \
return esxVI_##_type##_DeepCopy((esxVI_##_type **)dst, \
(esxVI_##_type *)src);
-
+#endif
#define ESX_VI__TEMPLATE__DISPATCH__CAST_FROM_ANY_TYPE(_type) \
diff --git a/src/libvirt.c b/src/libvirt.c
index e00c64f..c00823e 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -543,9 +543,6 @@ DllMain (HINSTANCE instance ATTRIBUTE_UNUSED,
#define virLibSecretError(code, ...) \
virReportErrorHelper(VIR_FROM_SECRET, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)
-#define virLibStreamError(code, ...) \
- virReportErrorHelper(VIR_FROM_STREAMS, code, __FILE__, \
- __FUNCTION__, __LINE__, __VA_ARGS__)
#define virLibNWFilterError(code, ...) \
virReportErrorHelper(VIR_FROM_NWFILTER, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)
diff --git a/src/locking/domain_lock.c b/src/locking/domain_lock.c
index de1937c..58cbd3c 100644
--- a/src/locking/domain_lock.c
+++ b/src/locking/domain_lock.c
@@ -27,8 +27,6 @@
#include "virterror_internal.h"
#include "logging.h"
-#define VIR_FROM_THIS VIR_FROM_LOCKING
-
static int virDomainLockManagerAddLease(virLockManagerPtr lock,
virDomainLeaseDefPtr lease)
diff --git a/src/node_device/node_device_hal.c b/src/node_device/node_device_hal.c
index 27fedc9..2aa7dd9 100644
--- a/src/node_device/node_device_hal.c
+++ b/src/node_device/node_device_hal.c
@@ -37,21 +37,12 @@
#include "logging.h"
#include "node_device_driver.h"
-#define VIR_FROM_THIS VIR_FROM_NODEDEV
-
/*
* Host device enumeration (HAL implementation)
*/
static virDeviceMonitorStatePtr driverState;
-#define CONN_DRV_STATE(conn) \
- ((virDeviceMonitorStatePtr)((conn)->devMonPrivateData))
-#define DRV_STATE_HAL_CTX(ds) ((LibHalContext *)((ds)->privateData))
-#define CONN_HAL_CTX(conn) DRV_STATE_HAL_CTX(CONN_DRV_STATE(conn))
-
-#define NODE_DEV_UDI(obj) ((const char *)((obj)->privateData)
-
static const char *hal_name(const char *udi)
{
@@ -440,7 +431,7 @@ static void dev_create(const char *udi)
return;
nodeDeviceLock(driverState);
- ctx = DRV_STATE_HAL_CTX(driverState);
+ ctx = driverState->privateData;
if (VIR_ALLOC(def) < 0)
goto failure;
@@ -599,7 +590,7 @@ static void dbus_watch_callback(int fdatch ATTRIBUTE_UNUSED,
(void)dbus_watch_handle(watch, dbus_flags);
nodeDeviceLock(driverState);
- hal_ctx = DRV_STATE_HAL_CTX(driverState);
+ hal_ctx = driverState->privateData;
dbus_conn = libhal_ctx_get_dbus_connection(hal_ctx);
nodeDeviceUnlock(driverState);
while (dbus_connection_dispatch(dbus_conn) == DBUS_DISPATCH_DATA_REMAINS)
@@ -807,7 +798,7 @@ static int halDeviceMonitorShutdown(void)
{
if (driverState) {
nodeDeviceLock(driverState);
- LibHalContext *hal_ctx = DRV_STATE_HAL_CTX(driverState);
+ LibHalContext *hal_ctx = driverState->privateData;
virNodeDeviceObjListFree(&driverState->devs);
(void)libhal_ctx_shutdown(hal_ctx, NULL);
(void)libhal_ctx_free(hal_ctx);
@@ -833,7 +824,7 @@ static int halDeviceMonitorReload(void)
virNodeDeviceObjListFree(&driverState->devs);
nodeDeviceUnlock(driverState);
- hal_ctx = DRV_STATE_HAL_CTX(driverState);
+ hal_ctx = driverState->privateData;
VIR_INFO("Creating new objects");
dbus_error_init(&err);
udi = libhal_get_all_devices(hal_ctx, &num_devs, &err);
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index c13f346..74b31ad 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -62,8 +62,6 @@
#define VIR_FROM_THIS VIR_FROM_OPENVZ
#define OPENVZ_MAX_ARG 28
-#define CMDBUF_LEN 1488
-#define CMDOP_LEN 288
static int openvzGetProcessInfo(unsigned long long *cpuTime, int vpsid);
static int openvzGetMaxVCPUs(virConnectPtr conn, const char *type);
diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
index aa5d1c6..6fbbaf0 100644
--- a/src/qemu/qemu_monitor_text.c
+++ b/src/qemu/qemu_monitor_text.c
@@ -43,9 +43,6 @@
#define VIR_FROM_THIS VIR_FROM_QEMU
-#define QEMU_CMD_PROMPT "\n(qemu) "
-#define QEMU_PASSWD_PROMPT "Password: "
-
#define DEBUG_IO 0
/* Return -1 for error, 0 for success */
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index f318740..8a56c9c 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -60,10 +60,14 @@
(_to) = (_from); \
} while (0)
-# define HYPER_TO_LONG(_to, _from) HYPER_TO_TYPE(long, _to, _from)
+# if 0
+# define HYPER_TO_LONG(_to, _from) HYPER_TO_TYPE(long, _to, _from)
+# endif
# define HYPER_TO_ULONG(_to, _from) HYPER_TO_TYPE(unsigned long, _to, _from)
#else
-# define HYPER_TO_LONG(_to, _from) (_to) = (_from)
+# if 0
+# define HYPER_TO_LONG(_to, _from) (_to) = (_from)
+# endif
# define HYPER_TO_ULONG(_to, _from) (_to) = (_from)
#endif
diff --git a/src/security/security_stack.c b/src/security/security_stack.c
index b63e4c8..5e8ead9 100644
--- a/src/security/security_stack.c
+++ b/src/security/security_stack.c
@@ -24,8 +24,6 @@
#include "virterror_internal.h"
-#define VIR_FROM_THIS VIR_FROM_SECURITY
-
typedef struct _virSecurityStackData virSecurityStackData;
typedef virSecurityStackData *virSecurityStackDataPtr;
diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c
index 0122472..d2c9ea6 100644
--- a/src/uml/uml_conf.c
+++ b/src/uml/uml_conf.c
@@ -52,8 +52,6 @@
#define VIR_FROM_THIS VIR_FROM_UML
-#define umlLog(level, msg, ...) \
- virLogMessage(__FILE__, level, 0, msg, __VA_ARGS__)
virCapsPtr umlCapsInit(void) {
struct utsname utsname;
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index a71ea21..3cc4f1b 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -64,9 +64,6 @@
#define VIR_FROM_THIS VIR_FROM_UML
-/* For storing short-lived temporary files. */
-#define TEMPDIR LOCALSTATEDIR "/cache/libvirt"
-
typedef struct _umlDomainObjPrivate umlDomainObjPrivate;
typedef umlDomainObjPrivate *umlDomainObjPrivatePtr;
struct _umlDomainObjPrivate {
diff --git a/src/util/bridge.c b/src/util/bridge.c
index 7204e64..8d6e0ce 100644
--- a/src/util/bridge.c
+++ b/src/util/bridge.c
@@ -52,9 +52,6 @@
# include "logging.h"
# include "network.h"
-# define JIFFIES_TO_MS(j) (((j)*1000)/HZ)
-# define MS_TO_JIFFIES(ms) (((ms)*HZ)/1000)
-
struct _brControl {
int fd;
};
diff --git a/src/util/hooks.c b/src/util/hooks.c
index 30e20ac..b5a399c 100644
--- a/src/util/hooks.c
+++ b/src/util/hooks.c
@@ -42,7 +42,7 @@
#define VIR_FROM_THIS VIR_FROM_HOOK
#define virHookReportError(code, ...) \
- virReportErrorHelper(VIR_FROM_HOOK, code, __FILE__, \
+ virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)
#define LIBVIRT_HOOK_DIR SYSCONFDIR "/libvirt/hooks"
diff --git a/src/util/logging.c b/src/util/logging.c
index c86fcda..927fe6d 100644
--- a/src/util/logging.c
+++ b/src/util/logging.c
@@ -44,8 +44,6 @@
#include "threads.h"
#include "files.h"
-#define VIR_FROM_THIS VIR_FROM_NONE
-
/*
* A logging buffer to keep some history over logs
*/
diff --git a/src/util/macvtap.c b/src/util/macvtap.c
index 30343c8..832e952 100644
--- a/src/util/macvtap.c
+++ b/src/util/macvtap.c
@@ -78,8 +78,10 @@ VIR_ENUM_IMPL(virMacvtapMode, VIR_MACVTAP_MODE_LAST,
# define MICROSEC_PER_SEC (1000 * 1000)
-# define NLMSGBUF_SIZE 256
-# define RATTBUF_SIZE 64
+# if 0
+# define NLMSGBUF_SIZE 256
+# define RATTBUF_SIZE 64
+# endif
# define STATUS_POLL_TIMEOUT_USEC (10 * MICROSEC_PER_SEC)
# define STATUS_POLL_INTERVL_USEC (MICROSEC_PER_SEC / 8)
diff --git a/src/util/netlink.c b/src/util/netlink.c
index 0672184..6986b93 100644
--- a/src/util/netlink.c
+++ b/src/util/netlink.c
@@ -37,9 +37,11 @@
#define VIR_FROM_THIS VIR_FROM_NET
-#define netlinkError(code, ...) \
- virReportErrorHelper(VIR_FROM_NET, code, __FILE__, \
- __FUNCTION__, __LINE__, __VA_ARGS__)
+#if ! (defined(__linux__) && defined(HAVE_LIBNL))
+# define netlinkError(code, ...) \
+ virReportErrorHelper(VIR_FROM_NET, code, __FILE__, \
+ __FUNCTION__, __LINE__, __VA_ARGS__)
+#endif
#define NETLINK_ACK_TIMEOUT_S 2
diff --git a/src/util/pci.c b/src/util/pci.c
index 21c12b9..70de273 100644
--- a/src/util/pci.c
+++ b/src/util/pci.c
@@ -101,7 +101,7 @@ struct _pciDeviceList {
#define PCI_HEADER_TYPE 0x0e /* Header type */
#define PCI_HEADER_TYPE_BRIDGE 0x1
#define PCI_HEADER_TYPE_MASK 0x7f
-#define PCI_HEADER_TYPE_MULTI 0x80
+/*#define PCI_HEADER_TYPE_MULTI 0x80*/
/* PCI30 6.2.1 Device Identification */
#define PCI_CLASS_DEVICE 0x0a /* Device class */
@@ -128,7 +128,7 @@ struct _pciDeviceList {
#define PCI_EXP_DEVCAP_FLR (1<<28) /* Function Level Reset */
/* Header type 1 BR12 3.2 PCI-to-PCI Bridge Configuration Space Header Format */
-#define PCI_PRIMARY_BUS 0x18 /* BR12 3.2.5.2 Primary bus number */
+/*#define PCI_PRIMARY_BUS 0x18*/ /* BR12 3.2.5.2 Primary bus number */
#define PCI_SECONDARY_BUS 0x19 /* BR12 3.2.5.3 Secondary bus number */
#define PCI_SUBORDINATE_BUS 0x1a /* BR12 3.2.5.4 Highest bus number behind the
bridge */
#define PCI_BRIDGE_CONTROL 0x3e
diff --git a/src/util/storage_file.c b/src/util/storage_file.c
index 06cabc8..78ab730 100644
--- a/src/util/storage_file.c
+++ b/src/util/storage_file.c
@@ -102,7 +102,9 @@ qedGetBackingStore(char **, int *, const unsigned char *, size_t);
#define QCOW1_HDR_CRYPT (QCOWX_HDR_IMAGE_SIZE+8+1+1)
#define QCOW2_HDR_CRYPT (QCOWX_HDR_IMAGE_SIZE+8)
-#define QCOW1_HDR_TOTAL_SIZE (QCOW1_HDR_CRYPT+4+8)
+#if 0
+# define QCOW1_HDR_TOTAL_SIZE (QCOW1_HDR_CRYPT+4+8)
+#endif
#define QCOW2_HDR_TOTAL_SIZE (QCOW2_HDR_CRYPT+4+4+8+8+4+4+8)
#define QCOW2_HDR_EXTENSION_END 0
diff --git a/src/vbox/vbox_driver.c b/src/vbox/vbox_driver.c
index eab4679..05aa7fa 100644
--- a/src/vbox/vbox_driver.c
+++ b/src/vbox/vbox_driver.c
@@ -42,8 +42,6 @@
#include "virterror_internal.h"
#include "util.h"
-#define VIR_FROM_THIS VIR_FROM_VBOX
-
extern virDriver vbox22Driver;
extern virNetworkDriver vbox22NetworkDriver;
@@ -66,7 +64,7 @@ static virDriver vboxDriverDummy;
#define VIR_FROM_THIS VIR_FROM_VBOX
#define vboxError(code, ...) \
- virReportErrorHelper(VIR_FROM_VBOX, code, __FILE__, \
+ virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)
int vboxRegister(void) {
diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
index 6a46a39..770df03 100644
--- a/src/xen/xen_hypervisor.c
+++ b/src/xen/xen_hypervisor.c
@@ -80,16 +80,12 @@ typedef struct v0_hypercall_struct {
} v0_hypercall_t;
#ifdef __linux__
-# define XEN_V0_IOCTL_HYPERCALL_CMD \
- _IOC(_IOC_NONE, 'P', 0, sizeof(v0_hypercall_t))
/* the new one */
typedef struct v1_hypercall_struct
{
uint64_t op;
uint64_t arg[5];
} v1_hypercall_t;
-# define XEN_V1_IOCTL_HYPERCALL_CMD \
- _IOC(_IOC_NONE, 'P', 0, sizeof(v1_hypercall_t))
typedef v1_hypercall_t hypercall_t;
#elif defined(__sun)
typedef privcmd_hypercall_t hypercall_t;
@@ -140,8 +136,6 @@ static regex_t xen_cap_rec;
# define DOMFLAGS_PAUSED (1<<3) /* Currently paused by control software. */
# define DOMFLAGS_BLOCKED (1<<4) /* Currently blocked pending an event. */
# define DOMFLAGS_RUNNING (1<<5) /* Domain is currently running. */
-# define DOMFLAGS_CPUMASK 255 /* CPU to which this domain is bound. */
-# define DOMFLAGS_CPUSHIFT 8
# define DOMFLAGS_SHUTDOWNMASK 255 /* DOMFLAGS_SHUTDOWN guest-supplied code. */
# define DOMFLAGS_SHUTDOWNSHIFT 16
#endif
@@ -2729,13 +2723,13 @@ xenHypervisorMakeCapabilities(virConnectPtr conn)
}
}
- capabilities = fopen ("/sys/hypervisor/properties/capabilities",
"r");
+ capabilities = fopen(HYPERVISOR_CAPABILITIES, "r");
if (capabilities == NULL) {
if (errno != ENOENT) {
VIR_FORCE_FCLOSE(cpuinfo);
virReportSystemError(errno,
_("cannot read file %s"),
- "/sys/hypervisor/properties/capabilities");
+ HYPERVISOR_CAPABILITIES);
return NULL;
}
}
@@ -3195,7 +3189,9 @@ xenHypervisorGetDomInfo(virConnectPtr conn, int id, virDomainInfoPtr
info)
break;
case DOMFLAGS_SHUTDOWN:
/* The domain is shutdown. Determine the cause. */
- domain_shutdown_cause = domain_flags >> DOMFLAGS_SHUTDOWNSHIFT;
+ domain_shutdown_cause =
+ (domain_flags >> DOMFLAGS_SHUTDOWNSHIFT) &
+ DOMFLAGS_SHUTDOWNMASK;
switch (domain_shutdown_cause) {
case SHUTDOWN_crash:
info->state = VIR_DOMAIN_CRASHED;
diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
index 530b0d4..0f5d146 100644
--- a/src/xen/xm_internal.c
+++ b/src/xen/xm_internal.c
@@ -52,14 +52,6 @@
#define VIR_FROM_THIS VIR_FROM_XENXM
-#ifdef WITH_RHEL5_API
-# define XEND_CONFIG_MAX_VERS_NET_TYPE_IOEMU 0
-# define XEND_CONFIG_MIN_VERS_PVFB_NEWCONF 2
-#else
-# define XEND_CONFIG_MAX_VERS_NET_TYPE_IOEMU 3
-# define XEND_CONFIG_MIN_VERS_PVFB_NEWCONF 3
-#endif
-
/* The true Xen limit varies but so far is always way
less than 1024, which is the Linux kernel limit according
to sched.h, so we'll match that for now */
@@ -78,7 +70,6 @@ static int xenXMDomainDetachDeviceFlags(virDomainPtr domain, const char
*xml,
#define XEND_CONFIG_FILE "xend-config.sxp"
#define XEND_PCI_CONFIG_PREFIX "xend-pci-"
#define QEMU_IF_SCRIPT "qemu-ifup"
-#define XM_XML_ERROR "Invalid xml"
struct xenUnifiedDriver xenXMDriver = {
xenXMOpen, /* open */
diff --git a/tests/sockettest.c b/tests/sockettest.c
index b9e37ab..9e5b678 100644
--- a/tests/sockettest.c
+++ b/tests/sockettest.c
@@ -169,16 +169,6 @@ mymain(void)
if (!virTestGetDebug())
virSetErrorFunc(NULL, testQuietError);
-#define DO_TEST_PARSE(addrstr, family, pass) \
- do { \
- virSocketAddr addr; \
- struct testParseData data = { &addr, addrstr, family, pass }; \
- memset(&addr, 0, sizeof(addr)); \
- if (virtTestRun("Test parse " addrstr, \
- 1, testParseHelper, &data) < 0) \
- ret = -1; \
- } while (0)
-
#define DO_TEST_PARSE_AND_FORMAT(addrstr, family, pass) \
do { \
virSocketAddr addr; \
diff --git a/tools/virsh.c b/tools/virsh.c
index 9a189fd..988fbab 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -74,14 +74,13 @@ static char *progname;
/**
* The log configuration
*/
-#define MSG_BUFFER 4096
#define SIGN_NAME "virsh"
-#define DIR_MODE (S_IWUSR | S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH |
S_IXOTH) /* 0755 */
#define FILE_MODE (S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH)
/* 0644 */
-#define LOCK_MODE (S_IWUSR | S_IRUSR)
/* 0600 */
#define LVL_DEBUG "DEBUG"
#define LVL_INFO "INFO"
-#define LVL_NOTICE "NOTICE"
+#if 0
+# define LVL_NOTICE "NOTICE"
+#endif
#define LVL_WARNING "WARNING"
#define LVL_ERROR "ERROR"
@@ -423,15 +422,6 @@ _vshStrdup(vshControl *ctl, const char *s, const char *filename, int
line)
exit(EXIT_FAILURE);
}
-/* Poison the raw allocating identifiers in favor of our vsh variants. */
-#undef malloc
-#undef calloc
-#undef realloc
-#undef strdup
-#define malloc use_vshMalloc_instead_of_malloc
-#define calloc use_vshCalloc_instead_of_calloc
-#define realloc use_vshRealloc_instead_of_realloc
-#define strdup use_vshStrdup_instead_of_strdup
static int idsorter(const void *a, const void *b) {
const int *ia = (const int *)a;
--
1.7.4.4