1 #ifndef _OFED_IBVERBS_CONFIG_H_ 2 #define _OFED_IBVERBS_CONFIG_H_ 3 4 #define memalign(align, size) ({ \ 5 void *__ptr; \ 6 if (posix_memalign(&__ptr, (align), (size))) \ 7 __ptr = NULL; \ 8 __ptr; \ 9 }) 10 11 /* 12 * Return true if the snprintf succeeded, false if there was 13 * truncation or error: 14 */ 15 #define check_snprintf(buf, len, fmt, ...) ({ \ 16 int rc = snprintf(buf, len, fmt, ##__VA_ARGS__); \ 17 (rc < len && rc >= 0); \ 18 }) 19 20 #define min_t(type, x, y) ({ \ 21 type __min1 = (x); \ 22 type __min2 = (y); \ 23 __min1 < __min2 ? __min1 : __min2; }) 24 25 #define freeaddrinfo_null(x) do { \ 26 if ((x) != NULL) \ 27 freeaddrinfo(x); \ 28 } while (0) 29 30 #define VALGRIND_MAKE_MEM_DEFINED(...) 0 31 #define s6_addr32 __u6_addr.__u6_addr32 32 #define __sum16 uint16_t 33 #define NRESOLVE_NEIGH 1 34 #define STREAM_CLOEXEC "e" 35 #define VERBS_PROVIDER_DIR "/usr/lib/" 36 #define IBV_CONFIG_DIR "/etc/ibverbs/" 37 #define MADV_DONTFORK MADV_NORMAL 38 #define MADV_DOFORK MADV_NORMAL 39 #define SWITCH_FALLTHROUGH (void)0 40 41 #endif /* _OFED_IBVERBS_CONFIG_H_ */ 42