diff mbox

[RFC,11/48] error: Move qemu_error & friends into their own header

Message ID 1267034160-3517-12-git-send-email-armbru@redhat.com
State New
Headers show

Commit Message

Markus Armbruster Feb. 24, 2010, 5:55 p.m. UTC
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 hw/scsi-bus.c     |    2 +-
 hw/scsi-disk.c    |    3 +--
 hw/scsi-generic.c |    1 +
 hw/usb-serial.c   |    1 +
 hw/virtio-net.c   |    1 +
 hw/virtio-pci.c   |    2 +-
 monitor.h         |    1 +
 net/dump.c        |    1 +
 net/socket.c      |    2 +-
 net/tap-linux.c   |    1 +
 net/tap.c         |    1 +
 qemu-config.c     |    1 +
 qemu-error.h      |   12 ++++++++++++
 qemu-tool.c       |    2 +-
 qerror.c          |    2 +-
 sysemu.h          |    8 --------
 16 files changed, 26 insertions(+), 15 deletions(-)
 create mode 100644 qemu-error.h

Comments

Luiz Capitulino Feb. 26, 2010, 7:43 p.m. UTC | #1
On Wed, 24 Feb 2010 18:55:23 +0100
Markus Armbruster <armbru@redhat.com> wrote:

> 
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  hw/scsi-bus.c     |    2 +-
>  hw/scsi-disk.c    |    3 +--
>  hw/scsi-generic.c |    1 +
>  hw/usb-serial.c   |    1 +
>  hw/virtio-net.c   |    1 +
>  hw/virtio-pci.c   |    2 +-
>  monitor.h         |    1 +
>  net/dump.c        |    1 +
>  net/socket.c      |    2 +-
>  net/tap-linux.c   |    1 +
>  net/tap.c         |    1 +
>  qemu-config.c     |    1 +
>  qemu-error.h      |   12 ++++++++++++
>  qemu-tool.c       |    2 +-
>  qerror.c          |    2 +-
>  sysemu.h          |    8 --------
>  16 files changed, 26 insertions(+), 15 deletions(-)
>  create mode 100644 qemu-error.h

 Minor: isn't this change related to patch 02/48? I would merge them or
move this one closer to 02.
Markus Armbruster March 1, 2010, 8:48 a.m. UTC | #2
Luiz Capitulino <lcapitulino@redhat.com> writes:

> On Wed, 24 Feb 2010 18:55:23 +0100
> Markus Armbruster <armbru@redhat.com> wrote:
>
>> 
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> ---
>>  hw/scsi-bus.c     |    2 +-
>>  hw/scsi-disk.c    |    3 +--
>>  hw/scsi-generic.c |    1 +
>>  hw/usb-serial.c   |    1 +
>>  hw/virtio-net.c   |    1 +
>>  hw/virtio-pci.c   |    2 +-
>>  monitor.h         |    1 +
>>  net/dump.c        |    1 +
>>  net/socket.c      |    2 +-
>>  net/tap-linux.c   |    1 +
>>  net/tap.c         |    1 +
>>  qemu-config.c     |    1 +
>>  qemu-error.h      |   12 ++++++++++++
>>  qemu-tool.c       |    2 +-
>>  qerror.c          |    2 +-
>>  sysemu.h          |    8 --------
>>  16 files changed, 26 insertions(+), 15 deletions(-)
>>  create mode 100644 qemu-error.h
>
>  Minor: isn't this change related to patch 02/48? I would merge them or
> move this one closer to 02.

I went for minimal patches, as close to their motivation as possible.  I
kept these two separate, because in each of them the code motion is a
bit more obvious than it would be in a merged patch.

01-02/48 are motivated by the desire to keep general error handling out
of a specific customer, the monitor.  I could move it down some, say
between 9/48 and 10/48.

11/48 is motivated by the desire not to further pollute sysemu.h with
the new error stuff, which starts in 12/48.  I could squash it into
02/48.

I like it the way it is well enough, but I'm not particular about it, so
if you really prefer one of the above moves or squashes, let me know.
diff mbox

Patch

diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c
index a2f9cc1..c41ce9b 100644
--- a/hw/scsi-bus.c
+++ b/hw/scsi-bus.c
@@ -1,5 +1,5 @@ 
 #include "hw.h"
-#include "sysemu.h"
+#include "qemu-error.h"
 #include "scsi.h"
 #include "scsi-defs.h"
 #include "block.h"
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index b2f61fe..b1424de 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -19,8 +19,6 @@ 
  * the host adapter emulator.
  */
 
-#include <qemu-common.h>
-#include <sysemu.h>
 //#define DEBUG_SCSI
 
 #ifdef DEBUG_SCSI
