aboutsummaryrefslogtreecommitdiff
path: root/dump
diff options
context:
space:
mode:
authorJanosch Frank <frankja@linux.ibm.com>2022-03-30 12:36:02 +0000
committerMarc-André Lureau <marcandre.lureau@redhat.com>2022-04-22 13:36:04 +0400
commit5ff2e5a3e1e67930e523486e39549a33fcf97227 (patch)
treeed4c7284e8e560a36231fc8b4691a9d140fdcf05 /dump
parentbc7d558017e6700f9a05c61b0b638a8994945f0d (diff)
dump: Cleanup dump_begin write functions
There's no need to have a gigantic if in there let's move the elf 32/64 bit logic into the section, segment or note code. Signed-off-by: Janosch Frank <frankja@linux.ibm.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220330123603.107120-9-frankja@linux.ibm.com>
Diffstat (limited to 'dump')
-rw-r--r--dump/dump.c42
1 files changed, 11 insertions, 31 deletions
diff --git a/dump/dump.c b/dump/dump.c
index 0d95fc5b7a..929ef95351 100644
--- a/dump/dump.c
+++ b/dump/dump.c
@@ -564,46 +564,26 @@ static void dump_begin(DumpState *s, Error **errp)
return;
}
- if (dump_is_64bit(s)) {
- /* write all PT_LOAD to vmcore */
- write_elf_loads(s, errp);
+ /* write all PT_LOAD to vmcore */
+ write_elf_loads(s, errp);
+ if (*errp) {
+ return;
+ }
+
+ /* write section to vmcore */
+ if (s->shdr_num) {
+ write_elf_section(s, 1, errp);
if (*errp) {
return;
}
+ }
- /* write section to vmcore */
- if (s->shdr_num) {
- write_elf_section(s, 1, errp);
- if (*errp) {
- return;
- }
- }
-
+ if (dump_is_64bit(s)) {
/* write notes to vmcore */
write_elf64_notes(fd_write_vmcore, s, errp);
- if (*errp) {
- return;
- }
} else {
- /* write all PT_LOAD to vmcore */
- write_elf_loads(s, errp);
- if (*errp) {
- return;
- }
-
- /* write section to vmcore */
- if (s->shdr_num) {
- write_elf_section(s, 0, errp);
- if (*errp) {
- return;
- }
- }
-
/* write notes to vmcore */
write_elf32_notes(fd_write_vmcore, s, errp);
- if (*errp) {
- return;
- }
}
}