Message ID | 20220330123603.107120-9-frankja@linux.ibm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | dump: Cleanup and consolidation | expand |
On Wed, Mar 30, 2022 at 4:52 PM Janosch Frank <frankja@linux.ibm.com> wrote: > 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> > --- > dump/dump.c | 42 +++++++++++------------------------------- > 1 file changed, 11 insertions(+), 31 deletions(-) > > diff --git a/dump/dump.c b/dump/dump.c > index 365798f5a1..92acd9eb5c 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 > > >
diff --git a/dump/dump.c b/dump/dump.c index 365798f5a1..92acd9eb5c 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; - } } }