/* Return the number of entries in a statically-allocated array */
#define ARRAY_LENGTH(x) (sizeof(x) / sizeof((x)[0]))
+/* Return minimum argument */
+#ifndef MIN
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
+#endif
+
+/* Return maximum argument */
+#ifndef MAX
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
+#endif
+
/* Compute the floor of log_2 of the given number */
static inline uint8_t
log2floor(uintptr_t num) {
#define roundup2(x, y) (((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */
#define powerof2(x) ((((x)-1)&(x))==0)
-/* Macros for min/max. */
+/* Macros for min/max.: these are also defined in include/bitmacros.h */
+#ifndef MIN
#define MIN(a,b) (((a)<(b))?(a):(b))
+#endif
+#ifndef MIN
#define MAX(a,b) (((a)>(b))?(a):(b))
+#endif
#ifdef _KERNEL
/*
/* struct packet **inpkt; */
};
-#define MIN(a,b) ((a) < (b) ? (a) : (b))
-
static void sock_recved_udp_packet(void *arg)
{
struct recv_udp_args *args = arg;
#include <string.h>
#include <barrelfish/static_assert.h>
-#include "cpiobin.h"
+#include <bitmacros.h> // for MIN
-#ifndef MIN
-#define MIN(a,b) ((a) < (b)) ? (a) : (b)
-#endif // MIN
+#include "cpiobin.h"
typedef struct
{
#define dprintf(...) //printf(__VA_ARGS__)
#endif
+#ifndef MIN
#define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
+#endif
+#ifndef MAX
#define MAX(X,Y) ((X) > (Y) ? (X) : (Y))
+#endif
#define OUT_PREFIX "[Phoenix] "
/* A key and a value pair. */
#include <assert.h>
#include <unistd.h>
-#define MAX(a,b) (((a)>(b))?(a):(b))
#define READ_SLOT 0
#define WRITE_SLOT 1
#include <vfs/fdtab.h>
#include "unixsock.h"
-#define MIN(a,b) ((a) < (b) ? (a) : (b))
-
ssize_t recv(int sockfd, void *buf, size_t len, int flags)
{
struct fdtab_entry *e = fdtab_get(sockfd);
// limitations under the License.
//
#include "RCCE_lib.h"
+#ifndef MIN
#define MIN(x,y) ( (x) < (y) ? (x) : (y) )
+#endif
+#ifndef MAX
#define MAX(x,y) ( (x) > (y) ? (x) : (y) )
+#endif
#include <stdlib.h>
#include <string.h>
#define MAX_NFS_WRITE_CHUNKS 1 /* workaround for breakage in lwip */
#define NFS_WRITE_STABILITY UNSTABLE
-#define MIN(a,b) ((a)<(b)?(a):(b))
#define assert_err(e,m) \
do { \
if (err_is_fail(e)) { \
#include <pci/confspace/pci_confspace.h>
+#include <bitmacros.h>
+
#include <dev/vtd_dev.h>
#include <dev/vtd_iotlb_dev.h>
#define VTD_FOR_EACH(var, head) for (var = (head); var; var = var->next)
#define VTD_ADD_UNIT(x, head) do {(x)->next = (head); (head) = (x);} while(0)
-#define MIN(a,b) ((a) < (b) ? (a) : (b))
-#define MAX(a,b) ((a) > (b) ? (a) : (b))
// A structure representing a remapping hardware unit. We currently assume
// that there is only one such unit per segment.
#define APIC_BASE 0xfee00000
-#define MIN(x,y) ((x)<(y)?(x):(y))
-
lvaddr_t guest_offset = 0;
/// stores the last used guest ASID
static uint32_t last_guest_asid = 0;
#define OMAP44XX_SDMA_MAX_FN_BITS 15
#define OMAP44XX_SDMA_MAX_EN_BITS 23
-#define MIN(a,b) ((a) < (b) ? (a) : (b))
-
#define MEASURE(outval, CALL) { \
uint64_t start, end; \
sys_debug_hardware_global_timer_read(&start); \
//#define SIMULATE_PROC_TIME
//#define ARRANET_RECVFROM
+#ifndef MIN
#define MIN(a,b) ((a) < (b) ? (a) : (b))
+#endif
+#ifndef MAX
#define MAX(a,b) ((a) > (b) ? (a) : (b))
+#endif
static char initbuf[] = "123456789012345678901234567890123456789012345678901234567890123";
#include <sys/time.h>
#include <strings.h>
#include <assert.h>
+#include <bitmacros.h>
#include <pthread.h>
#include <linux/if_ether.h>
#include <sys/ioctl.h>
#define INBUFSIZE 2048
#define MAX_ROUNDS 10000000
-#define MIN(a,b) ((a) < (b) ? (a) : (b))
-#define MAX(a,b) ((a) > (b) ? (a) : (b))
-
static struct timeval tvs[MAX_ROUNDS], tst[MAX_ROUNDS];
/*
#define BUFSIZE 1024
#define MAX_ROUNDS 10000000
+#ifndef MIN
#define MIN(a,b) ((a) < (b) ? (a) : (b))
+#endif
+#ifndef MAX
#define MAX(a,b) ((a) > (b) ? (a) : (b))
+#endif
static struct timeval tvs[MAX_ROUNDS], tst[MAX_ROUNDS];
#include <bulk_transfer/bulk_local.h>
#endif
+#include <bitmacros.h> // for MIN
enum block_net_msg_type
#endif
};
-#define MIN(a,b) ((a) < (b) ? (a) : (b))
-
#endif /* BLOCK_NETWORK_COMMON_H */
#define ECONNREFUSED 61
+#ifndef MIN
#define MIN(a,b) ((a) < (b) ? (a) : (b))
+#endif
struct megaraid_ctrl *sc = NULL;
#ifndef BARRELFISH
#define SDMA_H_
#include <if/omap_sdma_defs.h>
-
-#define MIN(a,b) ((a) < (b) ? (a) : (b))
+#include <bitmacros.h>
void start_service(void);
#define UOS_RESERVE_SIZE_MIN ((128) * 1024 * 1024)
#define UOS_RESERVE_SIZE_MAX (((4) * 1024 * 1024 * 1024ULL) - ((4) * 1024))
-/*
- * Helper macros
- */
-#define MAX(a, b) ( ((a) > (b)) ? (a) : (b) )
-#define MIN(a, b) ( ((a) < (b)) ? (a) : (b) )
-#define ALIGN(x) ((x + BASE_PAGE_SIZE-1) & ~(BASE_PAGE_SIZE-1))
+#define ALIGN(x) ROUND_UP(x, BASE_PAGE_SIZE)
static xeon_phi_boot_t boot_registers;
static xeon_phi_apic_t apic_registers;
#include "capops.h"
#include <trace_definitions/trace_defs.h>
-#define MIN(x,y) ((x<y) ? (x) : (y))
-#define MAX(x,y) ((x>y) ? (x) : (y))
static bool* notification_sent = NULL;
static bool* monitor_ready = NULL;
static errval_t new_monitor_notify(coreid_t id)
/* -------------- LWIP/network initialisation ----------------------*/
-#define MIN(a,b) ((a) < (b) ? (a) : (b))
-
#define SEND_TIMER_MSECS 4
#include <if/acpi_rpcclient_defs.h>
-#define MIN(a,b) ((a) < (b) ? (a) : (b))
-
#define BAR_PROBE 0xffffffff
#define PAGE_BITS BASE_PAGE_BITS
#include "defs.h"
+#ifndef MIN
#define MIN(x,y) (x < y ? x : y)
+#endif
static char *defdir;
static struct {
#define BACKLOG 10
#define BUFFER_SIZE 32
+#ifndef MAX
#define MAX(a,b) (((a)>(b))?(a):(b))
+#endif
+#ifndef MIN
#define MIN(a,b) (((a)<(b))?(a):(b))
+#endif
enum client_state {
READING,
#include <stdlib.h>
#include <string.h>
+#include <bitmacros.h> // for MIN
#include "vmkitmon.h"
#include <barrelfish/lmp_endpoints.h>
#include "x86.h"
#define SERIAL_DRIVER "serial0.raw"
-#define MIN(x,y) ((x)<(y)?(x):(y))
-
#ifndef CONFIG_SVM
extern uint16_t saved_exit_reason;
extern uint64_t saved_exit_qual, saved_rip;
#define HTTP_MIME_BZIP2 "Content-type: application/x-bzip2" CRLF
#define HTTP_MIME_OCTET "Content-type: application/octet-stream" CRLF
-#define MIN(a,b) ((a) < (b) ? (a) : (b))
-
-
static const char notfound_reply[] =
HTTP_HEADER_404 HTTP_MIME_HTML CRLF