18 #include <sys/types.h>
28 * Hook in new commands into debugfs
29 * Override debugfs's prompt
31 const char *debug_prog_name = "tst_libext2fs";
32 extern ss_request_table libext2fs_cmds;
33 ss_request_table *extra_cmds = &libext2fs_cmds;
35 static int print_blocks_proc(ext2_filsys fs EXT2FS_ATTR((unused)),
36 blk64_t *blocknr, e2_blkcnt_t blockcnt,
37 blk64_t ref_block, int ref_offset,
38 void *private EXT2FS_ATTR((unused)))
40 printf("%6lld %8llu (%d %llu)\n", (long long) blockcnt,
41 (unsigned long long)*blocknr, ref_offset, ref_block);
46 void do_block_iterate(int argc, char **argv)
48 const char *usage = "block_iterate <file> <flags";
53 if (common_args_process(argc, argv, 2, 3, argv[0], usage, 0))
56 ino = string_to_inode(argv[1]);
61 flags = parse_ulong(argv[2], argv[0], "flags", &err);
65 flags |= BLOCK_FLAG_READ_ONLY;
67 ext2fs_block_iterate3(current_fs, ino, flags, NULL,
68 print_blocks_proc, NULL);