Subject: RL driver disklabel problem (#438) Index: sys/rl.c 2.11BSD Description: Disklabels are not properly handled by the RL driver. Use of any partition other than the first ('a') causes the 'a' partition to be overwritten. Repeat-By: Label a RL02 and create partitions 'a', 'b', and 'd'. Then: newfs rl0a mount /dev/rl0a /a cp /unix /a umount /dev/rl0a newfs rl0d mount /dev/rl0a /a notice that /unix is not present in /a Fix: The problem was two fold. First the driver neglected to add, in rlstart(), the partition offset to the block number being requested. Second, the partition offset was not being taken into account during the seek calculations in rlseek(). Also modified is the Makefile for the GENERIC kernel. This is because overlay 7 was full and the RL driver grew slightly making it too large to fit into overlay 7. The patch below completes the job of adding disklabel support to the RL driver. To apply this update cut where indicated, save to a file (/tmp/438) and then: patch -p0 < /tmp/438 cd /sys/GENERIC make cp unix /genunix If you have a kernel with the RL driver configured in you may need to adjust the Makefile. Try building a new kernel but if you receive an error about "too big for type 431" from the linker then it will be necessary to move 'rl.o' to a different overlay (the growth is only 64 or 128 bytes so it may not be necessary to relocate the driver to a different overlay). As always this and previous updates to 2.11BSD are available via anonymous FTP to either FTP.TO.GD-ES.COM or MOE.2BSD.COM in the directory /pub/2.11BSD. ------------------------cut here--------------------- *** /usr/src/sys/pdpuba/rl.c.old Fri Apr 3 21:35:34 1998 --- /usr/src/sys/pdpuba/rl.c Tue Jul 31 21:24:56 2001 *************** *** 3,14 **** * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * ! * @(#)rl.c 1.11 (2.11BSD GTE) 1998/4/3 */ /* * RL01/RL02 disk driver * * Date: July 19, 1996 * The driver was taking the WRITE LOCK (RLMP_WL) bit to indicate * an error, when all it really does is indicate that the disk is --- 3,17 ---- * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * ! * @(#)rl.c 1.12 (2.11BSD) 2001/7/31 */ /* * RL01/RL02 disk driver * + * Date: July 31, 2001 + * Fix major bug in handling of disklabels. + * * Date: July 19, 1996 * The driver was taking the WRITE LOCK (RLMP_WL) bit to indicate * an error, when all it really does is indicate that the disk is *************** *** 78,83 **** --- 81,87 ---- daddr_t rlsize(); int rlstrategy(); void rldfltlbl(); + static daddr_t rlabsbn(); struct buf rlutab[NRL]; /* Seek structure for each device */ struct buf rltab; *************** *** 368,373 **** --- 372,378 ---- register struct buf *bp, *dp; struct dkdevice *disk; int unit; + daddr_t bn; if((bp = rltab.b_actf) == NULL) { for(unit = 0;unit < NRL;unit++) { /* Start seeks */ *************** *** 387,393 **** } continue; } ! rlseek((int)(dp->b_actf->b_blkno/20l),unit); } rlgss(); /* Put shortest seek on Q */ --- 392,398 ---- } continue; } ! rlseek((int)(rlabsbn(dp->b_actf)/20L),unit); } rlgss(); /* Put shortest seek on Q */ *************** *** 395,403 **** return; } rltab.b_active++; rlp->dn = RLUNIT(bp->b_dev); ! rlp->chn = bp->b_blkno / 20; ! rlp->sn = (bp->b_blkno % 20) << 1; rlp->bleft = bp->b_bcount; rlp->rl_un.w[0] = bp->b_xmem & 077; rlp->rl_un.w[1] = (int) bp->b_un.b_addr; --- 400,409 ---- return; } rltab.b_active++; + bn = rlabsbn(bp); rlp->dn = RLUNIT(bp->b_dev); ! rlp->chn = bn / 20; ! rlp->sn = (bn % 20) << 1; rlp->bleft = bp->b_bcount; rlp->rl_un.w[0] = bp->b_xmem & 077; rlp->rl_un.w[1] = (int) bp->b_un.b_addr; *************** *** 469,478 **** rltab.b_active = NULL; rltab.b_errcnt = 0; rltab.b_actf = bp->av_forw; - #ifdef notdef - if((bp != NULL)&&(rlutab[rl.dn].b_actf != NULL)) - rlseek((int)(rlutab[rl.dn].b_actf->b_blkno/20l),rl.dn); - #endif #ifdef SOFUB_MAP if (rlsoftmap == 1) sofub_relse(bp, bp->b_bcount); --- 475,480 ---- *************** *** 765,769 **** --- 767,787 ---- rl.nblks[drive] = RL01_NBLKS; /* drive RL01 */ rl_dk[drive].dk_flags |= DKF_ALIVE; return(0); + } + + static daddr_t rlabsbn(bp) + register struct buf *bp; + { + struct partition *pi; + struct dkdevice *disk; + int unit, part; + daddr_t bn; + + unit = RLUNIT(bp->b_dev); + part = dkpart(bp->b_dev); + disk = &rl_dk[unit]; + pi = &disk->dk_parts[part]; + bn = bp->b_blkno + pi->p_offset; + return(bn); } #endif /* NRL */ *** /usr/src/sys/conf/Make.sunix.old Fri Sep 24 20:30:05 1999 --- /usr/src/sys/conf/Make.sunix Fri Aug 3 12:31:43 2001 *************** *** 9,15 **** # software without specific prior written permission. This software # is provided ``as is'' without express or implied warranty. # ! # 2.13 (2.11BSD) 1999/9/24 # ######################################################### # Non-network, but separate I/D kernel # --- 9,15 ---- # software without specific prior written permission. This software # is provided ``as is'' without express or implied warranty. # ! # 2.14 (2.11BSD) 2001/8/3 # ######################################################### # Non-network, but separate I/D kernel # *************** *** 61,70 **** quota_ufs.o vm_swp.o vm_swap.o vm_proc.o OV5= ht.o tm.o ts.o OV6= tmscp.o tmscpdump.o mem.o ! OV7= rl.o mch_fpsim.o ingreslock.o ufs_disksubr.o OV8= rx.o kern_sysctl.o vm_sched.o vm_text.o OV9= kern_pdp.o kern_xxx.o ufs_syscalls2.o ufs_subr.o rk.o sys_pipe.o \ kern_sig2.o toy.o subr_log.o KERNOBJ=${CONF} ${BASE} ${OV1} ${OV2} ${OV3} ${OV4} ${OV5} \ ${OV6} ${OV7} ${OV8} ${OV9} ${OV10} ${OV11} ${OV12} \ --- 61,71 ---- quota_ufs.o vm_swp.o vm_swap.o vm_proc.o OV5= ht.o tm.o ts.o OV6= tmscp.o tmscpdump.o mem.o ! OV7= mch_fpsim.o ingreslock.o ufs_disksubr.o OV8= rx.o kern_sysctl.o vm_sched.o vm_text.o OV9= kern_pdp.o kern_xxx.o ufs_syscalls2.o ufs_subr.o rk.o sys_pipe.o \ kern_sig2.o toy.o subr_log.o + OV10= rl.o KERNOBJ=${CONF} ${BASE} ${OV1} ${OV2} ${OV3} ${OV4} ${OV5} \ ${OV6} ${OV7} ${OV8} ${OV9} ${OV10} ${OV11} ${OV12} \ *** /usr/src/sys/GENERIC/Makefile.old Fri Sep 24 20:19:52 1999 --- /usr/src/sys/GENERIC/Makefile Fri Aug 3 12:24:34 2001 *************** *** 10,16 **** # software without specific prior written permission. This software # is provided ``as is'' without express or implied warranty. # ! # 2.13 (2.11BSD) 1999/9/24 # ######################################################### # Non-network, but separate I/D kernel # --- 10,16 ---- # software without specific prior written permission. This software # is provided ``as is'' without express or implied warranty. # ! # 2.14 (2.11BSD) 2001/8/3 # ######################################################### # Non-network, but separate I/D kernel # *************** *** 62,71 **** quota_ufs.o vm_swp.o vm_swap.o vm_proc.o OV5= ht.o tm.o ts.o OV6= tmscp.o tmscpdump.o mem.o ! OV7= rl.o mch_fpsim.o ingreslock.o ufs_disksubr.o OV8= rx.o kern_sysctl.o vm_sched.o vm_text.o OV9= kern_pdp.o kern_xxx.o ufs_syscalls2.o ufs_subr.o rk.o sys_pipe.o \ kern_sig2.o toy.o subr_log.o KERNOBJ=${CONF} ${BASE} ${OV1} ${OV2} ${OV3} ${OV4} ${OV5} \ ${OV6} ${OV7} ${OV8} ${OV9} ${OV10} ${OV11} ${OV12} \ --- 62,72 ---- quota_ufs.o vm_swp.o vm_swap.o vm_proc.o OV5= ht.o tm.o ts.o OV6= tmscp.o tmscpdump.o mem.o ! OV7= mch_fpsim.o ingreslock.o ufs_disksubr.o OV8= rx.o kern_sysctl.o vm_sched.o vm_text.o OV9= kern_pdp.o kern_xxx.o ufs_syscalls2.o ufs_subr.o rk.o sys_pipe.o \ kern_sig2.o toy.o subr_log.o + OV10= rl.o KERNOBJ=${CONF} ${BASE} ${OV1} ${OV2} ${OV3} ${OV4} ${OV5} \ ${OV6} ${OV7} ${OV8} ${OV9} ${OV10} ${OV11} ${OV12} \ *** /VERSION.old Thu Apr 26 19:36:22 2001 --- /VERSION Fri Aug 3 11:27:29 2001 *************** *** 1,5 **** ! Current Patch Level: 436 ! Date: April 26, 2001 2.11 BSD ============ --- 1,5 ---- ! Current Patch Level: 438 ! Date: August 3, 2001 2.11 BSD ============