[Ocfs2-tools-devel] [PATCH 4/7] extras: Suppress build warnings

Sunil Mushran sunil.mushran at oracle.com
Tue Jun 3 14:46:41 PDT 2008


From: Tao Ma <tao.ma at oracle.com>

On x86_64, when printing a __u64 using PRIu64, gcc throws a warning:
warning: format ‘%lu’ expects type ‘long unsigned int’, but argument 4 has type ‘__u64’.

This patch silences the build warning by casting the argument as uint64_t.

Signed-off-by: Tao Ma <tao.ma at oracle.com>
Signed-off-by: Sunil Mushran <sunil.mushran at oracle.com>
---
 extras/compute_groups.c            |    4 ++--
 extras/find_allocation_fragments.c |    3 ++-
 extras/find_hardlinks.c            |   11 ++++++-----
 extras/find_inode_paths.c          |    8 ++++----
 4 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/extras/compute_groups.c b/extras/compute_groups.c
index e56fc33..dd5b158 100644
--- a/extras/compute_groups.c
+++ b/extras/compute_groups.c
@@ -67,8 +67,8 @@ int main (int argc, char **argv)
 		for (cs = 12; cs < 21; cs++) {
 			for (bytoff = 0, clsoff = 0; bytoff < max_size; ) {
 				stringyfy((1 << cs), 'c', clsstr);
-				printf("%-15llu  %-7s  %-7s\n", bytoff, clsstr,
-				       blkstr);
+				printf("%-15"PRIu64" %-7s  %-7s\n",
+				       bytoff, clsstr, blkstr);
 				clsoff += cpg;
 				bytoff = clsoff * (1 << cs);
 			}
diff --git a/extras/find_allocation_fragments.c b/extras/find_allocation_fragments.c
index 439a8e7..0724655 100644
--- a/extras/find_allocation_fragments.c
+++ b/extras/find_allocation_fragments.c
@@ -89,7 +89,8 @@ static int print_group(struct ocfs2_group_desc *gd)
 
 		free = end - start;
 
-		printf("%-6u   %-6u   %"PRIu64"\n", free, start, gd->bg_blkno);
+		printf("%-6u   %-6u   %"PRIu64"\n", free, start,
+		       (uint64_t)gd->bg_blkno);
 
 		if (free < FREE_BIT_STATS)
 			free_bit_stats[free]++;
diff --git a/extras/find_hardlinks.c b/extras/find_hardlinks.c
index cef0c90..b70f58b 100644
--- a/extras/find_hardlinks.c
+++ b/extras/find_hardlinks.c
@@ -94,8 +94,8 @@ static int walk_tree_func(struct ocfs2_dir_entry *dentry,
 		ret = ocfs2_bitmap_test(wp->dup_map, dentry->inode,
 					&oldval);
 		if (oldval) {
-			fprintf(stdout, "Dup! %20"PRIu64" %s\n", dentry->inode, 
-					path);
+			fprintf(stdout, "Dup! %20"PRIu64" %s\n",
+				(uint64_t)dentry->inode, path);
 		}
 		goto out;
 	}
@@ -105,7 +105,7 @@ static int walk_tree_func(struct ocfs2_dir_entry *dentry,
 	if (ret) {
 		com_err(wp->argv0, ret,
 			"while setting bitmap bit %"PRIu64"\n",
-			dentry->inode);
+			(uint64_t)dentry->inode);
 		reti = OCFS2_DIRENT_ABORT;
 		goto out;
 	}
@@ -117,14 +117,15 @@ static int walk_tree_func(struct ocfs2_dir_entry *dentry,
 		if (ret) {
 			com_err(wp->argv0, ret,
 				"while setting dup bit %"PRIu64"\n",
-				dentry->inode);
+				(uint64_t)dentry->inode);
 			reti = OCFS2_DIRENT_ABORT;
 			goto out;
 		}
 	}
 
 	if (!wp->quiet)
-		fprintf(stdout, "%20"PRIu64" %s\n", dentry->inode, path);
+		fprintf(stdout, "%20"PRIu64" %s\n",
+			(uint64_t)dentry->inode, path);
 
 	if (dentry->file_type == OCFS2_FT_DIR) {
 		old_path = wp->path;
diff --git a/extras/find_inode_paths.c b/extras/find_inode_paths.c
index ea8942a..1725b40 100644
--- a/extras/find_inode_paths.c
+++ b/extras/find_inode_paths.c
@@ -91,12 +91,12 @@ static int walk_tree_func(struct ocfs2_dir_entry *dentry,
 	oldval = 0;
 
 	if (!wp->quiet)
-		fprintf(stdout, "[trace] %13"PRIu64" %s\n", dentry->inode, 
-				path);
+		fprintf(stdout, "[trace] %13"PRIu64" %s\n",
+			(uint64_t)dentry->inode, path);
 
 	if (dentry->inode == wp->inode)
-		fprintf(stdout, "[found] %13"PRIu64" %s\n", dentry->inode, 
-				path);
+		fprintf(stdout, "[found] %13"PRIu64" %s\n",
+			(uint64_t)dentry->inode, path);
 
 	if (dentry->file_type == OCFS2_FT_DIR) {
 		old_path = wp->path;
-- 
1.5.3.6




More information about the Ocfs2-tools-devel mailing list