Clean up includes of monitor.h
v2 cover Clean up includes of monitor.h
There is no reason why QAPI clients should use monitor.h at all, qerror.h suffices.
qmp-commands.h uses the Monitor typedef, but it is only included from files that already get the typedef from qemu-common.h.
v1->v2: rebase to queue/qmp
Paolo Bonzini (3):
kvm: add missing include files
qmp: include monitor.h when needed
qmp: do not include monitor.h from qapi-types-core.h
hmp.c | 1 + kvm-all.c | 2 ++ net/tap.c | 1 + qapi/qapi-types-core.h | 4 +--- 4 files changed, 5 insertions(+), 3 deletions(-)
Signature · 1 line
1.7.10.1
PATCH v2 1/3 kvm: add missing include files
These are included via monitor.h right now, add them explicitly.
--- kvm-all.c | 2 ++ 1 file changed, 2 insertions(+)
kvm-all.c +2 -0
@@ -22,6 +22,8 @@#include "qemu-common.h" #include "qemu-barrier.h" +#include "qemu-option.h" +#include "qemu-config.h" #include "sysemu.h" #include "hw/hw.h" #include "hw/msi.h"
Signature · 1 line
1.7.10.1
PATCH v2 2/3 qmp: include monitor.h when needed
In reply to Paolo BonziniThis is needed to get file descriptors from SCM_RIGHTS.
--- hmp.c | 1 + net/tap.c | 1 + 2 file changed, 2 insertion(+)
hmp.c +1 -0
@@ -18,6 +18,7 @@#include "qemu-option.h" #include "qemu-timer.h" #include "qmp-commands.h" +#include "monitor.h" static void hmp_handle_error (Monitor *mon,Error **errp) {
net/tap.c +1 -0
@@ -34,6 +34,7 @@#include <net/if.h> #include "net.h" +#include "monitor.h" #include "sysemu.h" #include "qemu-char.h" #include "qemu-common.h"
Signature · 1 line
1.7.10.1
PATCH v2 3/3 qmp: do not include monitor.h from qapi-types-core.h
In reply to Paolo BonziniThe comment is stale, monitor.h is not needed anymore (only qerror.h is, because it contains the schema for errors).
--- qapi/qapi-types-core.h | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
qapi/qapi-types-core.h +1 -3
@@ -16,8 +16,6 @@#include "qemu-common.h" #include "error.h" - -/* FIXME this is temporary until we remove middle mode */ -#include "monitor.h" +#include "qerror.h" #endif
Signature · 1 line
1.7.10.1
Re: [Qemu-devel] [PATCH v2 3/3] qmp: do not include monitor.h from qapi-types-core.h
Quoted 13 lines · Paolo Bonzini
The comment is stale,
monitor.his not needed anymore (onlyqerror.his, because it contains the schema for errors).Signed-off-by Paolo Bonzini<[email protected]>--- qapi/qapi-types-core.h | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)qapi/qapi-types-core.h +0
-0
qapi/qapi-types-core.h line 19
Quoted 7 lines
qapi/qapi-types-core.h +1
-3@@ -16,8 +16,6 @@#include "qemu-common.h" #include "error.h" - -/* FIXME this is temporary until we remove middle mode */ -#include "monitor.h" +#include "qerror.h"
Middle mode generates signatures that contain a 'Monitor *'. qmp-commands.h includes qmp-types which only includes qmp-types-core.h
Without having a #include "monitor.h" here, qmp-commands.h is relying on something else including monitor.h before including qmp-commands.h
I guess you could push the monitor.h include to qmp-commands.h but the point of qmp-types-core was to avoid having to add #includes to the code generator.
Regards,
Anthony Liguori
Quoted 2 lines
qapi/qapi-types-core.h +0
-0#endif
Re: [Qemu-devel] [PATCH v2 3/3] qmp: do not include monitor.h from qapi-types-core.h
Il 07/06/2012 06:55, Anthony Liguori ha scritto:
Quoted 25 lines · Paolo Bonzini
Quoted 13 lines
The comment is stale,
monitor.his not needed anymore (onlyqerror.his, because it contains the schema for errors).Signed-off-by Paolo Bonzini<[email protected]>--- qapi/qapi-types-core.h | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)qapi/qapi-types-core.h +0
-0qapi/qapi-types-core.h line 19
Quoted 7 lines
qapi/qapi-types-core.h +1
-3@@ -16,8 +16,6 @@#include "qemu-common.h" #include "error.h" - -/* FIXME this is temporary until we remove middle mode */ -#include "monitor.h" +#include "qerror.h" Middle mode generates signatures that contain a 'Monitor *'.
qmp-commands.hincludes qmp-types which only includesqmp-types-core.h
Quoted 2 lines
Without having a #include "
monitor.h" here,qmp-commands.his relying on something else includingmonitor.hbefore includingqmp-commands.h
Everything should be including qemu-common.h that has the "typedef struct Monitor Monitor". Note that this is not really just a cleanup. Right now I cannot include qapi-types.h from block_int.h, because monitor.h depends on block_int.h.
Paolo
Re: [Qemu-devel] [PATCH v2 3/3] qmp: do not include monitor.h from qapi-types-core.h
In reply to Anthony LiguoriAm 07.06.2012 06:55, schrieb Anthony Liguori:
Quoted 25 lines · Paolo Bonzini
Quoted 13 lines
The comment is stale,
monitor.his not needed anymore (onlyqerror.his, because it contains the schema for errors).Signed-off-by Paolo Bonzini<[email protected]>--- qapi/qapi-types-core.h | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)qapi/qapi-types-core.h +0
-0qapi/qapi-types-core.h line 19
Quoted 7 lines
qapi/qapi-types-core.h +1
-3@@ -16,8 +16,6 @@#include "qemu-common.h" #include "error.h" - -/* FIXME this is temporary until we remove middle mode */ -#include "monitor.h" +#include "qerror.h" Middle mode generates signatures that contain a 'Monitor *'.
qmp-commands.hincludes qmp-types which only includesqmp-types-core.h
Quoted 2 lines
Without having a #include "
monitor.h" here,qmp-commands.his relying on something else includingmonitor.hbefore includingqmp-commands.h
[snip]
Similar situation with some block types - they're being used in one of these core QAPI files but my CPU-as-a-device branch no longer compiles since somehow the appropriate block header is no longer being included.
Andreas
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Luiz Capitulino
AppliedQuoted 5 lines · On Thu, 7 Jun 2012 04:02:19 +0200 Paolo Bonzini <[email protected]> wrote:
There is no reason why QAPI clients should use
monitor.hat all,qerror.hsuffices.
qmp-commands.huses the Monitor typedef, but it is only included from files that already get the typedef fromqemu-common.h.
Applied to the qmp branch, thanks.
PS: I'm assuming that Anthony doesn't have further objections.