Subject: read&write entry points duplicated in drivers (part 1 of 2)
Index:	pdpuba/many 2.11BSD

Description:
	The read and write entry points into many of the device
	drivers are essentially duplicated - all that is done is
	that physio() is called with the drivers strategy routine's
	address.

	Later versions of 4BSD have removed the individual driver's
	read&write functions and consolidated them into rawread()
	and rawwrite().  The read and write entries in the cdevsw[] are
	then replaced with rawread() and rawwrite() respectively.

	The space savings will of course vary depending on the number 
	of disc and tape drivers present in the system.

Repeat-By:
	Examine the code, look at (for example) ra.c and tm.c (one disc
	and one tape driver).  Note that raread()/rawrite() and
	tmwrite()/tmread() merely call physio(), the same as any other
	disc or tape driver.

Fix:
	The patch below will update all the necessary files.  Part 2
	is a cursory patch kit for the OTHERS directory (an attempt
	to keep those drivers somewhat updated).

	Note:  the cdevsw[] structure has an extra member - the
	strategy routine is now present in both the bdevsw[] and
	cdevsw[] tables.

	Note:  the 'kind' (BYTE/WORD) parameter to physio() is gone now,
	be sure to count the arguments to physio() when installing/porting
	a driver.  No one could remember the origin of the  BYTE/WORD stuff
	and testing showed that either the underlying hardware gave an error
	or nothing bad happened if the alignment was ignored.
------------------------------------------------------------------------
*** /usr/src/sys/pdpuba/br.c.old	Sun May 19 21:00:55 1991
--- /usr/src/sys/pdpuba/br.c	Sun Sep 22 11:36:20 1991
***************
*** 26,31 ****
--- 26,32 ----
   *	      partitions as partitions 'e', 'f', and 'g' as an aid in
   *	      converting the systems.  BE CAREFUL!  For T300 only.
   * 8/4/89   - Use the log() function to record soft errors.
+  * 9/22/91  - remove read and write entry - use common raw read/write routine.
   */
  
  #include "br.h"
***************
*** 354,373 ****
  	brstart();
  }
   
- brread(dev, uio)
- 	int dev;
- 	struct uio *uio;
- {
- 	return(physio(brstrategy, (struct buf *)NULL, dev, B_READ, WORD, uio));
- }
- 
- brwrite(dev, uio)
- 	int dev;
- 	struct uio *uio;
- {
- 	return(physio(brstrategy, (struct buf *)NULL, dev, B_WRITE, WORD, uio));
- }
- 
  #ifdef BR_DUMP
  /*
   * Dump routine.  Dumps from dumplo to end of memory/end of disk section for
--- 355,360 ----
*** /usr/src/sys/pdpuba/dr.c.old	Sun May 19 21:02:54 1991
--- /usr/src/sys/pdpuba/dr.c	Sun Sep 22 11:36:38 1991
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)dr.c	1.1 (2.10BSD Berkeley) 12/1/86
   */
  
  /*
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)dr.c	1.2 (2.11BSD Berkeley) 9/22/91
   */
  
  /*
***************
*** 199,218 ****
  	iodone(bp);				/* tell system we are done */
  	if(drptr->i_tab.b_actf)			/* start next request */
  		drstart(drptr);
- }
- 
- drread(dev, uio)
- 	dev_t dev;
- 	struct uio *uio;
- {
- 	return(physio(drstrategy, (struct buf *)NULL, dev, B_READ, WORD, uio));
- }
- 
- drwrite(dev, uio)
- 	dev_t dev;
- 	struct uio *uio;
- {
- 	return(physio(drstrategy, (struct buf *)NULL, dev, B_WRITE, WORD, uio));
  }
  
  drioctl(dev, cmd, data, flag)
