*** mk/kernel/sys/types.h.orig	Wed May 15 18:34:16 1991
--- mk/kernel/sys/types.h	Mon Jul 20 13:07:12 1992
***************
*** 57,66 ****
--- 57,68 ----
  typedef	char *		caddr_t;	/* address of a (signed) char */
  
  typedef	unsigned long	time_t;		/* an unsigned long */
  typedef unsigned long	daddr_t;	/* an unsigned long */
  typedef	unsigned long	off_t;		/* another unsigned long */
+ typedef	u_long	ino_t;			/* inode number */
+ typedef	u_short	uid_t;			/* user id */
  
  typedef	unsigned short	dev_t;		/* another unsigned short */
  #define	NODEV		((dev_t)-1)	/* and a null value for it */
  
  #define	major(i)	((i) >> 8)
*** mk/kernel/i386at/boot/disk.c.orig	Thu Apr  9 19:48:18 1992
--- mk/kernel/i386at/boot/disk.c	Mon Jul 20 13:02:11 1992
***************
*** 34,43 ****
--- 34,46 ----
   * 
   */
  
  #include "boot.h"
  #include <i386at/disk.h>
+ #define partition bsd_partition	/* avoid name conflict */
+ #include <sys/disklabel.h>
+ #undef partition
  
  #define	BIOS_DEV_FLOPPY	0x0
  #define	BIOS_DEV_WIN	0x80
  
  #define BPS		512
***************
*** 72,86 ****
  		for (i = 0; i < FD_NUMPART; i++, iptr++)
  			if (iptr->systid == UNIXOS)
  				break;
  		sector = iptr->relsect + HDPDLOC;
  		Bread(dev, unit, sector++);
! 		if (((struct evtoc *)0)->sanity != VTOC_SANE) {
  			printf("vtoc insane");
  			return 1;
  		}
- 		boff = ((struct evtoc *)0)->part[part].p_start;
  		altptr = (char *)(&alt_info);
  		for (i = 0; i++ < 4; altptr += BPS, sector++) {
  			Bread(dev, unit, sector);
  			bcopy(0, altptr, BPS);
  		}
--- 75,95 ----
  		for (i = 0; i < FD_NUMPART; i++, iptr++)
  			if (iptr->systid == UNIXOS)
  				break;
  		sector = iptr->relsect + HDPDLOC;
  		Bread(dev, unit, sector++);
! 		if (((struct evtoc *)0)->sanity == VTOC_SANE) {
! 		   boff = ((struct evtoc *)0)->part[part].p_start;
! 		}
! 		else if((((struct disklabel*)0)->d_magic == DISKMAGIC) &&
! 			(((struct disklabel*)0)->d_magic2 == DISKMAGIC) ) {
! 		   boff = ((struct disklabel*)0)->d_partitions[part].p_offset;
! 		}
! 		else {
  			printf("vtoc insane");
  			return 1;
  		}
  		altptr = (char *)(&alt_info);
  		for (i = 0; i++ < 4; altptr += BPS, sector++) {
  			Bread(dev, unit, sector);
  			bcopy(0, altptr, BPS);
  		}
*** mk/kernel/i386at/boot/boot.h.orig	Thu Apr  9 19:48:16 1992
--- mk/kernel/i386at/boot/boot.h	Mon Jul 20 12:49:43 1992
***************
*** 31,42 ****
   * 	Fabricated from 3.0 bootstrap.  But too many things are global.
   * 	[92/03/30            mg32]
   * 
   */
  
! #include <sys/fs.h>
! #include <sys/inode.h>
  
  extern char *devs[], *name, *iodest;
  extern struct fs *fs;
  extern struct inode inode;
  extern int unit, part, maj, boff, poff, bnum, cnt;
--- 31,45 ----
   * 	Fabricated from 3.0 bootstrap.  But too many things are global.
   * 	[92/03/30            mg32]
   * 
   */
  
! #include <sys/types.h>
! #include <sys/param.h>
! #include <ufs/fs.h>
! #include <ufs/quota.h>
! #include <ufs/inode.h>
  
  extern char *devs[], *name, *iodest;
  extern struct fs *fs;
  extern struct inode inode;
  extern int unit, part, maj, boff, poff, bnum, cnt;
*** mk/kernel/i386at/boot/Makefile.orig	Thu Apr  9 19:48:12 1992
--- mk/kernel/i386at/boot/Makefile	Mon Jul 20 13:02:56 1992
***************
*** 30,40 ****
  # 	Fabricated for 3.0
  # 	[92/03/30            mg32]
  # 
  #
  
! CFLAGS	= -O
  LIBS= -lc
  
  # start.o should be first, table.o should be second
  OBJS = start.o table.o boot2.o boot.o asm.o bios.o io.o disk.o sys.o
  
--- 30,40 ----
  # 	Fabricated for 3.0
  # 	[92/03/30            mg32]
  # 
  #
  
! CFLAGS	= -O -I../..
  LIBS= -lc
  
  # start.o should be first, table.o should be second
  OBJS = start.o table.o boot2.o boot.o asm.o bios.o io.o disk.o sys.o
  
*** mk/kernel/i386at/boot/sys.c.orig	Thu Apr  9 19:48:23 1992
--- mk/kernel/i386at/boot/sys.c	Mon Jul 20 12:55:28 1992
***************
*** 92,103 ****
  	struct direct *dp;
  loop:	iodest = iobuf;
  	cnt = fs->fs_bsize;
  	bnum = fsbtodb(fs,itod(fs,ino)) + boff;
  	devread();
! 	bcopy(&((struct dinode *)iodest)[ino % fs->fs_inopb].di_ic,
! 	      &inode.i_ic,
  	      sizeof (struct dinode));
  	if (!*path)
  		return 1;
  	while (*path == '/')
  		path++;
