diff options
author | Takashi Sato <sho@tnes.nec.co.jp> | 2006-03-18 21:43:46 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2006-03-18 21:43:46 -0500 |
commit | 8deb80a5d1078cbe43eaffcdeebf0a1a549d6a54 (patch) | |
tree | eea03c80759a330ae1f4500288b2c197b2e05adc /debugfs | |
parent | 5d2ef12f6ed4c35c7e6baa7cb83ced738a3f1976 (diff) | |
download | e2fsprogs-8deb80a5d1078cbe43eaffcdeebf0a1a549d6a54.tar.gz |
Fix format statements to make e2fsprogs programs 32-bit clean
Change the format string(%d, %ld) for a block number and inode number
to %u or %lu.
Signed-off-by: Takashi Sato <sho@tnes.nec.co.jp>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'debugfs')
-rw-r--r-- | debugfs/ChangeLog | 3 | ||||
-rw-r--r-- | debugfs/debugfs.c | 41 | ||||
-rw-r--r-- | debugfs/htree.c | 18 | ||||
-rw-r--r-- | debugfs/unused.c | 2 |
4 files changed, 34 insertions, 30 deletions
diff --git a/debugfs/ChangeLog b/debugfs/ChangeLog index 83844eda..d71f6d86 100644 --- a/debugfs/ChangeLog +++ b/debugfs/ChangeLog @@ -1,5 +1,8 @@ 2006-03-18 Theodore Ts'o <tytso@mit.edu> + * debugfs.c, htree.c, unused.c: Change printf statements to use + %u instead of %d when printing block numbers. + * debugfs.c (do_open_filesys), debugfs.8.in: Add the -e option to the open_filesystem command, which requests that the filesystem be opened in exclusive mode. diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c index 992a2b72..12ef00c2 100644 --- a/debugfs/debugfs.c +++ b/debugfs/debugfs.c @@ -303,9 +303,9 @@ void do_show_super_stats(int argc, char *argv[]) gdp = ¤t_fs->group_desc[0]; for (i = 0; i < current_fs->group_desc_count; i++, gdp++) - fprintf(out, " Group %2d: block bitmap at %d, " - "inode bitmap at %d, " - "inode table at %d\n" + fprintf(out, " Group %2d: block bitmap at %u, " + "inode bitmap at %u, " + "inode table at %u\n" " %d free %s, " "%d free %s, " "%d used %s\n", @@ -356,9 +356,9 @@ static void finish_range(struct list_blocks_struct *lb) else fprintf(lb->f, ", "); if (lb->first_block == lb->last_block) - fprintf(lb->f, "(%lld):%d", lb->first_bcnt, lb->first_block); + fprintf(lb->f, "(%lld):%u", lb->first_bcnt, lb->first_block); else - fprintf(lb->f, "(%lld-%lld):%d-%d", lb->first_bcnt, + fprintf(lb->f, "(%lld-%lld):%u-%u", lb->first_bcnt, lb->last_bcnt, lb->first_block, lb->last_block); lb->first_block = 0; } @@ -400,11 +400,11 @@ static int list_blocks_proc(ext2_filsys fs EXT2FS_ATTR((unused)), else fprintf(lb->f, ", "); if (blockcnt == -1) - fprintf(lb->f, "(IND):%d", *blocknr); + fprintf(lb->f, "(IND):%u", *blocknr); else if (blockcnt == -2) - fprintf(lb->f, "(DIND):%d", *blocknr); + fprintf(lb->f, "(DIND):%u", *blocknr); else if (blockcnt == -3) - fprintf(lb->f, "(TIND):%d", *blocknr); + fprintf(lb->f, "(TIND):%u", *blocknr); return 0; } @@ -436,7 +436,7 @@ static void internal_dump_inode_extra(FILE *out, const char *prefix, char *start, *end; unsigned int storage_size; - fprintf(out, "Size of extra inode fields: %d\n", inode->i_extra_isize); + fprintf(out, "Size of extra inode fields: %u\n", inode->i_extra_isize); if (inode->i_extra_isize > EXT2_INODE_SIZE(current_fs->super) - EXT2_GOOD_OLD_INODE_SIZE) { fprintf(stderr, "invalid inode->i_extra_isize (%u)\n", @@ -467,7 +467,7 @@ static void internal_dump_inode_extra(FILE *out, const char *prefix, fprintf(out, " = \""); dump_xattr_string(out, start + entry->e_value_offs, entry->e_value_size); - fprintf(out, "\" (%d)\n", entry->e_value_size); + fprintf(out, "\" (%u)\n", entry->e_value_size); entry = next; } } @@ -530,7 +530,7 @@ void internal_dump_inode(FILE *out, const char *prefix, fprintf(out, "%sFile ACL: %d Directory ACL: %d\n", prefix, inode->i_file_acl, LINUX_S_ISDIR(inode->i_mode) ? inode->i_dir_acl : 0); - fprintf(out, "%sLinks: %d Blockcount: %d\n", + fprintf(out, "%sLinks: %d Blockcount: %u\n", prefix, inode->i_links_count, inode->i_blocks); switch (os) { case EXT2_OS_LINUX: @@ -709,7 +709,7 @@ void do_freeb(int argc, char *argv[]) return; while (count-- > 0) { if (!ext2fs_test_block_bitmap(current_fs->block_map,block)) - com_err(argv[0], 0, "Warning: block %d already clear", + com_err(argv[0], 0, "Warning: block %u already clear", block); ext2fs_unmark_block_bitmap(current_fs->block_map,block); block++; @@ -728,7 +728,7 @@ void do_setb(int argc, char *argv[]) return; while (count-- > 0) { if (ext2fs_test_block_bitmap(current_fs->block_map,block)) - com_err(argv[0], 0, "Warning: block %d already set", + com_err(argv[0], 0, "Warning: block %u already set", block); ext2fs_mark_block_bitmap(current_fs->block_map,block); block++; @@ -745,9 +745,9 @@ void do_testb(int argc, char *argv[]) return; while (count-- > 0) { if (ext2fs_test_block_bitmap(current_fs->block_map,block)) - printf("Block %d marked in use\n", block); + printf("Block %u marked in use\n", block); else - printf("Block %d not in use\n", block); + printf("Block %u not in use\n", block); block++; } } @@ -827,6 +827,7 @@ void do_modify_inode(int argc, char *argv[]) const char *hex_format = "0x%x"; const char *octal_format = "0%o"; const char *decimal_format = "%d"; + const char *unsignedlong_format = "%lu"; if (common_inode_args_process(argc, argv, &inode_num, CHECK_FS_RW)) return; @@ -839,13 +840,13 @@ void do_modify_inode(int argc, char *argv[]) modify_u16(argv[0], "Mode", octal_format, &inode.i_mode); modify_u16(argv[0], "User ID", decimal_format, &inode.i_uid); modify_u16(argv[0], "Group ID", decimal_format, &inode.i_gid); - modify_u32(argv[0], "Size", decimal_format, &inode.i_size); + modify_u32(argv[0], "Size", unsignedlong_format, &inode.i_size); modify_u32(argv[0], "Creation time", decimal_format, &inode.i_ctime); modify_u32(argv[0], "Modification time", decimal_format, &inode.i_mtime); modify_u32(argv[0], "Access time", decimal_format, &inode.i_atime); modify_u32(argv[0], "Deletion time", decimal_format, &inode.i_dtime); modify_u16(argv[0], "Link count", decimal_format, &inode.i_links_count); - modify_u32(argv[0], "Block count", decimal_format, &inode.i_blocks); + modify_u32(argv[0], "Block count", unsignedlong_format, &inode.i_blocks); modify_u32(argv[0], "File flags", hex_format, &inode.i_flags); modify_u32(argv[0], "Generation", hex_format, &inode.i_generation); #if 0 @@ -1156,7 +1157,7 @@ void do_find_free_block(int argc, char *argv[]) com_err("ext2fs_new_block", retval, 0); return; } else - printf("%d ", free_blk); + printf("%u ", free_blk); } printf("\n"); } @@ -1667,10 +1668,10 @@ void do_bmap(int argc, char *argv[]) errcode = ext2fs_bmap(current_fs, ino, 0, 0, 0, blk, &pblk); if (errcode) { com_err("argv[0]", errcode, - "while mapping logical block %d\n", blk); + "while mapping logical block %u\n", blk); return; } - printf("%d\n", pblk); + printf("%u\n", pblk); } void do_imap(int argc, char *argv[]) diff --git a/debugfs/htree.c b/debugfs/htree.c index 7af3d1b3..6dbe426a 100644 --- a/debugfs/htree.c +++ b/debugfs/htree.c @@ -43,14 +43,14 @@ static void htree_dump_leaf_node(ext2_filsys fs, ext2_ino_t ino, errcode = ext2fs_bmap(fs, ino, inode, buf, 0, blk, &pblk); if (errcode) { com_err("htree_dump_leaf_node", errcode, - "while mapping logical block %d\n", blk); + "while mapping logical block %u\n", blk); return; } errcode = ext2fs_read_dir_block2(current_fs, pblk, buf, 0); if (errcode) { com_err("htree_dump_leaf_node", errcode, - "while reading block %d\n", blk); + "while reading block %u\n", blk); return; } @@ -60,7 +60,7 @@ static void htree_dump_leaf_node(ext2_filsys fs, ext2_ino_t ino, (dirent->rec_len < 8) || ((dirent->rec_len % 4) != 0) || (((dirent->name_len & 0xFF)+8) > dirent->rec_len)) { - fprintf(pager, "Corrupted directory block (%d)!\n", blk); + fprintf(pager, "Corrupted directory block (%u)!\n", blk); break; } thislen = ((dirent->name_len & 0xFF) < EXT2_NAME_LEN) ? @@ -124,7 +124,7 @@ static void htree_dump_int_node(ext2_filsys fs, ext2_ino_t ino, for (i=0; i < limit.count; i++) { e.hash = ext2fs_le32_to_cpu(ent[i].hash); e.block = ext2fs_le32_to_cpu(ent[i].block); - fprintf(pager, "Entry #%d: Hash 0x%08x, block %d\n", i, + fprintf(pager, "Entry #%d: Hash 0x%08x, block %u\n", i, i ? e.hash : 0, e.block); if (level) htree_dump_int_block(fs, ino, inode, rootnode, @@ -155,14 +155,14 @@ static void htree_dump_int_block(ext2_filsys fs, ext2_ino_t ino, errcode = ext2fs_bmap(fs, ino, inode, buf, 0, blk, &pblk); if (errcode) { com_err("htree_dump_int_block", errcode, - "while mapping logical block %d\n", blk); + "while mapping logical block %u\n", blk); return; } errcode = io_channel_read_blk(current_fs->io, pblk, 1, buf); if (errcode) { com_err("htree_dump_int_block", errcode, - "while reading block %d\n", blk); + "while reading block %u\n", blk); return; } @@ -241,7 +241,7 @@ void do_htree_dump(int argc, char *argv[]) rootnode = (struct ext2_dx_root_info *) (buf + 24); fprintf(pager, "Root node dump:\n"); - fprintf(pager, "\t Reserved zero: %d\n", rootnode->reserved_zero); + fprintf(pager, "\t Reserved zero: %u\n", rootnode->reserved_zero); fprintf(pager, "\t Hash Version: %d\n", rootnode->hash_version); fprintf(pager, "\t Info length: %d\n", rootnode->info_length); fprintf(pager, "\t Indirect levels: %d\n", rootnode->indirect_levels); @@ -372,9 +372,9 @@ static int search_dir_block(ext2_filsys fs, blk_t *blocknr, strncmp(p->search_name, dirent->name, p->len) == 0) { printf("Entry found at logical block %lld, " - "phys %d, offset %d\n", blockcnt, + "phys %u, offset %u\n", blockcnt, *blocknr, offset); - printf("offset %d\n", offset); + printf("offset %u\n", offset); return BLOCK_ABORT; } offset += dirent->rec_len; diff --git a/debugfs/unused.c b/debugfs/unused.c index d0a51621..a3de6c85 100644 --- a/debugfs/unused.c +++ b/debugfs/unused.c @@ -45,7 +45,7 @@ void do_dump_unused(int argc EXT2FS_ATTR((unused)), char **argv) break; if (i >= current_fs->blocksize) continue; - printf("\nUnused block %ld contains non-zero data:\n\n", + printf("\nUnused block %lu contains non-zero data:\n\n", blk); for (i=0; i < current_fs->blocksize; i++) fputc(buf[i], stdout); |