summaryrefslogtreecommitdiffstats
path: root/sys/geom/part
diff options
context:
space:
mode:
authormarius <marius@FreeBSD.org>2009-01-06 14:10:10 +0000
committermarius <marius@FreeBSD.org>2009-01-06 14:10:10 +0000
commit87687bfd7cea7933b61cd479f8b5a8cdef8a71c6 (patch)
tree7d5586b28e6c5effbdda4a43a0214467c2d15477 /sys/geom/part
parent2ea343a85ea84bdc751578929975c2bb96cc70a5 (diff)
downloadFreeBSD-src-87687bfd7cea7933b61cd479f8b5a8cdef8a71c6.zip
FreeBSD-src-87687bfd7cea7933b61cd479f8b5a8cdef8a71c6.tar.gz
- Don't enforce an upper-bound to the number of sectors or heads,
allowing the full 16-bit width of the corresponding fields in the VTOC8 label to be used. The removed limits basically only held true for providers labeled using the synthetic geometry provided by cam_calc_geometry(9) but neither SCSI disks labeled with Solaris nor sufficiently large ATA disks. - Given that providers (originally) labeled with Solaris typically use the native geometry as reported by the target while FreeBSD typically uses a synthetic one put the message complaining about mismatching geometries between what the label indicates and what GEOM thinks the provider has, which we generally can't help, under bootverbose in order to not unnecessarily scare users. - For informational purposes add the non-matching values to the message complaining about them, similar to what r186501 did for g_part_bsd_read() except also indicating the origin of the values. - Make it clear that the messages emitted by this code refer to the VTOC8 support rather than to another existing scheme or to VTOC32.
Diffstat (limited to 'sys/geom/part')
-rw-r--r--sys/geom/part/g_part_vtoc8.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/sys/geom/part/g_part_vtoc8.c b/sys/geom/part/g_part_vtoc8.c
index 0fae760..78212c3 100644
--- a/sys/geom/part/g_part_vtoc8.c
+++ b/sys/geom/part/g_part_vtoc8.c
@@ -371,7 +371,7 @@ g_part_vtoc8_read(struct g_part_table *basetable, struct g_consumer *cp)
msize = pp->mediasize / pp->sectorsize;
sectors = be16dec(&table->vtoc.nsecs);
- if (sectors < 1 || sectors > 63)
+ if (sectors < 1)
goto invalid_label;
if (sectors != basetable->gpt_sectors && !basetable->gpt_fixgeom) {
g_part_geometry_heads(msize, sectors, &chs, &heads);
@@ -382,13 +382,21 @@ g_part_vtoc8_read(struct g_part_table *basetable, struct g_consumer *cp)
}
heads = be16dec(&table->vtoc.nheads);
- if (heads < 1 || heads > 255)
+ if (heads < 1)
goto invalid_label;
if (heads != basetable->gpt_heads && !basetable->gpt_fixgeom)
basetable->gpt_heads = heads;
- if (sectors != basetable->gpt_sectors ||
- heads != basetable->gpt_heads)
- printf("GEOM: %s: geometry does not match label.\n", pp->name);
+ /*
+ * Except for ATA disks > 32GB, Solaris uses the native geometry
+ * as reported by the target for the labels while da(4) typically
+ * uses a synthetic one so we don't complain too loudly if these
+ * geometries don't match.
+ */
+ if (bootverbose && (sectors != basetable->gpt_sectors ||
+ heads != basetable->gpt_heads))
+ printf("GEOM: %s: geometry does not match VTOC8 label "
+ "(label: %uh,%us GEOM: %uh,%us).\n", pp->name, heads,
+ sectors, basetable->gpt_heads, basetable->gpt_sectors);
table->secpercyl = heads * sectors;
cyls = be16dec(&table->vtoc.ncyls);
@@ -402,7 +410,7 @@ g_part_vtoc8_read(struct g_part_table *basetable, struct g_consumer *cp)
withtags = (be32dec(&table->vtoc.sanity) == VTOC_SANITY) ? 1 : 0;
if (!withtags) {
- printf("GEOM: %s: adding VTOC information.\n", pp->name);
+ printf("GEOM: %s: adding VTOC8 information.\n", pp->name);
be32enc(&table->vtoc.version, VTOC_VERSION);
bzero(&table->vtoc.volume, VTOC_VOLUME_LEN);
be16enc(&table->vtoc.nparts, VTOC8_NPARTS);
@@ -444,7 +452,7 @@ g_part_vtoc8_read(struct g_part_table *basetable, struct g_consumer *cp)
return (0);
invalid_label:
- printf("GEOM: %s: invalid disklabel.\n", pp->name);
+ printf("GEOM: %s: invalid VTOC8 label.\n", pp->name);
return (EINVAL);
}
OpenPOWER on IntegriCloud