+2002-05-11 <tytso@snap.thunk.org>
+
+ * debug_cmds.ct, debugfs.c (do_bmap): Add new command "bmap" which
+ calculates the logical->physical block mapping for an
+ inode.
+
+ * debugfs.c (do_init_filsys, main), util.c
+ (common_block_args_process): Fix bad calling parameter
+ order when calling parse_ulong. This broke the -b and -s
+ options to debugfs, as well as do_init, and the testb,
+ setb, clearb functions.
+
2002-04-01 <tytso@snap.thunk.org>
* util.c (parse_ulong): Fix typo which cases parse_ulong to
return;
memset(¶m, 0, sizeof(struct ext2_super_block));
- param.s_blocks_count = parse_ulong(argv[0], argv[2],
+ param.s_blocks_count = parse_ulong(argv[2], argv[0],
"blocks count", &err);
if (err)
return;
print_features(current_fs->super, stdout);
}
+void do_bmap(int argc, char *argv[])
+{
+ ext2_ino_t ino;
+ blk_t blk, pblk;
+ int err;
+ errcode_t errcode;
+
+ if (common_args_process(argc, argv, 3, 3, argv[0],
+ "<file> logical_blk", 0))
+ return;
+
+ ino = string_to_inode(argv[1]);
+ blk = parse_ulong(argv[2], argv[0], "logical_block", &err);
+
+ 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);
+ return;
+ }
+ printf("%d\n", pblk);
+}
+
+
static int source_file(const char *cmd_file, int sci_idx)
{
FILE *f;
open_flags |= EXT2_FLAG_RW;
break;
case 'b':
- blocksize = parse_ulong(argv[0], optarg,
+ blocksize = parse_ulong(optarg, argv[0],
"block size", 0);
break;
case 's':
- superblock = parse_ulong(argv[0], optarg,
+ superblock = parse_ulong(optarg, argv[0],
"superblock number", 0);
break;
case 'c':
if (strtoblk(argv[0], argv[1], block))
return 1;
if (argc > 2) {
- *count = parse_ulong(argv[0], argv[2], "count", &err);
+ *count = parse_ulong(argv[2], argv[0], "count", &err);
if (err)
return 1;
}
+2002-05-11 <tytso@snap.thunk.org>
+
+ * bmap.c (ext2fs_bmap): Fix bug which caused ext2fs_bmap to fail
+ silently if inode pointer is NULL (and ext2fs_bmap is
+ expected to read the inode itself).
+
2002-04-27 <tytso@snap.thunk.org>
* ismounted.c (check_mntent_file, is_swap_device): Verify that the