aboutsummaryrefslogtreecommitdiff
path: root/slirp/util.h
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2019-01-17 15:43:52 +0400
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2019-02-07 15:49:08 +0200
commita9d8b3ec4385793815d7121785730422fa3dfb68 (patch)
tree1985cff48263e7f866f7dd6646639f71371ec3b5 /slirp/util.h
parent4ffa6325d16a5a520f330aa0b8f0d753f6704d9b (diff)
slirp: replace remaining qemu headers dependency
Except for the migration code which is gated by WITH_QEMU, only include our own headers, so libslirp can be built standalone. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Diffstat (limited to 'slirp/util.h')
-rw-r--r--slirp/util.h21
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