Subject: kern/6914: mac68k kernel build fails at disksubr.c
To: None <gnats-bugs@gnats.netbsd.org>
From: Frederick Bruckman <fb@enteract.com>
List: netbsd-bugs
Date: 01/30/1999 14:00:01
>Number:         6914
>Category:       kern
>Synopsis:       mac68k kernel build fails at disksubr.c
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jan 30 12:05:02 1999
>Last-Modified:
>Originator:     Frederick Bruckman
>Organization:

>Release:        Jan 29-30, 1999
>Environment:
	
System: NetBSD fb.sa.enteract.com 1.3I NetBSD 1.3I (FB) #216:
Wed Jan 27 21:59:13 CST 1999 fredb@fb.sa.enteract.com:
/usr/src/sys/arch/mac68k/compile/FB mac68k

compiler and libs from Jan 9-10 snapshot

>Description:
	
	Incompletely integreted mbr support causes mac68k kernel builds
	to fail with multiple errors:

cc  -O2 -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes  -Wpointer-arith -Wno-main -msoft-float -I. -I../../../../arch -I.
./../../.. -nostdinc -DHZ="0x3c" -DZSTTY_RING_SIZE="0x1000" -DSETUIDSCRIPTS -DM68040 -DFPSP -DLKM -DDIAGNOSTIC -DMAXUSERS=16 -D_K
ERNEL -Dmac68k  -c ../../../../arch/mac68k/mac68k/disksubr.c
../../../../arch/mac68k/mac68k/disksubr.c:100: `MBR_PTYPE_FAT12' undeclared here (not in a function)
../../../../arch/mac68k/mac68k/disksubr.c:100: initializer element for `fat_types[0]' is not constant
../../../../arch/mac68k/mac68k/disksubr.c:100: `MBR_PTYPE_FAT16S' undeclared here (not in a function)
../../../../arch/mac68k/mac68k/disksubr.c:100: initializer element for `fat_types[1]' is not constant
../../../../arch/mac68k/mac68k/disksubr.c:101: `MBR_PTYPE_FAT16B' undeclared here (not in a function)
../../../../arch/mac68k/mac68k/disksubr.c:101: initializer element for `fat_types[2]' is not constant
../../../../arch/mac68k/mac68k/disksubr.c:101: `MBR_PTYPE_FAT32' undeclared here (not in a function)
../../../../arch/mac68k/mac68k/disksubr.c:101: initializer element for `fat_types[3]' is not constant
../../../../arch/mac68k/mac68k/disksubr.c:102: `MBR_PTYPE_FAT32L' undeclared here (not in a function)
../../../../arch/mac68k/mac68k/disksubr.c:102: initializer element for `fat_types[4]' is not constant
../../../../arch/mac68k/mac68k/disksubr.c:102: `MBR_PTYPE_FAT16L' undeclared here (not in a function)
../../../../arch/mac68k/mac68k/disksubr.c:102: initializer element for `fat_types[5]' is not constant
../../../../arch/mac68k/mac68k/disksubr.c: In function `read_dos_label':
../../../../arch/mac68k/mac68k/disksubr.c:496: `MBR_BBSECTOR' undeclared (first use in this function)
../../../../arch/mac68k/mac68k/disksubr.c:496: (Each undeclared identifier is reported only once
../../../../arch/mac68k/mac68k/disksubr.c:496: for each function it appears in.)
../../../../arch/mac68k/mac68k/disksubr.c:508: `MBR_PARTOFF' undeclared (first use in this function)
../../../../arch/mac68k/mac68k/disksubr.c:509: `NMBRPART' undeclared (first use in this function)
../../../../arch/mac68k/mac68k/disksubr.c:509: increment of pointer to unknown structure
../../../../arch/mac68k/mac68k/disksubr.c:509: arithmetic on pointer to an incomplete type
../../../../arch/mac68k/mac68k/disksubr.c:510: dereferencing pointer to incomplete type
../../../../arch/mac68k/mac68k/disksubr.c:517: dereferencing pointer to incomplete type
../../../../arch/mac68k/mac68k/disksubr.c:518: dereferencing pointer to incomplete type
../../../../arch/mac68k/mac68k/disksubr.c:521: dereferencing pointer to incomplete type
../../../../arch/mac68k/mac68k/disksubr.c: In function `readdisklabel':
../../../../arch/mac68k/mac68k/disksubr.c:584: `MBR_MAGICOFF' undeclared (first use in this function)
../../../../arch/mac68k/mac68k/disksubr.c:585: `MBRSIG' undeclared (first use in this function)
*** Error code 1

Stop.

>How-To-Repeat:
	
	Try to build any mac68k kernel against Jan 30's sup. 
>Fix:
	
	I haven't tested the mbr support, nor the support for raw
	disklabels, at all. I can only verify that this builds and boots.

--- /usr/src/sys/arch/mac68k/mac68k/disksubr.c.orig	Thu Jan 28 06:18:43 1999
+++ /usr/src/sys/arch/mac68k/mac68k/disksubr.c	Sat Jan 30 11:45:02 1999
@@ -83,6 +83,7 @@
 #include <sys/buf.h>
 #include <sys/disk.h>
 #include <sys/disklabel.h>
+#include <sys/disklabel_mbr.h>
 #include <sys/syslog.h>
 
 #include <machine/bswap.h>
@@ -507,18 +508,18 @@
 		/* XXX */
 		dp = (struct mbr_partition *)(bp->b_data + MBR_PARTOFF);
 		for (i = 0; i < NMBRPART; i++, dp++) {
-			if (dp->dp_typ != 0) {
+			if (dp->mbrp_typ != 0) {
 				slot = getFreeLabelEntry(lp);
 				if (slot > maxslot)
 					maxslot = slot;
 
 				pp = &lp->d_partitions[slot];
 				pp->p_fstype = FS_OTHER;
-				pp->p_offset = bswap32(dp->dp_start);
-				pp->p_size = bswap32(dp->dp_size);
+				pp->p_offset = bswap32(dp->mbrp_start);
+				pp->p_size = bswap32(dp->mbrp_size);
 
 				for (ip = fat_types; *ip != -1; ip++) {
-					if (dp->dp_typ == *ip) {
+					if (dp->mbrp_typ == *ip) {
 						pp->p_fstype = FS_MSDOS;
 						break;
 					}
@@ -582,7 +583,7 @@
 		if (*sbSigp == 0x4552) {
 			msg = read_mac_label(dev, strat, lp, osdep);
 		} else if (bswap16(*(u_int16_t *)(bp->b_data + MBR_MAGICOFF))
-			   == MBRSIG) {
+			   == MBR_MAGIC) {
 			msg = read_dos_label(dev, strat, lp, osdep);
 		} else {
 			dlp = (struct disklabel *)(bp->b_un.b_addr + 0);
>Audit-Trail:
>Unformatted: