[PATCH v4 1/4] cleanup: add dbgprint_mem_range function

Simon Horman horms at verge.net.au
Wed Mar 19 23:49:31 EDT 2014


On Wed, Mar 19, 2014 at 04:03:58PM +0800, WANG Chao wrote:
> dbgprint_mem_range is used for printing the given memory range under
> debugging mode.
> 
> Signed-off-by: WANG Chao <chaowang at redhat.com>
> Tested-by: Linn Crosetto <linn at hp.com>

Thanks, I have applied this patch.

> ---
>  kexec/arch/i386/kexec-x86-common.c |  6 +-----
>  kexec/kexec.c                      | 10 ++++++++++
>  kexec/kexec.h                      |  1 +
>  3 files changed, 12 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.c b/kexec/kexec.c
> index 382f86a..133e622 100644
> --- a/kexec/kexec.c
> +++ b/kexec/kexec.c
> @@ -53,6 +53,16 @@ unsigned long long mem_max = ULONG_MAX;
>  static unsigned long kexec_flags = 0;
>  int kexec_debug = 0;
>  
> +void dbgprint_mem_range(const char *prefix, struct memory_range *mr, int nr_mr)
> +{
> +	int i;
> +	dbgprintf("%s\n", prefix);
> +	for (i = 0; i < nr_mr; i++) {
> +		dbgprintf("%016llx-%016llx (%d)\n", mr[i].start,
> +			  mr[i].end, mr[i].type);
> +	}
> +}
> +
>  void die(const char *fmt, ...)
>  {
>  	va_list args;
> diff --git a/kexec/kexec.h b/kexec/kexec.h
> index 2bd6e96..d69bba2 100644
> --- a/kexec/kexec.h
> +++ b/kexec/kexec.h
> @@ -232,6 +232,7 @@ extern int file_types;
>  
>  #define KEXEC_OPT_STR "h?vdfxluet:p"
>  
> +extern void dbgprint_mem_range(const char *prefix, struct memory_range *mr, int nr_mr);
>  extern void die(const char *fmt, ...)
>  	__attribute__ ((format (printf, 1, 2)));
>  extern void *xmalloc(size_t size);
> -- 
> 1.8.5.3
> 
> 
> _______________________________________________
> kexec mailing list
> kexec at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec
> 



More information about the kexec mailing list