コード例 #1
0
ファイル: fsdb.c プロジェクト: denrusio/vak-opensource
static int
find_indirblks32(uint32_t blk, int ind_level, uint32_t *wantedblk)
{
#define MAXNINDIR      (MAXBSIZE / sizeof(uint32_t))
    uint32_t idblk[MAXNINDIR];
    int i;

    check_blread(check_fsreadfd, (char *)idblk, fsbtodb(check_sblk.b_un.b_fs, blk), (int)check_sblk.b_un.b_fs->fs_bsize);
    if (ind_level <= 0) {
	if (find_blks32(idblk, check_sblk.b_un.b_fs->fs_bsize / sizeof(uint32_t), wantedblk))
	    return 1;
    } else {
	ind_level--;
	for (i = 0; i < check_sblk.b_un.b_fs->fs_bsize / sizeof(uint32_t); i++) {
	    if (compare_blk32(wantedblk, idblk[i])) {
		if (founddatablk(idblk[i]))
		    return 1;
	    }
	    if (idblk[i] != 0)
		if (find_indirblks32(idblk[i], ind_level, wantedblk))
		    return 1;
	}
    }
#undef MAXNINDIR
    return 0;
}
コード例 #2
0
ファイル: fsdb.c プロジェクト: ajinkya93/netbsd-src
static int
find_indirblks32(uint32_t blk, int ind_level, uint32_t *wantedblk)
{
#define MAXNINDIR	(MAXBSIZE / sizeof(uint32_t))
	uint32_t idblk[MAXNINDIR];
	size_t i;

	bread(fsreadfd, (char *)idblk, FFS_FSBTODB(sblock, blk),
	    (int)sblock->fs_bsize);
	if (ind_level <= 0) {
		if (find_blks32(idblk,
		    sblock->fs_bsize / sizeof(uint32_t), wantedblk))
			return 1;
	} else {
		ind_level--;
		for (i = 0; i < sblock->fs_bsize / sizeof(uint32_t); i++) {
			if (compare_blk32(wantedblk, iswap32(idblk[i]))) {
				if (founddatablk(iswap32(idblk[i])))
					return 1;
			}
			if(idblk[i] != 0)
				if (find_indirblks32(iswap32(idblk[i]),
				    ind_level, wantedblk))
				return 1;
		}
	}
#undef MAXNINDIR
	return 0;
}