#endif
#endif
+#ifndef ARRAY_SIZE
+#define ARRAY_SIZE(a) (sizeof(a) / sizeof(*a))
+#endif
+
#endif /* __XEN_TOOLS_LIBS__ */
#include <xen/sys/privcmd.h>
+#include <xen-tools/libs.h>
+
#if defined(HAVE_VALGRIND_MEMCHECK_H) && !defined(NDEBUG) && !defined(__MINIOS__)
/* Compile in Valgrind client requests? */
#include <valgrind/memcheck.h>
#define PAGE_SIZE XC_PAGE_SIZE
#define PAGE_MASK XC_PAGE_MASK
-#ifndef ARRAY_SIZE /* MiniOS leaks ARRAY_SIZE into our namespace as part of a
- * stubdom build. It shouldn't... */
-#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
-#endif
-
/*
** Define max dirty page cache to permit during save/restore -- need to balance
** keeping cache usage down with CPU impact of invalidating too often.
#include <xenguest.h>
#include <xc_dom.h>
+#include <xen-tools/libs.h>
+
#include "xentoollog.h"
#include <xen/io/xenbus.h>
#define MB(_mb) (_AC(_mb, ULL) << 20)
#define GB(_gb) (_AC(_gb, ULL) << 30)
-#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
-
#define ROUNDUP(_val, _order) \
(((unsigned long)(_val)+(1UL<<(_order))-1) & ~((1UL<<(_order))-1))
#include <xenctrl.h>
-#define ARRAY_SIZE(a) (sizeof a / sizeof *a)
+#include <xen-tools/libs.h>
+
static uint32_t nr_features;
static const char *str_1d[32] =
static xc_interface *xch;
-#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
-
void show_help(void)
{
fprintf(stderr,
#include <xenstore.h>
#include <unistd.h>
-#undef ARRAY_SIZE /* We shouldn't be including xc_private.h */
-#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
-
static xc_interface *xch;
void show_help(void)
return 0;
}
-#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
-
static const char *state2str(unsigned int state)
{
#define STATE(x) [LIVEPATCH_STATE_##x] = #x
#include "xg_save_restore.h"
-#undef ARRAY_SIZE /* We shouldn't be including xc_private.h */
-#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
-
static xc_interface *xch;
int help_func(int argc, char *argv[])
#include <inttypes.h>
#include <sys/time.h>
+#include <xen-tools/libs.h>
+
#define MAX_PKG_RESIDENCIES 12
#define MAX_CORE_RESIDENCIES 8
-#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
-
static xc_interface *xc_handle;
static unsigned int max_cpu_nr;
#include <xen/hvm/hvm_info_table.h>
#include <xen/hvm/params.h>
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+#include <xen-tools/libs.h>
/* Needed for Python versions earlier than 2.3. */
#ifndef PyMODINIT_FUNC
#include "hpet.h"
+#include <xen-tools/libs.h>
+
#define NR_CPUS 8
typedef int64_t s_time_t;
u32 dest32; /* used when Interrupt Remapping with EIM is enabled */
};
-#ifndef ARRAY_SIZE
-#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
-#endif
-
#define X86EMUL_OKAY 100
#define EINVAL 101
#include <asm/x86-defns.h>
#include <asm/x86-vendors.h>
+#include <xen-tools/libs.h>
+
#define BUG() abort()
#define ASSERT assert
#define ASSERT_UNREACHABLE() assert(!__LINE__)
-#define ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a)))
-
-#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
-/* Force a compilation error if condition is true */
-#define BUILD_BUG_ON(cond) ({ _Static_assert(!(cond), "!(" #cond ")"); })
-#define BUILD_BUG_ON_ZERO(cond) \
- sizeof(struct { _Static_assert(!(cond), "!(" #cond ")"); })
-#else
-#define BUILD_BUG_ON_ZERO(cond) sizeof(struct { int:-!!(cond); })
-#define BUILD_BUG_ON(cond) ((void)BUILD_BUG_ON_ZERO(cond))
-#endif
-
#define MASK_EXTR(v, m) (((v) & (m)) / ((m) & -(m)))
#define MASK_INSR(v, m) (((v) * ((m) & -(m))) & (m))
#include <xenevtchn.h>
#include <xen/vm_event.h>
+#include <xen-tools/libs.h>
+
#if defined(__arm__) || defined(__aarch64__)
#include <xen/arch-arm.h>
#define START_PFN (GUEST_RAM0_BASE >> 12)
/* From xen/include/asm-x86/x86-defns.h */
#define X86_CR4_PGE 0x00000080 /* enable global pages */
-#ifndef ARRAY_SIZE
-#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
-#endif
-
typedef struct vm_event {
domid_t domain_id;
xenevtchn_handle *xce_handle;
#include <time.h>
#include <xenstore.h>
+#include <xen-tools/libs.h>
+
#define TEST_PATH "xenstore-test"
-#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
#define WRITE_BUFFERS_N 10
#define WRITE_BUFFERS_SIZE 4000
#define MAX_TA_LOOPS 100
#include <string.h>
#include <stdint.h>
+#include <xen-tools/libs.h>
+
/* Is A == B ? */
#define streq(a,b) (strcmp((a),(b)) == 0)
return streq(a + strlen(a) - strlen(b), b);
}
-#ifndef ARRAY_SIZE
-#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
-#endif
-
void barf(const char *fmt, ...) __attribute__((noreturn));
void barf_perror(const char *fmt, ...) __attribute__((noreturn));
#include <stdint.h>
-#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+#include <xen-tools/libs.h>
#define TRC_GEN_MAIN 0
#define TRC_SCHED_MAIN 1