Example #1
0
static int pi_dos_next_mbr(struct part_iter *iter, uint32_t *lba,
			    struct disk_dos_part_entry **_dp)
{
    struct disk_dos_part_entry *dp;

    while (++iter->index0 < 4) {
	dp = ((struct disk_dos_mbr *)iter->data)->table + iter->index0;

	if (notsane_primary(iter)) {
	    iter->status = PI_INSANE;
	    goto bail;
	}

	if (ost_is_ext(dp->ostype)) {
	    if (iter->sub.dos.bebr_index0 >= 0) {
		error("You have more than 1 extended partition.\n");
		iter->status = PI_INSANE;
		goto bail;
	    }
	    /* record base EBR index */
	    iter->sub.dos.bebr_index0 = iter->index0;
	}
	if (!ost_is_nondata(dp->ostype) || iter->stepall) {
	    *lba = dp->start_lba;
	    *_dp = dp;
	    break;
	}
    }

    return 0;
bail:
    return -1;
}
Example #2
0
static int dos_next_mbr(struct part_iter *iter, uint32_t *lba,
			    struct disk_dos_part_entry **_dp)
{
    struct disk_dos_part_entry *dp;

    while (++iter->index0 < 4) {
	dp = ((struct disk_dos_mbr *)iter->data)->table + iter->index0;

	if (notsane_primary(iter)) {
	    iter->status = PI_INSANE;
	    return -1;
	}

	if (ost_is_ext(dp->ostype)) {
	    if (iter->dos.bebr_index0 >= 0) {
		error("More than 1 extended partition.");
		iter->status = PI_INSANE;
		return -1;
	    }
	    /* record base EBR index */
	    iter->dos.bebr_index0 = iter->index0;
	}
	if (!ost_is_nondata(dp->ostype) || (iter->flags & PIF_STEPALL)) {
	    *lba = dp->start_lba;
	    *_dp = dp;
	    break;
	}
    }

    return 0;
}