aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@android.com>2011-05-10 17:31:15 +0200
committerDavid 'Digit' Turner <digit@android.com>2011-06-01 17:08:18 +0200
commit95a83ce7ee413954ba6325584ea659c6685edfd5 (patch)
tree9d3a33d309a435361b855c9f09eb4629a3b5b2a9
parent986acc9eba2cf7c9b468c2f84764fa478907ac66 (diff)
downloadexternal_qemu-95a83ce7ee413954ba6325584ea659c6685edfd5.zip
external_qemu-95a83ce7ee413954ba6325584ea659c6685edfd5.tar.gz
external_qemu-95a83ce7ee413954ba6325584ea659c6685edfd5.tar.bz2
savevm: Remove OutputBuffer hack.
It's easier to provide a fake Monitor object instead. Change-Id: Ia45267061d489b147497add6120d3caa9234ac11
-rw-r--r--Makefile.common1
-rw-r--r--android/console.c56
-rw-r--r--buffered_file.c9
-rw-r--r--monitor-android.h49
-rw-r--r--monitor.c12
-rw-r--r--monitor.h13
-rw-r--r--outputchannel.c61
-rw-r--r--outputchannel.h38
-rw-r--r--savevm.c112
-rw-r--r--sysemu.h7
10 files changed, 147 insertions, 211 deletions
diff --git a/Makefile.common b/Makefile.common
index 74efd43..c762e4d 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -353,7 +353,6 @@ CORE_MISC_SOURCES = \
net-android.c \
notify.c \
osdep.c \
- outputchannel.c \
path.c \
qemu-char-android.c \
qemu-config.c \
diff --git a/android/console.c b/android/console.c
index daae2d7..f4273f4 100644
--- a/android/console.c
+++ b/android/console.c
@@ -2058,33 +2058,33 @@ static const CommandDefRec event_commands[] =
/********************************************************************************************/
static int
-control_write_out_cb(void* opaque, const char* fmt, va_list ap)
+control_write_out_cb(void* opaque, const char* str, int strsize)
{
ControlClient client = opaque;
- int ret = control_vwrite(client, fmt, ap);
- return ret;
+ control_control_write(client, str, strsize);
+ return strsize;
}
static int
-control_write_err_cb(void* opaque, const char* fmt, va_list ap)
+control_write_err_cb(void* opaque, const char* str, int strsize)
{
int ret = 0;
ControlClient client = opaque;
ret += control_write(client, "KO: ");
- ret += control_vwrite(client, fmt, ap);
- return ret;
+ control_control_write(client, str, strsize);
+ return ret + strsize;
}
static int
do_snapshot_list( ControlClient client, char* args )
{
- int ret;
- OutputChannel *out = output_channel_alloc(client, control_write_out_cb);
- OutputChannel *err = output_channel_alloc(client, control_write_err_cb);
- do_info_snapshots_oc(out, err);
- ret = output_channel_written(err);
- output_channel_free(out);
- output_channel_free(err);
+ int64_t ret;
+ Monitor *out = monitor_fake_new(client, control_write_out_cb);
+ Monitor *err = monitor_fake_new(client, control_write_err_cb);
+ do_info_snapshots(out, err);
+ ret = monitor_fake_get_bytes(err);
+ monitor_fake_free(err);
+ monitor_fake_free(out);
return ret > 0;
}
@@ -2092,17 +2092,17 @@ do_snapshot_list( ControlClient client, char* args )
static int
do_snapshot_save( ControlClient client, char* args )
{
- int ret;
+ int64_t ret;
if (args == NULL) {
control_write(client, "KO: argument missing, try 'avd snapshot save <name>'\r\n");
return -1;
}
- OutputChannel *err = output_channel_alloc(client, control_write_err_cb);
- do_savevm_oc(err, args);
- ret = output_channel_written(err);
- output_channel_free(err);
+ Monitor *err = monitor_fake_new(client, control_write_err_cb);
+ do_savevm(err, args);
+ ret = monitor_fake_get_bytes(err);
+ monitor_fake_free(err);
return ret > 0; // no output on error channel indicates success
}
@@ -2110,17 +2110,17 @@ do_snapshot_save( ControlClient client, char* args )
static int
do_snapshot_load( ControlClient client, char* args )
{
- int ret;
+ int64_t ret;
if (args == NULL) {
control_write(client, "KO: argument missing, try 'avd snapshot load <name>'\r\n");
return -1;
}
- OutputChannel *err = output_channel_alloc(client, control_write_err_cb);
- do_loadvm_oc(err, args);
- ret = output_channel_written(err);
- output_channel_free(err);
+ Monitor *err = monitor_fake_new(client, control_write_err_cb);
+ do_loadvm(err, args);
+ ret = monitor_fake_get_bytes(err);
+ monitor_fake_free(err);
return ret > 0;
}
@@ -2128,17 +2128,17 @@ do_snapshot_load( ControlClient client, char* args )
static int
do_snapshot_del( ControlClient client, char* args )
{
- int ret;
+ int64_t ret;
if (args == NULL) {
control_write(client, "KO: argument missing, try 'avd snapshot del <name>'\r\n");
return -1;
}
- OutputChannel *err = output_channel_alloc(client, control_write_err_cb);
- do_delvm_oc(err, args);
- ret = output_channel_written(err);
- output_channel_free(err);
+ Monitor *err = monitor_fake_new(client, control_write_err_cb);
+ do_delvm(err, args);
+ ret = monitor_fake_get_bytes(err);
+ monitor_fake_free(err);
return ret > 0;
}
diff --git a/buffered_file.c b/buffered_file.c
index bdfcea9..5e9484e 100644
--- a/buffered_file.c
+++ b/buffered_file.c
@@ -206,20 +206,23 @@ static int buffered_rate_limit(void *opaque)
return 0;
}
-static size_t buffered_set_rate_limit(void *opaque, size_t new_rate)
+static int64_t buffered_set_rate_limit(void *opaque, int64_t new_rate)
{
QEMUFileBuffered *s = opaque;
-
if (s->has_error)
goto out;
+ if (new_rate > SIZE_MAX) {
+ new_rate = SIZE_MAX;
+ }
+
s->xfer_limit = new_rate / 10;
out:
return s->xfer_limit;
}
-static size_t buffered_get_rate_limit(void *opaque)
+static int64_t buffered_get_rate_limit(void *opaque)
{
QEMUFileBuffered *s = opaque;
diff --git a/monitor-android.h b/monitor-android.h
new file mode 100644
index 0000000..b9b0b37
--- /dev/null
+++ b/monitor-android.h
@@ -0,0 +1,49 @@
+/* This file is included from monitor.c, it's purpose is to hold as much
+ * Android-specific stuff as possible to ease upstream integrations.
+ */
+
+Monitor*
+monitor_fake_new(void* opaque, MonitorFakeFunc cb)
+{
+ Monitor* mon;
+
+ assert(cb != NULL);
+ mon = qemu_mallocz(sizeof(*mon));
+ mon->fake_opaque = opaque;
+ mon->fake_func = cb;
+ mon->fake_count = 0;
+
+ return mon;
+}
+
+int
+monitor_fake_get_bytes(Monitor* mon)
+{
+ assert(mon->fake_func != NULL);
+ return mon->fake_count;
+}
+
+void
+monitor_fake_free(Monitor* mon)
+{
+ assert(mon->fake_func != NULL);
+ free(mon);
+}
+
+/* This replaces the definition in monitor.c which is in a
+ * #ifndef CONFIG_ANDROID .. #endif block.
+ */
+void monitor_flush(Monitor *mon)
+{
+ if (!mon)
+ return;
+
+ if (mon->fake_func != NULL) {
+ mon->fake_func(mon->fake_opaque, (void*)mon->outbuf, mon->outbuf_index);
+ mon->outbuf_index = 0;
+ mon->fake_count += mon->outbuf_index;
+ } else if (!mon->mux_out) {
+ qemu_chr_write(mon->chr, mon->outbuf, mon->outbuf_index);
+ mon->outbuf_index = 0;
+ }
+}
diff --git a/monitor.c b/monitor.c
index 3c9d512..cf8bb42 100644
--- a/monitor.c
+++ b/monitor.c
@@ -86,8 +86,18 @@ struct Monitor {
void *password_opaque;
QLIST_ENTRY(Monitor) entry;
int has_quit;
+#ifdef CONFIG_ANDROID
+ void* fake_opaque;
+ MonitorFakeFunc fake_func;
+ int64_t fake_count;
+
+#endif
};
+#ifdef CONFIG_ANDROID
+#include "monitor-android.h"
+#endif
+
static QLIST_HEAD(mon_list, Monitor) mon_list;
#if defined(TARGET_I386)
@@ -158,6 +168,7 @@ static int monitor_read_password(Monitor *mon, ReadLineFunc *readline_func,
}
}
+#ifndef CONFIG_ANDROID /* See monitor-android.h */
void monitor_flush(Monitor *mon)
{
if (mon && mon->outbuf_index != 0 && !mon->mux_out) {
@@ -165,6 +176,7 @@ void monitor_flush(Monitor *mon)
mon->outbuf_index = 0;
}
}
+#endif
/* flush at every end of line or if the buffer is full */
static void monitor_puts(Monitor *mon, const char *str)
diff --git a/monitor.h b/monitor.h
index c94a3c8..ce72052 100644
--- a/monitor.h
+++ b/monitor.h
@@ -60,4 +60,17 @@ typedef void (MonitorCompletion)(void *opaque, QObject *ret_data);
void monitor_set_error(Monitor *mon, QError *qerror);
+#ifdef CONFIG_ANDROID
+typedef int (*MonitorFakeFunc)(void* opaque, const char* str, int strsize);
+
+/* Create a new fake Monitor object to send all output to an internal
+ * buffer. This is used to send snapshot save/load errors (produced in
+ * savevm.c) to the Android console when 'avd snapshot save' or
+ * 'avd snapshot load' are used.
+ */
+Monitor* monitor_fake_new(void* opaque, MonitorFakeFunc cb);
+int monitor_fake_get_bytes(Monitor* mon);
+void monitor_fake_free(Monitor* mon);
+#endif
+
#endif /* !MONITOR_H */
diff --git a/outputchannel.c b/outputchannel.c
deleted file mode 100644
index 192b488..0000000
--- a/outputchannel.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#include "outputchannel.h"
-#include "qemu-common.h"
-
-struct OutputChannel {
- void* opaque; /* caller-specific information */
- OutputChannelPrintf printf; /* callback function to do the printing */
- unsigned int written; /* number of bytes written to the channel */
-};
-
-OutputChannel* output_channel_alloc(void* opaque, OutputChannelPrintf cb)
-{
- OutputChannel* oc = qemu_mallocz(sizeof(*oc));
- oc->printf = cb;
- oc->opaque = opaque;
- oc->written = 0;
-
- return oc;
-}
-
-int output_channel_printf(OutputChannel* oc, const char* fmt, ...)
-{
- int ret;
- va_list ap;
- va_start(ap, fmt);
- ret = oc->printf(oc->opaque, fmt, ap);
- va_end(ap);
-
- /* Don't count errors and no-ops towards number of bytes written */
- if (ret > 0) {
- oc->written += ret;
- }
-
- return ret;
-}
-
-void output_channel_free(OutputChannel* oc)
-{
- free(oc);
-}
-
-unsigned int output_channel_written(OutputChannel* oc)
-{
- return oc->written;
-}
diff --git a/outputchannel.h b/outputchannel.h
deleted file mode 100644
index 4dece8d..0000000
--- a/outputchannel.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _OUTPUTCHANNEL_H
-#define _OUTPUTCHANNEL_H
-
-#include <stdarg.h>
-
-/* Callback function to print a printf-formatted string to a channel */
-typedef int (*OutputChannelPrintf) (void* opaque, const char* fmt, va_list ap);
-
-typedef struct OutputChannel OutputChannel;
-
-/* Allocates a new output channel */
-OutputChannel* output_channel_alloc(void* opaque, OutputChannelPrintf cb);
-
-/* Prints a printf-formatted string to the output channel */
-int output_channel_printf(OutputChannel* oc, const char* fmt, ...);
-
-/* Frees an output channel */
-void output_channel_free(OutputChannel* oc);
-
-/* Returns the number of bytes written to the channel */
-unsigned int output_channel_written(OutputChannel* oc);
-
-#endif /* _OUTPUTCHANNEL_H */
diff --git a/savevm.c b/savevm.c
index e9d16de..5da7a8c 100644
--- a/savevm.c
+++ b/savevm.c
@@ -78,7 +78,6 @@
#include "qemu-timer.h"
#include "qemu-char.h"
#include "blockdev.h"
-#include "outputchannel.h"
#include "block.h"
#include "audio/audio.h"
#include "migration.h"
@@ -265,10 +264,10 @@ QEMUFile *qemu_popen(FILE *stdio_file, const char *mode)
s->stdio_file = stdio_file;
if(mode[0] == 'r') {
- s->file = qemu_fopen_ops(s, NULL, stdio_get_buffer, stdio_pclose,
+ s->file = qemu_fopen_ops(s, NULL, stdio_get_buffer, stdio_pclose,
NULL, NULL, NULL);
} else {
- s->file = qemu_fopen_ops(s, stdio_put_buffer, NULL, stdio_pclose,
+ s->file = qemu_fopen_ops(s, stdio_put_buffer, NULL, stdio_pclose,
NULL, NULL, NULL);
}
return s->file;
@@ -314,10 +313,10 @@ QEMUFile *qemu_fdopen(int fd, const char *mode)
goto fail;
if(mode[0] == 'r') {
- s->file = qemu_fopen_ops(s, NULL, stdio_get_buffer, stdio_fclose,
+ s->file = qemu_fopen_ops(s, NULL, stdio_get_buffer, stdio_fclose,
NULL, NULL, NULL);
} else {
- s->file = qemu_fopen_ops(s, stdio_put_buffer, NULL, stdio_fclose,
+ s->file = qemu_fopen_ops(s, stdio_put_buffer, NULL, stdio_fclose,
NULL, NULL, NULL);
}
return s->file;
@@ -332,7 +331,7 @@ QEMUFile *qemu_fopen_socket(int fd)
QEMUFileSocket *s = qemu_mallocz(sizeof(QEMUFileSocket));
s->fd = fd;
- s->file = qemu_fopen_ops(s, NULL, socket_get_buffer, file_socket_close,
+ s->file = qemu_fopen_ops(s, NULL, socket_get_buffer, file_socket_close,
NULL, NULL, NULL);
return s->file;
}
@@ -368,12 +367,12 @@ QEMUFile *qemu_fopen(const char *filename, const char *mode)
s->stdio_file = fopen(filename, mode);
if (!s->stdio_file)
goto fail;
-
+
if(mode[0] == 'w') {
- s->file = qemu_fopen_ops(s, file_put_buffer, NULL, stdio_fclose,
+ s->file = qemu_fopen_ops(s, file_put_buffer, NULL, stdio_fclose,
NULL, NULL, NULL);
} else {
- s->file = qemu_fopen_ops(s, NULL, file_get_buffer, stdio_fclose,
+ s->file = qemu_fopen_ops(s, NULL, file_get_buffer, stdio_fclose,
NULL, NULL, NULL);
}
return s->file;
@@ -402,7 +401,7 @@ static int bdrv_fclose(void *opaque)
static QEMUFile *qemu_fopen_bdrv(BlockDriverState *bs, int is_writable)
{
if (is_writable)
- return qemu_fopen_ops(bs, block_put_buffer, NULL, bdrv_fclose,
+ return qemu_fopen_ops(bs, block_put_buffer, NULL, bdrv_fclose,
NULL, NULL, NULL);
return qemu_fopen_ops(bs, NULL, block_get_buffer, bdrv_fclose, NULL, NULL, NULL);
}
@@ -1199,21 +1198,7 @@ static int bdrv_snapshot_find(BlockDriverState *bs, QEMUSnapshotInfo *sn_info,
return ret;
}
-static int
-monitor_output_channel_cb(void* opaque, const char* fmt, va_list ap)
-{
- return monitor_vprintf((Monitor*) opaque, fmt, ap);
-}
-
-
-void do_savevm(Monitor *mon, const char *name)
-{
- OutputChannel *oc = output_channel_alloc(mon, monitor_output_channel_cb);
- do_savevm_oc(oc, name);
- output_channel_free(oc);
-}
-
-void do_savevm_oc(OutputChannel *err, const char *name)
+void do_savevm(Monitor *err, const char *name)
{
BlockDriverState *bs, *bs1;
QEMUSnapshotInfo sn1, *sn = &sn1, old_sn1, *old_sn = &old_sn1;
@@ -1230,7 +1215,7 @@ void do_savevm_oc(OutputChannel *err, const char *name)
bs = bdrv_snapshots();
if (!bs) {
- output_channel_printf(err, "No block device can accept snapshots\n");
+ monitor_printf(err, "No block device can accept snapshots\n");
return;
}
@@ -1269,7 +1254,7 @@ void do_savevm_oc(OutputChannel *err, const char *name)
sn->vm_clock_nsec = qemu_get_clock_ns(vm_clock);
if (bdrv_get_info(bs, bdi) < 0 || bdi->vm_state_offset <= 0) {
- output_channel_printf(err, "Device %s does not support VM state snapshots\n",
+ monitor_printf(err, "Device %s does not support VM state snapshots\n",
bdrv_get_device_name(bs));
goto the_end;
}
@@ -1277,14 +1262,14 @@ void do_savevm_oc(OutputChannel *err, const char *name)
/* save the VM state */
f = qemu_fopen_bdrv(bs, 1);
if (!f) {
- output_channel_printf(err, "Could not open VM state file\n");
+ monitor_printf(err, "Could not open VM state file\n");
goto the_end;
}
ret = qemu_savevm_state(f);
vm_state_size = qemu_ftell(f);
qemu_fclose(f);
if (ret < 0) {
- output_channel_printf(err, "Error %d while writing VM\n", ret);
+ monitor_printf(err, "Error %d while writing VM\n", ret);
goto the_end;
}
@@ -1296,7 +1281,7 @@ void do_savevm_oc(OutputChannel *err, const char *name)
if (must_delete) {
ret = bdrv_snapshot_delete(bs1, old_sn->id_str);
if (ret < 0) {
- output_channel_printf(err,
+ monitor_printf(err,
"Error while deleting snapshot on '%s'\n",
bdrv_get_device_name(bs1));
}
@@ -1305,7 +1290,7 @@ void do_savevm_oc(OutputChannel *err, const char *name)
sn->vm_state_size = (bs == bs1 ? vm_state_size : 0);
ret = bdrv_snapshot_create(bs1, sn);
if (ret < 0) {
- output_channel_printf(err, "Error while creating snapshot on '%s'\n",
+ monitor_printf(err, "Error while creating snapshot on '%s'\n",
bdrv_get_device_name(bs1));
}
}
@@ -1316,15 +1301,7 @@ void do_savevm_oc(OutputChannel *err, const char *name)
vm_start();
}
-void do_loadvm(Monitor *mon, const char *name)
-{
- OutputChannel *oc = output_channel_alloc(mon, monitor_output_channel_cb);
- android_snapshot_update_time_request = 1;
- do_loadvm_oc(oc, name);
- output_channel_free(oc);
-}
-
-void do_loadvm_oc(OutputChannel *err, const char *name)
+void do_loadvm(Monitor *err, const char *name)
{
BlockDriverState *bs, *bs1;
BlockDriverInfo bdi1, *bdi = &bdi1;
@@ -1335,7 +1312,7 @@ void do_loadvm_oc(OutputChannel *err, const char *name)
bs = bdrv_snapshots();
if (!bs) {
- output_channel_printf(err, "No block device supports snapshots\n");
+ monitor_printf(err, "No block device supports snapshots\n");
return;
}
@@ -1351,20 +1328,20 @@ void do_loadvm_oc(OutputChannel *err, const char *name)
ret = bdrv_snapshot_goto(bs1, name);
if (ret < 0) {
if (bs != bs1)
- output_channel_printf(err, "Warning: ");
+ monitor_printf(err, "Warning: ");
switch(ret) {
case -ENOTSUP:
- output_channel_printf(err,
+ monitor_printf(err,
"Snapshots not supported on device '%s'\n",
bdrv_get_device_name(bs1));
break;
case -ENOENT:
- output_channel_printf(err, "Could not find snapshot '%s' on "
+ monitor_printf(err, "Could not find snapshot '%s' on "
"device '%s'\n",
name, bdrv_get_device_name(bs1));
break;
default:
- output_channel_printf(err, "Error %d while activating snapshot on"
+ monitor_printf(err, "Error %d while activating snapshot on"
" '%s'\n", ret, bdrv_get_device_name(bs1));
break;
}
@@ -1376,7 +1353,7 @@ void do_loadvm_oc(OutputChannel *err, const char *name)
}
if (bdrv_get_info(bs, bdi) < 0 || bdi->vm_state_offset <= 0) {
- output_channel_printf(err, "Device %s does not support VM state snapshots\n",
+ monitor_printf(err, "Device %s does not support VM state snapshots\n",
bdrv_get_device_name(bs));
return;
}
@@ -1389,33 +1366,27 @@ void do_loadvm_oc(OutputChannel *err, const char *name)
/* restore the VM state */
f = qemu_fopen_bdrv(bs, 0);
if (!f) {
- output_channel_printf(err, "Could not open VM state file\n");
+ monitor_printf(err, "Could not open VM state file\n");
goto the_end;
}
ret = qemu_loadvm_state(f);
qemu_fclose(f);
if (ret < 0) {
- output_channel_printf(err, "Error %d while loading VM state\n", ret);
+ monitor_printf(err, "Error %d while loading VM state\n", ret);
}
the_end:
if (saved_vm_running)
vm_start();
}
-void do_delvm(Monitor *mon, const char *name)
-{
- OutputChannel *oc = output_channel_alloc(mon, monitor_output_channel_cb);
- do_delvm_oc(oc, name);
- output_channel_free(oc);
-}
-void do_delvm_oc(OutputChannel *err, const char *name)
+void do_delvm(Monitor *err, const char *name)
{
BlockDriverState *bs, *bs1;
int ret;
bs = bdrv_snapshots();
if (!bs) {
- output_channel_printf(err, "No block device supports snapshots\n");
+ monitor_printf(err, "No block device supports snapshots\n");
return;
}
@@ -1425,25 +1396,18 @@ void do_delvm_oc(OutputChannel *err, const char *name)
ret = bdrv_snapshot_delete(bs1, name);
if (ret < 0) {
if (ret == -ENOTSUP)
- output_channel_printf(err,
+ monitor_printf(err,
"Snapshots not supported on device '%s'\n",
bdrv_get_device_name(bs1));
else
- output_channel_printf(err, "Error %d while deleting snapshot on "
+ monitor_printf(err, "Error %d while deleting snapshot on "
"'%s'\n", ret, bdrv_get_device_name(bs1));
}
}
}
}
-void do_info_snapshots(Monitor *mon)
-{
- OutputChannel *oc = output_channel_alloc(mon, monitor_output_channel_cb);
- do_info_snapshots_oc(oc, oc);
- output_channel_free(oc);
-}
-
-void do_info_snapshots_oc(OutputChannel *out, OutputChannel *err)
+void do_info_snapshots(Monitor* out, Monitor* err)
{
BlockDriverState *bs, *bs1;
QEMUSnapshotInfo *sn_tab, *sn;
@@ -1452,30 +1416,30 @@ void do_info_snapshots_oc(OutputChannel *out, OutputChannel *err)
bs = bdrv_snapshots();
if (!bs) {
- output_channel_printf(err, "No available block device supports snapshots\n");
+ monitor_printf(err, "No available block device supports snapshots\n");
return;
}
- output_channel_printf(out, "Snapshot devices:");
+ monitor_printf(out, "Snapshot devices:");
bs1 = NULL;
while ((bs1 = bdrv_next(bs1))) {
if (bdrv_can_snapshot(bs1)) {
if (bs == bs1)
- output_channel_printf(out, " %s", bdrv_get_device_name(bs1));
+ monitor_printf(out, " %s", bdrv_get_device_name(bs1));
}
}
- output_channel_printf(out, "\n");
+ monitor_printf(out, "\n");
nb_sns = bdrv_snapshot_list(bs, &sn_tab);
if (nb_sns < 0) {
- output_channel_printf(err, "bdrv_snapshot_list: error %d\n", nb_sns);
+ monitor_printf(err, "bdrv_snapshot_list: error %d\n", nb_sns);
return;
}
- output_channel_printf(out, "Snapshot list (from %s):\n",
+ monitor_printf(out, "Snapshot list (from %s):\n",
bdrv_get_device_name(bs));
- output_channel_printf(out, "%s\n", bdrv_snapshot_dump(buf, sizeof(buf), NULL));
+ monitor_printf(out, "%s\n", bdrv_snapshot_dump(buf, sizeof(buf), NULL));
for(i = 0; i < nb_sns; i++) {
sn = &sn_tab[i];
- output_channel_printf(out, "%s\n", bdrv_snapshot_dump(buf, sizeof(buf), sn));
+ monitor_printf(out, "%s\n", bdrv_snapshot_dump(buf, sizeof(buf), sn));
}
qemu_free(sn_tab);
}
diff --git a/sysemu.h b/sysemu.h
index 1b23b04..3ab2382 100644
--- a/sysemu.h
+++ b/sysemu.h
@@ -8,7 +8,6 @@
#include "qemu-timer.h"
#include "qdict.h"
#include "qerror.h"
-#include "outputchannel.h"
#ifdef _WIN32
#include <windows.h>
@@ -63,13 +62,9 @@ void qemu_system_powerdown(void);
void qemu_system_reset(void);
void do_savevm(Monitor *mon, const char *name);
-void do_savevm_oc(OutputChannel *err, const char *name);
void do_loadvm(Monitor *mon, const char *name);
-void do_loadvm_oc(OutputChannel *err, const char *name);
void do_delvm(Monitor *mon, const char *name);
-void do_delvm_oc(OutputChannel *err, const char *name);
-void do_info_snapshots(Monitor *mon);
-void do_info_snapshots_oc(OutputChannel *out, OutputChannel *err);
+void do_info_snapshots(Monitor *mon, Monitor* err);
void qemu_announce_self(void);