thebeanogamer / rpms / qemu-kvm

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