thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
9ae3a8
From 1f9d175ded89c7d1e3d3b76b32d107c565887e81 Mon Sep 17 00:00:00 2001
9ae3a8
From: Laszlo Ersek <lersek@redhat.com>
9ae3a8
Date: Fri, 7 Nov 2014 17:17:51 +0100
9ae3a8
Subject: [PATCH 04/41] dump: add argument to write_elfxx_notes
9ae3a8
9ae3a8
Message-id: <1415380693-16593-5-git-send-email-lersek@redhat.com>
9ae3a8
Patchwork-id: 62190
9ae3a8
O-Subject: [RHEL-7.1 qemu-kvm PATCH 04/26] dump: add argument to write_elfxx_notes
9ae3a8
Bugzilla: 1157798
9ae3a8
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
RH-Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
9ae3a8
RH-Acked-by: dgibson <dgibson@redhat.com>
9ae3a8
9ae3a8
From: qiaonuohan <qiaonuohan@cn.fujitsu.com>
9ae3a8
9ae3a8
write_elf32_notes/wirte_elf64_notes use fd_write_vmcore to write elf notes to
9ae3a8
vmcore. Adding parameter "WriteCoreDumpFunction f" makes it available to choose
9ae3a8
the method of writing elf notes
9ae3a8
9ae3a8
Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
9ae3a8
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
9ae3a8
(cherry picked from commit 6a519918b3f666759e20bcd0bb88378f3e4ffb57)
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
9ae3a8
Conflicts:
9ae3a8
	dump.c
9ae3a8
9ae3a8
Conflicts are due to our not having upstream commit 182735ef ("cpu: Make
9ae3a8
first_cpu and next_cpu CPUState").
9ae3a8
9ae3a8
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
---
9ae3a8
 dump.c | 16 ++++++++--------
9ae3a8
 1 file changed, 8 insertions(+), 8 deletions(-)
9ae3a8
9ae3a8
diff --git a/dump.c b/dump.c
9ae3a8
index aa56aba..fed8bd6 100644
9ae3a8
--- a/dump.c
9ae3a8
+++ b/dump.c
9ae3a8
@@ -271,7 +271,7 @@ static inline int cpu_index(CPUState *cpu)
9ae3a8
     return cpu->cpu_index + 1;
9ae3a8
 }
9ae3a8
 
9ae3a8
-static int write_elf64_notes(DumpState *s)
9ae3a8
+static int write_elf64_notes(WriteCoreDumpFunction f, DumpState *s)
9ae3a8
 {
9ae3a8
     CPUArchState *env;
9ae3a8
     CPUState *cpu;
9ae3a8
@@ -281,7 +281,7 @@ static int write_elf64_notes(DumpState *s)
9ae3a8
     for (env = first_cpu; env != NULL; env = env->next_cpu) {
9ae3a8
         cpu = ENV_GET_CPU(env);
9ae3a8
         id = cpu_index(cpu);
9ae3a8
-        ret = cpu_write_elf64_note(fd_write_vmcore, cpu, id, s);
9ae3a8
+        ret = cpu_write_elf64_note(f, cpu, id, s);
9ae3a8
         if (ret < 0) {
9ae3a8
             dump_error(s, "dump: failed to write elf notes.\n");
9ae3a8
             return -1;
9ae3a8
@@ -290,7 +290,7 @@ static int write_elf64_notes(DumpState *s)
9ae3a8
 
9ae3a8
     for (env = first_cpu; env != NULL; env = env->next_cpu) {
9ae3a8
         cpu = ENV_GET_CPU(env);
9ae3a8
-        ret = cpu_write_elf64_qemunote(fd_write_vmcore, cpu, s);
9ae3a8
+        ret = cpu_write_elf64_qemunote(f, cpu, s);
9ae3a8
         if (ret < 0) {
9ae3a8
             dump_error(s, "dump: failed to write CPU status.\n");
9ae3a8
             return -1;
9ae3a8
@@ -324,7 +324,7 @@ static int write_elf32_note(DumpState *s)
9ae3a8
     return 0;
9ae3a8
 }
9ae3a8
 
9ae3a8
-static int write_elf32_notes(DumpState *s)
9ae3a8
+static int write_elf32_notes(WriteCoreDumpFunction f, DumpState *s)
9ae3a8
 {
9ae3a8
     CPUArchState *env;
9ae3a8
     CPUState *cpu;
9ae3a8
@@ -334,7 +334,7 @@ static int write_elf32_notes(DumpState *s)
9ae3a8
     for (env = first_cpu; env != NULL; env = env->next_cpu) {
9ae3a8
         cpu = ENV_GET_CPU(env);
9ae3a8
         id = cpu_index(cpu);
9ae3a8
-        ret = cpu_write_elf32_note(fd_write_vmcore, cpu, id, s);
9ae3a8
+        ret = cpu_write_elf32_note(f, cpu, id, s);
9ae3a8
         if (ret < 0) {
9ae3a8
             dump_error(s, "dump: failed to write elf notes.\n");
9ae3a8
             return -1;
9ae3a8
@@ -343,7 +343,7 @@ static int write_elf32_notes(DumpState *s)
9ae3a8
 
9ae3a8
     for (env = first_cpu; env != NULL; env = env->next_cpu) {
9ae3a8
         cpu = ENV_GET_CPU(env);
9ae3a8
-        ret = cpu_write_elf32_qemunote(fd_write_vmcore, cpu, s);
9ae3a8
+        ret = cpu_write_elf32_qemunote(f, cpu, s);
9ae3a8
         if (ret < 0) {
9ae3a8
             dump_error(s, "dump: failed to write CPU status.\n");
9ae3a8
             return -1;
9ae3a8
@@ -580,7 +580,7 @@ static int dump_begin(DumpState *s)
9ae3a8
         }
9ae3a8
 
9ae3a8
         /* write notes to vmcore */
9ae3a8
-        if (write_elf64_notes(s) < 0) {
9ae3a8
+        if (write_elf64_notes(fd_write_vmcore, s) < 0) {
9ae3a8
             return -1;
9ae3a8
         }
9ae3a8
 
9ae3a8
@@ -603,7 +603,7 @@ static int dump_begin(DumpState *s)
9ae3a8
         }
9ae3a8
 
9ae3a8
         /* write notes to vmcore */
9ae3a8
-        if (write_elf32_notes(s) < 0) {
9ae3a8
+        if (write_elf32_notes(fd_write_vmcore, s) < 0) {
9ae3a8
             return -1;
9ae3a8
         }
9ae3a8
     }
9ae3a8
-- 
9ae3a8
1.8.3.1
9ae3a8