Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 May 2002 20:15:39 -0700 (PDT)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 11950 for review
Message-ID:  <200205270315.g4R3Fdd02740@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=11950

Change 11950 by marcel@marcel_vaio on 2002/05/26 20:15:26

	Back-off when when the second sector contains the GPT signature.
	This is a short-term hack to allow both a valid MBR and a valid
	GPT to coexist.
	
	We're booting GPT partitions now!

Affected files ...

... //depot/projects/ia64/sys/geom/geom_mbr.c#7 edit

Differences ...

==== //depot/projects/ia64/sys/geom/geom_mbr.c#7 (text+ko) ====

@@ -61,6 +61,8 @@
 #define MBR_CLASS_NAME "MBR"
 #define MBREXT_CLASS_NAME "MBREXT"
 
+#define	GPT_HACK	1
+
 static void
 g_dec_dos_partition(u_char *ptr, struct dos_partition *d)
 {
@@ -197,13 +199,27 @@
 		if (!error && sectorsize != 512)
 			break;
 		gsp->frontstuff = sectorsize * fwsectors;
-		buf = g_read_data(cp, 0, sectorsize, &error);
+#if GPT_HACK
+		/*
+		 * XXX: GPT hack: Read the second sector as well and back-off
+		 * if it has the GPT signature.
+		 */
+		buf = g_read_data(cp, 0, 2 * sectorsize, &error);
+#else
+		buf = g_read_data(cp, 0, 2 * sectorsize, &error);
+#endif
 		if (buf == NULL || error != 0)
 			break;
 		if (buf[0x1fe] != 0x55 && buf[0x1ff] != 0xaa) {
 			g_free(buf);
 			break;
 		}
+#if GPT_HACK
+		if (!memcmp(buf + 512, "EFI PART", 8)) {
+			g_free(buf);
+			break;
+		}
+#endif
 		for (i = 0; i < NDOSPART; i++) 
 			g_dec_dos_partition(
 			    buf + DOSPARTOFF + i * sizeof(struct dos_partition),

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




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