[Ocfs2-tools-devel] [PATCH] ocfs2-tools: Silence compiler warnings

Sunil Mushran sunil.mushran at oracle.com
Mon Sep 17 17:32:05 PDT 2007


This patch silences compiler warnings generated by gcc 4.1.

Signed-off-by: Sunil Mushran <sunil.mushran at oracle.com>
---
 debugfs.ocfs2/commands.c                  |    5 +++--
 fsck.ocfs2/fsck.c                         |    2 +-
 fsck.ocfs2/pass2.c                        |   14 +++++++-------
 fsck.ocfs2/pass4.c                        |    2 +-
 libocfs2/alloc.c                          |    4 ++--
 libocfs2/chainalloc.c                     |    2 +-
 libocfs2/extent_map.c                     |    2 +-
 libocfs2/include/bitmap.h                 |    2 +-
 libocfs2/truncate.c                       |    2 +-
 mkfs.ocfs2/mkfs.c                         |   18 +++++++++---------
 mkfs.ocfs2/mkfs.h                         |    2 +-
 mount.ocfs2/mntent.c                      |    2 +-
 o2cb_ctl/jconfig.c                        |    3 ++-
 ocfs2console/ocfs2interface/ocfs2module.c |    2 +-
 ocfs2console/ocfs2interface/ocfsplist.c   |    2 +-
 tunefs.ocfs2/query.c                      |    2 +-
 tunefs.ocfs2/tunefs.c                     |    6 +++---
 tunefs.ocfs2/tunefs.h                     |    2 +-
 18 files changed, 38 insertions(+), 36 deletions(-)

