@@ -9,6 +9,8 @@
#include <xen/hvm/hvm_info_table.h>
#include "e820.h"
+#include <xen-tools/common-macros.h>
+
/* Request un-prefixed values from errno.h. */
#define XEN_ERRNO(name, value) name = value,
enum {
@@ -41,12 +43,6 @@ void __assert_failed(const char *assertion, const char *file, int line)
void __bug(const char *file, int line) __attribute__((noreturn));
#define BUG() __bug(__FILE__, __LINE__)
#define BUG_ON(p) do { if (p) BUG(); } while (0)
-#define BUILD_BUG_ON(p) ((void)sizeof(char[1 - 2 * !!(p)]))
-
-#define min_t(type,x,y) \
- ({ type __x = (x); type __y = (y); __x < __y ? __x: __y; })
-#define max_t(type,x,y) \
- ({ type __x = (x); type __y = (y); __x > __y ? __x: __y; })
#define MB(mb) (mb##ULL << 20)
#define GB(gb) (gb##ULL << 30)
@@ -45,6 +45,7 @@
#include <xen/sys/gntalloc.h>
#include <xen/sys/gntdev.h>
#include <libxenvchan.h>
+#include <xen-tools/common-macros.h>
#include "vchan.h"
@@ -72,8 +73,6 @@
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
#endif
-#define max(a,b) ((a > b) ? a : b)
-
static int init_gnt_srv(struct libxenvchan *ctrl, int domain)
{
int pages_left = ctrl->read.order >= PAGE_SHIFT ? 1 << (ctrl->read.order - PAGE_SHIFT) : 0;
@@ -114,16 +114,7 @@ enum
TASKLET_SOFTIRQ,
NR_COMMON_SOFTIRQS
};
-/*
- * ..and if you can't take the strict
- * types, you can specify one yourself.
- *
- * Or not use min/max at all, of course.
- */
-#define min_t(type, x, y) \
- ({ type __x = (x); type __y = (y); __x < __y ? __x : __y; })
-#define max_t(type, x, y) \
- ({ type __x = (x); type __y = (y); __x > __y ? __x : __y; })
+
#define offsetof(t, m) ((unsigned long )&((t *)0)->m)
struct domain;
@@ -106,22 +106,6 @@ typedef union {
#define BUG() assert(0)
#define ASSERT_UNREACHABLE() assert(0)
-#define min(x, y) ({ \
- const typeof(x) tx = (x); \
- const typeof(y) ty = (y); \
- \
- (void) (&tx == &ty); \
- tx < ty ? tx : ty; \
-})
-
-#define max(x, y) ({ \
- const typeof(x) tx = (x); \
- const typeof(y) ty = (y); \
- \
- (void) (&tx == &ty); \
- tx > ty ? tx : ty; \
-})
-
#endif
/*
Defining min(), min_t(), max() and max_t() at other places than xen-tools/common-macros.h isn't needed, as the definitions in said header can be used instead. Same applies to BUILD_BUG_ON() in hvmloader. Signed-off-by: Juergen Gross <jgross@suse.com> --- tools/firmware/hvmloader/util.h | 8 ++------ tools/libs/vchan/init.c | 3 +-- tools/tests/vhpet/emul.h | 11 +---------- tools/tests/vpci/emul.h | 16 ---------------- 4 files changed, 4 insertions(+), 34 deletions(-)