diff options
author | Zhang Yanfei <zhangyanfei@cn.fujitsu.com> | 2013-03-14 17:38:02 +0800 |
---|---|---|
committer | Simon Horman <horms@verge.net.au> | 2013-03-14 11:02:00 +0100 |
commit | 337d4fcbdc45e61cab28f8ba6da49015cca5c8d0 (patch) | |
tree | 06ea85fe9b24edcea45659024e792ed40202a60d | |
parent | bb3f9f58427d1089b6429c8f8265a2838193a322 (diff) | |
download | kexec-tools-337d4fcbdc45e61cab28f8ba6da49015cca5c8d0.tar.gz |
kexec: ppc64: use _ALIGN* to make the logic clear
By replacing all the explicit align opertion with marco _ALIGN*,
the code logic could be more clear.
Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
-rw-r--r-- | kexec/arch/ppc64/crashdump-ppc64.c | 4 | ||||
-rw-r--r-- | 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 b8a63bda..49cab12b 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 9750c34f..924c7ff7 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; |