Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 Dec 2003 17:32:49 +0200
From:      Valentin Nechayev <netch@netch.kiev.ua>
To:        Poul-Henning Kamp <phk@phk.freebsd.dk>
Cc:        Valentin Nechayev <netch@netch.kiev.ua>
Subject:   Re: geom bsd strangeness in extended partition
Message-ID:  <20031231153249.GA434@iv.nn.kiev.ua>
In-Reply-To: <18000.1072741953@critter.freebsd.dk>
References:  <20031229230048.GA310@iv.nn.kiev.ua> <18000.1072741953@critter.freebsd.dk>

next in thread | previous in thread | raw e-mail | index | archive | help
 Tue, Dec 30, 2003 at 00:52:33, phk (Poul-Henning Kamp) wrote about "Re: geom bsd strangeness in extended partition": 

>>GEOM issues warnings during scanning bsdlabels in extended partition:
PHK> This is a bug and I know what it is.  I'll get back to you with
PHK> a patch sometimes in january.

Well, the attached patch is seems to be dirty, but fixed it for me.
I don't understand why multiple customers are allowed for g_geom, so get
one of them which leads to parent MBR.
Some variables may be unused because I omit debug print from final patch.


-netch-

--- geom/geom_mbr.c	Mon Sep  1 23:45:32 2003
+++ geom.1/geom_mbr.c	Wed Dec 31 17:22:10 2003
@@ -299,6 +299,29 @@
 	mp = gsp->softc;
 	if (bp->bio_cmd == BIO_GETATTR) {
 		if (g_handleattr_int(bp, "MBR::type", mp->type[idx]))
+			return (1);
+		off_t ro, off2;
+		struct g_consumer *pcons;
+		struct g_provider *pp2;
+		struct g_geom *gp2;
+		struct g_slicer *gsp2;
+		//struct g_mbr_softc *mp2;
+		/* Add MBR::offset of MBR in parent geom */
+		ro = gsp->slices[idx].offset;
+		LIST_FOREACH(pcons, &gp->consumer, consumer) {
+			if (!(pp2 = pcons->provider) ||
+			    !(gp2 = pp2->geom) ||
+			    !gp2->class ||
+			    strcmp(gp2->class->name, MBR_CLASS_NAME))
+				continue;
+			gsp2 = gp2->softc;
+			off2 = gsp2->slices[pp2->index].offset;
+			ro += off2;
+			break;
+		}
+		if (g_handleattr_off_t(bp, "MBR::offset", ro))
+			return (1);
+		if (g_handleattr_off_t(bp, "MBR::offset", ro))
 			return (1);
 	}
 	return (0);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031231153249.GA434>