[Ocfs2-tools-devel] [PATCH 1/6] ocfs2-tools/trivial: Silence compiler warnings

Joel Becker Joel.Becker at oracle.com
Tue Feb 16 18:13:06 PST 2010


On Tue, Feb 16, 2010 at 03:54:52PM -0800, Sunil Mushran wrote:
> Patch silences some compiler warnings.
> 
> Signed-off-by: Sunil Mushran <sunil.mushran at oracle.com>
Sob

> ---
>  extras/mark_journal_dirty.c     |    2 +-
>  fswreck/dir.c                   |    6 ++++--
>  fswreck/inode.c                 |    2 +-
>  fswreck/local_alloc.c           |    2 +-
>  fswreck/main.c                  |    2 +-
>  fswreck/truncate_log.c          |    4 ++--
>  libocfs2/fileio.c               |    2 +-
>  tunefs.ocfs2/feature_refcount.c |    4 ++--
>  8 files changed, 13 insertions(+), 11 deletions(-)
> 
> diff --git a/extras/mark_journal_dirty.c b/extras/mark_journal_dirty.c
> index 18ab63a..7a225e2 100644
> --- a/extras/mark_journal_dirty.c
> +++ b/extras/mark_journal_dirty.c
> @@ -125,7 +125,7 @@ static errcode_t insert_node_into_slot(ocfs2_filesys *fs,
>  	int i, num_slots;
>  	char *buf = NULL;
>  	uint64_t slot_map_blkno;
> -	uint32_t len = fs->fs_blocksize;
> +	int len = fs->fs_blocksize;
>  	int16_t *slots;
>  
>  	ret = ocfs2_lookup_system_inode(fs, SLOT_MAP_SYSTEM_INODE, -1,
> diff --git a/fswreck/dir.c b/fswreck/dir.c
> index e0a41ed..37874ea 100644
> --- a/fswreck/dir.c
> +++ b/fswreck/dir.c
> @@ -285,7 +285,8 @@ static void damage_dir_content(ocfs2_filesys *fs, uint64_t dir,
>  		corrupt_dirent_reclen(fs, dir, ".", &tmp_no, OCFS2_DIR_PAD);
>  		fprintf(stdout, "DIR_DOT_EXCESS: "
>  			"Corrupt directory#%"PRIu64","
> -			"change dot's dirent length from %lu to %lu\n",
> +			"change dot's dirent length from %"PRIu64" "
> +			"to %"PRIu64"\n",
>  			dir, tmp_no - OCFS2_DIR_PAD, tmp_no);
>  		break;
>  	case DIRENT_ZERO:
> @@ -371,7 +372,8 @@ static void damage_dir_content(ocfs2_filesys *fs, uint64_t dir,
>  		corrupt_dirent_reclen(fs, dir, name, &tmp_no, 1);
>  		fprintf(stdout, "DIRENT_LENGTH: "
>  			"Corrupt directory#%"PRIu64
> -			", modify entry#%"PRIu64" from %lu to %lu.\n",
> +			", modify entry#%"PRIu64" from %"PRIu64" "
> +			"to %"PRIu64".\n",
>  			dir, tmp_blkno, tmp_no - 1, tmp_no);
>  		break;
>  	default:
> diff --git a/fswreck/inode.c b/fswreck/inode.c
> index f8045cf..a34a03b 100644
> --- a/fswreck/inode.c
> +++ b/fswreck/inode.c
> @@ -106,7 +106,7 @@ static void damage_inode(ocfs2_filesys *fs, uint64_t blkno,
>  	case INODE_SPARSE_SIZE:
>  		fprintf(stdout, "INODE_SPARSE_SIZE: "
>  			"Corrupt inode#%"PRIu64", change i_size "
> -			"from %u to %u\n",
> +			"from %"PRIu64" to %u\n",
>  			 blkno, di->i_size, fs->fs_clustersize);
>  		di->i_size = fs->fs_clustersize;
>  		break;
> diff --git a/fswreck/local_alloc.c b/fswreck/local_alloc.c
> index eb9187e..6fb17c7 100644
> --- a/fswreck/local_alloc.c
> +++ b/fswreck/local_alloc.c
> @@ -40,7 +40,7 @@
>  
>  extern char *progname;
>  
> -static inline uint32_t get_local_alloc_window_bits()
> +static uint32_t get_local_alloc_window_bits()
>  {
>  	/* just return a specific number for test */
>  	return 256;
> diff --git a/fswreck/main.c b/fswreck/main.c
> index 679a359..ae8836c 100644
> --- a/fswreck/main.c
> +++ b/fswreck/main.c
> @@ -365,7 +365,7 @@ static int parse_corrupt_codes(const char *corrupt_codes)
>  	char *p;
>  	char *token = NULL;
>  
> -	p = corrupt_codes;
> +	p = (char *)corrupt_codes;
>  
>  	while (p) {
>  
> diff --git a/fswreck/truncate_log.c b/fswreck/truncate_log.c
> index 20f2dbd..c2cdee5 100644
> --- a/fswreck/truncate_log.c
> +++ b/fswreck/truncate_log.c
> @@ -226,7 +226,7 @@ void mess_up_truncate_log_list(ocfs2_filesys *fs, enum fsck_type type,
>  			       uint16_t slotnum)
>  {
>  	uint64_t blkno;
> -	int i;
> +	int i = 0;
>  
>  	get_truncate_log(fs, slotnum, &blkno);
>  
> @@ -250,7 +250,7 @@ void mess_up_truncate_log_rec(ocfs2_filesys *fs, enum fsck_type type,
>  			      uint16_t slotnum)
>  {
>  	uint64_t blkno;
> -	int i;
> +	int i = 0;
>  
>  	switch (type) {
>  	case TRUNCATE_REC_START_RANGE:
> diff --git a/libocfs2/fileio.c b/libocfs2/fileio.c
> index 8b8a359..2f30e98 100644
> --- a/libocfs2/fileio.c
> +++ b/libocfs2/fileio.c
> @@ -85,7 +85,7 @@ static errcode_t ocfs2_inline_data_read(struct ocfs2_dinode *di, void *buf,
>  	p = (__u8 *) &(id->id_data);
>  	p += offset;
>  
> -	*got = ocfs2_min((di->i_size - offset), (uint64_t)count);
> +	*got = ocfs2_min((uint64_t)(di->i_size - offset), (uint64_t)count);
>  	memcpy(buf, p, *got);
>  
>  	return 0;
> diff --git a/tunefs.ocfs2/feature_refcount.c b/tunefs.ocfs2/feature_refcount.c
> index 864f997..8b10378 100644
> --- a/tunefs.ocfs2/feature_refcount.c
> +++ b/tunefs.ocfs2/feature_refcount.c
> @@ -125,7 +125,7 @@ static int ocfs2_xattr_get_refcount_clusters(ocfs2_cached_inode *ci,
>  					     int in_bucket,
>  					     void *priv_data)
>  {
> -	errcode_t ret;
> +	errcode_t ret = 0;
>  	uint32_t *clusters = priv_data;
>  	uint32_t cpos = 0, len, p_cluster, num_clusters;
>  	uint16_t ext_flags;
> @@ -313,7 +313,7 @@ static int ocfs2_xattr_cow_refcount_clusters(ocfs2_cached_inode *ci,
>  					     int in_bucket,
>  					     void *priv_data)
>  {
> -	errcode_t ret;
> +	errcode_t ret = 0;
>  	uint32_t cpos = 0, len, p_cluster, num_clusters;
>  	uint16_t ext_flags;
>  	struct ocfs2_xattr_value_root *xv;
> -- 
> 1.6.3.3
> 
> 
> _______________________________________________
> Ocfs2-tools-devel mailing list
> Ocfs2-tools-devel at oss.oracle.com
> http://oss.oracle.com/mailman/listinfo/ocfs2-tools-devel

-- 

"The question of whether computers can think is just like the question
 of whether submarines can swim."
	- Edsger W. Dijkstra

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127



More information about the Ocfs2-tools-devel mailing list