[Ocfs2-tools-devel] [PATCH 3/7] fswreck: fix fprintf format build warnings

Gang He ghe at suse.com
Sun Mar 6 18:29:08 PST 2016




>>> 
> Fix the fprintf format build warnings:
> warning: format ‘%lu’ expects type ‘long unsigned int’, but argument 4
> has type ‘__u64’
> 
> Signed-off-by: Joseph Qi <joseph.qi at huawei.com>
Reviewed-by: Gang He <ghe at suse.com>

> ---
>  fswreck/chain.c   |  8 ++++----
>  fswreck/extent.c  |  8 ++++----
>  fswreck/group.c   |  8 ++++----
>  fswreck/inode.c   | 10 +++++-----
>  fswreck/symlink.c |  2 +-
>  5 files changed, 18 insertions(+), 18 deletions(-)
> 
> diff --git a/fswreck/chain.c b/fswreck/chain.c
> index 64b640e..e7fb019 100644
> --- a/fswreck/chain.c
> +++ b/fswreck/chain.c
> @@ -89,7 +89,7 @@ static void mess_up_sys_file(ocfs2_filesys *fs, uint64_t 
> blkno,
>  		fprintf(stdout, "Corrupt CHAIN_EMPTY:"
>  			" Modified e_blkno "
>  			"in block#%"PRIu64" from %"PRIu64" to 0\n",
> -			 blkno,	cr->c_blkno);
> +			 blkno,	(uint64_t)cr->c_blkno);
>  		cr->c_blkno = 0;
>  		break;
>  	case CHAIN_I_CLUSTERS:
> @@ -102,7 +102,7 @@ static void mess_up_sys_file(ocfs2_filesys *fs, uint64_t 
> blkno,
>  		fprintf(stdout, "Corrupt CHAIN_I_SIZE:"
>  			"change i_size "
>  			"in block#%"PRIu64" from %"PRIu64" to %"PRIu64"\n",
> -			 blkno, di->i_size, (di->i_size + 10));
> +			 blkno, (uint64_t)di->i_size, ((uint64_t)di->i_size + 10));
>  		di->i_size += 10;
>  		break;
>  	case CHAIN_GROUP_BITS:
> @@ -120,7 +120,7 @@ static void mess_up_sys_file(ocfs2_filesys *fs, uint64_t 
> blkno,
>  		fprintf(stdout, "Corrupt CHAIN_HEAD_LINK_RANGE:"
>  			"change  "
>  			"in block#%"PRIu64" from %"PRIu64" to %"PRIu64"\n",
> -			 blkno, oldblkno, cr->c_blkno);
> +			 blkno, oldblkno, (uint64_t)cr->c_blkno);
>  		break;
>  	case CHAIN_LINK_GEN:
>  	case CHAIN_LINK_MAGIC:
> @@ -151,7 +151,7 @@ static void mess_up_sys_file(ocfs2_filesys *fs, uint64_t 
> blkno,
>  			    ocfs2_clusters_to_blocks(fs, fs->fs_clusters) + 10;
>  			fprintf(stdout, "Corrupt CHAIN_LINK_RANGE: "
>  				"change next group from %"PRIu64" to %"PRIu64
> -				" \n", oldblkno, bg->bg_next_group);
> +				" \n", oldblkno, (uint64_t)bg->bg_next_group);
>  		}
>  		
>  		ret = ocfs2_write_group_desc(fs, cr->c_blkno, (char *)bg);
> diff --git a/fswreck/extent.c b/fswreck/extent.c
> index ab1f5d1..c12ace0 100644
> --- a/fswreck/extent.c
> +++ b/fswreck/extent.c
> @@ -160,7 +160,7 @@ static void damage_extent_block(ocfs2_filesys *fs, 
> uint64_t blkno,
>  			eb->h_blkno += 1;
>  			fprintf(stdout, "EB_BLKNO: Corrupt inode#%"PRIu64", "
>  				"change extent block's number from %"PRIu64" to "
> -			       	"%"PRIu64"\n", blkno, oldblkno, eb->h_blkno);
> +			       	"%"PRIu64"\n", blkno, oldblkno, (uint64_t)eb->h_blkno);
>  			break;
>  		case EB_GEN:
>  		case EB_GEN_FIX:
> @@ -180,7 +180,7 @@ static void damage_extent_block(ocfs2_filesys *fs, 
> uint64_t blkno,
>  			memset(eb->h_signature, 'a', sizeof(eb->h_signature));
>  			fprintf(stdout, "Corrupt the signature of extent block "
>  				"%"PRIu64"\n",
> -				eb->h_blkno);
> +				(uint64_t)eb->h_blkno);
>  			break;
>  		case EXTENT_LIST_DEPTH:
>  			oldno = eb->h_list.l_tree_depth;
> @@ -327,7 +327,7 @@ static void mess_up_record(ocfs2_filesys *fs, uint64_t 
> blkno,
>  			fprintf(stdout, "EXTENT_BLKNO_UNALIGNED: "
>  				"Corrupt inode#%"PRIu64", change blkno "
>  				"from %"PRIu64 " to %"PRIu64"\n",
> -				blkno, oldno, er->e_blkno);
> +				blkno, oldno, (uint64_t)er->e_blkno);
>  			break;
>  	 	case EXTENT_CLUSTERS_OVERRUN:
>  			oldno = er->e_leaf_clusters;
> @@ -344,7 +344,7 @@ static void mess_up_record(ocfs2_filesys *fs, uint64_t 
> blkno,
>  			fprintf(stdout, "EXTENT_BLKNO_RANGE: "
>  			"Corrupt inode#%"PRIu64", change blkno "
>  			" from %"PRIu64 " to %"PRIu64"\n",
> -			blkno, oldno, er->e_blkno);
> +			blkno, oldno, (uint64_t)er->e_blkno);
>  			break;
>  		case EXTENT_OVERLAP:
>  			ret = ocfs2_extend_allocation(fs, blkno, 2);
> diff --git a/fswreck/group.c b/fswreck/group.c
> index 593fe38..a1b000f 100644
> --- a/fswreck/group.c
> +++ b/fswreck/group.c
> @@ -118,7 +118,7 @@ static void damage_group_desc(ocfs2_filesys *fs, uint64_t 
> blkno,
>  	case GROUP_EXPECTED_DESC:
>  		fprintf(stdout, "Corrput GROUP_EXPECED_DESC: "
>  			"delete the group desciptor#%"PRIu64" from the chain "
> -			"#%d\n", bg->bg_next_group, bg->bg_chain);
> +			"#%d\n", (uint64_t)bg->bg_next_group, bg->bg_chain);
>  		bg->bg_next_group = 0;
>  		break;
>  	case GROUP_UNEXPECTED_DESC:
> @@ -161,13 +161,13 @@ static void damage_group_desc(ocfs2_filesys *fs, 
> uint64_t blkno,
>  	case GROUP_PARENT:
>  		fprintf(stdout, "Corrput GROUP_PARENT: "
>  			"change group parent from %"PRIu64" to %"PRIu64"\n",
> -			bg->bg_parent_dinode, (bg->bg_parent_dinode + 10));
> +			(uint64_t)bg->bg_parent_dinode, ((uint64_t)bg->bg_parent_dinode + 10));
>  		bg->bg_parent_dinode += 10;
>  		break;
>  	case GROUP_BLKNO:
>  		fprintf(stdout, "Corrput GROUP_BLKNO: "
>  			"change group blkno from %"PRIu64" to %"PRIu64"\n",
> -			bg->bg_blkno, (bg->bg_blkno + 10));
> +			(uint64_t)bg->bg_blkno, ((uint64_t)bg->bg_blkno + 10));
>  		bg->bg_blkno += 10;
>  		break;
>  	case GROUP_CHAIN:
> @@ -179,7 +179,7 @@ static void damage_group_desc(ocfs2_filesys *fs, uint64_t 
> blkno,
>  	case GROUP_CHAIN_LOOP:
>  		fprintf(stdout, "Corrput GROUP_LOOP: "
>  			"change group next from %"PRIu64" to %"PRIu64"\n",
> -			bg->bg_next_group, cr->c_blkno);
> +			(uint64_t)bg->bg_next_group, (uint64_t)cr->c_blkno);
>  		bg->bg_next_group = cpu_to_le64(cr->c_blkno);
>  		break;
>  	case GROUP_FREE_BITS:
> diff --git a/fswreck/inode.c b/fswreck/inode.c
> index 83adae2..5426c61 100644
> --- a/fswreck/inode.c
> +++ b/fswreck/inode.c
> @@ -81,13 +81,13 @@ static void damage_inode(ocfs2_filesys *fs, uint64_t 
> blkno,
>  		fprintf(stdout, "INODE_BLKNO: "
>  			"Corrupt inode#%"PRIu64", change i_blkno from %"PRIu64
>  			" to %"PRIu64"\n",
> -			blkno, di->i_blkno, (di->i_blkno + 100));
> +			blkno, (uint64_t)di->i_blkno, ((uint64_t)di->i_blkno + 100));
>  		di->i_blkno += 100;
>  		break;
>  	case INODE_NZ_DTIME:
>  		fprintf(stdout, "INODE_NZ_DTIME: "
>  			"Corrupt inode#%"PRIu64", change i_dtime from %"PRIu64
> -			" to 100\n", blkno, di->i_dtime);
> +			" to 100\n", blkno, (uint64_t)di->i_dtime);
>  		di->i_dtime = 100;
>  		break;
>  	case INODE_SUBALLOC:
> @@ -101,14 +101,14 @@ static void damage_inode(ocfs2_filesys *fs, uint64_t 
> blkno,
>  		fprintf(stdout, "INODE_SIZE: "
>  			"Corrupt inode#%"PRIu64", change i_size"
>  			" from %"PRIu64" to %"PRIu64"\n",
> -			 blkno, di->i_size, (di->i_size + 100));
> +			 blkno, (uint64_t)di->i_size, ((uint64_t)di->i_size + 100));
>  		di->i_size += 100;
>  		break;
>  	case INODE_SPARSE_SIZE:
>  		fprintf(stdout, "INODE_SPARSE_SIZE: "
>  			"Corrupt inode#%"PRIu64", change i_size "
>  			"from %"PRIu64" to %u\n",
> -			 blkno, di->i_size, fs->fs_clustersize);
> +			 blkno, (uint64_t)di->i_size, fs->fs_clustersize);
>  		di->i_size = fs->fs_clustersize;
>  		break;
>  	case INODE_CLUSTERS:
> @@ -132,7 +132,7 @@ static void damage_inode(ocfs2_filesys *fs, uint64_t 
> blkno,
>  	case INODE_BLOCK_ECC:
>  		fprintf(stdout, "INODE_BLOCK_ECC: "
>  			"Corrupte inode#%"PRIu64", set both i_check.bc_crc32e"
> -			"=%"PRIu64" and i_check.bc_ecc=%"PRIu64" to 0x1234\n",
> +			"=%u and i_check.bc_ecc=%u to 0x1234\n",
>  			blkno, di->i_check.bc_crc32e, di->i_check.bc_ecc);
>  		di->i_check.bc_crc32e = 0x1234;
>  		di->i_check.bc_ecc = 0x1234;
> diff --git a/fswreck/symlink.c b/fswreck/symlink.c
> index 531b4ab..7af5689 100644
> --- a/fswreck/symlink.c
> +++ b/fswreck/symlink.c
> @@ -204,7 +204,7 @@ static void corrupt_symlink_file(ocfs2_filesys *fs, 
> uint64_t blkno,
>  		fprintf(stdout, "LINK_SIZE: "
>  			"Corrupt inode#%"PRIu64","
>  			"change size from %"PRIu64" to %"PRIu64"\n",
> -			blkno, di->i_size, (di->i_size + 10));
> +			blkno, (uint64_t)di->i_size, ((uint64_t)di->i_size + 10));
>  		di->i_size += 10;
>  		break;
>  	case LINK_BLOCKS:
> -- 
> 1.8.4.3



More information about the Ocfs2-tools-devel mailing list