--- 199,204 ----
*** /usr/src/sys/pdpuba/hk.c.old	Sun May 19 21:07:02 1991
--- /usr/src/sys/pdpuba/hk.c	Sun Sep 22 11:37:08 1991
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)hk.c	1.1 (2.10BSD Berkeley) 12/1/86
   */
  
  /*
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)hk.c	1.l (2.11BSD Berkeley) 9/22/91
   */
  
  /*
***************
*** 504,523 ****
  			needie = 0;
  	if (needie)
  		hkaddr->hkcs1 = HK_IE;
- }
- 
- hkread(dev, uio)
- 	dev_t dev;
- 	struct uio *uio;
- {
- 	return(physio(hkstrategy, (struct buf *)NULL, dev, B_READ, WORD, uio));
- }
- 
- hkwrite(dev, uio)
- 	dev_t dev;
- 	struct uio *uio;
- {
- 	return(physio(hkstrategy, (struct buf *)NULL, dev, B_WRITE, WORD, uio));
  }
  
  #ifdef HK_DUMP
--- 504,509 ----
*** /usr/src/sys/pdpuba/ht.c.old	Mon May 27 02:27:07 1991
--- /usr/src/sys/pdpuba/ht.c	Sun Sep 22 11:37:43 1991
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)ht.c	2.0 (2.11BSD) 5/23/91
   */
  
  /*
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)ht.c	2.1 (2.11BSD) 9/22/91
   */
  
  /*
***************
*** 392,411 ****
  	HTADDR->htcs2 = ocs2;
  	HTADDR->httc = omttc;
  	HTADDR->htcs1 = HT_DCLR | HT_GO;
- }
- 
- htread(dev, uio)
- 	dev_t	dev;
- 	struct uio *uio;
- {
- 	return(physio(htstrategy, (struct buf *)NULL, dev, B_READ, BYTE, uio));
- }
- 
- htwrite(dev, uio)
- 	dev_t	dev;
- 	struct uio *uio;
- {
- 	return(physio(htstrategy, (struct buf *)NULL, dev, B_WRITE, BYTE, uio));
  }
  
  /*ARGSUSED*/
--- 392,397 ----
*** /usr/src/sys/pdpuba/ra.c.old	Sun May 19 04:14:45 1991
--- /usr/src/sys/pdpuba/ra.c	Sun Sep 22 11:40:02 1991
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)ra.c	2.0 (2.11BSD Berkeley) 3/16/91
   */
  
   /***********************************************************************
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)ra.c	2.1 (2.11BSD Berkeley) 9/22/91
   */
  
   /***********************************************************************
***************
*** 14,19 ****
--- 14,22 ----
  
  /* 
   * ra.c - MSCP Driver
+  * Date:	Sep  22 1991
+  * The read and write entries were removed as part of implementing the 
+  * common rawread and rawwrite routines.
   * 
   * Date:	Mar  16 1991
   * The command packets were moved to an external heap which is dynamically
***************
*** 486,505 ****
  	bp->b_flags |= B_ERROR;
  	iodone(bp);
  	return;
- }
- 
- raread(dev, uio)
- 	register dev_t 	dev;
- 	struct	uio *uio;
- {
- 	return(physio(rastrategy, (struct buf *)NULL, dev, B_READ, WORD, uio));
- }
- 
- rawrite(dev, uio)
- 	register dev_t 	dev;
- 	struct	uio *uio;
- {
- 	return(physio(rastrategy, (struct buf *)NULL, dev, B_WRITE, WORD, uio));
  }
  
  /* Start i/o, must be called at level splbio */
--- 489,494 ----
*** /usr/src/sys/pdpuba/rk.c.old	Sun May 19 21:09:55 1991
--- /usr/src/sys/pdpuba/rk.c	Sun Sep 22 11:40:33 1991
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)rk.c	1.1 (2.10BSD Berkeley) 12/1/86
   */
  
  /*
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)rk.c	1.2 (2.11BSD Berkeley) 9/22/91
   */
  
  /*
***************
*** 165,183 ****
  	bp->b_resid = -(rkaddr->rkwc << 1);
  	iodone(bp);
  	rkstart();
- }
- 
- rkread(dev, uio)
- 	register dev_t dev;
- 	struct	uio *uio;
- {
- 	return(physio(rkstrategy, (struct buf *)NULL, dev, B_READ, WORD, uio));
- }
- 
- rkwrite(dev, uio)
- 	register dev_t dev;
- 	struct	uio *uio;
- {
- 	return(physio(rkstrategy, (struct buf *)NULL, dev, B_WRITE, WORD, uio));
  }
  #endif NRK
--- 165,169 ----
*** /usr/src/sys/pdpuba/rl.c.old	Sun May 19 21:11:00 1991
--- /usr/src/sys/pdpuba/rl.c	Sun Sep 22 11:41:02 1991
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)rl.c	1.1 (2.10BSD Berkeley) 12/1/86
   */
  
  /*
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)rl.c	1.2 (2.11BSD Berkeley) 9/22/91
   */
  
  /*
***************
*** 289,308 ****
  		dk_wds[dkn] += rl.bpart>>6;
  	}
  #endif
- }
- 
- rlread(dev, uio)
- 	register dev_t dev;
- 	struct uio *uio;
- {
- 	return(physio(rlstrategy, (struct buf *)NULL, dev, B_READ, WORD, uio));
- }
- 
- rlwrite(dev, uio)
- 	register dev_t dev;
- 	struct uio *uio;
- {
- 	return(physio(rlstrategy, (struct buf *)NULL, dev, B_WRITE, WORD, uio));
  }
  
  /*
--- 289,294 ----
*** /usr/src/sys/pdpuba/rx.c.old	Sun May 19 21:11:46 1991
--- /usr/src/sys/pdpuba/rx.c	Sun Sep 22 11:41:32 1991
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)rx.c	1.1 (2.10BSD Berkeley) 12/1/86
   */
  
  /*
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)rx.c	1.2 (2.11BSD Berkeley) 9/22/91
   */
  
  /*
***************
*** 296,316 ****
  	*xmem = bp->b_xmem;
  	if (*addr < bp->b_un.b_addr)		/* overflow, bump xmem */
  		(*xmem)++;
