From patchwork Tue Jul 9 07:30:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qiao Nuohan X-Patchwork-Id: 257638 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E43102C02EC for ; Tue, 9 Jul 2013 17:31:59 +1000 (EST) Received: from localhost ([::1]:49468 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UwSOz-0006D0-Ey for incoming@patchwork.ozlabs.org; Tue, 09 Jul 2013 03:31:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51755) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UwSOW-00065E-0A for qemu-devel@nongnu.org; Tue, 09 Jul 2013 03:31:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UwSOQ-0006Tj-0N for qemu-devel@nongnu.org; Tue, 09 Jul 2013 03:31:27 -0400 Received: from fgwmail5.fujitsu.co.jp ([192.51.44.35]:52876) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UwSOP-0006TU-Gx for qemu-devel@nongnu.org; Tue, 09 Jul 2013 03:31:21 -0400 Received: from m4.gw.fujitsu.co.jp (unknown [10.0.50.74]) by fgwmail5.fujitsu.co.jp (Postfix) with ESMTP id D0C583EE0AE for ; Tue, 9 Jul 2013 16:31:19 +0900 (JST) Received: from smail (m4 [127.0.0.1]) by outgoing.m4.gw.fujitsu.co.jp (Postfix) with ESMTP id C241B45DE56 for ; Tue, 9 Jul 2013 16:31:19 +0900 (JST) Received: from s4.gw.fujitsu.co.jp (s4.gw.fujitsu.co.jp [10.0.50.94]) by m4.gw.fujitsu.co.jp (Postfix) with ESMTP id 96E1145DE55 for ; Tue, 9 Jul 2013 16:31:19 +0900 (JST) Received: from s4.gw.fujitsu.co.jp (localhost.localdomain [127.0.0.1]) by s4.gw.fujitsu.co.jp (Postfix) with ESMTP id 8847D1DB803B for ; Tue, 9 Jul 2013 16:31:19 +0900 (JST) Received: from s01.gw.fujitsu.co.jp (s01.gw.fujitsu.co.jp [133.161.11.16]) by s4.gw.fujitsu.co.jp (Postfix) with ESMTP id 2F7B51DB8041 for ; Tue, 9 Jul 2013 16:31:19 +0900 (JST) Received: from s01.gw.fujitsu.co.jp (yt-mxio2.gw.nic.fujitsu.com [10.134.25.142]) by s01.gw.fujitsu.co.jp (Postfix) with ESMTP id D7EB1D80E2 for ; Tue, 9 Jul 2013 16:31:18 +0900 (JST) Received: from localhost.localdomain (unknown [10.167.226.41]) by s01.gw.fujitsu.co.jp (Postfix) with ESMTP id 89D14AC3D0 for ; Tue, 9 Jul 2013 16:31:18 +0900 (JST) Received: by localhost.localdomain (Postfix, from userid 0) id 41EEE141F60; Tue, 9 Jul 2013 15:30:41 +0800 (CST) From: Qiao Nuohan To: stefanha@gmail.com, lcapitulino@redhat.com, afaerber@suse.de, eblake@redhat.com Date: Tue, 9 Jul 2013 15:30:06 +0800 Message-Id: <1373355014-14846-2-git-send-email-qiaonuohan@cn.fujitsu.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1373355014-14846-1-git-send-email-qiaonuohan@cn.fujitsu.com> References: <1373355014-14846-1-git-send-email-qiaonuohan@cn.fujitsu.com> X-TM-AS-Product-Ver: IMSS-7.1.0.1241-6.8.0.1017-20004.000 X-TM-AS-Result: No--4.466-7.0-31-1 X-imss-scan-details: No--4.466-7.0-31-1 X-TM-AS-User-Approved-Sender: No X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 192.51.44.35 Cc: anderson@redhat.com, Qiao Nuohan , kumagai-atsushi@mxc.nes.nec.co.jp, zhangxh@cn.fujitsu.com, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH v5 1/9] dump: Add argument to write_elfxx_notes 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 write_elf32_notes/wirte_elf64_notes use fd_write_vmcore to write elf notes to vmcore. Adding argument "WriteCoreDumpFunction f" makes it available to choose the way of writing elf notes when calling these two functions. Signed-off-by: Qiao Nuohan Reviewed-by: Zhang Xiaohe --- dump.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dump.c b/dump.c index c812cfa..4e478b1 100644 --- a/dump.c +++ b/dump.c @@ -273,7 +273,7 @@ static inline int cpu_index(CPUState *cpu) return cpu->cpu_index + 1; } -static int write_elf64_notes(DumpState *s) +static int write_elf64_notes(WriteCoreDumpFunction f, DumpState *s) { CPUArchState *env; CPUState *cpu; @@ -283,7 +283,7 @@ static int write_elf64_notes(DumpState *s) for (env = first_cpu; env != NULL; env = env->next_cpu) { cpu = ENV_GET_CPU(env); id = cpu_index(cpu); - ret = cpu_write_elf64_note(fd_write_vmcore, cpu, id, s); + ret = cpu_write_elf64_note(f, cpu, id, s); if (ret < 0) { dump_error(s, "dump: failed to write elf notes.\n"); return -1; @@ -291,7 +291,7 @@ static int write_elf64_notes(DumpState *s) } for (env = first_cpu; env != NULL; env = env->next_cpu) { - ret = cpu_write_elf64_qemunote(fd_write_vmcore, cpu, s); + ret = cpu_write_elf64_qemunote(f, cpu, s); if (ret < 0) { dump_error(s, "dump: failed to write CPU status.\n"); return -1; @@ -325,7 +325,7 @@ static int write_elf32_note(DumpState *s) return 0; } -static int write_elf32_notes(DumpState *s) +static int write_elf32_notes(WriteCoreDumpFunction f, DumpState *s) { CPUArchState *env; CPUState *cpu; @@ -335,7 +335,7 @@ static int write_elf32_notes(DumpState *s) for (env = first_cpu; env != NULL; env = env->next_cpu) { cpu = ENV_GET_CPU(env); id = cpu_index(cpu); - ret = cpu_write_elf32_note(fd_write_vmcore, cpu, id, s); + ret = cpu_write_elf32_note(f, cpu, id, s); if (ret < 0) { dump_error(s, "dump: failed to write elf notes.\n"); return -1; @@ -343,7 +343,7 @@ static int write_elf32_notes(DumpState *s) } for (env = first_cpu; env != NULL; env = env->next_cpu) { - ret = cpu_write_elf32_qemunote(fd_write_vmcore, cpu, s); + ret = cpu_write_elf32_qemunote(f, cpu, s); if (ret < 0) { dump_error(s, "dump: failed to write CPU status.\n"); return -1; @@ -562,7 +562,7 @@ static int dump_begin(DumpState *s) } /* write notes to vmcore */ - if (write_elf64_notes(s) < 0) { + if (write_elf64_notes(fd_write_vmcore, s) < 0) { return -1; } @@ -585,7 +585,7 @@ static int dump_begin(DumpState *s) } /* write notes to vmcore */ - if (write_elf32_notes(s) < 0) { + if (write_elf32_notes(fd_write_vmcore, s) < 0) { return -1; } }