summary refs log tree commit diff stats
path: root/include/qemu/osdep.h
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2016-03-11 13:41:13 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2016-03-22 22:20:16 +0100
commita8139632161d7546218b696cada0a4f64cc78fb7 (patch)
treec21aad2b0ab698e9882364f8608812f7e2461f6b /include/qemu/osdep.h
parenta7c4d9c7ca5178d32236fa5b31fa7fed4e4a7a9c (diff)
downloadfocaccia-qemu-a8139632161d7546218b696cada0a4f64cc78fb7.tar.gz
focaccia-qemu-a8139632161d7546218b696cada0a4f64cc78fb7.zip
Move HOST_LONG_BITS from qemu-common.h to qemu/osdep.h
qemu-common.h should only be included by .c files.  Its file comment
explains why: "No header file should depend on qemu-common.h, as this
would easily lead to circular header dependencies."

One of the reasons for headers to include it is HOST_LONG_BITS.  Move
that to its more natural home qemu/osdep.h, to facilitate removing
these ill-advised includes later on.

This also lets us use HOST_LONG_BITS in bswap.h instead of duplicating
its definition there to avoid cyclic inclusion.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'include/qemu/osdep.h')
-rw-r--r--include/qemu/osdep.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index 1c0ce4a1c7..64b06e30cd 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -127,6 +127,15 @@ extern int daemon(int, int);
 #define TIME_MAX LONG_MAX
 #endif
 
+/* HOST_LONG_BITS is the size of a native pointer in bits. */
+#if UINTPTR_MAX == UINT32_MAX
+# define HOST_LONG_BITS 32
+#elif UINTPTR_MAX == UINT64_MAX
+# define HOST_LONG_BITS 64
+#else
+# error Unknown pointer size
+#endif
+
 #ifndef MIN
 #define MIN(a, b) (((a) < (b)) ? (a) : (b))
 #endif