[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v2 08/13] dump: Cleanup dump_begin write functions
From: |
marcandre . lureau |
Subject: |
[PULL v2 08/13] dump: Cleanup dump_begin write functions |
Date: |
Fri, 22 Apr 2022 14:15:20 +0400 |
From: Janosch Frank <frankja@linux.ibm.com>
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>
---
dump/dump.c | 42 +++++++++++-------------------------------
1 file changed, 11 insertions(+), 31 deletions(-)
diff --git a/dump/dump.c b/dump/dump.c
index 0d95fc5b7a3c..929ef953515c 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;
- }
}
}
--
2.36.0
- [PULL v2 00/13] Dump patches, marcandre . lureau, 2022/04/22
- [PULL v2 01/13] dump: Use ERRP_GUARD(), marcandre . lureau, 2022/04/22
- [PULL v2 02/13] dump: Remove the sh_info variable, marcandre . lureau, 2022/04/22
- [PULL v2 03/13] dump: Introduce shdr_num to decrease complexity, marcandre . lureau, 2022/04/22
- [PULL v2 04/13] dump: Remove the section if when calculating the memory offset, marcandre . lureau, 2022/04/22
- [PULL v2 05/13] dump: Add more offset variables, marcandre . lureau, 2022/04/22
- [PULL v2 07/13] dump: Consolidate phdr note writes, marcandre . lureau, 2022/04/22
- [PULL v2 06/13] dump: Introduce dump_is_64bit() helper function, marcandre . lureau, 2022/04/22
- [PULL v2 08/13] dump: Cleanup dump_begin write functions,
marcandre . lureau <=
- [PULL v2 12/13] include/qemu: add 32-bit Windows dump structures, marcandre . lureau, 2022/04/22
- [PULL v2 09/13] dump: Consolidate elf note function, marcandre . lureau, 2022/04/22
- [PULL v2 11/13] dump/win_dump: add helper macros for Windows dump header access, marcandre . lureau, 2022/04/22
- [PULL v2 13/13] dump/win_dump: add 32-bit guest Windows support, marcandre . lureau, 2022/04/22
- [PULL v2 10/13] include/qemu: rename Windows context definitions to expose bitness, marcandre . lureau, 2022/04/22
- Re: [PULL v2 00/13] Dump patches, Richard Henderson, 2022/04/22