diff options
Diffstat (limited to 'slirp/util.h')
-rw-r--r-- | slirp/util.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/slirp/util.h b/slirp/util.h index ef75804560..4963747aef 100644 --- a/slirp/util.h +++ b/slirp/util.h @@ -48,6 +48,27 @@ # define SLIRP_PACKED __attribute__((packed)) #endif +#ifndef DIV_ROUND_UP +#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) +#endif + +#ifndef container_of +#define container_of(ptr, type, member) __extension__ ({ \ + void *__mptr = (void *)(ptr); \ + ((type *)(__mptr - offsetof(type, member))); }) +#endif + +#if defined(_WIN32) /* CONFIG_IOVEC */ +# if !defined(IOV_MAX) /* XXX: to avoid duplicate with QEMU osdep.h */ +struct iovec { + void *iov_base; + size_t iov_len; +}; +# endif +#else +#include <sys/uio.h> +#endif + #define SCALE_MS 1000000 #define ETH_ALEN 6 |