From patchwork Tue Jan 28 06:21:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qiao Nuohan X-Patchwork-Id: 314590 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 66B8F2C00B7 for ; Tue, 28 Jan 2014 17:23:48 +1100 (EST) Received: from localhost ([::1]:35448 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W825K-0004oh-5y for incoming@patchwork.ozlabs.org; Tue, 28 Jan 2014 01:23:46 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41654) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W824f-0004jb-MR for qemu-devel@nongnu.org; Tue, 28 Jan 2014 01:23:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W824X-0003xF-Gx for qemu-devel@nongnu.org; Tue, 28 Jan 2014 01:23:05 -0500 Received: from fgwmail5.fujitsu.co.jp ([192.51.44.35]:39452) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W824X-0003wO-2I for qemu-devel@nongnu.org; Tue, 28 Jan 2014 01:22:57 -0500 Received: from m3.gw.fujitsu.co.jp (unknown [10.0.50.73]) by fgwmail5.fujitsu.co.jp (Postfix) with ESMTP id 547AD3EE1D0 for ; Tue, 28 Jan 2014 15:22:56 +0900 (JST) Received: from smail (m3 [127.0.0.1]) by outgoing.m3.gw.fujitsu.co.jp (Postfix) with ESMTP id 367B045DEBB for ; Tue, 28 Jan 2014 15:22:56 +0900 (JST) Received: from s3.gw.fujitsu.co.jp (s3.gw.nic.fujitsu.com [10.0.50.93]) by m3.gw.fujitsu.co.jp (Postfix) with ESMTP id 613AA45DEC9 for ; Tue, 28 Jan 2014 15:22:55 +0900 (JST) Received: from s3.gw.fujitsu.co.jp (localhost.localdomain [127.0.0.1]) by s3.gw.fujitsu.co.jp (Postfix) with ESMTP id 5210B1DB8044 for ; Tue, 28 Jan 2014 15:22:55 +0900 (JST) Received: from s01.gw.fujitsu.co.jp (s01.gw.nic.fujitsu.com [133.161.11.16]) by s3.gw.fujitsu.co.jp (Postfix) with ESMTP id E7C2EE18005 for ; Tue, 28 Jan 2014 15:22:54 +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 12AE2D80CF for ; Tue, 28 Jan 2014 15:22:54 +0900 (JST) Received: from G08FNSTD100518.localdomain (unknown [10.167.226.68]) by s01.gw.fujitsu.co.jp (Postfix) with ESMTP id AE257AC45A for ; Tue, 28 Jan 2014 15:22:53 +0900 (JST) Received: by G08FNSTD100518.localdomain (Postfix, from userid 0) id 3B3AC380947; Tue, 28 Jan 2014 14:22:07 +0800 (CST) From: qiaonuohan To: lersek@redhat.com, stefanha@gmail.com, lcapitulino@redhat.com, afaerber@suse.de, eblake@redhat.com Date: Tue, 28 Jan 2014 14:21:55 +0800 Message-Id: <1390890126-17377-3-git-send-email-qiaonuohan@cn.fujitsu.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1390890126-17377-1-git-send-email-qiaonuohan@cn.fujitsu.com> References: <1390890126-17377-1-git-send-email-qiaonuohan@cn.fujitsu.com> X-TM-AS-MML: disable X-TM-AS-Product-Ver: IMSS-7.1.0.1403-6.8.0.1017-20466.005 X-TM-AS-Result: No--2.664-7.0-31-10 X-imss-scan-details: No--2.664-7.0-31-10 X-TM-AS-User-Approved-Sender: No X-TMASE-MatchedRID: zWX1NUdOaB5vH7GZAcw0g7MjW/sniEQKl9EbAHWWVZJGMe+tDjQ3Fh6k Nl/xpW056E2dWvUKCdrCmUj96YjOl5Coy9iDotiwFEUknJ/kEl6rplDzvlkuFMRB0bsfrpPIcSq bxBgG0w6Gw12555tUDkeWuzdwpIkKkYSf2WUf/Rl0c1mcHKgI3Qm+MuKbVHHRhHJAfNzN/NCho+ ssp6vUk8doRRixJ++OW7/yrGSuJsKCvqWrFsheUcLe0zBjeZrbFQOP52BRBXJMTsKj18q/fA== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 192.51.44.35 Cc: kumagai-atsushi@mxc.nes.nec.co.jp, qiaonuohan , anderson@redhat.com, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH v8 02/13] 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 parameter "WriteCoreDumpFunction f" makes it available to choose the method of writing elf notes Signed-off-by: Qiao Nuohan Reviewed-by: Laszlo Ersek --- dump.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dump.c b/dump.c index 42622de..c9d3492 100644 --- a/dump.c +++ b/dump.c @@ -271,7 +271,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) { CPUState *cpu; int ret; @@ -279,7 +279,7 @@ static int write_elf64_notes(DumpState *s) CPU_FOREACH(cpu) { 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; @@ -287,7 +287,7 @@ static int write_elf64_notes(DumpState *s) } CPU_FOREACH(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; @@ -321,7 +321,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) { CPUState *cpu; int ret; @@ -329,7 +329,7 @@ static int write_elf32_notes(DumpState *s) CPU_FOREACH(cpu) { 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; @@ -337,7 +337,7 @@ static int write_elf32_notes(DumpState *s) } CPU_FOREACH(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; @@ -574,7 +574,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; } @@ -597,7 +597,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; } }