void do_goto_block(int argc, char **argv) { errcode_t retval; blk64_t blk; int level = 0, err; if (common_extent_args_process(argc, argv, 2, 3, "goto_block", "block [level]", 0)) return; if (strtoblk(argv[0], argv[1], &blk)) return; if (argc == 3) { level = parse_ulong(argv[2], argv[0], "level", &err); if (err) return; } retval = ext2fs_extent_goto2(current_handle, level, (blk64_t) blk); if (retval) { com_err(argv[0], retval, "while trying to go to block %llu, level %d", (unsigned long long) blk, level); return; } generic_goto_node(NULL, argc, argv, EXT2_EXTENT_CURRENT); }
/* * This is a helper function used by do_freeb, do_setb, and do_testb */ int common_block_args_process(int argc, char *argv[], blk64_t *block, blk64_t *count) { int err; if (common_args_process(argc, argv, 2, 3, argv[0], "<block> [count]", CHECK_FS_BITMAPS)) return 1; if (strtoblk(argv[0], argv[1], NULL, block)) return 1; if (*block == 0) { com_err(argv[0], 0, "Invalid block number 0"); err = 1; } if (argc > 2) { err = strtoblk(argv[0], argv[2], "count", count); if (err) return 1; } return 0; }