From 4763d7e8a7fe5cd8d993ba48dbf8cc165d27d3ab Mon Sep 17 00:00:00 2001 From: Ryusuke Konishi Date: Thu, 21 Feb 2008 18:57:23 +0900 Subject: [PATCH] nilfs2-utils: fix gcc-4.2 warnings on 64-bit machines Gcc-4.2 warns against casts from pointer to interger of different size. Nilfs partially used this type of cast to calculate structure-member offsets, and led to warnings on some 64-bit environments. This fixes the problem by changing the type of offset calculation macros to long or unsigned long. Signed-off-by: Ryusuke Konishi --- include/nilfs_fs.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/include/nilfs_fs.h b/include/nilfs_fs.h index b3db41d..eb39a98 100644 --- a/include/nilfs_fs.h +++ b/include/nilfs_fs.h @@ -124,10 +124,12 @@ struct nilfs_super_root { struct nilfs_inode sr_sufile; }; -#define NILFS_SR_MDT_OFFSET(nilfs,i) ((unsigned int)(&((struct nilfs_super_root *)0)->sr_dat) + (nilfs)->ns_inode_size * (i)) -#define NILFS_SR_DAT_OFFSET(nilfs) NILFS_SR_MDT_OFFSET(nilfs,0) -#define NILFS_SR_CPFILE_OFFSET(nilfs) NILFS_SR_MDT_OFFSET(nilfs,1) -#define NILFS_SR_SUFILE_OFFSET(nilfs) NILFS_SR_MDT_OFFSET(nilfs,2) +#define NILFS_SR_MDT_OFFSET(inode_size, i) \ + ((unsigned long)&((struct nilfs_super_root *)0)->sr_dat + \ + (inode_size) * (i)) +#define NILFS_SR_DAT_OFFSET(inode_size) NILFS_SR_MDT_OFFSET(inode_size,0) +#define NILFS_SR_CPFILE_OFFSET(inode_size) NILFS_SR_MDT_OFFSET(inode_size,1) +#define NILFS_SR_SUFILE_OFFSET(inode_size) NILFS_SR_MDT_OFFSET(inode_size,2) #define NILFS_SR_BYTES (sizeof(struct nilfs_super_root)) /* @@ -236,7 +238,8 @@ struct nilfs_super_block { /* * Bytes count of super_block for CRC-calculation */ -#define NILFS_SB_BYTES ((int)(((struct nilfs_super_block *)0)->s_reserved)) +#define NILFS_SB_BYTES \ + ((long)&((struct nilfs_super_block *)0)->s_reserved) /* * Special inode number