Move QEMU_ALIGN_*() from qemu-common.h to qemu/osdep.h
authorMarkus Armbruster <armbru@redhat.com>
Fri, 11 Mar 2016 15:27:23 +0000 (16:27 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 22 Mar 2016 21:20:16 +0000 (22:20 +0100)
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 QEMU_ALIGN_UP() and
QEMU_ALIGN_DOWN().  Move them next to ROUND_UP() in qemu/osdep.h, to
facilitate removing these ill-advised includes later on.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
include/qemu-common.h
include/qemu/osdep.h

index fbd999c..f272752 100644 (file)
@@ -369,12 +369,6 @@ static inline uint8_t from_bcd(uint8_t val)
     return ((val >> 4) * 10) + (val & 0x0f);
 }
 
-/* Round number down to multiple */
-#define QEMU_ALIGN_DOWN(n, m) ((n) / (m) * (m))
-
-/* Round number up to multiple */
-#define QEMU_ALIGN_UP(n, m) QEMU_ALIGN_DOWN((n) + (m) - 1, (m))
-
 #include "qemu/module.h"
 
 /*
index 64b06e3..97a7fa2 100644 (file)
@@ -149,6 +149,12 @@ extern int daemon(int, int);
 #define MIN_NON_ZERO(a, b) (((a) != 0 && (a) < (b)) ? (a) : (b))
 #endif
 
+/* Round number down to multiple */
+#define QEMU_ALIGN_DOWN(n, m) ((n) / (m) * (m))
+
+/* Round number up to multiple */
+#define QEMU_ALIGN_UP(n, m) QEMU_ALIGN_DOWN((n) + (m) - 1, (m))
+
 #ifndef ROUND_UP
 #define ROUND_UP(n,d) (((n) + (d) - 1) & -(d))
 #endif