Ejemplo n.º 1
0
inline int next(int zone) {

	if (!zone)
		zone = FIRSTZONE-1;
	while (++zone < ZONES)
		if (zone_in_use(zone))
			return zone;
	return 0;
}
Ejemplo n.º 2
0
static int next(int zone)
{
	if (!zone)
		zone = SB_FIRSTZONE - 1;
	while (++zone < SB_ZONES)
		if (zone_in_use(zone))
			return zone;
	return 0;
}
Ejemplo n.º 3
0
static inline int next(unsigned long zone) {
	unsigned long zones = get_nzones();
	unsigned long first_zone = get_first_zone();

	if (!zone)
		zone = first_zone-1;
	while (++zone < zones)
		if (zone_in_use(zone))
			return zone;
	return 0;
}
Ejemplo n.º 4
0
int get_free_block(void)
{
	int blk;

	blk = FIRSTZONE;
	while (blk < ZONES && zone_in_use(blk))
		blk++;
	if (blk >= ZONES)
		die("not enough good blocks");
	mark_zone(blk);
	return blk;
}
Ejemplo n.º 5
0
static int get_free_block(void)
{
	int blk;

	if (G.used_good_blocks + 1 >= MAX_GOOD_BLOCKS)
		bb_error_msg_and_die("too many bad blocks");
	if (G.used_good_blocks)
		blk = G.good_blocks_table[G.used_good_blocks - 1] + 1;
	else
		blk = SB_FIRSTZONE;
	while (blk < SB_ZONES && zone_in_use(blk))
		blk++;
	if (blk >= SB_ZONES)
		bb_error_msg_and_die("not enough good blocks");
	G.good_blocks_table[G.used_good_blocks] = blk;
	G.used_good_blocks++;
	return blk;
}
Ejemplo n.º 6
0
static int
get_free_block(void) {
	int blk;

	if (used_good_blocks+1 >= MAX_GOOD_BLOCKS)
		die(_("too many bad blocks"));
	if (used_good_blocks)
		blk = good_blocks_table[used_good_blocks-1]+1;
	else
		blk = FIRSTZONE;
	while (blk < ZONES && zone_in_use(blk))
		blk++;
	if (blk >= ZONES)
		die(_("not enough good blocks"));
	good_blocks_table[used_good_blocks] = blk;
	used_good_blocks++;
	return blk;
}
Ejemplo n.º 7
0
static int get_free_block(void) {
	unsigned int blk;
	unsigned int zones = get_nzones();
	unsigned int first_zone = get_first_zone();

	if (used_good_blocks+1 >= MAX_GOOD_BLOCKS)
		errx(MKFS_EX_ERROR, _("%s: too many bad blocks"), device_name);
	if (used_good_blocks)
		blk = good_blocks_table[used_good_blocks-1]+1;
	else
		blk = first_zone;
	while (blk < zones && zone_in_use(blk))
		blk++;
	if (blk >= zones)
		errx(MKFS_EX_ERROR, _("%s: not enough good blocks"), device_name);
	good_blocks_table[used_good_blocks] = blk;
	used_good_blocks++;
	return blk;
}