From patchwork Thu Mar 28 16:35:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Freimann X-Patchwork-Id: 232102 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 B4D2E2C00D9 for ; Fri, 29 Mar 2013 03:37:07 +1100 (EST) Received: from localhost ([::1]:49939 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULFp3-0000kE-RE for incoming@patchwork.ozlabs.org; Thu, 28 Mar 2013 12:37:05 -0400 Received: from eggs.gnu.org ([208.118.235.92]:45221) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULFoW-0000j2-T5 for qemu-devel@nongnu.org; Thu, 28 Mar 2013 12:36:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ULFoV-0000TM-HU for qemu-devel@nongnu.org; Thu, 28 Mar 2013 12:36:32 -0400 Received: from e06smtp11.uk.ibm.com ([195.75.94.107]:36857) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULFoV-0000R6-8V for qemu-devel@nongnu.org; Thu, 28 Mar 2013 12:36:31 -0400 Received: from /spool/local by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 28 Mar 2013 16:33:19 -0000 Received: from d06dlp01.portsmouth.uk.ibm.com (9.149.20.13) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 28 Mar 2013 16:33:16 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id 8DE0E17D8017 for ; Thu, 28 Mar 2013 16:37:02 +0000 (GMT) Received: from d06av04.portsmouth.uk.ibm.com (d06av04.portsmouth.uk.ibm.com [9.149.37.216]) by b06cxnps3075.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r2SGa6ZX37945566 for ; Thu, 28 Mar 2013 16:36:06 GMT Received: from d06av04.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av04.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r2SGaEIW032356 for ; Thu, 28 Mar 2013 10:36:14 -0600 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av04.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r2SGaEo0032348; Thu, 28 Mar 2013 10:36:14 -0600 Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 1122) id 139D41224437; Thu, 28 Mar 2013 17:36:14 +0100 (CET) From: Jens Freimann To: Alexander Graf Date: Thu, 28 Mar 2013 17:35:59 +0100 Message-Id: <1364488560-16265-3-git-send-email-jfrei@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1364488560-16265-1-git-send-email-jfrei@linux.vnet.ibm.com> References: <1364488560-16265-1-git-send-email-jfrei@linux.vnet.ibm.com> X-TM-AS-MML: No X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13032816-5024-0000-0000-0000059A3458 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 195.75.94.107 Cc: Ekaterina Tumanova , Ekaterina Tumanova , qemu-devel , Rabin Vincent , Christian Borntraeger , Jens Freimann , Cornelia Huck , =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [Qemu-devel] [PATCH 2/3] s390: Added check for unsupported parameters of dump-guest-memory 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 From: Ekaterina Tumanova Check for the 'begin' and 'length' parameters of dump-guest-memory monitor command (not supported for s390) was placed into arch specific function: arch_check_parameter. The stub of this function is added to target-i386 directory for compatibility reasons. Signed-Off-By: Ekaterina Tumanova Signed-off-by: Jens Freimann --- dump.c | 4 ++++ include/qapi/qmp/qerror.h | 3 +++ include/sysemu/dump.h | 6 ++++++ target-i386/arch_dump.c | 6 ++++++ target-s390x/arch_dump.c | 11 +++++++++++ 5 files changed, 30 insertions(+) diff --git a/dump.c b/dump.c index a25f509..fd1d0f6 100644 --- a/dump.c +++ b/dump.c @@ -822,6 +822,10 @@ void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin, DumpState *s; int ret; + if (arch_check_parameter(paging, has_begin, begin, length, errp) < 0) { + return; + } + if (has_begin && !has_length) { error_set(errp, QERR_MISSING_PARAMETER, "length"); return; diff --git a/include/qapi/qmp/qerror.h b/include/qapi/qmp/qerror.h index 6c0a18d..58b7f7a 100644 --- a/include/qapi/qmp/qerror.h +++ b/include/qapi/qmp/qerror.h @@ -249,4 +249,7 @@ void assert_no_error(Error *err); #define QERR_SOCKET_CREATE_FAILED \ ERROR_CLASS_GENERIC_ERROR, "Failed to create socket" +#define QERR_UNSUPPORTED_COMMAND_OPTION \ + ERROR_CLASS_GENERIC_ERROR, "Option(s) %s of %s command not supported for %s" + #endif /* QERROR_H */ diff --git a/include/sysemu/dump.h b/include/sysemu/dump.h index e25b7cf..b03efd4 100644 --- a/include/sysemu/dump.h +++ b/include/sysemu/dump.h @@ -14,6 +14,9 @@ #ifndef DUMP_H #define DUMP_H +#include "qapi/error.h" +#include "include/qapi/qmp/qerror.h" + typedef struct ArchDumpInfo { int d_machine; /* Architecture */ int d_endian; /* ELFDATA2LSB or ELFDATA2MSB */ @@ -32,4 +35,7 @@ int cpu_write_elf32_qemunote(write_core_dump_function f, CPUArchState *env, int cpu_get_dump_info(ArchDumpInfo *info); ssize_t cpu_get_note_size(int class, int machine, int nr_cpus); +int arch_check_parameter(bool paging, bool has_filter, int64_t begin, int64_t length, + Error **errp); + #endif diff --git a/target-i386/arch_dump.c b/target-i386/arch_dump.c index 2cd2f7f..959a5f7 100644 --- a/target-i386/arch_dump.c +++ b/target-i386/arch_dump.c @@ -447,3 +447,9 @@ ssize_t cpu_get_note_size(int class, int machine, int nr_cpus) return (elf_note_size + qemu_note_size) * nr_cpus; } + +int arch_check_parameter(bool paging, bool has_filter, int64_t begin, int64_t length, + Error **errp) +{ + return 0; +} diff --git a/target-s390x/arch_dump.c b/target-s390x/arch_dump.c index d8fa158..18f2652 100644 --- a/target-s390x/arch_dump.c +++ b/target-s390x/arch_dump.c @@ -241,3 +241,14 @@ int cpu_write_elf32_qemunote(write_core_dump_function f, CPUArchState *env, return 0; } +int arch_check_parameter(bool paging, bool has_filter, int64_t begin, int64_t length, + Error **errp) +{ + if (has_filter) { + error_set(errp, QERR_UNSUPPORTED_COMMAND_OPTION, "begin and length", + "dump-guest-memory", "s390"); + return -2; + } + return 0; +} +