View | Details | Raw Unified | Return to bug 158358
Collapse All | Expand All

(-)biosdisk.c (-21 / +23 lines)
Lines 162-168 Link Here
162
static void	bd_closedisk(struct open_disk *od);
162
static void	bd_closedisk(struct open_disk *od);
163
static int	bd_open_mbr(struct open_disk *od, struct i386_devdesc *dev);
163
static int	bd_open_mbr(struct open_disk *od, struct i386_devdesc *dev);
164
static int	bd_bestslice(struct open_disk *od);
164
static int	bd_bestslice(struct open_disk *od);
165
static void	bd_checkextended(struct open_disk *od, int slicenum);
165
static void	bd_checkextended(struct open_disk *od, struct dos_partition *dp, 
166
            struct dos_partition *primary_dp);
166
static int	bd_open_gpt(struct open_disk *od, struct i386_devdesc *dev);
167
static int	bd_open_gpt(struct open_disk *od, struct i386_devdesc *dev);
167
static struct gpt_part *bd_best_gptpart(struct open_disk *od);
168
static struct gpt_part *bd_best_gptpart(struct open_disk *od);
168
169
Lines 381-386 Link Here
381
382
382
	switch (dp->dp_typ) {
383
	switch (dp->dp_typ) {
383
	case DOSPTYP_386BSD:
384
	case DOSPTYP_386BSD:
385
		if (verbose)
386
			sprintf(line, "%s: BSD     %.6dMB (%d - %d)\n",
387
			    prefix, dp->dp_size / 2048,
388
			    dp->dp_start, dp->dp_start + dp->dp_size);
389
		else
390
			sprintf(line, "%s: BSD\n", prefix);
391
 		pager_output(line);
384
		bd_printbsdslice(od, (daddr_t)dp->dp_start, prefix, verbose);
392
		bd_printbsdslice(od, (daddr_t)dp->dp_start, prefix, verbose);
385
		return;
393
		return;
386
	case DOSPTYP_LINSWP:
394
	case DOSPTYP_LINSWP:
Lines 626-632 Link Here
626
      sizeof(struct dos_partition) * NDOSPART);
634
      sizeof(struct dos_partition) * NDOSPART);
627
    od->od_nslices = 4;			/* extended slices start here */
635
    od->od_nslices = 4;			/* extended slices start here */
628
    for (i = 0; i < NDOSPART; i++)
636
    for (i = 0; i < NDOSPART; i++)
629
        bd_checkextended(od, i);
637
        bd_checkextended(od, &od->od_slicetab[i], &od->od_slicetab[i]);
630
    od->od_flags |= BD_PARTTABOK;
638
    od->od_flags |= BD_PARTTABOK;
631
    dptr = &od->od_slicetab[0];
639
    dptr = &od->od_slicetab[0];
632
640
Lines 728-743 Link Here
728
}
736
}
729
737
730
static void
738
static void
731
bd_checkextended(struct open_disk *od, int slicenum)
739
bd_checkextended(struct open_disk *od, struct dos_partition *dp, struct dos_partition *primary_dp)
732
{
740
{
733
	char	buf[BIOSDISK_SECSIZE];
741
	char	buf[BIOSDISK_SECSIZE];
734
	struct dos_partition *dp;
742
	int i;
735
	u_int base;
743
	struct dos_partition *base_dp;
736
	int i, start, end;
744
	
737
738
	dp = &od->od_slicetab[slicenum];
739
	start = od->od_nslices;
740
741
	if (dp->dp_size == 0)
745
	if (dp->dp_size == 0)
742
		goto done;
746
		goto done;
743
	if (dp->dp_typ != DOSPTYP_EXT)
747
	if (dp->dp_typ != DOSPTYP_EXT)
Lines 748-771 Link Here
748
		DEBUG("no magic in extended table");
752
		DEBUG("no magic in extended table");
749
		goto done;
753
		goto done;
750
	}
754
	}
751
	base = dp->dp_start;
755
	base_dp = dp;
752
	dp = (struct dos_partition *)(&buf[DOSPARTOFF]);
756
	dp = (struct dos_partition *)(&buf[DOSPARTOFF]);
753
	for (i = 0; i < NDOSPART; i++, dp++) {
757
	for (i = 0; i < NDOSPART; i++, dp++) {
754
		if (dp->dp_size == 0)
758
		if (dp->dp_size == 0)
755
			continue;
759
			continue;
756
		if (od->od_nslices == NEXTDOSPART)
760
		if (od->od_nslices == NEXTDOSPART)
757
			goto done;
761
			goto done;
758
		dp->dp_start += base;
762
		if (dp->dp_typ == DOSPTYP_EXT) {
759
		bcopy(dp, &od->od_slicetab[od->od_nslices], sizeof(*dp));
763
			dp->dp_start += primary_dp->dp_start;
760
		od->od_nslices++;
764
			bd_checkextended(od, dp, primary_dp);
765
		} else {
766
			dp->dp_start += base_dp->dp_start;
767
			bcopy(dp, &od->od_slicetab[od->od_nslices], sizeof(*dp));
768
			od->od_nslices++;
769
		}
761
	}
770
	}
762
	end = od->od_nslices;
763
764
	/*
765
	 * now, recursively check the slices we just added
766
	 */
767
	for (i = start; i < end; i++)
768
		bd_checkextended(od, i);
769
done:
771
done:
770
	return;
772
	return;
771
}
773
}

Return to bug 158358