- }
- 
- rxread(dev, uio)
- 	dev_t dev;
- 	struct uio *uio;
- {
- 	return(physio(rxstrategy, (struct buf *)NULL, dev, B_READ, WORD, uio));
- }
- 
- 
- rxwrite(dev, uio)
- 	dev_t dev;
- 	struct uio *uio;
- {
- 	return(physio(rxstrategy, (struct buf *)NULL, dev, B_WRITE, WORD, uio));
  }
  
  /*
--- 296,301 ----
*** /usr/src/sys/pdpuba/si.c.old	Sun May 19 21:12:30 1991
--- /usr/src/sys/pdpuba/si.c	Sun Sep 22 11:41:56 1991
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)si.c	1.1 (2.10BSD Berkeley) 12/1/86
   */
  
  /*
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)si.c	1.2 (2.11BSD Berkeley) 9/22/91
   */
  
  /*
***************
*** 397,416 ****
  	}
  
  	sistart();
- }
- 
- siread(dev, uio)
- 	dev_t	dev;
- 	struct uio *uio;
- {
- 	return(physio(sistrategy, (struct buf *)NULL, dev, B_READ, WORD, uio));
- }
- 
- siwrite(dev, uio)
- 	dev_t	dev;
- 	struct uio *uio;
- {
- 	return(physio(sistrategy, (struct buf *)NULL, dev, B_WRITE, WORD, uio));
  }
  
  #ifdef SI_DUMP
--- 397,402 ----
*** /usr/src/sys/pdpuba/tm.c.old	Thu May 23 20:41:36 1991
--- /usr/src/sys/pdpuba/tm.c	Sun Sep 22 11:42:33 1991
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)tm.c	2.0 (2.11BSD) 5/22/91
   */
  
  /*
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)tm.c	2.1 (2.11BSD) 9/22/91
   */
  
  /*
***************
*** 570,589 ****
  	}
  	/* eof on read */
  	sc->sc_nxrec = bn;
- }
- 
- tmread(dev, uio)
- 	dev_t dev;
- 	struct uio *uio;
- {
- 	return(physio(tmstrategy, (struct buf *)NULL, dev, B_READ, BYTE, uio));
- }
- 
- tmwrite(dev, uio)
- 	dev_t dev;
- 	struct uio *uio;
- {
- 	return(physio(tmstrategy, (struct buf *)NULL, dev, B_WRITE, BYTE, uio));
  }
  
  /*ARGSUSED*/
--- 570,575 ----
*** /usr/src/sys/pdpuba/tmscp.c.old	Sat May 25 01:43:23 1991
--- /usr/src/sys/pdpuba/tmscp.c	Sun Sep 22 11:43:13 1991
***************
*** 1,4 ****
! /*	@(#)tmscp.c	1.1 (2.11BSD) 5/10/91 */
  
  #if	!defined(lint) && defined(DOSCCS)
  static	char	*sccsid = "@(#)tmscp.c	1.24	(ULTRIX)	1/21/86";
--- 1,4 ----
! /*	@(#)tmscp.c	1.2 (2.11BSD) 9/22/91 */
  
  #if	!defined(lint) && defined(DOSCCS)
  static	char	*sccsid = "@(#)tmscp.c	1.24	(ULTRIX)	1/21/86";
***************
*** 1636,1655 ****
  	return(1);
  }
  #endif TMSCP_DUMP
- 
- tmscpread(dev, uio)
- 	register dev_t dev;
- 	struct uio *uio;
- {
- 	return(physio(tmscpstrategy, (struct buf *)NULL, dev, B_READ, BYTE, uio));
- }
- 
- tmscpwrite(dev, uio)
- 	register dev_t dev;
- 	struct uio *uio;
- {
- 	return(physio(tmscpstrategy, (struct buf *)NULL, dev, B_WRITE, BYTE, uio));
- }
  
  /*
   * Catch ioctl commands, and call the "command" routine to do them.
--- 1636,1641 ----
*** /usr/src/sys/pdpuba/ts.c.old	Mon Jun  3 21:53:16 1991
--- /usr/src/sys/pdpuba/ts.c	Sun Sep 22 11:43:39 1991
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)ts.c	2.1 (2.11BSD) 5/31/91
   */
  
  /*
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)ts.c	2.2 (2.11BSD) 9/22/91
   */
  
  /*
***************
*** 643,662 ****
  		}
  	}
  	return(0);
- }
- 
- tsread(dev, uio)
- 	dev_t	dev;
- 	struct uio *uio;
- {
- 	return(physio(tsstrategy, (struct buf *)NULL, dev, B_READ, BYTE, uio));
- }
- 
- tswrite(dev, uio)
- 	dev_t	dev;
- 	struct uio *uio;
- {
- 	return(physio(tsstrategy, (struct buf *)NULL, dev, B_WRITE, BYTE, uio));
  }
  
  /*ARGSUSED*/
