From patchwork Wed May 30 14:15:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 162018 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 24891B7001 for ; Thu, 31 May 2012 01:58:42 +1000 (EST) Received: from localhost ([::1]:52915 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SZjhG-0000p1-UD for incoming@patchwork.ozlabs.org; Wed, 30 May 2012 10:16:22 -0400 Received: from eggs.gnu.org ([208.118.235.92]:59126) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SZjgp-0000Jy-Op for qemu-devel@nongnu.org; Wed, 30 May 2012 10:16:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SZjgj-00080c-0w for qemu-devel@nongnu.org; Wed, 30 May 2012 10:15:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39899) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SZjgh-0007yt-Fx for qemu-devel@nongnu.org; Wed, 30 May 2012 10:15:48 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q4UEFgTa004859 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 30 May 2012 10:15:42 -0400 Received: from localhost (ovpn-116-69.ams2.redhat.com [10.36.116.69]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q4UEFZbx003193; Wed, 30 May 2012 10:15:36 -0400 From: Luiz Capitulino To: qemu-devel@nongnu.org Date: Wed, 30 May 2012 11:15:01 -0300 Message-Id: <1338387301-10074-15-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1338387301-10074-1-git-send-email-lcapitulino@redhat.com> References: <1338387301-10074-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: aliguori@us.ibm.com, alevy@redhat.com, armbru@redhat.com Subject: [Qemu-devel] [PATCH 14/14] qapi: convert screendump X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Also activates full error reporting from devices. Signed-off-by: Luiz Capitulino --- console.c | 7 ++++--- console.h | 1 - hmp-commands.hx | 3 +-- hmp.c | 9 +++++++++ hmp.h | 1 + monitor.c | 6 ------ qapi-schema.json | 25 +++++++++++++++++++++++++ qmp-commands.hx | 5 +---- 8 files changed, 41 insertions(+), 16 deletions(-) diff --git a/console.c b/console.c index 4669e62..2bbf104 100644 --- a/console.c +++ b/console.c @@ -24,6 +24,7 @@ #include "qemu-common.h" #include "console.h" #include "qemu-timer.h" +#include "qmp-commands.h" //#define DEBUG_CONSOLE #define DEFAULT_BACKSCROLL 512 @@ -173,7 +174,7 @@ void vga_hw_invalidate(void) active_console->hw_invalidate(active_console->hw); } -void vga_hw_screen_dump(const char *filename) +void qmp_screendump(const char *filename, Error **errp) { TextConsole *previous_active_console; bool cswitch; @@ -187,9 +188,9 @@ void vga_hw_screen_dump(const char *filename) console_select(0); } if (consoles[0] && consoles[0]->hw_screen_dump) { - consoles[0]->hw_screen_dump(consoles[0]->hw, filename, cswitch, NULL); + consoles[0]->hw_screen_dump(consoles[0]->hw, filename, cswitch, errp); } else { - error_report("screen dump not implemented"); + error_set(errp, QERR_NOT_SUPPORTED); } if (cswitch) { diff --git a/console.h b/console.h index 9caeb43..d72c546 100644 --- a/console.h +++ b/console.h @@ -356,7 +356,6 @@ DisplayState *graphic_console_init(vga_hw_update_ptr update, void vga_hw_update(void); void vga_hw_invalidate(void); -void vga_hw_screen_dump(const char *filename); void vga_hw_text_update(console_ch_t *chardata); int is_graphic_console(void); diff --git a/hmp-commands.hx b/hmp-commands.hx index f5d9d91..70f4d71 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -194,8 +194,7 @@ ETEXI .args_type = "filename:F", .params = "filename", .help = "save screen into PPM image 'filename'", - .user_print = monitor_user_noop, - .mhandler.cmd_new = do_screen_dump, + .mhandler.cmd = hmp_screen_dump, }, STEXI diff --git a/hmp.c b/hmp.c index 2ce8cb9..e7edbf9 100644 --- a/hmp.c +++ b/hmp.c @@ -999,3 +999,12 @@ void hmp_netdev_del(Monitor *mon, const QDict *qdict) qmp_netdev_del(id, &err); hmp_handle_error(mon, &err); } + +void hmp_screen_dump(Monitor *mon, const QDict *qdict) +{ + const char *filename = qdict_get_str(qdict, "filename"); + Error *err = NULL; + + qmp_screendump(filename, &err); + hmp_handle_error(mon, &err); +} diff --git a/hmp.h b/hmp.h index 79d138d..a98f2b3 100644 --- a/hmp.h +++ b/hmp.h @@ -64,5 +64,6 @@ void hmp_device_del(Monitor *mon, const QDict *qdict); void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict); void hmp_netdev_add(Monitor *mon, const QDict *qdict); void hmp_netdev_del(Monitor *mon, const QDict *qdict); +void hmp_screen_dump(Monitor *mon, const QDict *qdict); #endif diff --git a/monitor.c b/monitor.c index a3bc2c7..b3dfb7c 100644 --- a/monitor.c +++ b/monitor.c @@ -880,12 +880,6 @@ static int client_migrate_info(Monitor *mon, const QDict *qdict, return -1; } -static int do_screen_dump(Monitor *mon, const QDict *qdict, QObject **ret_data) -{ - vga_hw_screen_dump(qdict_get_str(qdict, "filename")); - return 0; -} - static void do_logfile(Monitor *mon, const QDict *qdict) { cpu_set_log_filename(qdict_get_str(qdict, "filename")); diff --git a/qapi-schema.json b/qapi-schema.json index 3b6e346..23e103d 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -1862,3 +1862,28 @@ # Since: 0.14.0 ## { 'command': 'netdev_del', 'data': {'id': 'str'} } + +## +# @screendump: +# +# Write a PPM of the VGA screen to a file. +# +# @filename: the path of a new PPM file to store the image +# +# Since: 0.14.0 +# +# Returns: Nothing on success +# If the underlying device doesn't support screen dump, NotSupported +# If access to the file is not allowed, InvalidAccess +# If QEMU has too many open files, TooManyFilesByProcess +# If the system has too many open files, TooManyFilesInSystem +# If @filename is too long, NameTooLong +# If a @filename path component doesn't exist, NoSuchFileOrDirectory +# If there isn't enough space available to write the file, NoSpace +# If the file-system to write the file to is read-only, ReadOnlyFileSystem +# If opening @filename fails for an unknown reason, OpenFileFailed +# If @filename becames too big, FileTooBig +# If an I/O error happens while writing @filename, IOError +# +## +{ 'command': 'screendump', 'data': {'filename': 'str'} } diff --git a/qmp-commands.hx b/qmp-commands.hx index 2e1a38e..44a8dbd 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -146,10 +146,7 @@ EQMP { .name = "screendump", .args_type = "filename:F", - .params = "filename", - .help = "save screen into PPM image 'filename'", - .user_print = monitor_user_noop, - .mhandler.cmd_new = do_screen_dump, + .mhandler.cmd_new = qmp_marshal_input_screendump, }, SQMP