Subject: mistake in yesterday's rz.c patch for reading ultrix part. info
To: None <port-pmax@sun-lamp.cs.berkeley.edu>
From: Andrew Gallatin <gallatin@isds.Duke.EDU>
List: port-pmax
Date: 08/22/1994 14:34:17
I realized this morning that I forgot to protect a few lines in rz.c
with #ifdef COMPAT_ULTRIX Below is a replacement for the patch to rz.c
I posted yesterday.

Sorry!

Drew

*** sys/arch/pmax/dev/rz.c.DIST	Sun Aug 21 16:11:53 1994
--- sys/arch/pmax/dev/rz.c	Mon Aug 22 09:16:09 1994
***************
*** 89,94 ****
--- 89,104 ----
   * (including the boot area).
   */
  static struct size rzdefaultpart[MAXPARTITIONS] = {
+ #ifdef GENERIC	/* greedy machines have 64 meg of swap */
+                 0,   32768,     /* A */
+             32768,  131072,     /* B */
+ 	        0,       0,	/* C */
+ 	    17408,       0,	/* D */
+ 	   115712,       0,	/* E */
+ 	   218112,       0,	/* F */
+ 	   163840,       0,	/* G */
+ 	   115712,       0,	/* H */
+ #else
  	        0,   16384,	/* A */
  	    16384,   65536,	/* B */
  	        0,       0,	/* C */
***************
*** 97,102 ****
--- 107,113 ----
  	   218112,       0,	/* F */
  	    81920,       0,	/* G */
  	   115712,       0,	/* H */
+ #endif
  };
  
  #define	RAWPART		2	/* 'c' partition */	/* XXX */
***************
*** 663,668 ****
--- 674,683 ----
  	}
  }
  
+ #ifdef COMPAT_ULTRIX
+ #include "../../stand/dec_boot.h"
+ #endif
+ 
  /*
   * Read or constuct a disklabel
   */
***************
*** 695,702 ****
  	msg = readdisklabel(dev, rzstrategy, lp, &cd);
  	if (msg == NULL)
  		return;
! #if 0
  	printf("rz%d: WARNING: %s\n", unit, msg);
  	sc->sc_label.d_magic = DISKMAGIC;
  	sc->sc_label.d_magic2 = DISKMAGIC;
  	sc->sc_label.d_type = DTYPE_SCSI;
--- 710,741 ----
  	msg = readdisklabel(dev, rzstrategy, lp, &cd);
  	if (msg == NULL)
  		return;
! 
  	printf("rz%d: WARNING: %s\n", unit, msg);
+ #if 1
+ #ifdef COMPAT_ULTRIX
+ 	if(sc->sc_label.d_magic != DEC_LABEL_MAGIC){
+ #endif /*COMPAT_ULTRIX*/
+ 	  bzero(lp, sizeof (*lp));
+ 	  for (i = 0; i < MAXPARTITIONS; i++) {
+ 		sc->sc_label.d_partitions[i].p_size =
+ 			(rzdefaultpart[i].nblocks) ?
+ 			rzdefaultpart[i].nblocks: sc->sc_blks;
+ 		sc->sc_label.d_partitions[i].p_offset =
+ 			rzdefaultpart[i].strtblk;
+ 		printf(" default rz%d%c: start %d len %d\n",
+ 			unit, "abcdefgh"[i],
+ 			rzdefaultpart[i].strtblk,  rzdefaultpart[i].nblocks);
+ 	      }
+ #ifdef COMPAT_ULTRIX
+ 	}
+ 	else
+ 	  for (i = 0; i < MAXPARTITIONS; i++)
+ 	    printf(" rz%d%c: start %d len %d\n",
+ 		   unit, "abcdefgh"[i],
+ 		   sc->sc_label.d_partitions[i].p_offset,
+ 		   sc->sc_label.d_partitions[i].p_size);
+ #endif /*COMPAT_ULTRIX*/
  	sc->sc_label.d_magic = DISKMAGIC;
  	sc->sc_label.d_magic2 = DISKMAGIC;
  	sc->sc_label.d_type = DTYPE_SCSI;
***************
*** 707,720 ****
  	sc->sc_label.d_npartitions = MAXPARTITIONS;
  	sc->sc_label.d_bbsize = BBSIZE;
  	sc->sc_label.d_sbsize = SBSIZE;
- 	for (i = 0; i < MAXPARTITIONS; i++) {
- 		sc->sc_label.d_partitions[i].p_size =
- 			rzdefaultpart[i].nblocks;
- 		sc->sc_label.d_partitions[i].p_offset =
- 			rzdefaultpart[i].strtblk;
- 	}
  	sc->sc_label.d_partitions[RAWPART].p_size = sc->sc_blks;
! #endif
  }
  
  int
--- 746,753 ----
  	sc->sc_label.d_npartitions = MAXPARTITIONS;
  	sc->sc_label.d_bbsize = BBSIZE;
  	sc->sc_label.d_sbsize = SBSIZE;
  	sc->sc_label.d_partitions[RAWPART].p_size = sc->sc_blks;
! #endif /*if 1*/
  }
  
  int
***************
*** 740,746 ****
--- 773,786 ----
  
  	lp = &sc->sc_label;
  	if (part >= lp->d_npartitions || lp->d_partitions[part].p_size == 0)
+ 	{
+ 		printf("rzopen: ENXIO on rz%d%c unit %d part %d\n",
+ 			unit, "abcdefg"[part],  unit, part);
+ 		printf("# partions %d, size of %d = %d\n",
+ 			lp->d_npartitions, lp->d_partitions[part].p_size);
  		return (ENXIO);
+ 	}
+ 
  	/*
  	 * Warn if a partition is opened that overlaps another
  	 * already open, unless either is the `raw' partition

------------------------------------------------------------------------------