dbgprint_mem_range is used for printing the given memory range under debugging mode. Signed-off-by: WANG Chao <chaowang at redhat.com> --- kexec/arch/i386/kexec-x86-common.c | 6 +----- kexec/kexec.h | 10 ++++++++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/kexec/arch/i386/kexec-x86-common.c b/kexec/arch/i386/kexec-x86-common.c index f55e2c2..e416177 100644 --- a/kexec/arch/i386/kexec-x86-common.c +++ b/kexec/arch/i386/kexec-x86-common.c @@ -374,11 +374,7 @@ int get_memory_ranges(struct memory_range **range, int *ranges, mem_max = end; } - dbgprintf("MEMORY RANGES\n"); - for (i = 0; i < *ranges; i++) { - dbgprintf("%016Lx-%016Lx (%d)\n", (*range)[i].start, - (*range)[i].end, (*range)[i].type); - } + dbgprint_mem_range("MEMORY RANGES", *range, *ranges); return ret; } diff --git a/kexec/kexec.h b/kexec/kexec.h index 2bd6e96..753acc5 100644 --- a/kexec/kexec.h +++ b/kexec/kexec.h @@ -121,6 +121,16 @@ do { \ fprintf(stderr, __VA_ARGS__); \ } while(0) +#define dbgprint_mem_range(prefix, mr, nr_mr) \ +do { \ + int i; \ + dbgprintf(prefix "\n"); \ + for (i = 0; i < nr_mr; i++) { \ + dbgprintf("%016llx-%016llx (%d)\n", (mr)[i].start, \ + (mr)[i].end, (mr)[i].type); \ + } \ +} while (0) + struct kexec_segment { const void *buf; size_t bufsz; -- 1.8.5.3