@@ -34,6 +32,7 @@  do { printf("scsi-disk: " fmt , ## __VA_ARGS__); } while (0)
 do { fprintf(stderr, "scsi-disk: " fmt , ## __VA_ARGS__); } while (0)
 
 #include "qemu-common.h"
+#include "qemu-error.h"
 #include "block.h"
 #include "scsi.h"
 #include "scsi-defs.h"
diff --git a/hw/scsi-generic.c b/hw/scsi-generic.c
index de778ef..cfd9903 100644
--- a/hw/scsi-generic.c
+++ b/hw/scsi-generic.c
@@ -12,6 +12,7 @@ 
  */
 
 #include "qemu-common.h"
+#include "qemu-error.h"
 #include "block.h"
 #include "scsi.h"
 
diff --git a/hw/usb-serial.c b/hw/usb-serial.c
index c3f3401..e78c6c0 100644
--- a/hw/usb-serial.c
+++ b/hw/usb-serial.c
@@ -9,6 +9,7 @@ 
  */
 
 #include "qemu-common.h"
+#include "qemu-error.h"
 #include "usb.h"
 #include "qemu-char.h"
 
diff --git a/hw/virtio-net.c b/hw/virtio-net.c
index 5c0093e..8359be6 100644
--- a/hw/virtio-net.c
+++ b/hw/virtio-net.c
@@ -15,6 +15,7 @@ 
 #include "net.h"
 #include "net/checksum.h"
 #include "net/tap.h"
+#include "qemu-error.h"
 #include "qemu-timer.h"
 #include "virtio-net.h"
 
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index bcd40f7..7781328 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -19,7 +19,7 @@ 
 #include "virtio-blk.h"
 #include "virtio-net.h"
 #include "pci.h"
-#include "sysemu.h"
+#include "qemu-error.h"
 #include "msix.h"
 #include "net.h"
 #include "block_int.h"
diff --git a/monitor.h b/monitor.h
index 6d7969c..1222ff0 100644
--- a/monitor.h
+++ b/monitor.h
@@ -3,6 +3,7 @@ 
 
 #include "qemu-common.h"
 #include "qemu-char.h"
+#include "qemu-error.h"
 #include "qerror.h"
 #include "qdict.h"
 #include "block.h"
diff --git a/net/dump.c b/net/dump.c
index d50b4ee..e702830 100644
--- a/net/dump.c
+++ b/net/dump.c
@@ -25,6 +25,7 @@ 
 #include "dump.h"
 #include "qemu-common.h"
 #include "sysemu.h"
+#include "qemu-error.h"
 #include "qemu-log.h"
 
 typedef struct DumpState {
diff --git a/net/socket.c b/net/socket.c
index 442a9c7..474d573 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -28,9 +28,9 @@ 
 #include "net.h"
 #include "qemu-char.h"
 #include "qemu-common.h"
+#include "qemu-error.h"
 #include "qemu-option.h"
 #include "qemu_socket.h"
-#include "sysemu.h"
 
 typedef struct NetSocketState {
     VLANClientState nc;
diff --git a/net/tap-linux.c b/net/tap-linux.c
index 6af9e82..c5748e6 100644
--- a/net/tap-linux.c
+++ b/net/tap-linux.c
@@ -31,6 +31,7 @@ 
 
 #include "sysemu.h"
 #include "qemu-common.h"
+#include "qemu-error.h"
 
 int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required)
 {
diff --git a/net/tap.c b/net/tap.c
index 7a7320c..9ba9b4a 100644
--- a/net/tap.c
+++ b/net/tap.c
@@ -38,6 +38,7 @@ 
 #include "sysemu.h"
 #include "qemu-char.h"
 #include "qemu-common.h"
+#include "qemu-error.h"
 
 #include "net/tap-linux.h"
 
diff --git a/qemu-config.c b/qemu-config.c
index 246fae6..2c9a7a5 100644
--- a/qemu-config.c
+++ b/qemu-config.c
@@ -1,4 +1,5 @@ 
 #include "qemu-common.h"
+#include "qemu-error.h"
 #include "qemu-option.h"
 #include "qemu-config.h"
 #include "sysemu.h"
diff --git a/qemu-error.h b/qemu-error.h
new file mode 100644
index 0000000..fa16113
--- /dev/null
+++ b/qemu-error.h
@@ -0,0 +1,12 @@ 
+#ifndef QEMU_ERROR_H
+#define QEMU_ERROR_H
+
+void qemu_error(const char *fmt, ...) __attribute__ ((format(printf, 1, 2)));
+void qemu_error_internal(const char *file, int linenr, const char *func,
+                         const char *fmt, ...)
+                         __attribute__ ((format(printf, 4, 5)));
+
+#define qemu_error_new(fmt, ...) \
+    qemu_error_internal(__FILE__, __LINE__, __func__, fmt, ## __VA_ARGS__)
+
+#endif
diff --git a/qemu-tool.c b/qemu-tool.c
index bbce99f..26f46eb 100644
--- a/qemu-tool.c
+++ b/qemu-tool.c
@@ -13,9 +13,9 @@ 
 
 #include "qemu-common.h"
 #include "monitor.h"
-#include "sysemu.h"
 #include "qemu-timer.h"
 #include "qemu-log.h"
+#include "qemu-error.h"
 
 #include <sys/time.h>
 
diff --git a/qerror.c b/qerror.c
index 2f657f4..a418bde 100644
--- a/qerror.c
+++ b/qerror.c
@@ -12,8 +12,8 @@ 
 #include "qjson.h"
 #include "qerror.h"
 #include "qstring.h"
-#include "sysemu.h"
 #include "qemu-common.h"
+#include "qemu-error.h"
 
 static void qerror_destroy_obj(QObject *obj);
 
diff --git a/sysemu.h b/sysemu.h
index cd84ee8..6a2dd93 100644
--- a/sysemu.h
+++ b/sysemu.h
@@ -69,14 +69,6 @@  int qemu_savevm_state_complete(Monitor *mon, QEMUFile *f);
 void qemu_savevm_state_cancel(Monitor *mon, QEMUFile *f);
 int qemu_loadvm_state(QEMUFile *f);
 
-void qemu_error(const char *fmt, ...) __attribute__ ((format(printf, 1, 2)));
-void qemu_error_internal(const char *file, int linenr, const char *func,
-                         const char *fmt, ...)
-                         __attribute__ ((format(printf, 4, 5)));
-
-#define qemu_error_new(fmt, ...) \
-    qemu_error_internal(__FILE__, __LINE__, __func__, fmt, ## __VA_ARGS__)
-
 #ifdef _WIN32
 /* Polling handling */