[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 8/9] dump: Cleanup dump_begin write functions
From: |
Janosch Frank |
Subject: |
[PATCH v2 8/9] dump: Cleanup dump_begin write functions |
Date: |
Thu, 10 Mar 2022 11:08:53 +0000 |
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>
---
dump/dump.c | 42 +++++++++++-------------------------------
1 file changed, 11 insertions(+), 31 deletions(-)
diff --git a/dump/dump.c b/dump/dump.c
index 1294673444..5542adf7b8 100644
--- a/dump/dump.c
+++ b/dump/dump.c
@@ -555,46 +555,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;
- }
}
}
--
2.32.0
- [PATCH v2 0/9] dump: Cleanup and consolidation, Janosch Frank, 2022/03/10
- [PATCH v2 5/9] dump: Add more offset variables, Janosch Frank, 2022/03/10
- [PATCH v2 8/9] dump: Cleanup dump_begin write functions,
Janosch Frank <=
- [PATCH v2 6/9] dump: Introduce dump_is_64bit() helper function, Janosch Frank, 2022/03/10
- [PATCH v2 7/9] dump: Consolidate phdr note writes, Janosch Frank, 2022/03/10
- [PATCH v2 9/9] dump: Consolidate elf note function, Janosch Frank, 2022/03/10
- [PATCH v2 2/9] dump: Remove the sh_info variable, Janosch Frank, 2022/03/10
- [PATCH v2 4/9] dump: Remove the section if when calculating the memory offset, Janosch Frank, 2022/03/10