thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
bf143f
From cbb653d73e32513ccd46b293a52384eed6a5f84f Mon Sep 17 00:00:00 2001
bf143f
From: Janosch Frank <frankja@linux.ibm.com>
bf143f
Date: Wed, 30 Mar 2022 12:36:02 +0000
bf143f
Subject: [PATCH 20/42] dump: Cleanup dump_begin write functions
bf143f
MIME-Version: 1.0
bf143f
Content-Type: text/plain; charset=UTF-8
bf143f
Content-Transfer-Encoding: 8bit
bf143f
bf143f
RH-Author: Cédric Le Goater <clg@redhat.com>
bf143f
RH-MergeRequest: 226: s390: Enhanced Interpretation for PCI Functions and Secure Execution guest dump
bf143f
RH-Bugzilla: 1664378 2043909
bf143f
RH-Acked-by: Thomas Huth <thuth@redhat.com>
bf143f
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
bf143f
RH-Acked-by: Jon Maloy <jmaloy@redhat.com>
bf143f
RH-Commit: [20/41] 18ea1457a3e54fd368e556d96c3be50c6ad0a6bd
bf143f
bf143f
There's no need to have a gigantic if in there let's move the elf
bf143f
32/64 bit logic into the section, segment or note code.
bf143f
bf143f
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
bf143f
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
bf143f
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
bf143f
Message-Id: <20220330123603.107120-9-frankja@linux.ibm.com>
bf143f
(cherry picked from commit 5ff2e5a3e1e67930e523486e39549a33fcf97227)
bf143f
Signed-off-by: Cédric Le Goater <clg@redhat.com>
bf143f
---
bf143f
 dump/dump.c | 42 +++++++++++-------------------------------
bf143f
 1 file changed, 11 insertions(+), 31 deletions(-)
bf143f
bf143f
diff --git a/dump/dump.c b/dump/dump.c
bf143f
index 823ca32883..88abde355a 100644
bf143f
--- a/dump/dump.c
bf143f
+++ b/dump/dump.c
bf143f
@@ -565,46 +565,26 @@ static void dump_begin(DumpState *s, Error **errp)
bf143f
         return;
bf143f
     }
bf143f
 
bf143f
-    if (dump_is_64bit(s)) {
bf143f
-        /* write all PT_LOAD to vmcore */
bf143f
-        write_elf_loads(s, errp);
bf143f
+    /* write all PT_LOAD to vmcore */
bf143f
+    write_elf_loads(s, errp);
bf143f
+    if (*errp) {
bf143f
+        return;
bf143f
+    }
bf143f
+
bf143f
+    /* write section to vmcore */
bf143f
+    if (s->shdr_num) {
bf143f
+        write_elf_section(s, 1, errp);
bf143f
         if (*errp) {
bf143f
             return;
bf143f
         }
bf143f
+    }
bf143f
 
bf143f
-        /* write section to vmcore */
bf143f
-        if (s->shdr_num) {
bf143f
-            write_elf_section(s, 1, errp);
bf143f
-            if (*errp) {
bf143f
-                return;
bf143f
-            }
bf143f
-        }
bf143f
-
bf143f
+    if (dump_is_64bit(s)) {
bf143f
         /* write notes to vmcore */
bf143f
         write_elf64_notes(fd_write_vmcore, s, errp);
bf143f
-        if (*errp) {
bf143f
-            return;
bf143f
-        }
bf143f
     } else {
bf143f
-        /* write all PT_LOAD to vmcore */
bf143f
-        write_elf_loads(s, errp);
bf143f
-        if (*errp) {
bf143f
-            return;
bf143f
-        }
bf143f
-
bf143f
-        /* write section to vmcore */
bf143f
-        if (s->shdr_num) {
bf143f
-            write_elf_section(s, 0, errp);
bf143f
-            if (*errp) {
bf143f
-                return;
bf143f
-            }
bf143f
-        }
bf143f
-
bf143f
         /* write notes to vmcore */
bf143f
         write_elf32_notes(fd_write_vmcore, s, errp);
bf143f
-        if (*errp) {
bf143f
-            return;
bf143f
-        }
bf143f
     }
bf143f
 }
bf143f
 
bf143f
-- 
bf143f
2.37.3
bf143f