119c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o/*
219c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o * tst_inode.c --- this function tests the inode scan function
3efc6f628e15de95bcd13e4f0ee223cb42115d520Theodore Ts'o *
419c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o * Copyright (C) 1996 by Theodore Ts'o.
5efc6f628e15de95bcd13e4f0ee223cb42115d520Theodore Ts'o *
619c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o * %Begin-Header%
7543547a52a20cb7e69d74921b2f691078fd55d83Theodore Ts'o * This file may be redistributed under the terms of the GNU Library
8543547a52a20cb7e69d74921b2f691078fd55d83Theodore Ts'o * General Public License, version 2.
919c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o * %End-Header%
1019c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o */
1119c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o
1219c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o#include <stdio.h>
1319c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o#include <string.h>
144cbe8af4b0d0c72fb28bb500c1bd8a46b00fdde3Theodore Ts'o#if HAVE_UNISTD_H
1519c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o#include <unistd.h>
164cbe8af4b0d0c72fb28bb500c1bd8a46b00fdde3Theodore Ts'o#endif
1719c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o#include <fcntl.h>
1819c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o#include <time.h>
1919c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o#include <sys/stat.h>
2019c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o#include <sys/types.h>
2119c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o#if HAVE_ERRNO_H
2219c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o#include <errno.h>
2319c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o#endif
2419c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o
25b5abe6fac9c9e7caf4710501d1657d30e4857ef6Theodore Ts'o#include "ext2_fs.h"
2619c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o#include "ext2fs.h"
2719c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o
28e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallblk64_t test_vec[] = { 8, 12, 24, 34, 43, 44, 100, 0 };
2919c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o
3019c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'oext2_filsys	test_fs;
3119c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'oext2fs_block_bitmap bad_block_map, touched_map;
3219c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'oext2fs_inode_bitmap bad_inode_map;
3319c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'obadblocks_list	test_badblocks;
3419c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o
3519c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'oint first_no_comma = 1;
3619c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'oint failed = 0;
3719c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o
38e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallstatic void iscan_test_read_blk64(unsigned long long block, int count, errcode_t err)
3919c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o{
4019c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	int	i;
4119c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o
4219c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	if (first_no_comma)
4319c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o		first_no_comma = 0;
4419c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	else
4519c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o		printf(", ");
4619c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o
4719c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	if (count > 1)
48e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall		printf("%llu-%llu", block, block+count-1);
4919c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	else
50e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall		printf("%llu", block);
5119c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o
5219c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	for (i=0; i < count; i++, block++) {
53e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall		if (ext2fs_test_block_bitmap2(touched_map, block)) {
54e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall			printf("\nDuplicate block?!? --- %llu\n", block);
5519c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o			failed++;
5619c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o			first_no_comma = 1;
5719c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o		}
58e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall		ext2fs_mark_block_bitmap2(touched_map, block);
5919c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	}
6019c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o}
6119c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o
62e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallstatic void iscan_test_read_blk(unsigned long block, int count, errcode_t err)
63e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall{
64e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	iscan_test_read_blk64(block, count, err);
65e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall}
66e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
6719c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o/*
6819c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o * Setup the variables for doing the inode scan test.
6919c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o */
7019c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'ostatic void setup(void)
7119c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o{
7219c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	errcode_t	retval;
7319c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	int		i;
7419c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	struct ext2_super_block param;
7519c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o
7619c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	initialize_ext2_error_table();
7719c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o
7819c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	memset(&param, 0, sizeof(param));
79e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	ext2fs_blocks_count_set(&param, 12000);
8019c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o
8119c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o
82e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	test_io_cb_read_blk = iscan_test_read_blk;
83e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	test_io_cb_read_blk64 = iscan_test_read_blk64;
84efc6f628e15de95bcd13e4f0ee223cb42115d520Theodore Ts'o
85e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	retval = ext2fs_initialize("test fs", EXT2_FLAG_64BITS, &param,
8619c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o				   test_io_manager, &test_fs);
8719c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	if (retval) {
8819c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o		com_err("setup", retval,
8919c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o			"While initializing filesystem");
9019c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o		exit(1);
9119c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	}
9219c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	retval = ext2fs_allocate_tables(test_fs);
9319c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	if (retval) {
9419c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o		com_err("setup", retval,
9519c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o			"While allocating tables for test filesystem");
9619c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o		exit(1);
9719c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	}
9819c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	retval = ext2fs_allocate_block_bitmap(test_fs, "bad block map",
9919c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o					      &bad_block_map);
10019c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	if (retval) {
10119c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o		com_err("setup", retval,
10219c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o			"While allocating bad_block bitmap");
10319c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o		exit(1);
10419c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	}
10519c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	retval = ext2fs_allocate_block_bitmap(test_fs, "touched map",
10619c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o					      &touched_map);
10719c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	if (retval) {
10819c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o		com_err("setup", retval,
10919c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o			"While allocating touched block bitmap");
11019c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o		exit(1);
11119c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	}
11219c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	retval = ext2fs_allocate_inode_bitmap(test_fs, "bad inode map",
11319c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o					      &bad_inode_map);
11419c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	if (retval) {
11519c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o		com_err("setup", retval,
11619c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o			"While allocating bad inode bitmap");
11719c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o		exit(1);
11819c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	}
119efc6f628e15de95bcd13e4f0ee223cb42115d520Theodore Ts'o
120cbbf031b6edf9bdf5511af2193e44cff7fdaa66aTheodore Ts'o	retval = ext2fs_badblocks_list_create(&test_badblocks, 5);
12119c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	if (retval) {
12219c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o		com_err("setup", retval, "while creating badblocks list");
12319c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o		exit(1);
12419c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	}
12519c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	for (i=0; test_vec[i]; i++) {
126cbbf031b6edf9bdf5511af2193e44cff7fdaa66aTheodore Ts'o		retval = ext2fs_badblocks_list_add(test_badblocks, test_vec[i]);
12719c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o		if (retval) {
12819c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o			com_err("setup", retval,
12919c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o				"while adding test vector %d", i);
13019c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o			exit(1);
13119c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o		}
132e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall		ext2fs_mark_block_bitmap2(bad_block_map, test_vec[i]);
13319c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	}
13419c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	test_fs->badblocks = test_badblocks;
13519c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o}
13619c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o
13719c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o/*
13819c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o * Iterate using inode_scan
13919c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o */
14019c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'ostatic void iterate(void)
14119c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o{
14219c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	struct ext2_inode inode;
14319c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	ext2_inode_scan	scan;
14419c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	errcode_t	retval;
14531dbecd482405e0d3a67eb58e1a1c8cb9f2ad83eTheodore Ts'o	ext2_ino_t	ino;
14619c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o
14719c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	retval = ext2fs_open_inode_scan(test_fs, 8, &scan);
14819c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	if (retval) {
14919c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o		com_err("iterate", retval, "While opening inode scan");
15019c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o		exit(1);
15119c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	}
15219c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	printf("Reading blocks: ");
15319c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	retval = ext2fs_get_next_inode(scan, &ino, &inode);
15419c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	if (retval) {
15519c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o		com_err("iterate", retval, "while reading first inode");
15619c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o		exit(1);
15719c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	}
15819c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	while (ino) {
15919c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o		retval = ext2fs_get_next_inode(scan, &ino, &inode);
16019c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o		if (retval == EXT2_ET_BAD_BLOCK_IN_INODE_TABLE) {
161e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall			ext2fs_mark_inode_bitmap2(bad_inode_map, ino);
16219c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o			continue;
16319c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o		}
16419c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o		if (retval) {
16519c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o			com_err("iterate", retval,
16619c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o				"while getting next inode");
16719c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o			exit(1);
16819c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o		}
16919c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	}
17019c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	printf("\n");
17119c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	ext2fs_close_inode_scan(scan);
17219c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o}
17319c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o
17419c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o/*
17519c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o * Verify the touched map
17619c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o */
17719c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'ostatic void check_map(void)
17819c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o{
17919c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	int	i, j, first=1;
180e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	blk64_t	blk;
18119c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o
18219c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	for (i=0; test_vec[i]; i++) {
183e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall		if (ext2fs_test_block_bitmap2(touched_map, test_vec[i])) {
184e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall			printf("Bad block was touched --- %llu\n", test_vec[i]);
18519c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o			failed++;
18619c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o			first_no_comma = 1;
18719c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o		}
188e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall		ext2fs_mark_block_bitmap2(touched_map, test_vec[i]);
18919c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	}
19019c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	for (i = 0; i < test_fs->group_desc_count; i++) {
191e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall		for (j=0, blk = ext2fs_inode_table_loc(test_fs, i);
19219c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o		     j < test_fs->inode_blocks_per_group;
19319c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o		     j++, blk++) {
194e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall			if (!ext2fs_test_block_bitmap2(touched_map, blk) &&
195e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall			    !ext2fs_test_block_bitmap2(bad_block_map, blk)) {
196e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall				printf("Missing block --- %llu\n", blk);
19719c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o				failed++;
19819c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o			}
19919c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o		}
20019c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	}
20119c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	printf("Bad inodes: ");
20219c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	for (i=1; i <= test_fs->super->s_inodes_count; i++) {
203e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall		if (ext2fs_test_inode_bitmap2(bad_inode_map, i)) {
20419c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o			if (first)
20519c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o				first = 0;
20619c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o			else
20719c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o				printf(", ");
208d0ff90d5202428583c78a60c3042e7b60d88bc45Eric Sandeen			printf("%u", i);
20919c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o		}
21019c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	}
21119c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	printf("\n");
21219c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o}
21319c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o
21419c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o
21519c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'oint main(int argc, char **argv)
21619c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o{
21719c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	setup();
21819c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	iterate();
21919c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	check_map();
22019c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	if (!failed)
22119c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o		printf("Inode scan tested OK!\n");
22219c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	return failed;
22319c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o}
22419c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o
225