Skip to contentSkip to conversation

Clean up includes of monitor.h

PATCH Applied Paolo Bonzini 4 participants 8 messages Jun 7, 2012 – Jun 12, 2012 Networking

lore
Share & tools
lore
#0 lore raw

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
#1 lore raw

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
index 489ee53..831651d 100644
@@ -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
#2 lore raw

PATCH v2 2/3 qmp: include monitor.h when needed

In reply to Paolo Bonzini

This 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
index 2ce8cb9..b9cec1d 100644
@@ -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
index 5ac4ba3..17e9135 100644
@@ -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
#3 lore raw

PATCH v2 3/3 qmp: do not include monitor.h from qapi-types-core.h

In reply to Paolo Bonzini

The 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
index 27e6be0..f781fc3 100644
@@ -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
#4 lore raw

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.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 +0 -0
index 27e6be0..f781fc3 100644

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
#5 lore raw

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.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 +0 -0
index 27e6be0..f781fc3 100644

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

Quoted 2 lines

Without having a #include "monitor.h" here, qmp-commands.h is relying on something else including monitor.h before including qmp-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

#6 lore raw

Re: [Qemu-devel] [PATCH v2 3/3] qmp: do not include monitor.h from qapi-types-core.h

In reply to Anthony Liguori

Am 07.06.2012 06:55, schrieb Anthony Liguori:

Quoted 25 lines · Paolo Bonzini
Quoted 13 lines

The 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 +0 -0
index 27e6be0..f781fc3 100644

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

Quoted 2 lines

Without having a #include "monitor.h" here, qmp-commands.h is relying on something else including monitor.h before including qmp-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
#7 lore raw
In reply to Paolo Bonzini
Quoted 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.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.

Applied to the qmp branch, thanks.

PS: I'm assuming that Anthony doesn't have further objections.