summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.target1
-rw-r--r--audio/audio.c4
-rw-r--r--hw/device-assignment.c2
-rw-r--r--hw/pc.c35
-rw-r--r--hw/scsi-bus.c2
-rw-r--r--hw/scsi-disk.c3
-rw-r--r--hw/scsi-generic.c1
-rw-r--r--hw/usb-msd.c2
-rw-r--r--hw/usb-serial.c1
-rw-r--r--hw/virtio-net.c1
-rw-r--r--hw/virtio-pci.c2
-rw-r--r--monitor.c123
-rw-r--r--monitor.h5
-rw-r--r--net/dump.c1
-rw-r--r--net/socket.c2
-rw-r--r--net/tap-linux.c1
-rw-r--r--net/tap.c1
-rw-r--r--qemu-config.c1
-rw-r--r--qemu-error.c34
-rw-r--r--qemu-error.h12
-rw-r--r--qemu-tool.c4
-rw-r--r--qerror.c2
-rw-r--r--savevm.c24
-rw-r--r--slirp/misc.c2
-rw-r--r--sysemu.h13
-rw-r--r--usb-linux.c8
-rw-r--r--vl.c3
-rw-r--r--vnc.c5
28 files changed, 113 insertions, 182 deletions
diff --git a/Makefile.target b/Makefile.target
index 4d88543f7..b93b01ee4 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -182,6 +182,7 @@ endif #CONFIG_BSD_USER
ifdef CONFIG_SOFTMMU
obj-y = vl.o async.o monitor.o pci.o pci_host.o pcie_host.o machine.o gdbstub.o
+obj-y += qemu-error.o
# virtio has to be here due to weird dependency between PCI and virtio-net.
# need to fix this properly
obj-y += virtio-blk.o virtio-balloon.o virtio-net.o virtio-pci.o virtio-serial-bus.o
diff --git a/audio/audio.c b/audio/audio.c
index 2a20e5be1..dbf0b96f3 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -330,10 +330,10 @@ void AUD_vlog (const char *cap, const char *fmt, va_list ap)
{
if (conf.log_to_monitor) {
if (cap) {
- monitor_printf(cur_mon, "%s: ", cap);
+ monitor_printf(default_mon, "%s: ", cap);
}
- monitor_vprintf(cur_mon, fmt, ap);
+ monitor_vprintf(default_mon, fmt, ap);
}
else {
if (cap) {
diff --git a/hw/device-assignment.c b/hw/device-assignment.c
index 4522ef480..00c10f2e3 100644
--- a/hw/device-assignment.c
+++ b/hw/device-assignment.c
@@ -33,7 +33,7 @@
#include "qemu-kvm.h"
#include "hw.h"
#include "pc.h"
-#include "sysemu.h"
+#include "qemu-error.h"
#include "console.h"
#include "device-assignment.h"
#include "loader.h"
diff --git a/hw/pc.c b/hw/pc.c
index 0aebae939..fffe79e33 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -237,40 +237,40 @@ static int boot_device2nibble(char boot_device)
return 0;
}
-/* copy/pasted from cmos_init, should be made a general function
- and used there as well */
-static int pc_boot_set(void *opaque, const char *boot_device)
+static int set_boot_dev(RTCState *s, const char *boot_device, int fd_bootchk)
{
- Monitor *mon = cur_mon;
#define PC_MAX_BOOT_DEVICES 3
- RTCState *s = (RTCState *)opaque;
int nbds, bds[3] = { 0, };
int i;
nbds = strlen(boot_device);
if (nbds > PC_MAX_BOOT_DEVICES) {
- monitor_printf(mon, "Too many boot devices for PC\n");
+ qemu_error("Too many boot devices for PC\n");
return(1);
}
for (i = 0; i < nbds; i++) {
bds[i] = boot_device2nibble(boot_device[i]);
if (bds[i] == 0) {
- monitor_printf(mon, "Invalid boot device for PC: '%c'\n",
- boot_device[i]);
+ qemu_error("Invalid boot device for PC: '%c'\n",
+ boot_device[i]);
return(1);
}
}
rtc_set_memory(s, 0x3d, (bds[1] << 4) | bds[0]);
- rtc_set_memory(s, 0x38, (bds[2] << 4));
+ rtc_set_memory(s, 0x38, (bds[2] << 4) | (fd_bootchk ? 0x0 : 0x1));
return(0);
}
+static int pc_boot_set(void *opaque, const char *boot_device)
+{
+ return set_boot_dev(opaque, boot_device, 0);
+}
+
/* hd_table must contain 4 block drivers */
static void cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size,
const char *boot_device, DriveInfo **hd_table)
{
RTCState *s = rtc_state;
- int nbds, bds[3] = { 0, };
int val;
int fd0, fd1, nb;
int i;
@@ -309,22 +309,9 @@ static void cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size,
rtc_set_memory(s, 0x5f, smp_cpus - 1);
/* set boot devices, and disable floppy signature check if requested */
-#define PC_MAX_BOOT_DEVICES 3
- nbds = strlen(boot_device);
- if (nbds > PC_MAX_BOOT_DEVICES) {
- fprintf(stderr, "Too many boot devices for PC\n");
+ if (set_boot_dev(s, boot_device, fd_bootchk)) {
exit(1);
}
- for (i = 0; i < nbds; i++) {
- bds[i] = boot_device2nibble(boot_device[i]);
- if (bds[i] == 0) {
- fprintf(stderr, "Invalid boot device for PC: '%c'\n",
- boot_device[i]);
- exit(1);
- }
- }
- rtc_set_memory(s, 0x3d, (bds[1] << 4) | bds[0]);
- rtc_set_memory(s, 0x38, (bds[2] << 4) | (fd_bootchk ? 0x0 : 0x1));
/* floppy type */
diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c
index a2f9cc1cc..c41ce9b32 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 8f7ffc143..9cc35f8e9 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 de778efa3..cfd990352 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-msd.c b/hw/usb-msd.c
index 1a11bc557..0afb03133 100644
--- a/hw/usb-msd.c
+++ b/hw/usb-msd.c
@@ -535,7 +535,7 @@ static int usb_msd_initfn(USBDevice *dev)
usb_msd_handle_reset(dev);
if (bdrv_key_required(s->conf.dinfo->bdrv)) {
- if (s->dev.qdev.hotplugged) {
+ if (cur_mon) {
monitor_read_bdrv_key_start(cur_mon, s->conf.dinfo->bdrv,
usb_msd_password_cb, s);
s->dev.auto_attach = 0;
diff --git a/hw/usb-serial.c b/hw/usb-serial.c
index 1410b11b2..6db9446b8 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 5c0093e87..8359be69e 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 799f664d8..52f8812b0 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.c b/monitor.c
index e5944f3d3..ef58cd435 100644
--- a/monitor.c
+++ b/monitor.c
@@ -180,7 +180,8 @@ static QLIST_HEAD(mon_list, Monitor) mon_list;
static const mon_cmd_t mon_cmds[];
static const mon_cmd_t info_cmds[];
-Monitor *cur_mon = NULL;
+Monitor *cur_mon;
+Monitor *default_mon;
static void monitor_command_cb(Monitor *mon, const char *cmdline,
void *opaque);
@@ -2564,7 +2565,7 @@ static void do_loadvm(Monitor *mon, const QDict *qdict)
vm_stop(0);
- if (load_vmstate(mon, name) >= 0 && saved_vm_running)
+ if (load_vmstate(name) >= 0 && saved_vm_running)
vm_start();
}
@@ -3888,6 +3889,18 @@ fail:
return NULL;
}
+void monitor_set_error(Monitor *mon, QError *qerror)
+{
+ /* report only the first error */
+ if (!mon->error) {
+ mon->error = qerror;
+ } else {
+ MON_DEBUG("Additional error report at %s:%d\n",
+ qerror->file, qerror->linenr);
+ QDECREF(qerror);
+ }
+}
+
static void monitor_print_error(Monitor *mon)
{
qerror_print(mon->error);
@@ -3989,8 +4002,6 @@ static void handle_user_command(Monitor *mon, const char *cmdline)
if (!cmd)
goto out;
- qemu_errors_to_mon(mon);
-
if (monitor_handler_is_async(cmd)) {
user_async_cmd_handler(mon, cmd, qdict);
} else if (monitor_handler_ported(cmd)) {
@@ -4002,8 +4013,6 @@ static void handle_user_command(Monitor *mon, const char *cmdline)
if (monitor_has_error(mon))
monitor_print_error(mon);
- qemu_errors_to_previous();
-
out:
QDECREF(qdict);
}
@@ -4405,7 +4414,6 @@ static void handle_qmp_command(JSONMessageParser *parser, QList *tokens)
const char *cmd_name, *info_item;
args = NULL;
- qemu_errors_to_mon(mon);
obj = json_parser_parse(tokens, NULL);
if (!obj) {
@@ -4486,7 +4494,6 @@ err_out:
monitor_protocol_emitter(mon, NULL);
out:
QDECREF(args);
- qemu_errors_to_previous();
}
/**
@@ -4655,8 +4662,8 @@ void monitor_init(CharDriverState *chr, int flags)
}
QLIST_INSERT_HEAD(&mon_list, mon, entry);
- if (!cur_mon || (flags & MONITOR_IS_DEFAULT))
- cur_mon = mon;
+ if (!default_mon || (flags & MONITOR_IS_DEFAULT))
+ default_mon = mon;
}
static void bdrv_password_cb(Monitor *mon, const char *password, void *opaque)
@@ -4704,99 +4711,3 @@ int monitor_read_bdrv_key_start(Monitor *mon, BlockDriverState *bs,
return err;
}
-
-typedef struct QemuErrorSink QemuErrorSink;
-struct QemuErrorSink {
- enum {
- ERR_SINK_FILE,
- ERR_SINK_MONITOR,
- } dest;
- union {
- FILE *fp;
- Monitor *mon;
- };
- QemuErrorSink *previous;
-};
-
-static QemuErrorSink *qemu_error_sink;
-
-void qemu_errors_to_file(FILE *fp)
-{
- QemuErrorSink *sink;
-
- sink = qemu_mallocz(sizeof(*sink));
- sink->dest = ERR_SINK_FILE;
- sink->fp = fp;
- sink->previous = qemu_error_sink;
- qemu_error_sink = sink;
-}
-
-void qemu_errors_to_mon(Monitor *mon)
-{
- QemuErrorSink *sink;
-
- sink = qemu_mallocz(sizeof(*sink));
- sink->dest = ERR_SINK_MONITOR;
- sink->mon = mon;
- sink->previous = qemu_error_sink;
- qemu_error_sink = sink;
-}
-
-void qemu_errors_to_previous(void)
-{
- QemuErrorSink *sink;
-
- assert(qemu_error_sink != NULL);
- sink = qemu_error_sink;
- qemu_error_sink = sink->previous;
- qemu_free(sink);
-}
-
-void qemu_error(const char *fmt, ...)
-{
- va_list args;
-
- assert(qemu_error_sink != NULL);
- switch (qemu_error_sink->dest) {
- case ERR_SINK_FILE:
- va_start(args, fmt);
- vfprintf(qemu_error_sink->fp, fmt, args);
- va_end(args);
- break;
- case ERR_SINK_MONITOR:
- va_start(args, fmt);
- monitor_vprintf(qemu_error_sink->mon, fmt, args);
- va_end(args);
- break;
- }
-}
-
-void qemu_error_internal(const char *file, int linenr, const char *func,
- const char *fmt, ...)
-{
- va_list va;
- QError *qerror;
-
- assert(qemu_error_sink != NULL);
-
- va_start(va, fmt);
- qerror = qerror_from_info(file, linenr, func, fmt, &va);
- va_end(va);
-
- switch (qemu_error_sink->dest) {
- case ERR_SINK_FILE:
- qerror_print(qerror);
- QDECREF(qerror);
- break;
- case ERR_SINK_MONITOR:
- /* report only the first error */
- if (!qemu_error_sink->mon->error) {
- qemu_error_sink->mon->error = qerror;
- } else {
- MON_DEBUG("Additional error report at %s:%d\n", qerror->file,
- qerror->linenr);
- QDECREF(qerror);
- }
- break;
- }
-}
diff --git a/monitor.h b/monitor.h
index e5f2d2ba7..dbb7becba 100644
--- a/monitor.h
+++ b/monitor.h
@@ -3,10 +3,13 @@
#include "qemu-common.h"
#include "qemu-char.h"
+#include "qemu-error.h"
+#include "qerror.h"
#include "qdict.h"
#include "block.h"
extern Monitor *cur_mon;
+extern Monitor *default_mon;
/* flags for monitor_init */
#define MONITOR_IS_DEFAULT 0x01
@@ -48,4 +51,6 @@ void monitor_flush(Monitor *mon);
typedef void (MonitorCompletion)(void *opaque, QObject *ret_data);
+void monitor_set_error(Monitor *mon, QError *qerror);
+
#endif /* !MONITOR_H */
diff --git a/net/dump.c b/net/dump.c
index d50b4eeac..e70283010 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 442a9c790..474d573a4 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 6af9e824d..c5748e631 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 7a7320c1a..9ba9b4a5d 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 6cecf3341..e8383b889 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.c b/qemu-error.c
new file mode 100644
index 000000000..63bcdcfa1
--- /dev/null
+++ b/qemu-error.c
@@ -0,0 +1,34 @@
+#include <stdio.h>
+#include "monitor.h"
+#include "sysemu.h"
+
+void qemu_error(const char *fmt, ...)
+{
+ va_list args;
+
+ va_start(args, fmt);
+ if (cur_mon) {
+ monitor_vprintf(cur_mon, fmt, args);
+ } else {
+ vfprintf(stderr, fmt, args);
+ }
+ va_end(args);
+}
+
+void qemu_error_internal(const char *file, int linenr, const char *func,
+ const char *fmt, ...)
+{
+ va_list va;
+ QError *qerror;
+
+ va_start(va, fmt);
+ qerror = qerror_from_info(file, linenr, func, fmt, &va);
+ va_end(va);
+
+ if (cur_mon) {
+ monitor_set_error(cur_mon, qerror);
+ } else {
+ qerror_print(qerror);
+ QDECREF(qerror);
+ }
+}
diff --git a/qemu-error.h b/qemu-error.h
new file mode 100644
index 000000000..fa161135f
--- /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 18b48af31..26f46eb09 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>
@@ -33,8 +33,6 @@ void qemu_service_io(void)
{
}
-Monitor *cur_mon;
-
void monitor_printf(Monitor *mon, const char *fmt, ...)
{
}
diff --git a/qerror.c b/qerror.c
index 2f657f4f7..a418bde37 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/savevm.c b/savevm.c
index 7d877e7e9..22ca10244 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1760,7 +1760,7 @@ void do_savevm(Monitor *mon, const QDict *qdict)
vm_start();
}
-int load_vmstate(Monitor *mon, const char *name)
+int load_vmstate(const char *name)
{
DriveInfo *dinfo;
BlockDriverState *bs, *bs1;
@@ -1770,7 +1770,7 @@ int load_vmstate(Monitor *mon, const char *name)
bs = get_bs_snapshots();
if (!bs) {
- monitor_printf(mon, "No block device supports snapshots\n");
+ qemu_error("No block device supports snapshots\n");
return -EINVAL;
}
@@ -1783,21 +1783,19 @@ int load_vmstate(Monitor *mon, const char *name)
ret = bdrv_snapshot_goto(bs1, name);
if (ret < 0) {
if (bs != bs1)
- monitor_printf(mon, "Warning: ");
+ qemu_error("Warning: ");
switch(ret) {
case -ENOTSUP:
- monitor_printf(mon,
- "Snapshots not supported on device '%s'\n",
- bdrv_get_device_name(bs1));
+ qemu_error("Snapshots not supported on device '%s'\n",
+ bdrv_get_device_name(bs1));
break;
case -ENOENT:
- monitor_printf(mon, "Could not find snapshot '%s' on "
- "device '%s'\n",
- name, bdrv_get_device_name(bs1));
+ qemu_error("Could not find snapshot '%s' on device '%s'\n",
+ name, bdrv_get_device_name(bs1));
break;
default:
- monitor_printf(mon, "Error %d while activating snapshot on"
- " '%s'\n", ret, bdrv_get_device_name(bs1));
+ qemu_error("Error %d while activating snapshot on '%s'\n",
+ ret, bdrv_get_device_name(bs1));
break;
}
/* fatal on snapshot block device */
@@ -1815,13 +1813,13 @@ int load_vmstate(Monitor *mon, const char *name)
/* restore the VM state */
f = qemu_fopen_bdrv(bs, 0);
if (!f) {
- monitor_printf(mon, "Could not open VM state file\n");
+ qemu_error("Could not open VM state file\n");
return -EINVAL;
}
ret = qemu_loadvm_state(f);
qemu_fclose(f);
if (ret < 0) {
- monitor_printf(mon, "Error %d while loading VM state\n", ret);
+ qemu_error("Error %d while loading VM state\n", ret);
return ret;
}
return 0;
diff --git a/slirp/misc.c b/slirp/misc.c
index dcb1dc117..1aeb40108 100644
--- a/slirp/misc.c
+++ b/slirp/misc.c
@@ -260,7 +260,7 @@ void lprint(const char *format, ...)
va_list args;
va_start(args, format);
- monitor_vprintf(cur_mon, format, args);
+ monitor_vprintf(default_mon, format, args);
va_end(args);
}
diff --git a/sysemu.h b/sysemu.h
index 9812dc6f3..403afb43a 100644
--- a/sysemu.h
+++ b/sysemu.h
@@ -55,7 +55,7 @@ extern qemu_irq qemu_system_powerdown;
void qemu_system_reset(void);
void do_savevm(Monitor *mon, const QDict *qdict);
-int load_vmstate(Monitor *mon, const char *name);
+int load_vmstate(const char *name);
void do_delvm(Monitor *mon, const QDict *qdict);
void do_info_snapshots(Monitor *mon);
@@ -74,17 +74,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_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 */
diff --git a/usb-linux.c b/usb-linux.c
index a9c15c6d1..d0d7cff49 100644
--- a/usb-linux.c
+++ b/usb-linux.c
@@ -1188,9 +1188,6 @@ static int usb_host_scan_dev(void *opaque, USBScanFunc *func)
*/
static int usb_host_read_file(char *line, size_t line_size, const char *device_file, const char *device_name)
{
-#if 0
- Monitor *mon = cur_mon;
-#endif
FILE *f;
int ret = 0;
char filename[PATH_MAX];
@@ -1201,11 +1198,6 @@ static int usb_host_read_file(char *line, size_t line_size, const char *device_f
if (f) {
ret = fgets(line, line_size, f) != NULL;
fclose(f);
-#if 0
- } else {
- if (mon)
- monitor_printf(mon, "husb: could not open %s\n", filename);
-#endif
}
return ret;
diff --git a/vl.c b/vl.c
index d959fdb11..7296c95c4 100644
--- a/vl.c
+++ b/vl.c
@@ -4908,7 +4908,6 @@ int main(int argc, char **argv, char **envp)
init_clocks();
- qemu_errors_to_file(stderr);
qemu_cache_utils_init(envp);
QLIST_INIT (&vm_change_state_head);
@@ -6174,7 +6173,7 @@ int main(int argc, char **argv, char **envp)
qemu_system_reset();
if (loadvm) {
- if (load_vmstate(cur_mon, loadvm) < 0) {
+ if (load_vmstate(loadvm) < 0) {
autostart = 0;
}
}
diff --git a/vnc.c b/vnc.c
index 7ce73dca3..f10a37f74 100644
--- a/vnc.c
+++ b/vnc.c
@@ -1046,11 +1046,10 @@ static void audio_capture(void *opaque, void *buf, int size)
static void audio_add(VncState *vs)
{
- Monitor *mon = cur_mon;
struct audio_capture_ops ops;
if (vs->audio_cap) {
- monitor_printf(mon, "audio already running\n");
+ monitor_printf(default_mon, "audio already running\n");
return;
}
@@ -1060,7 +1059,7 @@ static void audio_add(VncState *vs)
vs->audio_cap = AUD_add_capture(&vs->as, &ops, vs);
if (!vs->audio_cap) {
- monitor_printf(mon, "Failed to add audio capture\n");
+ monitor_printf(default_mon, "Failed to add audio capture\n");
}
}