--- 643,648 ----
*** /usr/src/sys/pdpuba/xp.c.old	Sun May 19 21:14:35 1991
--- /usr/src/sys/pdpuba/xp.c	Sun Sep 22 11:44:09 1991
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)xp.c	1.2 (2.11BSD) 5/4/91
   */
  
  /*
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)xp.c	1.3 (2.11BSD) 9/22/91
   */
  
  /*
***************
*** 880,900 ****
  			xpustart(unit);
  	xpstart(xc);
  }
- 
- xpread(dev, uio)
- 	dev_t	dev;
- 	struct uio *uio;
- {
- 	return(physio(xpstrategy, (struct buf *)NULL, dev, B_READ, WORD, uio));
- }
- 
- xpwrite(dev, uio)
- 	dev_t	dev;
- 	struct uio *uio;
- {
- 	return(physio(xpstrategy, (struct buf *)NULL, dev, B_WRITE, WORD, uio));
- }
- 
  
  #define exadr(x,y)	(((long)(x) << 16) | (unsigned)(y))
  
--- 880,885 ----
*** /usr/src/sys/sys/vm_swp.c.old	Thu Jun  6 14:42:52 1991
--- /usr/src/sys/sys/vm_swp.c	Sun Sep 22 11:03:40 1991
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)vm_swp.c	2.1 (2.11BSD) 6/6/91
   */
  
  #include "param.h"
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)vm_swp.c	2.2 (2.11BSD) 9/22/91
   */
  
  #include "param.h"
***************
*** 115,126 ****
   * Refined (and streamlined) the flow by using a 'for' construct 
   * (a la 4.3Reno).  Avoid allocating/freeing the buffer for each iovec
   * element (i must have been confused at the time).  6/91-sms
   */
! physio(strat, bp, dev, rw, kind, uio)
  	int (*strat)();
  	register struct buf *bp;
  	dev_t dev;