diff --git a/debugfs.ocfs2/commands.c b/debugfs.ocfs2/commands.c
index 28aab8f..5bad208 100644
--- a/debugfs.ocfs2/commands.c
+++ b/debugfs.ocfs2/commands.c
@@ -347,7 +347,8 @@ static int process_open_args(char **args,
 	errcode_t ret = 0;
 	uint32_t s;
 	char *ptr;
-	uint64_t byte_off[OCFS2_MAX_BACKUP_SUPERBLOCKS], blksize;
+	uint64_t byte_off[OCFS2_MAX_BACKUP_SUPERBLOCKS];
+	uint64_t blksize = 0;
 	int num, ind = 2;
 
 	if (!args[ind])
@@ -960,7 +961,7 @@ static void do_stat (char **args)
 	else if ((inode->i_flags & OCFS2_CHAIN_FL))
 		ret = traverse_chains(gbls.fs, &(inode->id2.i_chain), out);
 	else if (S_ISLNK(inode->i_mode) && !inode->i_clusters)
-		dump_fast_symlink(out, inode->id2.i_symlink);
+		dump_fast_symlink(out, (char *)inode->id2.i_symlink);
 	else if (inode->i_flags & OCFS2_DEALLOC_FL)
 		dump_truncate_log(out, &(inode->id2.i_dealloc));
 	else
diff --git a/fsck.ocfs2/fsck.c b/fsck.ocfs2/fsck.c
index 4e017f4..e4c9105 100644
--- a/fsck.ocfs2/fsck.c
+++ b/fsck.ocfs2/fsck.c
@@ -318,7 +318,7 @@ static int fs_is_clean(o2fsck_state *ost, char *filename)
 
 static void print_label(o2fsck_state *ost)
 {
-	char *label = OCFS2_RAW_SB(ost->ost_fs->fs_super)->s_label;
+	unsigned char *label = OCFS2_RAW_SB(ost->ost_fs->fs_super)->s_label;
 	size_t i, max = sizeof(OCFS2_RAW_SB(ost->ost_fs->fs_super)->s_label);
 
 	for(i = 0; i < max && label[i]; i++) {
diff --git a/fsck.ocfs2/pass2.c b/fsck.ocfs2/pass2.c
index ad82645..2243807 100644
--- a/fsck.ocfs2/pass2.c
+++ b/fsck.ocfs2/pass2.c
@@ -97,7 +97,7 @@ static int expected_dots(o2fsck_dirblock_entry *dbe, int offset)
 
 static errcode_t fix_dirent_dots(o2fsck_state *ost, o2fsck_dirblock_entry *dbe,
 				 struct ocfs2_dir_entry *dirent, int offset, 
-				 int left, int *flags)
+				 int left, unsigned int *flags)
 {
 	int expect_dots = expected_dots(dbe, offset);
 	int changed_len = 0;
@@ -213,7 +213,7 @@ static int dirent_leaves_partial(struct ocfs2_dir_entry *dirent, int left)
  */
 static void fix_dirent_lengths(struct ocfs2_dir_entry *dirent,
 			       int left, struct ocfs2_dir_entry *prev,
-			       int *flags)
+			       unsigned int *flags)
 {
 	/* 
 	 * as described above we can't reconstruct either value if it is
@@ -286,7 +286,7 @@ out:
 
 static void fix_dirent_name(o2fsck_state *ost, o2fsck_dirblock_entry *dbe,
 			    struct ocfs2_dir_entry *dirent, int offset,
-			    int *flags)
+			    unsigned int *flags)
 {
 	char *chr = dirent->name;
 	int len = dirent->name_len, fix = 0;
@@ -318,7 +318,7 @@ static void fix_dirent_name(o2fsck_state *ost, o2fsck_dirblock_entry *dbe,
 
 static void fix_dirent_inode(o2fsck_state *ost, o2fsck_dirblock_entry *dbe,
 			     struct ocfs2_dir_entry *dirent, int offset,
-			     int *flags)
+			     unsigned int *flags)
 {
 	if (ocfs2_block_out_of_range(ost->ost_fs, dirent->inode) &&
 	    prompt(ost, PY, PR_DIRENT_INODE_RANGE,
@@ -368,7 +368,7 @@ static errcode_t fix_dirent_filetype(o2fsck_state *ost,
 				     o2fsck_dirblock_entry *dbe,
 				     struct ocfs2_dir_entry *dirent,
 				     int offset,
-				     int *flags)
+				     unsigned int *flags)
 {
 	uint8_t expected_type;
 	errcode_t ret;
@@ -430,7 +430,7 @@ static errcode_t fix_dirent_linkage(o2fsck_state *ost,
 				    o2fsck_dirblock_entry *dbe,
 				    struct ocfs2_dir_entry *dirent,
 				    int offset,
-				    int *flags)
+				    unsigned int *flags)
 {
 	int expect_dots = expected_dots(dbe, offset);
 	o2fsck_dir_parent *dp;
@@ -499,7 +499,7 @@ static errcode_t fix_dirent_dups(o2fsck_state *ost,
 				 o2fsck_dirblock_entry *dbe,
 				 struct ocfs2_dir_entry *dirent,
 				 o2fsck_strings *strings,
-				 int *flags)
+				 unsigned int *flags)
 {
 	errcode_t ret = 0;
 	char *new_name = NULL;
diff --git a/fsck.ocfs2/pass4.c b/fsck.ocfs2/pass4.c
index 4b6fb97..64373e0 100644
--- a/fsck.ocfs2/pass4.c
+++ b/fsck.ocfs2/pass4.c
@@ -276,7 +276,7 @@ errcode_t o2fsck_pass4(o2fsck_state *ost)
 	struct ocfs2_dinode *di;
 	char *buf = NULL;
 	errcode_t ret;
-	uint64_t blkno, start;
+	uint64_t blkno = 0, start;
 
 	printf("Pass 4a: checking for orphaned inodes\n");
 
diff --git a/libocfs2/alloc.c b/libocfs2/alloc.c
index b4e22bb..5207239 100644
--- a/libocfs2/alloc.c
+++ b/libocfs2/alloc.c
@@ -140,7 +140,7 @@ static void ocfs2_init_inode(ocfs2_filesys *fs, struct ocfs2_dinode *di,
 		di->i_links_count = 2;
 	else
 		di->i_links_count = 1;
-	strcpy(di->i_signature, OCFS2_INODE_SIGNATURE);
+	strcpy((char *)di->i_signature, OCFS2_INODE_SIGNATURE);
 	di->i_atime = di->i_ctime = di->i_mtime = time(NULL);
 	di->i_dtime = 0;
 
@@ -181,7 +181,7 @@ static void ocfs2_init_eb(ocfs2_filesys *fs,
 			  struct ocfs2_extent_block *eb,
 			  uint64_t gd_blkno, uint64_t blkno)
 {
-	strcpy(eb->h_signature, OCFS2_EXTENT_BLOCK_SIGNATURE);
+	strcpy((char *)eb->h_signature, OCFS2_EXTENT_BLOCK_SIGNATURE);
 	eb->h_fs_generation = fs->fs_super->i_fs_generation;
 	eb->h_blkno = blkno;
 	eb->h_suballoc_slot = 0;
diff --git a/libocfs2/chainalloc.c b/libocfs2/chainalloc.c
index 4f5b1cc..3b967b4 100644
--- a/libocfs2/chainalloc.c
+++ b/libocfs2/chainalloc.c
@@ -486,7 +486,7 @@ void ocfs2_init_group_desc(ocfs2_filesys *fs,
 {
 	memset(gd, 0, fs->fs_blocksize);
 
-	strcpy(gd->bg_signature, OCFS2_GROUP_DESC_SIGNATURE);
+	strcpy((char *)gd->bg_signature, OCFS2_GROUP_DESC_SIGNATURE);
 	gd->bg_generation = generation;
 	gd->bg_size = ocfs2_group_bitmap_size(fs->fs_blocksize);
 	gd->bg_bits = bits;
diff --git a/libocfs2/extent_map.c b/libocfs2/extent_map.c
index 4fb7e34..c5fc34c 100644
--- a/libocfs2/extent_map.c
+++ b/libocfs2/extent_map.c
@@ -236,7 +236,7 @@ errcode_t ocfs2_extent_map_get_blocks(ocfs2_cached_inode *cinode,
 {
 	errcode_t ret;
 	int bpc;
-	uint32_t cpos, num_clusters, p_cluster;
+	uint32_t cpos, num_clusters = -1, p_cluster = -1;
 	uint64_t boff = 0;
 	ocfs2_filesys *fs = cinode->ci_fs;
 
diff --git a/libocfs2/include/bitmap.h b/libocfs2/include/bitmap.h
index 3f49cf4..e144e74 100644
--- a/libocfs2/include/bitmap.h
+++ b/libocfs2/include/bitmap.h
@@ -38,7 +38,7 @@ struct ocfs2_bitmap_region {
 					   int offsets */
 	size_t br_bytes;
 	int br_set_bits;
-	char *br_bitmap;
+	uint8_t *br_bitmap;
 	void *br_private;
 };
 
diff --git a/libocfs2/truncate.c b/libocfs2/truncate.c
index 783c30b..33d0c65 100644
--- a/libocfs2/truncate.c
+++ b/libocfs2/truncate.c
@@ -47,7 +47,7 @@ static int truncate_iterate(ocfs2_filesys *fs,
 			    void *priv_data)
 {
 	struct truncate_ctxt *ctxt = (struct truncate_ctxt *)priv_data;
-	uint32_t len, new_size_in_clusters = ctxt->new_size_in_clusters;
+	uint32_t len = 0, new_size_in_clusters = ctxt->new_size_in_clusters;
 	uint64_t start = 0;
 	errcode_t ret;
 	int func_ret = OCFS2_EXTENT_ERROR;
diff --git a/mkfs.ocfs2/mkfs.c b/mkfs.ocfs2/mkfs.c
index 785c68b..9253d2b 100644
--- a/mkfs.ocfs2/mkfs.c
+++ b/mkfs.ocfs2/mkfs.c
@@ -1509,7 +1509,7 @@ initialize_alloc_group(State *s, const char *name,
 	group->gd = do_malloc(s, s->blocksize);
 	memset(group->gd, 0, s->blocksize);
 
-	strcpy(group->gd->bg_signature, OCFS2_GROUP_DESC_SIGNATURE);
+	strcpy((char *)group->gd->bg_signature, OCFS2_GROUP_DESC_SIGNATURE);
 	group->gd->bg_generation = s->vol_generation;
 	group->gd->bg_size = (uint32_t)ocfs2_group_bitmap_size(s->blocksize);
 	group->gd->bg_bits = cpg * bpc;
@@ -1985,7 +1985,7 @@ format_superblock(State *s, SystemFileDiskRecord *rec,
 	di = do_malloc(s, s->blocksize);
 	memset(di, 0, s->blocksize);
 
-	strcpy(di->i_signature, OCFS2_SUPER_BLOCK_SIGNATURE);
+	strcpy((char *)di->i_signature, OCFS2_SUPER_BLOCK_SIGNATURE);
 	di->i_suballoc_slot = (__u16)OCFS2_INVALID_SLOT;
 	di->i_suballoc_bit = (__u16)-1;
 	di->i_generation = s->vol_generation;
@@ -2035,7 +2035,7 @@ format_superblock(State *s, SystemFileDiskRecord *rec,
 	di->id2.i_super.s_feature_compat = s->feature_flags.compat;
 	di->id2.i_super.s_feature_ro_compat = s->feature_flags.ro_compat;
 
-	strcpy(di->id2.i_super.s_label, s->vol_label);
+	strcpy((char *)di->id2.i_super.s_label, s->vol_label);
 	memcpy(di->id2.i_super.s_uuid, s->uuid, 16);
 
 	ocfs2_swap_inode_from_cpu(di);
@@ -2085,7 +2085,7 @@ format_file(State *s, SystemFileDiskRecord *rec)
 	di = do_malloc(s, s->blocksize);
 	memset(di, 0, s->blocksize);
 
-	strcpy(di->i_signature, OCFS2_INODE_SIGNATURE);
+	strcpy((char *)di->i_signature, OCFS2_INODE_SIGNATURE);
 	di->i_generation = s->vol_generation;
 	di->i_fs_generation = s->vol_generation;
 	di->i_suballoc_slot = (__u16)OCFS2_INVALID_SLOT;
@@ -2216,7 +2216,7 @@ write_bitmap_data(State *s, AllocBitmap *bitmap)
 	parent_blkno = bitmap->bm_record->fe_off >> s->blocksize_bits;
 	for(i = 0; i < s->nr_cluster_groups; i++) {
 		gd = bitmap->groups[i]->gd;
-		if (strcmp(gd->bg_signature, OCFS2_GROUP_DESC_SIGNATURE)) {
+		if (strcmp((char *)gd->bg_signature, OCFS2_GROUP_DESC_SIGNATURE)) {
 			fprintf(stderr, "bad group descriptor!\n");
 			exit(1);
 		}
@@ -2290,13 +2290,13 @@ format_leading_space(State *s)
 	memset(buf, 2, size);
 
 	hdr = buf;
-	strcpy(hdr->signature, "this is an ocfs2 volume");
-	strcpy(hdr->mount_point, "this is an ocfs2 volume");
+	strcpy((char *)hdr->signature, "this is an ocfs2 volume");
+	strcpy((char *)hdr->mount_point, "this is an ocfs2 volume");
 
 	p += 512;
 	lbl = (struct ocfs1_vol_label *)p;
-	strcpy(lbl->label, "this is an ocfs2 volume");
-	strcpy(lbl->cluster_name, "this is an ocfs2 volume");
+	strcpy((char *)lbl->label, "this is an ocfs2 volume");
+	strcpy((char *)lbl->cluster_name, "this is an ocfs2 volume");
 
 	do_pwrite(s, buf, size, 0);
 	free(buf);
diff --git a/mkfs.ocfs2/mkfs.h b/mkfs.ocfs2/mkfs.h
index 262c43d..cd1b5f3 100644
--- a/mkfs.ocfs2/mkfs.h
+++ b/mkfs.ocfs2/mkfs.h
@@ -235,7 +235,7 @@ struct _State {
 
 	char *vol_label;
 	char *device_name;
-	char *uuid;
+	unsigned char *uuid;
 	uint32_t vol_generation;
 
 	int fd;
diff --git a/mount.ocfs2/mntent.c b/mount.ocfs2/mntent.c
index 5c07c50..f16ef16 100644
--- a/mount.ocfs2/mntent.c
+++ b/mount.ocfs2/mntent.c
@@ -21,7 +21,7 @@
 static unsigned char need_escaping[] = { ' ', '\t', '\n', '\\' };
 
 static char *
-mangle(const unsigned char *s) {
+mangle(const char *s) {
 	char *ss, *sp;
 	int n;
 
diff --git a/o2cb_ctl/jconfig.c b/o2cb_ctl/jconfig.c
index cb4d229..d5bb975 100644
--- a/o2cb_ctl/jconfig.c
+++ b/o2cb_ctl/jconfig.c
@@ -1060,6 +1060,7 @@ JConfigStanza *j_config_add_stanza(JConfig *cf,
 {
     JConfigStanza *cfs;
     GList *elem;
+    GList *tmp;
 
     g_return_val_if_fail(cf != NULL, NULL);
     g_return_val_if_fail(stanza_name != NULL, NULL);
@@ -1086,7 +1087,7 @@ JConfigStanza *j_config_add_stanza(JConfig *cf,
                             elem);
     }
     else
-        g_list_append(elem, cfs);
+        tmp = g_list_append(elem, cfs);
 
     return(cfs);
 }  /* j_config_add_stanza() */
diff --git a/ocfs2console/ocfs2interface/ocfs2module.c b/ocfs2console/ocfs2interface/ocfs2module.c
index f7f7ee6..d860cf0 100644
--- a/ocfs2console/ocfs2interface/ocfs2module.c
+++ b/ocfs2console/ocfs2interface/ocfs2module.c
@@ -348,7 +348,7 @@ SUPER_U64_GETTER (first_cluster_group)
 static PyObject *
 super_uuid (SuperBlock *self, void *closure)
 {
-  return PyString_FromStringAndSize (self->super.s_uuid,
+  return PyString_FromStringAndSize ((char *)self->super.s_uuid,
                                      sizeof (self->super.s_uuid));
 }
 
diff --git a/ocfs2console/ocfs2interface/ocfsplist.c b/ocfs2console/ocfs2interface/ocfsplist.c
index 9e50b90..f93f2b3 100644
--- a/ocfs2console/ocfs2interface/ocfsplist.c
+++ b/ocfs2console/ocfs2interface/ocfsplist.c
@@ -86,7 +86,7 @@ async_loop_run (gboolean     async,
 {
   if (async)
     {
-      *count++;
+      (*count)++;
 
       if (*count % num_iterations == 0)
 	while (g_main_context_iteration (NULL, FALSE));
diff --git a/tunefs.ocfs2/query.c b/tunefs.ocfs2/query.c
index 3f6c4e2..c98ce24 100644
--- a/tunefs.ocfs2/query.c
+++ b/tunefs.ocfs2/query.c
@@ -106,7 +106,7 @@ static int handle_label(FILE *stream, const struct printf_info *info,
 	char label[OCFS2_MAX_VOL_LABEL_LEN + 1];
 
 	snprintf(label, OCFS2_MAX_VOL_LABEL_LEN + 1,
-		 OCFS2_RAW_SB(fs_gbl->fs_super)->s_label);
+		 (char *)OCFS2_RAW_SB(fs_gbl->fs_super)->s_label);
 
 	return print_string(stream, info, args, label);
 }
diff --git a/tunefs.ocfs2/tunefs.c b/tunefs.ocfs2/tunefs.c
index 1c8d3a8..4bb9f82 100644
--- a/tunefs.ocfs2/tunefs.c
+++ b/tunefs.ocfs2/tunefs.c
@@ -572,7 +572,7 @@ bail:
 	return ret;
 }
 
-static void get_total_free_bits(struct ocfs2_group_desc *gd, int *bits)
+static void get_total_free_bits(struct ocfs2_group_desc *gd, uint16_t *bits)
 {
 	int end = 0;
 	int start;
@@ -599,7 +599,7 @@ static errcode_t validate_chain_group(ocfs2_filesys *fs, struct ocfs2_dinode *di
 	struct ocfs2_chain_rec *cr;
 	uint32_t total = 0;
 	uint32_t free = 0;
-	uint32_t bits;
+	uint16_t bits;
 
 	ret = ocfs2_malloc_block(fs->fs_io, &buf);
 	if (ret) {
@@ -824,7 +824,7 @@ static void update_volume_label(ocfs2_filesys *fs, int *changed)
 {
   	memset (OCFS2_RAW_SB(fs->fs_super)->s_label, 0,
 		OCFS2_MAX_VOL_LABEL_LEN);
-	strncpy (OCFS2_RAW_SB(fs->fs_super)->s_label, opts.vol_label,
+	strncpy ((char *)OCFS2_RAW_SB(fs->fs_super)->s_label, opts.vol_label,
 		 OCFS2_MAX_VOL_LABEL_LEN);
 
 	*changed = 1;
diff --git a/tunefs.ocfs2/tunefs.h b/tunefs.ocfs2/tunefs.h
index 825a413..c4c172a 100644
--- a/tunefs.ocfs2/tunefs.h
+++ b/tunefs.ocfs2/tunefs.h
@@ -79,7 +79,7 @@ typedef struct _ocfs2_tune_opts {
 	char *vol_label;
 	char *progname;
 	char *device;
-	char *vol_uuid;
+	unsigned char *vol_uuid;
 	char *queryfmt;
 	int mount;
 	int verbose;
-- 
1.5.0.6




More information about the Ocfs2-tools-devel mailing list