[sheepdog] [PATCH v2 01/12] sheep: fix some compile errors

Liu Yuan namei.unix at gmail.com
Wed Jan 29 08:35:47 CET 2014


Both MIN/MAX and roundup are provided by glibc and would cause compile error
when we #include <sys/param.h>. Just use GNU version.

Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
 include/util.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/include/util.h b/include/util.h
index 83f3c08..1932fe3 100644
--- a/include/util.h
+++ b/include/util.h
@@ -12,6 +12,7 @@
 #include <urcu/uatomic.h>
 #include <pthread.h>
 #include <errno.h>
+#include <sys/param.h>
 
 #include "logger.h"
 #include "list.h"
@@ -20,7 +21,7 @@
 #define SECTOR_SIZE (1U << 9)
 #define BLOCK_SIZE (1U << 12)
 
-#define round_up(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
+#define round_up(x, y) roundup(x, y)
 #define round_down(x, y) (((x) / (y)) * (y))
 
 #if __BYTE_ORDER == __LITTLE_ENDIAN
@@ -53,9 +54,6 @@ static inline int after(uint32_t seq1, uint32_t seq2)
 	return (int32_t)(seq2 - seq1) < 0;
 }
 
-#define MIN(x, y) ((x) > (y) ? (y) : (x))
-#define MAX(x, y) ((x) > (y) ? (x) : (y))
-
 #define min(x, y) ({ \
 	typeof(x) _x = (x);	\
 	typeof(y) _y = (y);	\
-- 
1.8.1.2




More information about the sheepdog mailing list