! 	int rw, kind;
  	register struct uio *uio;
  {
  	int error = 0, s, nb, ts, c, allocbuf = 0;
--- 115,130 ----
   * Refined (and streamlined) the flow by using a 'for' construct 
   * (a la 4.3Reno).  Avoid allocating/freeing the buffer for each iovec
   * element (i must have been confused at the time).  6/91-sms
+  *
+  * Finished removing the BYTE/WORD code as part of implementing the common
+  * raw read&write routines , systems had been running fine for several
+  * months with it ifdef'd out.  9/91-sms
   */
! physio(strat, bp, dev, rw, uio)
  	int (*strat)();
  	register struct buf *bp;
  	dev_t dev;
! 	int rw;
  	register struct uio *uio;
  {
  	int error = 0, s, nb, ts, c, allocbuf = 0;
***************
*** 133,149 ****
  	u.u_procp->p_flag |= SLOCK;
  	for ( ; uio->uio_iovcnt; uio->uio_iov++, uio->uio_iovcnt--) {
  		iov = uio->uio_iov;
- #ifdef	whybother
- 	/*
- 	 * Check odd base, odd count, and address wraparound
- 	 * Odd base and count not allowed if flag = WORD,
- 	 * allowed if flag = BYTE.
- 	 */
- 		if (kind == WORD && (((int)iov->iov_base|iov->iov_len) & 01)) {
- 			error = EFAULT;
- 			break;
- 		}
- #endif
  		if (iov->iov_base >= iov->iov_base + iov->iov_len) {
  			error = EFAULT;
  			break;
--- 137,142 ----
***************
*** 218,220 ****
--- 211,229 ----
  	u.u_procp->p_flag &= ~SLOCK;
  	return(error);
  }
+ 
+ rawread(dev, uio)
+ 	dev_t dev;
+ 	struct uio *uio;
+ 	{
+ 	return(physio(cdevsw[major(dev)].d_strategy, (struct buf *)NULL, dev,
+ 		B_READ, uio));
+ 	}
+ 
+ rawwrite(dev, uio)
+ 	dev_t dev;
+ 	struct uio *uio;
+ 	{
+ 	return(physio(cdevsw[major(dev)].d_strategy, (struct buf *)NULL, dev,
+ 		B_WRITE, uio));
+ 	}
*** /usr/src/sys/h/conf.h.old	Sat Apr 30 00:34:00 1988
--- /usr/src/sys/h/conf.h	Sun Sep 22 10:48:39 1991
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)conf.h	1.1 (2.10BSD Berkeley) 12/1/86
   */
  
  /*
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)conf.h	1.2 (2.11BSD Berkeley) 9/22/91
   */
  
  /*
***************
*** 41,46 ****
--- 41,47 ----
  	int	(*d_stop)();
  	struct tty *d_ttys;
  	int	(*d_select)();
+ 	int	(*d_strategy)();
  };
  #if defined(KERNEL) && !defined(SUPERVISOR)
  extern struct	cdevsw cdevsw[];
*** /usr/src/sys/pdp/conf.c.old	Sun Jul  1 15:33:05 1990
--- /usr/src/sys/pdp/conf.c	Sun Sep 22 11:33:53 1991
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)conf.c	1.1 (2.10BSD Berkeley) 12/1/86
   */
  
  #include "param.h"
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)conf.c	2.0 (2.11BSD Berkeley) 9/22/91
   */
  
  #include "param.h"
***************
*** 18,44 ****
  
  int	nulldev();
  int	nodev();
  
  #include "rk.h"
  #if NRK > 0
! int	rkopen(), rkstrategy(), rkread(), rkwrite();
  #define	rkclose		nulldev
  #else
  #define	rkopen		nodev
  #define	rkclose		nodev
  #define	rkstrategy	nodev
- #define	rkread		nodev
- #define	rkwrite		nodev
  #endif
  
  #include "tm.h"
  #if NTM > 0
! int	tmopen(), tmclose(), tmread(), tmwrite(), tmioctl(), tmstrategy();
  #else
  #define	tmopen		nodev
  #define	tmclose		nodev
- #define	tmread		nodev
- #define	tmwrite		nodev
  #define	tmioctl		nodev
  #define	tmstrategy	nodev
  #endif
--- 18,41 ----
  
  int	nulldev();
  int	nodev();
+ int	rawread(), rawwrite();
  
  #include "rk.h"
  #if NRK > 0
! int	rkopen(), rkstrategy();
  #define	rkclose		nulldev
  #else
  #define	rkopen		nodev
  #define	rkclose		nodev
  #define	rkstrategy	nodev
  #endif
  
  #include "tm.h"
  #if NTM > 0
! int	tmopen(), tmclose(), tmioctl(), tmstrategy();
  #else
  #define	tmopen		nodev
  #define	tmclose		nodev
  #define	tmioctl		nodev
  #define	tmstrategy	nodev
  #endif
***************
*** 45,51 ****
  
  #include "hk.h"
  #if NHK > 0
! int	hkopen(), hkstrategy(), hkread(), hkwrite(), hkroot();
  #define	hkclose		nulldev
  #else
  #define	hkopen		nodev
--- 42,48 ----
  
  #include "hk.h"
  #if NHK > 0
! int	hkopen(), hkstrategy(), hkroot();
  #define	hkclose		nulldev
  #else
  #define	hkopen		nodev
***************
*** 52,64 ****
  #define	hkclose		nodev
  #define	hkroot		nulldev
  #define	hkstrategy	nodev
- #define	hkread		nodev
- #define	hkwrite		nodev
  #endif
  
  #include "xp.h"
  #if NXPD > 0
! int	xpopen(), xpstrategy(), xpread(), xpwrite(), xproot();
  #define	xpclose		nulldev
  #else
  #define	xpopen		nodev
--- 49,59 ----
  #define	hkclose		nodev
  #define	hkroot		nulldev
  #define	hkstrategy	nodev
  #endif
  
  #include "xp.h"
  #if NXPD > 0
! int	xpopen(), xpstrategy(), xproot();
  #define	xpclose		nulldev
  #else
  #define	xpopen		nodev
***************
*** 65,77 ****
  #define	xpclose		nodev
  #define	xproot		nulldev
  #define	xpstrategy	nodev
- #define	xpread		nodev
- #define	xpwrite		nodev
  #endif
  
  #include "br.h"
  #if NBR > 0
! int	bropen(), brstrategy(), brread(), brwrite(), brroot();
  #define	brclose		nulldev
  #else
  #define	bropen		nodev
--- 60,70 ----
  #define	xpclose		nodev
  #define	xproot		nulldev
  #define	xpstrategy	nodev
  #endif
  
  #include "br.h"
  #if NBR > 0
! int	bropen(), brstrategy(), brroot();
  #define	brclose		nulldev
  #else
  #define	bropen		nodev
***************
*** 78,95 ****
  #define	brclose		nodev
  #define	brroot		nulldev
  #define	brstrategy	nodev
- #define	brread		nodev
- #define	brwrite		nodev
  #endif
  
  #include "ht.h"
  #if NHT > 0
! int	htopen(), htclose(), htread(), htwrite(), htstrategy(), htioctl();
  #else
  #define	htopen		nodev
  #define	htclose		nodev
- #define	htread		nodev
- #define	htwrite		nodev
  #define	htioctl		nodev
  #define	htstrategy	nodev
  #endif
--- 71,84 ----
  #define	brclose		nodev
  #define	brroot		nulldev
  #define	brstrategy	nodev
  #endif
  
  #include "ht.h"
  #if NHT > 0
! int	htopen(), htclose(), htstrategy(), htioctl();
  #else
  #define	htopen		nodev
  #define	htclose		nodev
  #define	htioctl		nodev
  #define	htstrategy	nodev
  #endif
***************
*** 96,102 ****
  
  #include "rl.h"
  #if NRL > 0
! int	rlopen(), rlstrategy(), rlread(), rlwrite(), rlroot();
  #define	rlclose		nulldev
  #else
  #define	rlroot		nulldev
--- 85,91 ----
  
  #include "rl.h"
  #if NRL > 0
! int	rlopen(), rlstrategy(), rlroot();
  #define	rlclose		nulldev
  #else
  #define	rlroot		nulldev
***************
*** 103,120 ****
  #define	rlopen		nodev
  #define	rlclose		nodev
  #define	rlstrategy	nodev
- #define	rlread		nodev
- #define	rlwrite		nodev
  #endif
  
  #include "ts.h"
  #if NTS > 0
! int	tsopen(), tsclose(), tsread(), tswrite(), tsstrategy(), tsioctl();
  #else
  #define	tsopen		nodev
  #define	tsclose		nodev
- #define	tsread		nodev
- #define	tswrite		nodev
  #define	tsioctl		nodev
  #define	tsstrategy	nodev
  #endif
--- 92,105 ----
  #define	rlopen		nodev
  #define	rlclose		nodev
  #define	rlstrategy	nodev
  #endif
  
  #include "ts.h"
  #if NTS > 0
! int	tsopen(), tsclose(), tsstrategy(), tsioctl();
  #else
  #define	tsopen		nodev
  #define	tsclose		nodev
  #define	tsioctl		nodev
  #define	tsstrategy	nodev
  #endif
***************
*** 121,132 ****
  
  #include "tms.h"
  #if NTMS > 0
! int	tmscpopen(), tmscpclose(), tmscpread(), tmscpwrite(), tmscpstrategy(), tmscpioctl();
  #else
  #define	tmscpopen	nodev
  #define	tmscpclose	nodev
- #define	tmscpread	nodev
- #define	tmscpwrite	nodev
  #define	tmscpioctl	nodev
  #define	tmscpstrategy	nodev
  #endif
--- 106,115 ----
  
  #include "tms.h"
  #if NTMS > 0
! int	tmscpopen(), tmscpclose(), tmscpstrategy(), tmscpioctl();
  #else
  #define	tmscpopen	nodev
  #define	tmscpclose	nodev
  #define	tmscpioctl	nodev
  #define	tmscpstrategy	nodev
  #endif
***************
*** 133,139 ****
  
  #include "si.h"
  #if NSI > 0
! int	siopen(), sistrategy(), siread(), siwrite(), siroot();
  #define	siclose		nulldev
  #else
  #define	siopen		nodev
--- 116,122 ----
  
  #include "si.h"
  #if NSI > 0
! int	siopen(), sistrategy(), siroot();
  #define	siclose		nulldev
  #else
  #define	siopen		nodev
***************
*** 140,152 ****
  #define	siclose		nodev
  #define	siroot		nulldev
  #define	sistrategy	nodev
- #define	siread		nodev
- #define	siwrite		nodev
  #endif
  
  #include "ra.h"
  #if NRAC > 0
! int	rastrategy(), raread(), rawrite(), raroot(), raopen();
  #define	raclose		nulldev
  #else
  #define	raopen		nodev
--- 123,133 ----
  #define	siclose		nodev
  #define	siroot		nulldev
  #define	sistrategy	nodev
  #endif
  
  #include "ra.h"
  #if NRAC > 0
! int	rastrategy(), raroot(), raopen();
  #define	raclose		nulldev
  #else
  #define	raopen		nodev
***************
*** 153,172 ****
  #define	raclose		nodev
  #define	raroot		nulldev
  #define	rastrategy	nodev
- #define	raread		nodev
- #define	rawrite		nodev
  #endif
  
  #include "rx.h"
  #if NRX > 0
! int	rxopen(), rxstrategy(), rxread(), rxwrite(), rxioctl();
  #define	rxclose		nulldev
  #else
  #define	rxopen		nodev
  #define	rxclose		nodev
  #define	rxstrategy	nodev
- #define	rxread		nodev
- #define	rxwrite		nodev
  #define	rxioctl		nodev
  #endif
  
--- 134,149 ----
  #define	raclose		nodev
  #define	raroot		nulldev
  #define	rastrategy	nodev
  #endif
  
  #include "rx.h"
  #if NRX > 0
! int	rxopen(), rxstrategy(), rxioctl();
  #define	rxclose		nulldev
  #else
  #define	rxopen		nodev
  #define	rxclose		nodev
  #define	rxstrategy	nodev
  #define	rxioctl		nodev
  #endif
  
***************
*** 274,286 ****
  
  #include "dr.h"
  #if NDR > 0
! int	dropen(), drclose(), drread(), drwrite(), drioctl();
  #else
  #define	dropen		nodev
  #define	drclose		nodev
- #define	drread		nodev
- #define	drwrite		nodev
  #define	drioctl		nodev
  #endif
  
  #include "dhu.h"
--- 251,262 ----
  
  #include "dr.h"
  #if NDR > 0
! int	dropen(), drclose(), drioctl(), drstrategy();
  #else
  #define	dropen		nodev
  #define	drclose		nodev
  #define	drioctl		nodev
+ #define	drstrategy	nodev
  #endif
  
  #include "dhu.h"
***************
*** 322,396 ****
  /* cn = 0 */
  	cnopen,		cnclose,	cnread,		cnwrite,
  	cnioctl,	nulldev,	cons,		ttselect,
  /* mem = 1 */
  	nulldev,	nulldev,	mmread,		mmwrite,
  	nodev,		nulldev,	0,		mmselect,
  /* dz = 2 */
  	dzopen,		dzclose,	dzread,		dzwrite,
  	dzioctl,	dzstop,		dz_tty,		ttselect,
  /* dh = 3 */
  	dhopen,		dhclose,	dhread,		dhwrite,
  	dhioctl,	dhstop,		dh11,		ttselect,
  /* dhu = 4 */
  	dhuopen,	dhuclose,	dhuread,	dhuwrite,
  	dhuioctl,	dhustop,	dhu_tty,	ttselect,
  /* lp = 5 */
  	lpopen,		lpclose,	nodev,		lpwrite,
  	nodev,		nulldev,	0,		nodev,
  /* ht = 6 */
! 	htopen,		htclose,	htread,		htwrite,
  	htioctl,	nulldev,	0,		seltrue,
  /* tm = 7 */
! 	tmopen,		tmclose,	tmread,		tmwrite,
  	tmioctl,	nulldev,	0,		seltrue,
  /* ts = 8 */
! 	tsopen,		tsclose,	tsread,		tswrite,
  	tsioctl,	nulldev,	0,		seltrue,
  /* tty = 9 */
  	syopen,		nulldev,	syread,		sywrite,
  	syioctl,	nulldev,	0,		syselect,
  /* ptc = 10 */
  	ptcopen,	ptcclose,	ptcread,	ptcwrite,
  	ptyioctl,	nulldev,	pt_tty,		ptcselect,
  /* pts = 11 */
  	ptsopen,	ptsclose,	ptsread,	ptswrite,
  	ptyioctl,	ptsstop,	pt_tty,		ttselect,
  /* dr = 12 */
! 	dropen,		drclose,	drread,		drwrite,
  	drioctl,	nulldev,	0,		seltrue,
  /* hk = 13 */
! 	hkopen,		hkclose,	hkread,		hkwrite,
  	nodev,		nulldev,	0,		seltrue,
  /* ra = 14 */
! 	raopen,		raclose,	raread,		rawrite,
  	nodev,		nulldev,	0,		seltrue,
  /* rk = 15 */
! 	rkopen,		rkclose,	rkread,		rkwrite,
  	nodev,		nulldev,	0,		seltrue,
  /* rl = 16 */
! 	rlopen,		rlclose,	rlread,		rlwrite,
  	nodev,		nulldev,	0,		seltrue,
  /* rx = 17 */
! 	rxopen,		rxclose,	rxread,		rxwrite,
  	rxioctl,	nulldev,	0,		seltrue,
  /* si = 18 */
! 	siopen,		siclose,	siread,		siwrite,
  	nodev,		nulldev,	0,		seltrue,
  /* xp = 19 */
! 	xpopen,		xpclose,	xpread,		xpwrite,
  	nodev,		nulldev,	0,		seltrue,
  /* br = 20 */
! 	bropen,		brclose,	brread,		brwrite,
  	nodev,		nulldev,	0,		seltrue,
  /* dn = 21 */
  	dnopen,		dnclose,	dnread,		dnwrite,
  	dnioctl,	nulldev,	0,		seltrue,
  /* log = 22 */
  	logopen,	logclose,	logread,	nodev,
  	logioctl,	nulldev,	0,		logselect,
  /* tmscp = 23 (tu81/tk50) */
! 	tmscpopen,	tmscpclose,	tmscpread,	tmscpwrite,
  	tmscpioctl,	nulldev,	0,		seltrue,
  };
  
  int	nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]);
