aboutsummaryrefslogtreecommitdiff
path: root/dump
diff options
context:
space:
mode:
authorJanosch Frank <frankja@linux.ibm.com>2022-03-30 12:36:03 +0000
committerMarc-André Lureau <marcandre.lureau@redhat.com>2022-04-22 13:36:04 +0400
commitc68124738bc29017e4254c898bc40be7be477af7 (patch)
tree855c1de319d171985c0110c78e1bb16d6bb4a55f /dump
parent5ff2e5a3e1e67930e523486e39549a33fcf97227 (diff)
dump: Consolidate elf note function
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> Message-Id: <20220330123603.107120-10-frankja@linux.ibm.com>
Diffstat (limited to 'dump')
-rw-r--r--dump/dump.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/dump/dump.c b/dump/dump.c
index 929ef95351..4d9658ffa2 100644
--- a/dump/dump.c
+++ b/dump/dump.c
@@ -519,6 +519,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)
{
@@ -578,13 +587,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)