thebeanogamer / rpms / qemu-kvm

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