--- 298,396 ----
  /* cn = 0 */
  	cnopen,		cnclose,	cnread,		cnwrite,
  	cnioctl,	nulldev,	cons,		ttselect,
+ 	nulldev,
  /* mem = 1 */
  	nulldev,	nulldev,	mmread,		mmwrite,
  	nodev,		nulldev,	0,		mmselect,
+ 	nulldev,
  /* dz = 2 */
  	dzopen,		dzclose,	dzread,		dzwrite,
  	dzioctl,	dzstop,		dz_tty,		ttselect,
+ 	nulldev,
  /* dh = 3 */
  	dhopen,		dhclose,	dhread,		dhwrite,
  	dhioctl,	dhstop,		dh11,		ttselect,
+ 	nulldev,
  /* dhu = 4 */
  	dhuopen,	dhuclose,	dhuread,	dhuwrite,
  	dhuioctl,	dhustop,	dhu_tty,	ttselect,
+ 	nulldev,
  /* lp = 5 */
  	lpopen,		lpclose,	nodev,		lpwrite,
  	nodev,		nulldev,	0,		nodev,
+ 	nulldev,
  /* ht = 6 */
! 	htopen,		htclose,	rawread,	rawwrite,
  	htioctl,	nulldev,	0,		seltrue,
+ 	htstrategy,
  /* tm = 7 */
