2 * unused.c --- quick and dirty unused space dumper
4 * Copyright (C) 1997 Theodore Ts'o. This file may be redistributed
5 * under the terms of the GNU Public License.
18 #include <sys/types.h>
28 void do_dump_unused(int argc EXT2FS_ATTR((unused)), char **argv)
31 unsigned char buf[EXT2_MAX_BLOCK_SIZE];
35 if (common_args_process(argc, argv, 1, 1,
36 "dump_unused", "", 0))
39 for (blk=current_fs->super->s_first_data_block;
40 blk < ext2fs_blocks_count(current_fs->super); blk++) {
41 if (ext2fs_test_block_bitmap2(current_fs->block_map,blk))
43 retval = io_channel_read_blk64(current_fs->io, blk, 1, buf);
45 com_err(argv[0], retval, "While reading block\n");
48 for (i=0; i < current_fs->blocksize; i++)
51 if (i >= current_fs->blocksize)
53 printf("\nUnused block %llu contains non-zero data:\n\n",
55 for (i=0; i < current_fs->blocksize; i++)
56 fputc(buf[i], stdout);