[PATCH 10/13] kexec: ppc64: use _ALIGN* to make the logic clear

Simon Horman horms at verge.net.au
Thu Mar 14 05:23:46 EDT 2013


On Thu, Mar 14, 2013 at 01:33:07AM +0800, Zhang Yanfei wrote:
> From: Zhang Yanfei <zhangyanfei at cn.fujitsu.com>
> 
> By replacing all the explicit align opertion with marco _ALIGN*,
> the code logic could be more clear.

This appears to break the ppc64 build.

powerpc64-unknown-linux-gnu-gcc -Wall -Wextra -Wpointer-arith -Wwrite-strings -Wformat -O2 -fomit-frame-pointer -pipe -fno-strict-aliasing -Wall -Wstrict-prototypes -I/home/horms/local/opt/crosstool/powerpc-970/gcc-4.1.1-glibc-2.3.6/powerpc64-unknown-linux-gnu/include -I./include -I./util_lib/include -Iinclude/  -I./kexec/arch/ppc64/include -c -MD -o kexec/arch/ppc64/fs2dt.o kexec/arch/ppc64/fs2dt.c
kexec/arch/ppc64/fs2dt.c: In function 'putnode':
kexec/arch/ppc64/fs2dt.c:492: warning: passing argument 4 of 'scandir' from
incompatible pointer type
kexec/arch/ppc64/fs2dt.c:738:1: error: unterminated argument list invoking
macro "_ALIGN"
kexec/arch/ppc64/fs2dt.c: In function 'create_flatten_tree':
kexec/arch/ppc64/fs2dt.c:701: error: '_ALIGN' undeclared (first use in this
function)
kexec/arch/ppc64/fs2dt.c:701: error: (Each undeclared identifier is
reported only once
kexec/arch/ppc64/fs2dt.c:701: error: for each function it appears in.)
kexec/arch/ppc64/fs2dt.c:701: error: expected ';' at end of input
kexec/arch/ppc64/fs2dt.c:676: warning: unused variable 'buf'
kexec/arch/ppc64/fs2dt.c:675: warning: unused variable 'tlen'
kexec/arch/ppc64/fs2dt.c:672: warning: unused parameter 'bufp'
kexec/arch/ppc64/fs2dt.c:672: warning: unused parameter 'sizep'
kexec/arch/ppc64/fs2dt.c:701: warning: control reaches end of non-void function

> Signed-off-by: Zhang Yanfei <zhangyanfei at cn.fujitsu.com>
> ---
>  kexec/arch/ppc64/crashdump-ppc64.c |    4 ++--
>  kexec/arch/ppc64/fs2dt.c           |    6 ++----
>  2 files changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/kexec/arch/ppc64/crashdump-ppc64.c b/kexec/arch/ppc64/crashdump-ppc64.c
> index b8a63bd..49cab12 100644
> --- a/kexec/arch/ppc64/crashdump-ppc64.c
> +++ b/kexec/arch/ppc64/crashdump-ppc64.c
> @@ -298,7 +298,7 @@ static int get_crash_memory_ranges(struct memory_range **range, int *ranges)
>  		 * to the next page size boundary though, so makedumpfile can
>  		 * read it safely without going south on us.
>  		 */
> -		cend = (cend + page_size - 1) & (~(page_size - 1));
> +		cend = _ALIGN(cend, page_size);
>  
>  		crash_memory_range[memory_ranges].start = cstart;
>  		crash_memory_range[memory_ranges++].end = cend;
> @@ -400,7 +400,7 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline,
>  	info->backup_src_start = BACKUP_SRC_START;
>  	info->backup_src_size = BACKUP_SRC_SIZE;
>  	/* Create a backup region segment to store backup data*/
> -	sz = (BACKUP_SRC_SIZE + align - 1) & ~(align - 1);
> +	sz = _ALIGN(BACKUP_SRC_SIZE, align);
>  	tmp = xmalloc(sz);
>  	memset(tmp, 0, sz);
>  	info->backup_start = add_buffer(info, tmp, sz, sz, align,
> diff --git a/kexec/arch/ppc64/fs2dt.c b/kexec/arch/ppc64/fs2dt.c
> index 9750c34..62edc93 100644
> --- a/kexec/arch/ppc64/fs2dt.c
> +++ b/kexec/arch/ppc64/fs2dt.c
> @@ -698,8 +698,7 @@ int create_flatten_tree(char **bufp, off_t *sizep, char *cmdline)
>  	dt_reserve(&dt, 1);
>  	*dt++ = 9;
>  
> -	len = sizeof(bb[0]);
> -	len += 7; len &= ~7;
> +	len = _ALIGN(sizeof(bb[0], 8);
>  
>  	bb->off_mem_rsvmap = len;
>  
> @@ -714,8 +713,7 @@ int create_flatten_tree(char **bufp, off_t *sizep, char *cmdline)
>  	len *= sizeof(unsigned);
>  	bb->off_dt_strings = bb->off_dt_struct + len;
>  
> -	len = propnum("");
> -	len +=  3; len &= ~3;
> +	len = _ALIGN(propnum(""), 4);
>  	bb->totalsize = bb->off_dt_strings + len;
>  
>  	bb->magic = 0xd00dfeed;
> -- 
> 1.7.1
> 



More information about the kexec mailing list