bf143f
From 0547599cf507930f91943f22d5f917ebacf69484 Mon Sep 17 00:00:00 2001
bf143f
From: Janosch Frank <frankja@linux.ibm.com>
bf143f
Date: Wed, 30 Mar 2022 12:36:03 +0000
bf143f
Subject: [PATCH 21/42] dump: Consolidate elf note function
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: [21/41] 52298c098c116aea75ad15894731ff412c2c4e73
bf143f
bf143f
Just like with the other write functions let's move the 32/64 bit elf
bf143f
handling to a function to improve readability.
bf143f
bf143f
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
bf143f
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
bf143f
Message-Id: <20220330123603.107120-10-frankja@linux.ibm.com>
bf143f
(cherry picked from commit c68124738bc29017e4254c898bc40be7be477af7)
bf143f
Signed-off-by: Cédric Le Goater <clg@redhat.com>
bf143f
---
bf143f
 dump/dump.c | 18 +++++++++++-------
bf143f
 1 file changed, 11 insertions(+), 7 deletions(-)
bf143f
bf143f
diff --git a/dump/dump.c b/dump/dump.c
bf143f
index 88abde355a..a451abc590 100644
bf143f
--- a/dump/dump.c
bf143f
+++ b/dump/dump.c
bf143f
@@ -520,6 +520,15 @@ static void write_elf_loads(DumpState *s, Error **errp)
bf143f
     }
bf143f
 }
bf143f
 
bf143f
+static void write_elf_notes(DumpState *s, Error **errp)
bf143f
+{
bf143f
+    if (dump_is_64bit(s)) {
bf143f
+        write_elf64_notes(fd_write_vmcore, s, errp);
bf143f
+    } else {
bf143f
+        write_elf32_notes(fd_write_vmcore, s, errp);
bf143f
+    }
bf143f
+}
bf143f
+
bf143f
 /* write elf header, PT_NOTE and elf note to vmcore. */
bf143f
 static void dump_begin(DumpState *s, Error **errp)
bf143f
 {
bf143f
@@ -579,13 +588,8 @@ static void dump_begin(DumpState *s, Error **errp)
bf143f
         }
bf143f
     }
bf143f
 
bf143f
-    if (dump_is_64bit(s)) {
bf143f
-        /* write notes to vmcore */
bf143f
-        write_elf64_notes(fd_write_vmcore, s, errp);
bf143f
-    } else {
bf143f
-        /* write notes to vmcore */
bf143f
-        write_elf32_notes(fd_write_vmcore, s, errp);
bf143f
-    }
bf143f
+    /* write notes to vmcore */
bf143f
+    write_elf_notes(s, errp);
bf143f
 }
bf143f
 
bf143f
 static int get_next_block(DumpState *s, GuestPhysBlock *block)
bf143f
-- 
bf143f
2.37.3
bf143f