diff options
author | jhb <jhb@FreeBSD.org> | 2007-12-06 09:20:27 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2007-12-06 09:20:27 +0000 |
commit | 82ec005a0a3eb13a9c5e676c1965696509fa2c62 (patch) | |
tree | 467db79f72048a7a584bcecdd58b2db065e5b447 /sys/geom | |
parent | 2e2fe0271f844e316e19974f1eff0b16ec88de65 (diff) | |
download | FreeBSD-src-82ec005a0a3eb13a9c5e676c1965696509fa2c62.zip FreeBSD-src-82ec005a0a3eb13a9c5e676c1965696509fa2c62.tar.gz |
Only attach to a GPT partition if it has the GPT_ENT_TYPE_FREEBSD type.
XXX: This only works currently with GEOM_GPT which only exists in 6.x.
XXX: I didn't add 'mbroffset' support for a GPT partition holding a BSD
label as I'm not sure if they use relative or absolute offsets.
MFC after: 3 days
Diffstat (limited to 'sys/geom')
-rw-r--r-- | sys/geom/geom_bsd.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/sys/geom/geom_bsd.c b/sys/geom/geom_bsd.c index 26252ab..1a0bf20 100644 --- a/sys/geom/geom_bsd.c +++ b/sys/geom/geom_bsd.c @@ -55,6 +55,8 @@ __FBSDID("$FreeBSD$"); #include <sys/md5.h> #include <sys/errno.h> #include <sys/disklabel.h> +#include <sys/gpt.h> +#include <sys/uuid.h> #include <geom/geom.h> #include <geom/geom_slice.h> @@ -461,6 +463,8 @@ g_bsd_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, struct g_ * not implemented here. */ +static struct uuid freebsd_slice = GPT_ENT_TYPE_FREEBSD; + static struct g_geom * g_bsd_taste(struct g_class *mp, struct g_provider *pp, int flags) { @@ -472,6 +476,7 @@ g_bsd_taste(struct g_class *mp, struct g_provider *pp, int flags) struct g_slicer *gsp; u_char hash[16]; MD5_CTX md5sum; + struct uuid uuid; g_trace(G_T_TOPOLOGY, "bsd_taste(%s,%s)", mp->name, pp->name); g_topology_assert(); @@ -527,6 +532,14 @@ g_bsd_taste(struct g_class *mp, struct g_provider *pp, int flags) break; } + /* Same thing if we are inside a GPT */ + error = g_getattr("GPT::type", cp, &uuid); + if (!error) { + if (memcmp(&uuid, &freebsd_slice, sizeof(uuid)) != 0 && + flags == G_TF_NORMAL) + break; + } + /* Get sector size, we need it to read data. */ secsize = cp->provider->sectorsize; if (secsize < 512) |