Subject: head's up: minor disklabel reordering in -current
To: None <port-macppc@netbsd.org>
From: Darrin B. Jewell <dbj@netbsd.org>
List: port-macppc
Date: 09/10/2002 08:35:47
--=-=-=


I intend to commit the macppc disksubr patch below to
to the cvs trunk shortly.  This is not a big deal, but it may
cause some partition assignments in your disklabel to change.
This should not affect the assignment of the root partition.

Linux partitions previously were hidden from the disklabel.
This will cause previously hidden Linux partitions to show
up in the disklabel as "unknown" or "swap".  This change is
necessary to allow linux filesystems to be accessed from
NetBSD in the future.

I also took advatage of the reshuffling to cause
"Apple_Boot" and "Apple_Loader" to now be hidden instead of
showing up as type "unknown".

Darrin


--=-=-=
Content-Disposition: attachment; filename=disksubr.diffs
Content-Description: patch to be committed to macppc disksubr

Index: src/sys/arch/macppc/macppc/disksubr.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/macppc/macppc/disksubr.c,v
retrieving revision 1.24
diff -u -u -r1.24 disksubr.c
--- src/sys/arch/macppc/macppc/disksubr.c	2002/09/10 11:31:10	1.24
+++ src/sys/arch/macppc/macppc/disksubr.c	2002/09/10 12:11:15
@@ -190,7 +190,9 @@
 	    strcmp(PART_TYPE_FWDRIVER, typestr) == 0 ||
 	    strcmp(PART_TYPE_FWB_COMPONENT, typestr) == 0 ||
 	    strcmp(PART_TYPE_PARTMAP, typestr) == 0 ||
-	    strcmp(PART_TYPE_PATCHES, typestr) == 0)
+	    strcmp(PART_TYPE_PATCHES, typestr) == 0 ||
+	    strcmp(PART_TYPE_BOOT, typestr) == 0 ||
+	    strcmp(PART_TYPE_LOADER, typestr) == 0)
 		type = 0;
 	else if (strcmp(PART_TYPE_NBSD_PPCBOOT, typestr) == 0) {
 		type = ROOT_PART;
@@ -214,7 +216,21 @@
 		bzb = (struct blockzeroblock *)(&part->pmBootArgs);
 		*clust = bzb->bzbCluster;
 		if (bzb->bzbMagic != BZB_MAGIC) {
-			type = 0;
+			char namestr[32];
+			/* Linux uses Apple_UNIX_SVR2 without setting BZB_MAGIC.
+			 */
+			strncpy(namestr, (char *)part->pmPartName, sizeof(namestr));
+			namestr[sizeof(namestr) - 1] = '\0';
+			for (s = namestr; *s; s++)
+				if ((*s >= 'a') && (*s <= 'z'))
+					*s = (*s - 'a' + 'A');
+			if (strcmp("SWAP",namestr) == 0) {
+				type = SWAP_PART;
+				*fstype = FS_SWAP;
+			} else {
+				type = SCRATCH_PART;
+				*fstype = FS_OTHER;
+			}
 		} else if (bzb->bzbFlags & BZB_ROOTFS) {
 			type = ROOT_PART;
 			*fstype = FS_BSDFFS;

--=-=-=--