! 	tmopen,		tmclose,	rawread,	rawwrite,
  	tmioctl,	nulldev,	0,		seltrue,
+ 	tmstrategy,
  /* ts = 8 */
! 	tsopen,		tsclose,	rawread,	rawwrite,
  	tsioctl,	nulldev,	0,		seltrue,
+ 	tsstrategy,
  /* tty = 9 */
  	syopen,		nulldev,	syread,		sywrite,
  	syioctl,	nulldev,	0,		syselect,
+ 	nulldev,
  /* ptc = 10 */
  	ptcopen,	ptcclose,	ptcread,	ptcwrite,
  	ptyioctl,	nulldev,	pt_tty,		ptcselect,
+ 	nulldev,
  /* pts = 11 */
  	ptsopen,	ptsclose,	ptsread,	ptswrite,
  	ptyioctl,	ptsstop,	pt_tty,		ttselect,
+ 	nulldev,
  /* dr = 12 */
! 	dropen,		drclose,	rawread,	rawwrite,
  	drioctl,	nulldev,	0,		seltrue,
+ 	drstrategy,
  /* hk = 13 */
! 	hkopen,		hkclose,	rawread,	rawwrite,
  	nodev,		nulldev,	0,		seltrue,
+ 	hkstrategy,
  /* ra = 14 */
