From 6730bd3131a82541cffba6c1cd2550d1d83d020e Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Wed, 21 Feb 2018 23:12:22 -0500 Subject: [PATCH] Move QEMU_ALIGN_*() 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 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. Backports commit e07e540aaa08718c9ff8213067a3dcef31b3e313 from qemu --- qemu/include/qemu-common.h | 6 ------ qemu/include/qemu/osdep.h | 6 ++++++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/qemu/include/qemu-common.h b/qemu/include/qemu-common.h index 64bfd538..713a59e3 100644 --- a/qemu/include/qemu-common.h +++ b/qemu/include/qemu-common.h @@ -222,12 +222,6 @@ bool tcg_enabled(struct uc_struct *uc); struct uc_struct; void cpu_exec_init_all(struct uc_struct *uc); -/* 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" /* vector definitions */ diff --git a/qemu/include/qemu/osdep.h b/qemu/include/qemu/osdep.h index 12639c18..7599e34b 100644 --- a/qemu/include/qemu/osdep.h +++ b/qemu/include/qemu/osdep.h @@ -137,6 +137,12 @@ #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