qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 9/9] dump: Consolidate elf note function


From: Marc-André Lureau
Subject: Re: [PATCH v3 9/9] dump: Consolidate elf note function
Date: Thu, 31 Mar 2022 12:56:20 +0400



On Wed, Mar 30, 2022 at 4:37 PM Janosch Frank <frankja@linux.ibm.com> wrote:
Just like with the other write functions let's move the 32/64 bit elf
handling to a function to improve readability.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
 
---
 dump/dump.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/dump/dump.c b/dump/dump.c
index 92acd9eb5c..4af71de9b1 100644
--- a/dump/dump.c
+++ b/dump/dump.c
@@ -510,6 +510,15 @@ static void write_elf_loads(DumpState *s, Error **errp)
     }
 }

+static void write_elf_notes(DumpState *s, Error **errp)
+{
+    if (dump_is_64bit(s)) {
+        write_elf64_notes(fd_write_vmcore, s, errp);
+    } else {
+        write_elf32_notes(fd_write_vmcore, s, errp);
+    }
+}
+
 /* write elf header, PT_NOTE and elf note to vmcore. */
 static void dump_begin(DumpState *s, Error **errp)
 {
@@ -569,13 +578,8 @@ static void dump_begin(DumpState *s, Error **errp)
         }
     }

-    if (dump_is_64bit(s)) {
-        /* write notes to vmcore */
-        write_elf64_notes(fd_write_vmcore, s, errp);
-    } else {
-        /* write notes to vmcore */
-        write_elf32_notes(fd_write_vmcore, s, errp);
-    }
+    /* write notes to vmcore */
+    write_elf_notes(s, errp);
 }

 static int get_next_block(DumpState *s, GuestPhysBlock *block)
--
2.32.0




--
Marc-André Lureau

reply via email to

[Prev in Thread] Current Thread [Next in Thread]