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
This commit is contained in:
Markus Armbruster 2018-02-21 23:12:22 -05:00 committed by Lioncash
parent 6b1ebd16e6
commit 6730bd3131
No known key found for this signature in database
GPG Key ID: 4E3C3CC1031BA9C7
2 changed files with 6 additions and 6 deletions

View File

@ -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 */

View File

@ -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