zdump: dfi_elf: refactor nt_* functions

The functions are refactored so the `struct zg_fh` value is now passed as
argument to the `nt_*` functions instead of accessing the global variable `g.fh`
from within of the functions. This makes the functions reusable and easier to
test. While at it, improve the documentation of `nt_read`.

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Marc Hartmayer
2022-09-23 15:14:15 +00:00
committed by Jan Höppner
parent 922d29ee49
commit 4e6d43e2ac
3 changed files with 71 additions and 65 deletions
+10
View File
@@ -156,6 +156,16 @@ int read_elf_hdr(const struct zg_fh *fh, Elf64_Ehdr *ehdr);
Elf64_Phdr *read_elf_phdrs(const struct zg_fh *fh, const Elf64_Ehdr *ehdr,
unsigned int *phdr_count);
/*
* Read note and store the note description in @buf
*/
int nt_read(const struct zg_fh *fh, const Elf64_Nhdr *note, void *buf, size_t buf_len);
/*
* Skip note
*/
void nt_skip(const struct zg_fh *fh, const Elf64_Nhdr *note);
/*
* Initialize ELF note
*/