thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
62547e
From 0547599cf507930f91943f22d5f917ebacf69484 Mon Sep 17 00:00:00 2001
62547e
From: Janosch Frank <frankja@linux.ibm.com>
62547e
Date: Wed, 30 Mar 2022 12:36:03 +0000
62547e
Subject: [PATCH 21/42] dump: Consolidate elf note function
62547e
MIME-Version: 1.0
62547e
Content-Type: text/plain; charset=UTF-8
62547e
Content-Transfer-Encoding: 8bit
62547e
62547e
RH-Author: Cédric Le Goater <clg@redhat.com>
62547e
RH-MergeRequest: 226: s390: Enhanced Interpretation for PCI Functions and Secure Execution guest dump
62547e
RH-Bugzilla: 1664378 2043909
62547e
RH-Acked-by: Thomas Huth <thuth@redhat.com>
62547e
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
62547e
RH-Acked-by: Jon Maloy <jmaloy@redhat.com>
62547e
RH-Commit: [21/41] 52298c098c116aea75ad15894731ff412c2c4e73
62547e
62547e
Just like with the other write functions let's move the 32/64 bit elf
62547e
handling to a function to improve readability.
62547e
62547e
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
62547e
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
62547e
Message-Id: <20220330123603.107120-10-frankja@linux.ibm.com>
62547e
(cherry picked from commit c68124738bc29017e4254c898bc40be7be477af7)
62547e
Signed-off-by: Cédric Le Goater <clg@redhat.com>
62547e
---
62547e
 dump/dump.c | 18 +++++++++++-------
62547e
 1 file changed, 11 insertions(+), 7 deletions(-)
62547e
62547e
diff --git a/dump/dump.c b/dump/dump.c
62547e
index 88abde355a..a451abc590 100644
62547e
--- a/dump/dump.c
62547e
+++ b/dump/dump.c
62547e
@@ -520,6 +520,15 @@ static void write_elf_loads(DumpState *s, Error **errp)
62547e
     }
62547e
 }
62547e
 
62547e
+static void write_elf_notes(DumpState *s, Error **errp)
62547e
+{
62547e
+    if (dump_is_64bit(s)) {
62547e
+        write_elf64_notes(fd_write_vmcore, s, errp);
62547e
+    } else {
62547e
+        write_elf32_notes(fd_write_vmcore, s, errp);
62547e
+    }
62547e
+}
62547e
+
62547e
 /* write elf header, PT_NOTE and elf note to vmcore. */
62547e
 static void dump_begin(DumpState *s, Error **errp)
62547e
 {
62547e
@@ -579,13 +588,8 @@ static void dump_begin(DumpState *s, Error **errp)
62547e
         }
62547e
     }
62547e
 
62547e
-    if (dump_is_64bit(s)) {
62547e
-        /* write notes to vmcore */
62547e
-        write_elf64_notes(fd_write_vmcore, s, errp);
62547e
-    } else {
62547e
-        /* write notes to vmcore */
62547e
-        write_elf32_notes(fd_write_vmcore, s, errp);
62547e
-    }
62547e
+    /* write notes to vmcore */
62547e
+    write_elf_notes(s, errp);
62547e
 }
62547e
 
62547e
 static int get_next_block(DumpState *s, GuestPhysBlock *block)
62547e
-- 
62547e
2.37.3
62547e