Date: Sat, 22 Jan 2011 15:58:38 +0300 From: "Andrey V. Elsukov" <bu7cher@yandex.ru> To: freebsd-geom@freebsd.org Cc: Marcel Moolenaar <marcel@freebsd.org>, Pawel Jakub Dawidek <pjd@FreeBSD.org> Subject: [PATCH] Do tasting for UFS's id and volume only for freebsd-ufs partitions Message-ID: <4D3AD47E.9010400@yandex.ru>
next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format. --------------070207000008030808070207 Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 8bit Hi All. I saw several strangest problem reports where UFS labels were successfully tasted for an inappropriate provider. So, what you thing about proposed patch? It add new handled attribute to geom PART class - "PART::type". It does return partition type for given consumer. Also it does limit tasting for UFS labels only for "freebsd-ufs" providers. -- WBR, Andrey V. Elsukov --------------070207000008030808070207 Content-Type: text/plain; name="ufs_labels.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="ufs_labels.diff" Index: head/sys/geom/label/g_label_ufs.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- head/sys/geom/label/g_label_ufs.c (revision 217714) +++ head/sys/geom/label/g_label_ufs.c (working copy) @@ -53,6 +53,7 @@ g_label_ufs_taste_common(struct g_consumer *cp, ch struct g_provider *pp; int sb, superblock; struct fs *fs; + char type[64]; =20 g_topology_assert_not(); pp =3D cp->provider; @@ -60,6 +61,10 @@ g_label_ufs_taste_common(struct g_consumer *cp, ch =20 if (SBLOCKSIZE % cp->provider->sectorsize !=3D 0) return; + if (g_getattr("PART::type", cp, &type) !=3D 0) + return; + if (strcmp(type, "freebsd-ufs") !=3D 0) + return; =20 /* * Walk through the standard places that superblocks hide and look Index: head/sys/geom/part/g_part.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- head/sys/geom/part/g_part.c (revision 217714) +++ head/sys/geom/part/g_part.c (working copy) @@ -1912,6 +1912,7 @@ g_part_start(struct bio *bp) struct g_part_table *table; struct g_kerneldump *gkd; struct g_provider *pp; + char buf[64]; =20 pp =3D bp->bio_to; gp =3D pp->geom; @@ -1960,6 +1961,9 @@ g_part_start(struct bio *bp) if (g_handleattr_str(bp, "PART::scheme", table->gpt_scheme->name)) return; + if (g_handleattr_str(bp, "PART::type", + G_PART_TYPE(table, entry, buf, sizeof(buf)))) + return; if (!strcmp("GEOM::kerneldump", bp->bio_attribute)) { /* * Check that the partition is suitable for kernel --------------070207000008030808070207--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4D3AD47E.9010400>