[PATCH 1/4] - e2fsprogs - fix more rounding overflows

Eric Sandeen <[email protected]> Fri, 25 Aug 2006 17:04:17 -0500
Newsgroups gmane.comp.file-systems.ext2.devel
Message-ID <[email protected]>
More format fixes for blocks & inodes

Signed-off-by: Eric Sandeen <[email protected]>

Index: e2fsprogs-1.39-16T-2/debugfs/htree.c
===================================================================
--- e2fsprogs-1.39-16T-2.orig/debugfs/htree.c
+++ e2fsprogs-1.39-16T-2/debugfs/htree.c
@@ -114,7 +114,7 @@ static void htree_dump_int_node(ext2_fil
 
 	for (i=0; i < limit.count; i++) {
 		hash = i ? ext2fs_le32_to_cpu(ent[i].hash) : 0;
-		fprintf(pager, "Entry #%d: Hash 0x%08x%s, block %d\n", i,
+		fprintf(pager, "Entry #%d: Hash 0x%08x%s, block %u\n", i,
 			hash, (hash & 1) ? " (**)" : "",
 			ext2fs_le32_to_cpu(ent[i].block));
 		}
Index: e2fsprogs-1.39-16T-2/e2fsck/unix.c
===================================================================
--- e2fsprogs-1.39-16T-2.orig/e2fsck/unix.c
+++ e2fsprogs-1.39-16T-2/e2fsck/unix.c
@@ -124,17 +124,16 @@ static void show_stats(e2fsck_t	ctx)
 		       blocks_used, blocks);
 		return;
 	}
-	printf (P_("\n%8u inode used (%u%%)\n", "\n%8u inodes used (%d%%)\n",
-		   inodes_used), inodes_used, 100 * inodes_used / inodes);
+	printf (P_("\n%8u inode used (%2.2f%%)\n", "\n%8u inodes used (%2.2f%%)\n",
+		   inodes_used), inodes_used, 100.0 * inodes_used / inodes);
 	printf (P_("%8u non-contiguous inode (%0d.%d%%)\n",
 		   "%8u non-contiguous inodes (%0d.%d%%)\n",
 		   ctx->fs_fragmented),
 		ctx->fs_fragmented, frag_percent / 10, frag_percent % 10);
 	printf (_("         # of inodes with ind/dind/tind blocks: %u/%u/%u\n"),
 		ctx->fs_ind_count, ctx->fs_dind_count, ctx->fs_tind_count);
-	printf (P_("%8u block used (%d%%)\n", "%8u blocks used (%d%%)\n",
-		   blocks_used),
-		blocks_used, (int) ((long long) 100 * blocks_used / blocks));
+	printf (P_("%8u block used (%2.2f%%)\n", "%8u blocks used (%2.2f%%)\n",
+		   blocks_used), blocks_used, 100.0 * blocks_used / blocks);
 	printf (P_("%8u bad block\n", "%8u bad blocks\n",
 		   ctx->fs_badblocks_count), ctx->fs_badblocks_count);
 	printf (P_("%8u large file\n", "%8u large files\n",
@@ -148,7 +147,7 @@ static void show_stats(e2fsck_t	ctx)
 		ctx->fs_chardev_count);
 	printf (P_("%8u block device file\n", "%8u block device files\n",
 		   ctx->fs_blockdev_count), ctx->fs_blockdev_count);
-	printf (P_("%8d fifo\n", "%8d fifos\n", ctx->fs_fifo_count),
+	printf (P_("%8u fifo\n", "%8u fifos\n", ctx->fs_fifo_count),
 		ctx->fs_fifo_count);
 	printf (P_("%8u link\n", "%8u links\n",
 		   ctx->fs_links_count - dir_links),
Index: e2fsprogs-1.39-16T-2/misc/dumpe2fs.c
===================================================================
--- e2fsprogs-1.39-16T-2.orig/misc/dumpe2fs.c
+++ e2fsprogs-1.39-16T-2/misc/dumpe2fs.c
@@ -250,10 +250,10 @@ static void list_bad_blocks(ext2_filsys 
 		return;
 	}
 	if (dump) {
-		header = fmt = "%d\n";
+		header = fmt = "%u\n";
 	} else {
-		header =  _("Bad blocks: %d");
-		fmt = ", %d";
+		header =  _("Bad blocks: %u");
+		fmt = ", %u";
 	}
 	while (ext2fs_badblocks_list_iterate(bb_iter, &blk)) {
 		printf(header ? header : fmt, blk);
Index: e2fsprogs-1.39-16T-2/misc/e2image.c
===================================================================
--- e2fsprogs-1.39-16T-2.orig/misc/e2image.c
+++ e2fsprogs-1.39-16T-2/misc/e2image.c
@@ -417,7 +417,7 @@ static void output_meta_data_blocks(ext2
 			retval = io_channel_read_blk(fs->io, blk, 1, buf);
 			if (retval) {
 				com_err(program_name, retval,
-					"error reading block %d", blk);
+					"error reading block %u", blk);
 			}
 			if (scramble_block_map && 
 			    ext2fs_test_block_bitmap(scramble_block_map, blk))
@@ -516,7 +516,7 @@ static void write_raw_image_file(ext2_fi
 				       block_buf, process_dir_block, &pb);
 			if (retval) {
 				com_err(program_name, retval,
-					"while iterating over inode %d", 
+					"while iterating over inode %u",
 					ino);
 				exit(1);
 			}
@@ -529,7 +529,7 @@ static void write_raw_image_file(ext2_fi
 				       process_file_block, &pb);
 				if (retval) {
 					com_err(program_name, retval,
-					"while iterating over %d", ino);
+					"while iterating over inode %u", ino);
 					exit(1);
 				}
 			}
Index: e2fsprogs-1.39-16T-2/misc/mke2fs.c
===================================================================
--- e2fsprogs-1.39-16T-2.orig/misc/mke2fs.c
+++ e2fsprogs-1.39-16T-2/misc/mke2fs.c
@@ -232,7 +232,7 @@ static void handle_bad_blocks(ext2_filsy
 		if (ext2fs_badblocks_list_test(bb_list, i)) {
 			fprintf(stderr, _("Block %d in primary "
 				"superblock/group descriptor area bad.\n"), i);
-			fprintf(stderr, _("Blocks %u through %d must be good "
+			fprintf(stderr, _("Blocks %u through %u must be good "
 				"in order to build a filesystem.\n"),
 				fs->super->s_first_data_block, must_be_good);
 			fputs(_("Aborting....\n"), stderr);



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642