[Ocfs2-tools-devel] [PATCH 7/7] tunefs.ocfs2: fix build warnings

Joseph Qi joseph.qi at huawei.com
Fri Mar 4 01:52:26 PST 2016


Fix the following build warnings:
1) warning: format ‘%lu’ expects type ‘long unsigned int’, but
argument 3 has type ‘__u64’
2) warning: ‘register_printf_function’ is deprecated (declared at
/usr/include/printf.h:107)

Signed-off-by: Joseph Qi <joseph.qi at huawei.com>
---
 tunefs.ocfs2/feature_metaecc.c |  6 +++---
 tunefs.ocfs2/libocfs2ne.c      |  2 +-
 tunefs.ocfs2/op_query.c        | 25 +++++++++++++------------
 3 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/tunefs.ocfs2/feature_metaecc.c b/tunefs.ocfs2/feature_metaecc.c
index c9c2709..708410f 100644
--- a/tunefs.ocfs2/feature_metaecc.c
+++ b/tunefs.ocfs2/feature_metaecc.c
@@ -399,7 +399,7 @@ static int dirdata_iterate(ocfs2_filesys *fs, struct ocfs2_extent_rec *rec,

 	if (tree_depth) {
 		verbosef(VL_DEBUG, "Reading extent block at %"PRIu64"\n",
-			 rec->e_blkno);
+			 (uint64_t)rec->e_blkno);
 		eb = (struct ocfs2_extent_block *)buf;
 		ret = ocfs2_read_extent_block(fs, rec->e_blkno, (char *)eb);
 		if (ret)
@@ -451,7 +451,7 @@ static int metadata_iterate(ocfs2_filesys *fs, struct ocfs2_extent_rec *rec,
 		goto out;

 	verbosef(VL_DEBUG, "Reading extent block at %"PRIu64"\n",
-		 rec->e_blkno);
+		 (uint64_t)rec->e_blkno);
 	ret = ocfs2_read_extent_block(fs, rec->e_blkno, (char *)eb);
 	if (ret)
 		goto out;
@@ -670,7 +670,7 @@ static errcode_t install_trailers(ocfs2_filesys *fs,
 		tc = list_entry(pos, struct tunefs_trailer_context, d_list);
 		verbosef(VL_DEBUG,
 			 "Writing trailer for dinode %"PRIu64"\n",
-			 tc->d_di->i_blkno);
+			 (uint64_t)tc->d_di->i_blkno);
 		tunefs_block_signals();
 		ret = tunefs_install_dir_trailer(fs, tc->d_di, tc);
 		tunefs_unblock_signals();
diff --git a/tunefs.ocfs2/libocfs2ne.c b/tunefs.ocfs2/libocfs2ne.c
index d940ec9..1f4796b 100644
--- a/tunefs.ocfs2/libocfs2ne.c
+++ b/tunefs.ocfs2/libocfs2ne.c
@@ -750,7 +750,7 @@ static int dirblock_scan_iterate(ocfs2_filesys *fs, uint64_t blkno,
 	verbosef(VL_DEBUG,
 		 "Reading dinode %"PRIu64" dirblock %"PRIu64" at block "
 		 "%"PRIu64"\n",
-		 tc->d_di->i_blkno, bcount, blkno);
+		 (uint64_t)tc->d_di->i_blkno, bcount, blkno);
 	ret = ocfs2_read_dir_block(fs, tc->d_di, blkno, db->db_buf);
 	if (ret)
 		goto out;
diff --git a/tunefs.ocfs2/op_query.c b/tunefs.ocfs2/op_query.c
index b937722..dc24cfd 100644
--- a/tunefs.ocfs2/op_query.c
+++ b/tunefs.ocfs2/op_query.c
@@ -222,7 +222,8 @@ static int handle_ro_compat(FILE *stream, const struct printf_info *info,
 	return len;
 }

-static int handle_arginfo(const struct printf_info *info, size_t n, int *types)
+static int handle_arginfo(const struct printf_info *info, size_t n, int *types,
+		int *size)
 {
 	return 0;
 }
@@ -323,19 +324,19 @@ static int query_run(struct tunefs_operation *op, ocfs2_filesys *fs,
 		return 1;
 	}

-	register_printf_function('B', handle_blocksize, handle_arginfo);
-	register_printf_function('T', handle_clustersize, handle_arginfo);
-	register_printf_function('N', handle_numslots, handle_arginfo);
-	register_printf_function('R', handle_rootdir, handle_arginfo);
-	register_printf_function('Y', handle_sysdir, handle_arginfo);
-	register_printf_function('P', handle_clustergroup, handle_arginfo);
+	register_printf_specifier('B', handle_blocksize, handle_arginfo);
+	register_printf_specifier('T', handle_clustersize, handle_arginfo);
+	register_printf_specifier('N', handle_numslots, handle_arginfo);
+	register_printf_specifier('R', handle_rootdir, handle_arginfo);
+	register_printf_specifier('Y', handle_sysdir, handle_arginfo);
+	register_printf_specifier('P', handle_clustergroup, handle_arginfo);

-	register_printf_function('V', handle_label, handle_arginfo);
-	register_printf_function('U', handle_uuid, handle_arginfo);
+	register_printf_specifier('V', handle_label, handle_arginfo);
+	register_printf_specifier('U', handle_uuid, handle_arginfo);

-	register_printf_function('M', handle_compat, handle_arginfo);
-	register_printf_function('H', handle_incompat, handle_arginfo);
-	register_printf_function('O', handle_ro_compat, handle_arginfo);
+	register_printf_specifier('M', handle_compat, handle_arginfo);
+	register_printf_specifier('H', handle_incompat, handle_arginfo);
+	register_printf_specifier('O', handle_ro_compat, handle_arginfo);

 	query_fs = fs;
 	fprintf(stdout, fmt);
-- 
1.8.4.3





More information about the Ocfs2-tools-devel mailing list