--- 92,103 ----
  	struct direct *dp;
  loop:	iodest = iobuf;
  	cnt = fs->fs_bsize;
  	bnum = fsbtodb(fs,itod(fs,ino)) + boff;
  	devread();
! 	bcopy(&((struct dinode *)iodest)[ino % fs->fs_inopb],
! 	      &inode.i_din,
  	      sizeof (struct dinode));
  	if (!*path)
  		return 1;
  	while (*path == '/')
  		path++;
*** mk/kernel/i386at/hd.c.orig	Sun Mar  8 19:17:31 1992
--- mk/kernel/i386at/hd.c	Mon Jul 20 13:09:00 1992
***************
*** 222,231 ****
--- 222,235 ----
  #include <i386/ipl.h>
  #include <i386at/disk.h>
  #include <chips/busses.h>
  #include <i386at/hdreg.h>
  
+ #define partition bsd_partition		/* avoid name conflict */
+ #include <sys/disklabel.h>
+ #undef partition
+ 
  /* From sys/systm.h */
  struct buf *geteblk();
  
  #define b_cylin		b_resid
  #define PAGESIZ 4096
***************
*** 265,275 ****
  		ctrl = ctlr->unit;
  	int 	addr = devaddr[ctrl] = (int)ctlr->address;
  
  	outb(PORT_DRIVE_HEADREGISTER(addr),0);
  	outb(PORT_COMMAND(addr),CMD_RESTORE);
! 	for (i=350000; i && inb(PORT_STATUS(addr))&STAT_BUSY; i--);
  	if (i && inb(PORT_STATUS(addr))&STAT_READY) {
  		take_ctlr_irq(ctlr);
  		hh[ctrl].curdrive = ctrl<<1;
  		printf("%s%d: port = %x, spl = %d, pic = %d.\n", ctlr->name,
  			ctlr->unit, ctlr->address, ctlr->sysdep, ctlr->sysdep1);
--- 269,279 ----
  		ctrl = ctlr->unit;
  	int 	addr = devaddr[ctrl] = (int)ctlr->address;
  
  	outb(PORT_DRIVE_HEADREGISTER(addr),0);
  	outb(PORT_COMMAND(addr),CMD_RESTORE);
! 	for (i = 700000; i && inb(PORT_STATUS(addr))&STAT_BUSY;i--);
  	if (i && inb(PORT_STATUS(addr))&STAT_READY) {
  		take_ctlr_irq(ctlr);
  		hh[ctrl].curdrive = ctrl<<1;
  		printf("%s%d: port = %x, spl = %d, pic = %d.\n", ctlr->name,
  			ctlr->unit, ctlr->address, ctlr->sysdep, ctlr->sysdep1);
***************
*** 911,920 ****
--- 915,925 ----
  {
  	u_int			n;
  	struct boot_record	*boot_record_p;
  	struct evtoc		*evp;
  	struct buf		*bp1;
+ 	struct disklabel *disk_label_p;	/* for disk with BSD disk label */
  
  	if (hdgotvtoc[unit]) {
  		if (hdgotvtoc[unit] == -1)
  			sleep(&hdgotvtoc[unit],PRIBIO);
  		return;
***************
*** 988,997 ****
--- 993,1038 ----
  	biowait(bp1);
  	if (bp1->b_flags & B_ERROR) {
  		printf("hd%d: can't read evtoc\n", unit);
  		goto done;
  	}
+ 	/***** BEGIN SECTION FOR READING BSD DISK LABEL *****/
+ 	evp = (struct evtoc *)bp1->b_un.b_addr;
+ 	disk_label_p = (struct disklabel*) (bp1->b_un.b_addr);
+ 	if((disk_label_p->d_magic == DISKMAGIC) &&
+ 	   (disk_label_p->d_magic2 == DISKMAGIC) ) {
+ 
+ 	   hdparm[unit].ncyl = disk_label_p->d_ncylinders;
+ 	   hdparm[unit].nheads = disk_label_p->d_ntracks;
+ 	   hdparm[unit].nsec = disk_label_p->d_nsectors;
+ 
+ 	   /* copy info on all valid partition, zero the others */
+ 	   for (n = 0; n < disk_label_p->d_npartitions; n++) {
+ 	      if (n == PART_DISK)
+ 		 continue;
+ 	      partition_struct[unit][n].p_flag = V_VALID;
+ 	      if( disk_label_p->d_partitions[n].p_fstype == FS_BSDFFS ) {
+ 		 partition_struct[unit][n].p_flag |= V_VALID;
+ 	      }
+ 	      partition_struct[unit][n].p_start =
+ 		 disk_label_p->d_partitions[n].p_offset;
+ 	      partition_struct[unit][n].p_size =
+ 		 disk_label_p->d_partitions[n].p_size;
+ 	   }
+ 	   for ( ; n < V_NUMPAR; n++) {
+ 	      if (n == PART_DISK)
+ 		 continue;
+ 	      partition_struct[unit][n].p_flag = 0;
+ 	      partition_struct[unit][n].p_size = 0;
+ 	   }	
+ 	   /* leave C partition "open" for raw I/O */
+ 	   partition_struct[unit][PART_DISK].p_flag |= V_OPEN;
+ 
+ 	   if (bp1 != NULL) brelse(bp1);
+ 	   return;
+ 	}
+ 	/***** END SECTION FOR READING BSD DISK LABEL *****/
  	if ((evp = (struct evtoc *)bp1->b_un.b_addr)->sanity != VTOC_SANE) {
  		printf("hd%d: evtoc corrupt\n",unit);
  		goto done;
  	}
  	/* pd info from disk must be more accurate than that in cmos thus
