]>
git.ipfire.org Git - thirdparty/e2fsprogs.git/blob - debugfs/unused.c
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
,
29 int sci_idx
EXT2FS_ATTR((unused
)),
30 void *infop
EXT2FS_ATTR((unused
)))
33 unsigned char buf
[EXT2_MAX_BLOCK_SIZE
];
37 if (common_args_process(argc
, argv
, 1, 1,
38 "dump_unused", "", 0))
41 for (blk
=current_fs
->super
->s_first_data_block
;
42 blk
< ext2fs_blocks_count(current_fs
->super
); blk
++) {
43 if (ext2fs_test_block_bitmap2(current_fs
->block_map
,blk
))
45 retval
= io_channel_read_blk64(current_fs
->io
, blk
, 1, buf
);
47 com_err(argv
[0], retval
, "While reading block\n");
50 for (i
=0; i
< current_fs
->blocksize
; i
++)
53 if (i
>= current_fs
->blocksize
)
55 printf("\nUnused block %llu contains non-zero data:\n\n",
57 for (i
=0; i
< current_fs
->blocksize
; i
++)
58 fputc(buf
[i
], stdout
);