diff options
author | David 'Digit' Turner <digit@android.com> | 2011-05-10 17:31:15 +0200 |
---|---|---|
committer | David 'Digit' Turner <digit@android.com> | 2011-06-01 17:08:18 +0200 |
commit | 95a83ce7ee413954ba6325584ea659c6685edfd5 (patch) | |
tree | 9d3a33d309a435361b855c9f09eb4629a3b5b2a9 /android | |
parent | 986acc9eba2cf7c9b468c2f84764fa478907ac66 (diff) | |
download | external_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
Diffstat (limited to 'android')
-rw-r--r-- | android/console.c | 56 |
1 files changed, 28 insertions, 28 deletions
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; } |