xfs: use aligned-endian get/put helpers
PATCH 9/21 xfs: use aligned-endian get/put helpers
Signed-off-by Harvey Harrison <[email protected]>
--- fs/xfs/xfs_log.c | 4 ++-- fs/xfs/xfs_log_priv.h | 6 +++--- fs/xfs/xfs_log_recover.c | 9 ++++----- fs/xfs/xfs_mount.c | 12 ++++++------ 4 files changed, 15 insertions(+), 16 deletions(-)
fs/xfs/xfs_log.c +2 -2
@@ -1529,7 +1529,7 @@ xlog_sync(xlog_t *log,*/ for (i =0 ; i < split; i +=BBSIZE ) {be32_add_cpu ((__be32 *)dptr,1 ); -if (be32_to_cpu (*(__be32 *)dptr) ==XLOG_HEADER_MAGIC_NUM ) +if (get_be32 (dptr) ==XLOG_HEADER_MAGIC_NUM )be32_add_cpu ((__be32 *)dptr,1 ); dptr +=BBSIZE ; }
@@ -3387,7 +3387,7 @@ xlog_verify_iclog(xlog_t *log, ptr = (xfs_caddr_t) &iclog->ic_header;for (ptr +=BBSIZE ; ptr < ((xfs_caddr_t)&iclog->ic_header) + count; ptr +=BBSIZE ) { -if (be32_to_cpu (*(__be32 *)ptr) ==XLOG_HEADER_MAGIC_NUM ) +if (get_be32 (ptr) ==XLOG_HEADER_MAGIC_NUM )xlog_panic ("xlog_verify_iclog: unexpected magic num" ); }
fs/xfs/xfs_log_priv.h +3 -3
@@ -63,10 +63,10 @@ static inline xfs_lsn_t xlog_assign_lsn(uint cycle, uint block)static inline uint xlog_get_cycle (char *ptr) { -if (be32_to_cpu (*(__be32 *)ptr) ==XLOG_HEADER_MAGIC_NUM ) -return be32_to_cpu (*((__be32 *)ptr +1 )); +if (get_be32 (ptr) ==XLOG_HEADER_MAGIC_NUM ) +return get_be32 ((__be32 *)ptr +1 );else -return be32_to_cpu (*(__be32 *)ptr); +return get_be32 (ptr); }#define BLK_AVG (blk1, blk2) ((blk1+blk2) >> 1)
fs/xfs/xfs_log_recover.c +4 -5
@@ -824,7 +824,7 @@ xlog_find_tail(if ((error =xlog_bread (log, i,1 , bp))) goto bread_err; offset =xlog_align (log, i,1 , bp); -if (XLOG_HEADER_MAGIC_NUM ==be32_to_cpu (*(__be32 *)offset)) { +if (XLOG_HEADER_MAGIC_NUM ==get_be32 (offset)) { found =1 ;break ; }
@@ -840,8 +840,7 @@ xlog_find_tail(if ((error =xlog_bread (log, i,1 , bp))) goto bread_err; offset =xlog_align (log, i,1 , bp); -if (XLOG_HEADER_MAGIC_NUM == -be32_to_cpu (*(__be32 *)offset)) { +if (XLOG_HEADER_MAGIC_NUM ==get_be32 (offset)) { found =2 ;break ; }
@@ -3342,7 +3341,7 @@ xlog_pack_data_checksum( up = (__be32 *)iclog->ic_datap;/* divide length by 4 to get # words */ for (i =0 ; i < (size >>2 ); i++) { - chksum ^=be32_to_cpu (*up); + chksum ^=get_be32 (up); up++; } iclog->ic_header.h_chksum =cpu_to_be32 (chksum);
@@ -3407,7 +3406,7 @@ xlog_unpack_data_checksum(/* divide length by 4 to get # words */ for (i=0 ; i <be32_to_cpu (rhead->h_len) >>2 ; i++) { - chksum ^=be32_to_cpu (*up); + chksum ^=get_be32 (up); up++; }if (chksum !=be32_to_cpu (rhead->h_chksum)) {
fs/xfs/xfs_mount.c +6 -6
@@ -488,16 +488,16 @@ xfs_sb_to_disk( }else {switch (size) {case 2 : - *(__be16 *)(to_ptr + first) = -cpu_to_be16 (*(__u16 *)(from_ptr + first)); +put_be16 (*(__u16 *)(from_ptr + first), + to_ptr + first);break ;case 4 : - *(__be32 *)(to_ptr + first) = -cpu_to_be32 (*(__u32 *)(from_ptr + first)); +put_be32 (*(__u32 *)(from_ptr + first), + to_ptr + first);break ;case 8 : - *(__be64 *)(to_ptr + first) = -cpu_to_be64 (*(__u64 *)(from_ptr + first)); +put_be64 (*(__u64 *)(from_ptr + first), + to_ptr + first);break ;default :ASSERT (0 );
Signature · 1 line
1.5.5.1.570.g26b5e