summaryrefslogtreecommitdiff
path: root/sysemu.h
diff options
context:
space:
mode:
authorLuiz Capitulino <lcapitulino@redhat.com>2009-11-18 23:05:31 -0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-12-03 09:41:20 -0600
commit8204a9180c5f456d30cbd29fddf734e97f7c74fa (patch)
tree66789e33d8ff66cc287ff78a83eb568d5e169906 /sysemu.h
parent9f9daf9a636c0e6ea435c93bfbccaf05e581eed9 (diff)
downloadqemu-8204a9180c5f456d30cbd29fddf734e97f7c74fa.zip
monitor: QError support
This commit adds QError support in the Monitor. A QError member is added to the Monitor struct. This new member stores error information and is also used to check if an error has occurred when the called handler returns. Additionally, a new macro called qemu_error_new() is introduced. It builds on top of the QemuErrorSink API and should be used in place of qemu_error(). When all conversion to qemu_error_new() is done, qemu_error() can be turned private. Basically, Monitor's error flow is something like this: 1. An error occurs in the handler, it calls qemu_error_new() 2. qemu_error_new() builds a new QError object and stores it in the Monitor struct 3. The handler returns 4. Top level Monitor code checks the Monitor struct and calls qerror_print() to print the error Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'sysemu.h')
-rw-r--r--sysemu.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/sysemu.h b/sysemu.h
index b1887ef1f4..70a2b044df 100644
--- a/sysemu.h
+++ b/sysemu.h
@@ -7,6 +7,7 @@
#include "qemu-queue.h"
#include "qemu-timer.h"
#include "qdict.h"
+#include "qerror.h"
#ifdef _WIN32
#include <windows.h>
@@ -71,6 +72,12 @@ void qemu_errors_to_file(FILE *fp);
void qemu_errors_to_mon(Monitor *mon);
void qemu_errors_to_previous(void);
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 */