! 	raopen,		raclose,	rawread,	rawwrite,
  	nodev,		nulldev,	0,		seltrue,
+ 	rastrategy,
  /* rk = 15 */
! 	rkopen,		rkclose,	rawread,	rawwrite,
  	nodev,		nulldev,	0,		seltrue,
+ 	rkstrategy,
  /* rl = 16 */
! 	rlopen,		rlclose,	rawread,	rawwrite,
  	nodev,		nulldev,	0,		seltrue,
+ 	rlstrategy,
  /* rx = 17 */
! 	rxopen,		rxclose,	rawread,	rawwrite,
  	rxioctl,	nulldev,	0,		seltrue,
+ 	rxstrategy,
  /* si = 18 */
! 	siopen,		siclose,	rawread,	rawwrite,
  	nodev,		nulldev,	0,		seltrue,
+ 	sistrategy,
  /* xp = 19 */
! 	xpopen,		xpclose,	rawread,	rawwrite,
  	nodev,		nulldev,	0,		seltrue,
+ 	xpstrategy,
  /* br = 20 */
! 	bropen,		brclose,	rawread,	rawwrite,
  	nodev,		nulldev,	0,		seltrue,
+ 	brstrategy,
  /* dn = 21 */
  	dnopen,		dnclose,	dnread,		dnwrite,
  	dnioctl,	nulldev,	0,		seltrue,
+ 	nulldev,
  /* log = 22 */
  	logopen,	logclose,	logread,	nodev,
  	logioctl,	nulldev,	0,		logselect,
+ 	nulldev,
  /* tmscp = 23 (tu81/tk50) */
! 	tmscpopen,	tmscpclose,	rawread,	rawwrite,
  	tmscpioctl,	nulldev,	0,		seltrue,
+ 	tmscpstrategy,
  };
  
  int	nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]);
