[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 00/12] qemu-common.h/osdep.h refactoring
From: |
Peter Maydell |
Subject: |
[Qemu-devel] [PATCH 00/12] qemu-common.h/osdep.h refactoring |
Date: |
Wed, 22 Jul 2015 17:43:59 +0100 |
This series makes a start at cleaning up some of our headers
to avoid the common problem of header files including qemu-common.h
(which then in turn can lead to awkward circular includes).
One common cause of this is that we don't have any header
which will include the basic things most header files require,
except for qemu-common.h. This series fixes that by making
'osdep.h' that "common basic stuff" header. The idea is that:
* osdep.h can be included from anywhere, since it doesn't
include any other QEMU headers itself except a few very
restricted special purpose ones (config-host.h, compiler.h, etc)
* osdep.h provides:
+ things everybody needs, like NULL, int32_t, container_of,
the CONFIG_* defines, etc
+ things that will cause subtle problems if they're not
present everywhere (eg directly using system headers and
not getting the portability fixups will result in something
that builds on most but not all hosts)
So most places can just include osdep.h, not the full qemu-common.h.
(I initially thought about defining a new header for this
purpose, "qemu/basics.h" or some such, but in fact osdep.h
was already very close to what I wanted so it didn't really
seem like it was very useful to switch everything over.)
The series has some minor cleanups, some shuffling around of
things between qemu-common.h, osdep.h and compiler.h, and
a couple of patches at the end that use osdep.h to allow
dropping a qemu-common.h include from various header files,
as a demonstration.
The real question here I guess is whether people like the
direction I'm trying to go with this. If so, we can further
reduce the number of qemu-common.h includes without too much
difficulty with further patches.
A cleanup deferred for the future is that osdep.h (in addition
to the stuff listed above) also has a pile of prototypes for
various functions that could reasonably be split out to their
own header files, since they're not critically important to
provide everywhere.
host-utils.h is rather misnamed these days, incidentally, but
a header rename doesn't seem really worth the effort (and I
couldn't think of a better name anyway).
Compile-tested on Linux, OSX, Windows and FreeBSD.
Peter Maydell (12):
qapi/qmp-event.c: Don't manually include os-win32.h/os-posix.h
osdep.h: Remove qemu_printf
osdep.h: Move some compiler-specific things to compiler.h
compiler.h: Use glue() in QEMU_BUILD_BUG_ON define
qemu-common.h: Move Win32 fixups into os-win32.h
osdep.h: Move some OS header includes and fixups from qemu-common.h
osdep.h: Add header comment
qemu-common.h: Move muldiv64() to host-utils.h
apic_internal.h: Include cpu.h directly
timer.h: Don't include qemu-common.h
event_notifier.h: Don't include qemu-common.h
throttle.h: Don't include qemu-common.h
include/hw/i386/apic_internal.h | 1 +
include/qemu-common.h | 103 +------------------------------------
include/qemu/compiler.h | 51 ++++++++++++++++--
include/qemu/event_notifier.h | 7 +--
include/qemu/host-utils.h | 29 +++++++++++
include/qemu/osdep.h | 111 ++++++++++++++++++++++++----------------
include/qemu/throttle.h | 4 +-
include/qemu/timer.h | 4 +-
include/sysemu/os-win32.h | 18 +++++++
monitor.c | 4 +-
qapi/qmp-event.c | 8 ---
user-exec.c | 4 +-
12 files changed, 175 insertions(+), 169 deletions(-)
--
1.9.1
- [Qemu-devel] [PATCH 00/12] qemu-common.h/osdep.h refactoring,
Peter Maydell <=
- [Qemu-devel] [PATCH 12/12] throttle.h: Don't include qemu-common.h, Peter Maydell, 2015/07/22
- [Qemu-devel] [PATCH 11/12] event_notifier.h: Don't include qemu-common.h, Peter Maydell, 2015/07/22
- [Qemu-devel] [PATCH 10/12] timer.h: Don't include qemu-common.h, Peter Maydell, 2015/07/22
- [Qemu-devel] [PATCH 01/12] qapi/qmp-event.c: Don't manually include os-win32.h/os-posix.h, Peter Maydell, 2015/07/22
- [Qemu-devel] [PATCH 06/12] osdep.h: Move some OS header includes and fixups from qemu-common.h, Peter Maydell, 2015/07/22
- [Qemu-devel] [PATCH 04/12] compiler.h: Use glue() in QEMU_BUILD_BUG_ON define, Peter Maydell, 2015/07/22