Make each disk and tape driver define its own read and write functions.

Deprecate rawread() and rawwrite() completely.  Remove d_strategy from cdevsw to
force the abstraction barrier.
This commit is contained in:
mycroft 1995-07-04 07:15:28 +00:00
parent 9fbf4d6f47
commit 7263209ce6
26 changed files with 398 additions and 262 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: conf.c,v 1.6 1995/06/28 02:45:00 cgd Exp $ */ /* $NetBSD: conf.c,v 1.7 1995/07/04 07:15:28 mycroft Exp $ */
/*- /*-
* Copyright (c) 1991 The Regents of the University of California. * Copyright (c) 1991 The Regents of the University of California.
@ -43,9 +43,6 @@
#include <sys/conf.h> #include <sys/conf.h>
#include <sys/vnode.h> #include <sys/vnode.h>
int rawread __P((dev_t, struct uio *, int));
int rawwrite __P((dev_t, struct uio *, int));
void swstrategy __P((struct buf *));
int ttselect __P((dev_t, int, struct proc *)); int ttselect __P((dev_t, int, struct proc *));
#ifndef LKM #ifndef LKM
@ -54,6 +51,7 @@ int ttselect __P((dev_t, int, struct proc *));
int lkmenodev(); int lkmenodev();
#endif #endif
bdev_decl(sw);
#include "st.h" #include "st.h"
bdev_decl(st); bdev_decl(st);
#include "cd.h" #include "cd.h"
@ -66,7 +64,7 @@ bdev_decl(vnd);
struct bdevsw bdevsw[] = struct bdevsw bdevsw[] =
{ {
bdev_notdef(), /* 0 */ bdev_notdef(), /* 0 */
bdev_swap_init(), /* 1: swap pseudo-device */ bdev_swap_init(1,sw), /* 1: swap pseudo-device */
bdev_tape_init(NST,st), /* 2: SCSI tape */ bdev_tape_init(NST,st), /* 2: SCSI tape */
bdev_disk_init(NCD,cd), /* 3: SCSI CD-ROM */ bdev_disk_init(NCD,cd), /* 3: SCSI CD-ROM */
bdev_notdef(), /* 4 */ bdev_notdef(), /* 4 */
@ -89,6 +87,7 @@ cdev_decl(ctty);
#define mmread mmrw #define mmread mmrw
#define mmwrite mmrw #define mmwrite mmrw
cdev_decl(mm); cdev_decl(mm);
cdev_decl(sw);
#include "pty.h" #include "pty.h"
#define ptstty ptytty #define ptstty ptytty
#define ptsioctl ptyioctl #define ptsioctl ptyioctl

View File

@ -1,4 +1,4 @@
/* $NetBSD: conf.c,v 1.29 1995/06/26 02:34:01 chopps Exp $ */ /* $NetBSD: conf.c,v 1.30 1995/07/04 07:15:42 mycroft Exp $ */
/*- /*-
* Copyright (c) 1991 The Regents of the University of California. * Copyright (c) 1991 The Regents of the University of California.
@ -48,9 +48,6 @@
#include <sys/bankeddev.h> #include <sys/bankeddev.h>
#endif #endif
int rawread __P((dev_t, struct uio *, int));
int rawwrite __P((dev_t, struct uio *, int));
void swstrategy __P((struct buf *));
int ttselect __P((dev_t, int, struct proc *)); int ttselect __P((dev_t, int, struct proc *));
#ifndef LKM #ifndef LKM
@ -59,6 +56,7 @@ int ttselect __P((dev_t, int, struct proc *));
int lkmenodev(); int lkmenodev();
#endif #endif
bdev_decl(sw);
#include "vnd.h" #include "vnd.h"
bdev_decl(vnd); bdev_decl(vnd);
#include "sd.h" #include "sd.h"
@ -79,7 +77,7 @@ struct bdevsw bdevsw[] =
#define fdopen Fdopen /* conflicts with fdopen() in kern_descrip.c */ #define fdopen Fdopen /* conflicts with fdopen() in kern_descrip.c */
bdev_disk_init(NFD,fd), /* 2: floppy disk */ bdev_disk_init(NFD,fd), /* 2: floppy disk */
#undef fdopen #undef fdopen
bdev_swap_init(), /* 3: swap pseudo-device */ bdev_swap_init(1,sw), /* 3: swap pseudo-device */
bdev_disk_init(NSD,sd), /* 4: SCSI disk */ bdev_disk_init(NSD,sd), /* 4: SCSI disk */
bdev_tape_init(NST,st), /* 5: SCSI tape */ bdev_tape_init(NST,st), /* 5: SCSI tape */
bdev_disk_init(NVND,vnd), /* 6: vnode disk driver */ bdev_disk_init(NVND,vnd), /* 6: vnode disk driver */
@ -98,28 +96,28 @@ int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]);
#define cdev_grf_init(c,n) { \ #define cdev_grf_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) nullop, \ dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) nullop, \
(dev_type_write((*))) nullop, dev_init(c,n,ioctl), \ (dev_type_write((*))) nullop, dev_init(c,n,ioctl), \
(dev_type_stop((*))) enodev, 0, \ (dev_type_stop((*))) enodev, 0, dev_init(c,n,select), \
dev_init(c,n,select), dev_init(c,n,mmap), 0 } dev_init(c,n,mmap) }
/* open, close, ioctl, select, mmap -- XXX should be a map device */ /* open, close, ioctl, select, mmap -- XXX should be a map device */
#define cdev_view_init(c,n) { \ #define cdev_view_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) nullop, \ dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) nullop, \
(dev_type_write((*))) nullop, dev_init(c,n,ioctl), \ (dev_type_write((*))) nullop, dev_init(c,n,ioctl), \
(dev_type_stop((*))) enodev, 0, \ (dev_type_stop((*))) enodev, 0, dev_init(c,n,select), \
dev_init(c,n,select), dev_init(c,n,mmap), 0 } dev_init(c,n,mmap) }
/* open, close, read, write, ioctl -- XXX should be a generic device */ /* open, close, read, write, ioctl -- XXX should be a generic device */
#define cdev_par_init(c,n) { \ #define cdev_par_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \ dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) enodev, \ dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) enodev, \
0, (dev_type_select((*))) enodev, \ 0, (dev_type_select((*))) enodev, (dev_type_mmap((*))) enodev }
(dev_type_mmap((*))) enodev, 0 }
cdev_decl(cn); cdev_decl(cn);
cdev_decl(ctty); cdev_decl(ctty);
#define mmread mmrw #define mmread mmrw
#define mmwrite mmrw #define mmwrite mmrw
cdev_decl(mm); cdev_decl(mm);
cdev_decl(sw);
#include "pty.h" #include "pty.h"
#define ptstty ptytty #define ptstty ptytty
#define ptsioctl ptyioctl #define ptsioctl ptyioctl

View File

@ -1,4 +1,4 @@
/* $NetBSD: conf.c,v 1.7 1995/06/25 19:06:46 leo Exp $ */ /* $NetBSD: conf.c,v 1.8 1995/07/04 07:15:53 mycroft Exp $ */
/* /*
* Copyright (c) 1991 The Regents of the University of California. * Copyright (c) 1991 The Regents of the University of California.
@ -48,9 +48,6 @@
#include <sys/bankeddev.h> #include <sys/bankeddev.h>
#endif #endif
int rawread __P((dev_t, struct uio *, int));
int rawwrite __P((dev_t, struct uio *, int));
void swstrategy __P((struct buf *));
int ttselect __P((dev_t, int, struct proc *)); int ttselect __P((dev_t, int, struct proc *));
#ifndef LKM #ifndef LKM
@ -71,6 +68,7 @@ bdev_decl(rd);
#define fdopen Fdopen /* conflicts with fdopen() in kern_descrip.c */ #define fdopen Fdopen /* conflicts with fdopen() in kern_descrip.c */
bdev_decl(fd); bdev_decl(fd);
#undef fdopen #undef fdopen
bdev_decl(sw);
#include "sd.h" #include "sd.h"
bdev_decl(sd); bdev_decl(sd);
#include "st.h" #include "st.h"
@ -85,7 +83,7 @@ struct bdevsw bdevsw[] =
#define fdopen Fdopen /* conflicts with fdopen() in kern_descrip.c */ #define fdopen Fdopen /* conflicts with fdopen() in kern_descrip.c */
bdev_disk_init(NFD,fd), /* 2: floppy disk */ bdev_disk_init(NFD,fd), /* 2: floppy disk */
#undef fdopen #undef fdopen
bdev_swap_init(), /* 3: swap pseudo-device */ bdev_swap_init(1,sw), /* 3: swap pseudo-device */
bdev_disk_init(NSD,sd), /* 4: SCSI disk */ bdev_disk_init(NSD,sd), /* 4: SCSI disk */
bdev_tape_init(NST,st), /* 5: SCSI tape */ bdev_tape_init(NST,st), /* 5: SCSI tape */
bdev_disk_init(NCD,cd), /* 6: SCSI CD-ROM */ bdev_disk_init(NCD,cd), /* 6: SCSI CD-ROM */
@ -103,20 +101,21 @@ int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]);
dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) nullop, \ dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) nullop, \
(dev_type_write((*))) nullop, dev_init(c,n,ioctl), \ (dev_type_write((*))) nullop, dev_init(c,n,ioctl), \
(dev_type_stop((*))) enodev, (dev_type_tty((*))) nullop, \ (dev_type_stop((*))) enodev, (dev_type_tty((*))) nullop, \
dev_init(c,n,select), dev_init(c,n,mmap), 0 } dev_init(c,n,select), dev_init(c,n,mmap) }
/* open, close, ioctl, select, mmap -- XXX should be a map device */ /* open, close, ioctl, select, mmap -- XXX should be a map device */
#define cdev_view_init(c,n) { \ #define cdev_view_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) nullop, \ dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) nullop, \
(dev_type_write((*))) nullop, dev_init(c,n,ioctl), \ (dev_type_write((*))) nullop, dev_init(c,n,ioctl), \
(dev_type_stop((*))) enodev, (dev_type_tty((*))) nullop, \ (dev_type_stop((*))) enodev, (dev_type_tty((*))) nullop, \
dev_init(c,n,select), dev_init(c,n,mmap), 0 } dev_init(c,n,select), dev_init(c,n,mmap) }
cdev_decl(cn); cdev_decl(cn);
cdev_decl(ctty); cdev_decl(ctty);
#define mmread mmrw #define mmread mmrw
#define mmwrite mmrw #define mmwrite mmrw
cdev_decl(mm); cdev_decl(mm);
cdev_decl(sw);
#include "pty.h" #include "pty.h"
#define ptstty ptytty #define ptstty ptytty
#define ptsioctl ptyioctl #define ptsioctl ptyioctl

View File

@ -1,4 +1,4 @@
/* $NetBSD: conf.c,v 1.28 1995/04/19 22:37:27 mycroft Exp $ */ /* $NetBSD: conf.c,v 1.29 1995/07/04 07:16:04 mycroft Exp $ */
/*- /*-
* Copyright (c) 1991 The Regents of the University of California. * Copyright (c) 1991 The Regents of the University of California.
@ -43,9 +43,6 @@
#include <sys/conf.h> #include <sys/conf.h>
#include <sys/vnode.h> #include <sys/vnode.h>
int rawread __P((dev_t, struct uio *, int));
int rawwrite __P((dev_t, struct uio *, int));
void swstrategy __P((struct buf *));
int ttselect __P((dev_t, int, struct proc *)); int ttselect __P((dev_t, int, struct proc *));
#ifndef LKM #ifndef LKM
@ -60,6 +57,7 @@ bdev_decl(ct);
bdev_decl(mt); bdev_decl(mt);
#include "rd.h" #include "rd.h"
bdev_decl(rd); bdev_decl(rd);
bdev_decl(sw);
#include "sd.h" #include "sd.h"
bdev_decl(sd); bdev_decl(sd);
#include "ccd.h" #include "ccd.h"
@ -74,7 +72,7 @@ struct bdevsw bdevsw[] =
bdev_tape_init(NCT,ct), /* 0: cs80 cartridge tape */ bdev_tape_init(NCT,ct), /* 0: cs80 cartridge tape */
bdev_tape_init(NMT,mt), /* 1: magnetic reel tape */ bdev_tape_init(NMT,mt), /* 1: magnetic reel tape */
bdev_disk_init(NRD,rd), /* 2: HPIB disk */ bdev_disk_init(NRD,rd), /* 2: HPIB disk */
bdev_swap_init(), /* 3: swap pseudo-device */ bdev_swap_init(1,sw), /* 3: swap pseudo-device */
bdev_disk_init(NSD,sd), /* 4: SCSI disk */ bdev_disk_init(NSD,sd), /* 4: SCSI disk */
bdev_disk_init(NCCD,ccd), /* 5: concatenated disk driver */ bdev_disk_init(NCCD,ccd), /* 5: concatenated disk driver */
bdev_disk_init(NVND,vnd), /* 6: vnode disk driver */ bdev_disk_init(NVND,vnd), /* 6: vnode disk driver */
@ -93,26 +91,27 @@ int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]);
dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) nullop, \ dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) nullop, \
(dev_type_write((*))) nullop, dev_init(c,n,ioctl), \ (dev_type_write((*))) nullop, dev_init(c,n,ioctl), \
(dev_type_stop((*))) enodev, 0, dev_init(c,n,select), \ (dev_type_stop((*))) enodev, 0, dev_init(c,n,select), \
dev_init(c,n,mmap), 0 } dev_init(c,n,mmap) }
/* open, close, read, write, ioctl -- XXX should be a generic device */ /* open, close, read, write, ioctl -- XXX should be a generic device */
#define cdev_ppi_init(c,n) { \ #define cdev_ppi_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \ dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) nullop, \ dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) nullop, \
0, (dev_type_select((*))) enodev, (dev_type_mmap((*))) enodev, 0 } 0, (dev_type_select((*))) enodev, (dev_type_mmap((*))) enodev }
/* open, close, read, ioctl, select, mmap -- XXX should be a map device */ /* open, close, read, ioctl, select, mmap -- XXX should be a map device */
#define cdev_hil_init(c,n) { \ #define cdev_hil_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \ dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
(dev_type_write((*))) nullop, dev_init(c,n,ioctl), \ (dev_type_write((*))) nullop, dev_init(c,n,ioctl), \
(dev_type_stop((*))) enodev, 0, dev_init(c,n,select), \ (dev_type_stop((*))) enodev, 0, dev_init(c,n,select), \
dev_init(c,n,mmap), 0 } dev_init(c,n,mmap) }
cdev_decl(cn); cdev_decl(cn);
cdev_decl(ctty); cdev_decl(ctty);
#define mmread mmrw #define mmread mmrw
#define mmwrite mmrw #define mmwrite mmrw
cdev_decl(mm); cdev_decl(mm);
cdev_decl(sw);
#include "pty.h" #include "pty.h"
#define ptstty ptytty #define ptstty ptytty
#define ptsioctl ptyioctl #define ptsioctl ptyioctl

View File

@ -1,4 +1,4 @@
/* $NetBSD: conf.c,v 1.65 1995/04/19 22:35:40 mycroft Exp $ */ /* $NetBSD: conf.c,v 1.66 1995/07/04 07:16:21 mycroft Exp $ */
/* /*
* Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved. * Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved.
@ -37,9 +37,6 @@
#include <sys/conf.h> #include <sys/conf.h>
#include <sys/vnode.h> #include <sys/vnode.h>
int rawread __P((dev_t, struct uio *, int));
int rawwrite __P((dev_t, struct uio *, int));
void swstrategy __P((struct buf *));
int ttselect __P((dev_t, int, struct proc *)); int ttselect __P((dev_t, int, struct proc *));
#ifndef LKM #ifndef LKM
@ -50,6 +47,7 @@ int lkmenodev();
#include "wdc.h" #include "wdc.h"
bdev_decl(wd); bdev_decl(wd);
bdev_decl(sw);
#include "fdc.h" #include "fdc.h"
#define fdopen Fdopen /* conflicts with fdopen() in kern_descrip.c */ #define fdopen Fdopen /* conflicts with fdopen() in kern_descrip.c */
bdev_decl(fd); bdev_decl(fd);
@ -72,7 +70,7 @@ bdev_decl(scd);
struct bdevsw bdevsw[] = struct bdevsw bdevsw[] =
{ {
bdev_disk_init(NWDC,wd), /* 0: ST506/ESDI/IDE disk */ bdev_disk_init(NWDC,wd), /* 0: ST506/ESDI/IDE disk */
bdev_swap_init(), /* 1: swap pseudo-device */ bdev_swap_init(1,sw), /* 1: swap pseudo-device */
#define fdopen Fdopen #define fdopen Fdopen
bdev_disk_init(NFDC,fd), /* 2: floppy diskette */ bdev_disk_init(NFDC,fd), /* 2: floppy diskette */
#undef fdopen #undef fdopen
@ -96,19 +94,19 @@ int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]);
#define cdev_pc_init(c,n) { \ #define cdev_pc_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \ dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
dev_init(c,n,write), dev_init(c,n,ioctl), dev_init(c,n,stop), \ dev_init(c,n,write), dev_init(c,n,ioctl), dev_init(c,n,stop), \
dev_init(c,n,tty), ttselect, dev_init(c,n,mmap), 0, D_TTY } dev_init(c,n,tty), ttselect, dev_init(c,n,mmap), D_TTY }
/* open, close, write, ioctl */ /* open, close, write, ioctl */
#define cdev_lpt_init(c,n) { \ #define cdev_lpt_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \ dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) enodev, \ dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) enodev, \
0, seltrue, (dev_type_mmap((*))) enodev, 0 } 0, seltrue, (dev_type_mmap((*))) enodev }
/* open, close, write, ioctl */ /* open, close, write, ioctl */
#define cdev_spkr_init(c,n) { \ #define cdev_spkr_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \ dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) enodev, \ dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) enodev, \
0, seltrue, (dev_type_mmap((*))) enodev, 0 } 0, seltrue, (dev_type_mmap((*))) enodev }
cdev_decl(cn); cdev_decl(cn);
cdev_decl(ctty); cdev_decl(ctty);
@ -116,6 +114,7 @@ cdev_decl(ctty);
#define mmwrite mmrw #define mmwrite mmrw
cdev_decl(mm); cdev_decl(mm);
cdev_decl(wd); cdev_decl(wd);
cdev_decl(sw);
#include "pty.h" #include "pty.h"
#define ptstty ptytty #define ptstty ptytty
#define ptsioctl ptyioctl #define ptsioctl ptyioctl

View File

@ -1,4 +1,4 @@
/* $NetBSD: fd.c,v 1.77 1995/06/28 04:30:54 cgd Exp $ */ /* $NetBSD: fd.c,v 1.78 1995/07/04 07:23:09 mycroft Exp $ */
/*- /*-
* Copyright (c) 1993, 1994, 1995 Charles Hannum. * Copyright (c) 1993, 1994, 1995 Charles Hannum.
@ -566,6 +566,24 @@ fdfinish(fd, bp)
fdc->sc_state = DEVIDLE; fdc->sc_state = DEVIDLE;
} }
int
fdread(dev, uio)
dev_t dev;
struct uio *uio;
{
return (physio(fdstrategy, NULL, dev, B_READ, minphys, uio));
}
int
fdwrite(dev, uio)
dev_t dev;
struct uio *uio;
{
return (physio(fdstrategy, NULL, dev, B_WRITE, minphys, uio));
}
void void
fd_set_motor(fdc, reset) fd_set_motor(fdc, reset)
struct fdc_softc *fdc; struct fdc_softc *fdc;

View File

@ -1,4 +1,4 @@
/* $NetBSD: conf.c,v 1.26 1995/04/20 15:30:22 briggs Exp $ */ /* $NetBSD: conf.c,v 1.27 1995/07/04 07:16:37 mycroft Exp $ */
/* /*
* Copyright (c) 1990 The Regents of the University of California. * Copyright (c) 1990 The Regents of the University of California.
@ -79,11 +79,9 @@
#include <sys/vnode.h> #include <sys/vnode.h>
#include <dev/cons.h> #include <dev/cons.h>
int rawread __P((dev_t, struct uio *, int));
int rawwrite __P((dev_t, struct uio *, int));
void swstrategy __P((struct buf *));
int ttselect __P((dev_t, int, struct proc *)); int ttselect __P((dev_t, int, struct proc *));
bdev_decl(sw);
#include "st.h" #include "st.h"
bdev_decl(st); bdev_decl(st);
#include "sd.h" #include "sd.h"
@ -106,7 +104,7 @@ struct bdevsw bdevsw[] =
bdev_notdef(), /* 0 */ bdev_notdef(), /* 0 */
bdev_notdef(), /* 1 */ bdev_notdef(), /* 1 */
bdev_notdef(), /* 2 */ bdev_notdef(), /* 2 */
bdev_swap_init(), /* 3: swap pseudo-device */ bdev_swap_init(1,sw), /* 3: swap pseudo-device */
bdev_disk_init(NSD,sd), /* 4: SCSI disk */ bdev_disk_init(NSD,sd), /* 4: SCSI disk */
bdev_tape_init(NST,st), /* 5: SCSI tape */ bdev_tape_init(NST,st), /* 5: SCSI tape */
bdev_disk_init(NCD,cd), /* 6: SCSI CD-ROM */ bdev_disk_init(NCD,cd), /* 6: SCSI CD-ROM */
@ -126,8 +124,8 @@ int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]);
#define cdev_grf_init(c,n) { \ #define cdev_grf_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) nullop, \ dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) nullop, \
(dev_type_write((*))) nullop, dev_init(c,n,ioctl), \ (dev_type_write((*))) nullop, dev_init(c,n,ioctl), \
(dev_type_stop((*))) enodev, 0, \ (dev_type_stop((*))) enodev, 0, dev_init(c,n,select), \
dev_init(c,n,select), dev_init(c,n,mmap), 0 } dev_init(c,n,mmap) }
cdev_decl(cn); cdev_decl(cn);
cdev_decl(ctty); cdev_decl(ctty);
@ -137,6 +135,7 @@ cdev_decl(ite);
#define mmread mmrw #define mmread mmrw
#define mmwrite mmrw #define mmwrite mmrw
cdev_decl(mm); cdev_decl(mm);
cdev_decl(sw);
#include "pty.h" #include "pty.h"
#define ptstty ptytty #define ptstty ptytty
#define ptsioctl ptyioctl #define ptsioctl ptyioctl

View File

@ -1,4 +1,4 @@
/* $NetBSD: conf.c,v 1.23 1995/04/27 07:16:31 phil Exp $ */ /* $NetBSD: conf.c,v 1.24 1995/07/04 07:16:51 mycroft Exp $ */
/*- /*-
* Copyright (c) 1991 The Regents of the University of California. * Copyright (c) 1991 The Regents of the University of California.
@ -43,9 +43,6 @@
#include <sys/conf.h> #include <sys/conf.h>
#include <sys/vnode.h> #include <sys/vnode.h>
int rawread __P((dev_t, struct uio *, int));
int rawwrite __P((dev_t, struct uio *, int));
void swstrategy __P((struct buf *));
int ttselect __P((dev_t, int, struct proc *)); int ttselect __P((dev_t, int, struct proc *));
#define bdev_rd_init(c,n) { \ #define bdev_rd_init(c,n) { \
@ -55,6 +52,7 @@ int ttselect __P((dev_t, int, struct proc *));
#include "sd.h" #include "sd.h"
bdev_decl(sd); bdev_decl(sd);
bdev_decl(sw);
#include "st.h" #include "st.h"
bdev_decl(st); bdev_decl(st);
#ifdef RAMD_SIZE #ifdef RAMD_SIZE
@ -71,7 +69,7 @@ bdev_decl(vnd);
struct bdevsw bdevsw[] = struct bdevsw bdevsw[] =
{ {
bdev_disk_init(NSD,sd), /* 0: SCSI disk */ bdev_disk_init(NSD,sd), /* 0: SCSI disk */
bdev_swap_init(), /* 1: swap pseudo-device */ bdev_swap_init(1,sw), /* 1: swap pseudo-device */
bdev_tape_init(NST,st), /* 2: SCSI tape */ bdev_tape_init(NST,st), /* 2: SCSI tape */
bdev_rd_init(NRD,rd), /* 3: ram disk */ bdev_rd_init(NRD,rd), /* 3: ram disk */
bdev_disk_init(NCD,cd), /* 4: SCSI CD-ROM */ bdev_disk_init(NCD,cd), /* 4: SCSI CD-ROM */
@ -84,7 +82,7 @@ int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]);
dev_init(c,n,open), dev_init(c,n,close), \ dev_init(c,n,open), dev_init(c,n,close), \
(dev_type_read((*))) enodev, dev_init(c,n,write), \ (dev_type_read((*))) enodev, dev_init(c,n,write), \
dev_init(c,n,ioctl), (dev_type_stop((*))) enodev, \ dev_init(c,n,ioctl), (dev_type_stop((*))) enodev, \
0, seltrue, (dev_type_mmap((*))) enodev, 0, 0} 0, seltrue, (dev_type_mmap((*))) enodev, 0}
cdev_decl(cn); cdev_decl(cn);
cdev_decl(ctty); cdev_decl(ctty);
@ -92,6 +90,7 @@ cdev_decl(ctty);
#define mmwrite mmrw #define mmwrite mmrw
cdev_decl(mm); cdev_decl(mm);
cdev_decl(sd); cdev_decl(sd);
cdev_decl(sw);
#include "pty.h" #include "pty.h"
#define ptstty ptytty #define ptstty ptytty
#define ptsioctl ptyioctl #define ptsioctl ptyioctl

View File

@ -1,4 +1,4 @@
/* $NetBSD: conf.c,v 1.14 1995/04/21 01:21:06 mellon Exp $ */ /* $NetBSD: conf.c,v 1.15 1995/07/04 07:17:00 mycroft Exp $ */
/* /*
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
@ -46,13 +46,11 @@
#include <sys/conf.h> #include <sys/conf.h>
#include <sys/vnode.h> #include <sys/vnode.h>
int rawread __P((dev_t, struct uio *, int));
int rawwrite __P((dev_t, struct uio *, int));
void swstrategy __P((struct buf *));
int ttselect __P((dev_t, int, struct proc *)); int ttselect __P((dev_t, int, struct proc *));
#include "vnd.h" #include "vnd.h"
bdev_decl(vnd); bdev_decl(vnd);
bdev_decl(sw);
#include "rz.h" #include "rz.h"
bdev_decl(rz); bdev_decl(rz);
@ -62,7 +60,7 @@ struct bdevsw bdevsw[] =
bdev_notdef(), /* 1: vax ht */ bdev_notdef(), /* 1: vax ht */
bdev_disk_init(NVND,vnd), /* 2: vnode disk driver */ bdev_disk_init(NVND,vnd), /* 2: vnode disk driver */
bdev_notdef(), /* 3: vax rk*/ bdev_notdef(), /* 3: vax rk*/
bdev_swap_init(), /* 4: swap pseudo-device*/ bdev_swap_init(1,sw), /* 4: swap pseudo-device*/
bdev_notdef(), /* 5: vax tm */ bdev_notdef(), /* 5: vax tm */
bdev_notdef(), /* 6: vax ts */ bdev_notdef(), /* 6: vax ts */
bdev_notdef(), /* 7: vax mt */ bdev_notdef(), /* 7: vax mt */
@ -86,6 +84,7 @@ struct bdevsw bdevsw[] =
int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]); int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]);
cdev_decl(cn); cdev_decl(cn);
cdev_decl(sw);
cdev_decl(ctty); cdev_decl(ctty);
#define mmread mmrw #define mmread mmrw
#define mmwrite mmrw #define mmwrite mmrw

View File

@ -1,4 +1,4 @@
/* $NetBSD: conf.c,v 1.31 1995/07/02 06:13:27 christos Exp $ */ /* $NetBSD: conf.c,v 1.32 1995/07/04 07:17:06 mycroft Exp $ */
/* /*
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
@ -52,9 +52,6 @@
#include <sys/tty.h> #include <sys/tty.h>
#include <sys/conf.h> #include <sys/conf.h>
int rawread __P((dev_t, struct uio *, int));
int rawwrite __P((dev_t, struct uio *, int));
void swstrategy __P((struct buf *));
int ttselect __P((dev_t, int, struct proc *)); int ttselect __P((dev_t, int, struct proc *));
#ifdef LKM #ifdef LKM
@ -63,6 +60,7 @@ int lkmenodev();
#define lkmenodev enodev #define lkmenodev enodev
#endif #endif
bdev_decl(sw);
#include "sd.h" #include "sd.h"
bdev_decl(sd); bdev_decl(sd);
#include "xd.h" #include "xd.h"
@ -83,7 +81,7 @@ struct bdevsw bdevsw[] =
bdev_notdef(), /* 0 */ bdev_notdef(), /* 0 */
bdev_notdef(), /* 1 */ bdev_notdef(), /* 1 */
bdev_notdef(), /* 2 */ bdev_notdef(), /* 2 */
bdev_swap_init(), /* 3 */ bdev_swap_init(1,sw), /* 3 */
bdev_notdef(), /* 4 */ bdev_notdef(), /* 4 */
bdev_notdef(), /* 5 */ bdev_notdef(), /* 5 */
bdev_notdef(), /* 6 */ bdev_notdef(), /* 6 */
@ -113,21 +111,22 @@ int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]);
/* open, close, read, write, ioctl, select */ /* open, close, read, write, ioctl, select */
#define cdev_gen_init(c,n) { \ #define cdev_gen_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \ dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
dev_init(c,n,write), dev_init(c,n,ioctl), 0, 0, \ dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) nullop, \
dev_init(c,n,select), 0, 0 } 0, dev_init(c,n,select), (dev_type_mmap((*))) enodev }
/* open, close, ioctl */ /* open, close, ioctl */
#define cdev_openprom_init(c,n) { \ #define cdev_openprom_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \ dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
(dev_type_write((*))) enodev, dev_init(c,n,ioctl), \ (dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
(dev_type_stop((*))) nullop, 0, (dev_type_select((*))) enodev, \ (dev_type_stop((*))) nullop, 0, (dev_type_select((*))) enodev, \
(dev_type_mmap((*))) enodev, 0 } (dev_type_mmap((*))) enodev }
cdev_decl(cn); cdev_decl(cn);
cdev_decl(ctty); cdev_decl(ctty);
#define mmread mmrw #define mmread mmrw
#define mmwrite mmrw #define mmwrite mmrw
cdev_decl(mm); cdev_decl(mm);
cdev_decl(sw);
#include "zs.h" #include "zs.h"
cdev_decl(zs); cdev_decl(zs);
cdev_decl(ms); cdev_decl(ms);

View File

@ -1,4 +1,4 @@
/* $NetBSD: conf.c,v 1.40 1995/04/26 23:24:13 gwr Exp $ */ /* $NetBSD: conf.c,v 1.41 1995/07/04 07:17:14 mycroft Exp $ */
/*- /*-
* Copyright (c) 1994 Adam Glass, Gordon W. Ross * Copyright (c) 1994 Adam Glass, Gordon W. Ross
@ -44,11 +44,9 @@
#include <sys/conf.h> #include <sys/conf.h>
#include <sys/vnode.h> #include <sys/vnode.h>
int rawread __P((dev_t, struct uio *, int));
int rawwrite __P((dev_t, struct uio *, int));
void swstrategy __P((struct buf *));
int ttselect __P((dev_t, int, struct proc *)); int ttselect __P((dev_t, int, struct proc *));
bdev_decl(sw);
#include "vnd.h" #include "vnd.h"
bdev_decl(vnd); bdev_decl(vnd);
#include "sd.h" #include "sd.h"
@ -64,7 +62,7 @@ struct bdevsw bdevsw[] =
bdev_notdef(), /* 1: tapemaster tape */ bdev_notdef(), /* 1: tapemaster tape */
bdev_notdef(), /* 2 */ bdev_notdef(), /* 2 */
bdev_notdef(), /* 3: SMD disk on Xylogics 450/451 */ bdev_notdef(), /* 3: SMD disk on Xylogics 450/451 */
bdev_swap_init(), /* 4: swap pseudo-device */ bdev_swap_init(1,sw), /* 4: swap pseudo-device */
bdev_disk_init(NVND,vnd), /* 5: vnode disk driver */ bdev_disk_init(NVND,vnd), /* 5: vnode disk driver */
bdev_notdef(), /* 6 */ bdev_notdef(), /* 6 */
bdev_disk_init(NSD,sd), /* 7: SCSI disk */ bdev_disk_init(NSD,sd), /* 7: SCSI disk */
@ -92,6 +90,7 @@ cdev_decl(ctty);
#define mmread mmrw #define mmread mmrw
#define mmwrite mmrw #define mmwrite mmrw
cdev_decl(mm); cdev_decl(mm);
cdev_decl(sw);
/* XXX - prom driver is dead code! */ /* XXX - prom driver is dead code! */
#include "prom.h" #include "prom.h"

View File

@ -1,4 +1,4 @@
/* $NetBSD: conf.c,v 1.11 1995/06/05 16:26:34 ragge Exp $ */ /* $NetBSD: conf.c,v 1.12 1995/07/04 07:17:21 mycroft Exp $ */
/*- /*-
* Copyright (c) 1982, 1986 The Regents of the University of California. * Copyright (c) 1982, 1986 The Regents of the University of California.
@ -43,9 +43,6 @@
#include <sys/conf.h> #include <sys/conf.h>
#include <sys/vnode.h> #include <sys/vnode.h>
int rawread __P((dev_t, struct uio *, int));
int rawwrite __P((dev_t, struct uio *, int));
void swstrategy __P((struct buf *));
int ttselect __P((dev_t, int, struct proc *)); int ttselect __P((dev_t, int, struct proc *));
#ifndef LKM #ifndef LKM
@ -63,6 +60,8 @@ bdev_decl(ht);
#include "rk.h" #include "rk.h"
bdev_decl(rk); bdev_decl(rk);
bdev_decl(sw);
#include "te.h" #include "te.h"
bdev_decl(tm); bdev_decl(tm);
@ -112,7 +111,7 @@ struct bdevsw bdevsw[] =
bdev_tape_init(NTU,ht), /* 1: TU77 w/ TM03 */ bdev_tape_init(NTU,ht), /* 1: TU77 w/ TM03 */
bdev_disk_init(NUP,up), /* 2: SC-21/SC-31 */ bdev_disk_init(NUP,up), /* 2: SC-21/SC-31 */
bdev_disk_init(NRK,rk), /* 3: RK06/07 */ bdev_disk_init(NRK,rk), /* 3: RK06/07 */
bdev_swap_init(), /* 4: swap pseudo-device */ bdev_swap_init(1,sw), /* 4: swap pseudo-device */
bdev_tape_init(NTE,tm), /* 5: TM11/TE10 */ bdev_tape_init(NTE,tm), /* 5: TM11/TE10 */
bdev_tape_init(NTS,ts), /* 6: TS11 */ bdev_tape_init(NTS,ts), /* 6: TS11 */
bdev_tape_init(NMU,mt), /* 7: TU78 */ bdev_tape_init(NMU,mt), /* 7: TU78 */
@ -155,33 +154,32 @@ struct consdev constab[]={
#define cdev_plotter_init(c,n) { \ #define cdev_plotter_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \ dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) enodev, \ dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) enodev, \
0, dev_init(c,n,select), (dev_type_mmap((*))) enodev, 0 } 0, dev_init(c,n,select), (dev_type_mmap((*))) enodev }
/* console mass storage - open, close, read/write */ /* console mass storage - open, close, read/write */
#define cdev_cnstore_init(c,n) { \ #define cdev_cnstore_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \ dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
dev_init(c,n,write), (dev_type_ioctl((*))) enodev, \ dev_init(c,n,write), (dev_type_ioctl((*))) enodev, \
(dev_type_stop((*))) enodev, 0, (dev_type_select((*))) enodev, \ (dev_type_stop((*))) enodev, 0, (dev_type_select((*))) enodev, \
(dev_type_mmap((*))) enodev, 0 } (dev_type_mmap((*))) enodev }
#define cdev_lp_init(c,n) { \ #define cdev_lp_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \ dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
dev_init(c,n,write), (dev_type_ioctl((*))) enodev, \ dev_init(c,n,write), (dev_type_ioctl((*))) enodev, \
(dev_type_stop((*))) enodev, 0, seltrue, (dev_type_mmap((*))) enodev, \ (dev_type_stop((*))) enodev, 0, seltrue, (dev_type_mmap((*))) enodev }
0 }
/* graphic display adapters */ /* graphic display adapters */
#define cdev_graph_init(c,n) { \ #define cdev_graph_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \ dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
dev_init(c,n,write), dev_init(c,n,ioctl), dev_init(c,n,stop), \ dev_init(c,n,write), dev_init(c,n,ioctl), dev_init(c,n,stop), \
0, dev_init(c,n,select), (dev_type_mmap((*))) enodev, 0 } 0, dev_init(c,n,select), (dev_type_mmap((*))) enodev }
/* Ingres */ /* Ingres */
#define cdev_ingres_init(c,n) { \ #define cdev_ingres_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) nullop, \ dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) nullop, \
(dev_type_write((*))) nullop, dev_init(c,n,ioctl), \ (dev_type_write((*))) nullop, dev_init(c,n,ioctl), \
(dev_type_stop((*))) nullop, 0, (dev_type_select((*))) nullop, \ (dev_type_stop((*))) nullop, 0, (dev_type_select((*))) nullop, \
(dev_type_mmap((*))) enodev, 0 } (dev_type_mmap((*))) enodev }
@ -190,6 +188,7 @@ cdev_decl(ctty);
#define mmread mmrw #define mmread mmrw
#define mmwrite mmrw #define mmwrite mmrw
cdev_decl(mm); cdev_decl(mm);
cdev_decl(sw);
#include "pty.h" #include "pty.h"
#define ptstty ptytty #define ptstty ptytty
#define ptsioctl ptyioctl #define ptsioctl ptyioctl

View File

@ -1,4 +1,4 @@
/* $NetBSD: wd.c,v 1.140 1995/06/26 05:18:28 cgd Exp $ */ /* $NetBSD: wd.c,v 1.141 1995/07/04 07:23:53 mycroft Exp $ */
/* /*
* Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved. * Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved.
@ -453,6 +453,24 @@ wdfinish(wd, bp)
biodone(bp); biodone(bp);
} }
int
wdread(dev, uio)
dev_t dev;
struct uio *uio;
{
return (physio(wdstrategy, NULL, dev, B_READ, minphys, uio));
}
int
wdwrite(dev, uio)
dev_t dev;
struct uio *uio;
{
return (physio(wdstrategy, NULL, dev, B_WRITE, minphys, uio));
}
/* /*
* Start I/O on a controller. This does the calculation, and starts a read or * Start I/O on a controller. This does the calculation, and starts a read or
* write operation. Called to from wdstart() to start a transfer, from * write operation. Called to from wdstart() to start a transfer, from

View File

@ -1,4 +1,4 @@
/* $NetBSD: ccd.c,v 1.9 1995/06/26 05:34:44 cgd Exp $ */ /* $NetBSD: ccd.c,v 1.10 1995/07/04 07:18:26 mycroft Exp $ */
/* /*
* Copyright (c) 1988 University of Utah. * Copyright (c) 1988 University of Utah.
@ -700,30 +700,30 @@ ccdiodone(cbp)
splx(s); splx(s);
} }
int
ccdread(dev, uio) ccdread(dev, uio)
dev_t dev; dev_t dev;
struct uio *uio; struct uio *uio;
{ {
register int unit = ccdunit(dev);
#ifdef DEBUG #ifdef DEBUG
if (ccddebug & CCDB_FOLLOW) if (ccddebug & CCDB_FOLLOW)
printf("ccdread(%x, %x)\n", dev, uio); printf("ccdread(%x, %x)\n", dev, uio);
#endif #endif
return(physio(ccdstrategy, NULL, dev, B_READ, minphys, uio)); return (physio(ccdstrategy, NULL, dev, B_READ, minphys, uio));
} }
int
ccdwrite(dev, uio) ccdwrite(dev, uio)
dev_t dev; dev_t dev;
struct uio *uio; struct uio *uio;
{ {
register int unit = ccdunit(dev);
#ifdef DEBUG #ifdef DEBUG
if (ccddebug & CCDB_FOLLOW) if (ccddebug & CCDB_FOLLOW)
printf("ccdwrite(%x, %x)\n", dev, uio); printf("ccdwrite(%x, %x)\n", dev, uio);
#endif #endif
return(physio(ccdstrategy, NULL, dev, B_WRITE, minphys, uio)); return (physio(ccdstrategy, NULL, dev, B_WRITE, minphys, uio));
} }
ccdioctl(dev, cmd, data, flag) ccdioctl(dev, cmd, data, flag)

View File

@ -1,4 +1,4 @@
/* $NetBSD: wd.c,v 1.140 1995/06/26 05:18:28 cgd Exp $ */ /* $NetBSD: wd.c,v 1.141 1995/07/04 07:23:53 mycroft Exp $ */
/* /*
* Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved. * Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved.
@ -453,6 +453,24 @@ wdfinish(wd, bp)
biodone(bp); biodone(bp);
} }
int
wdread(dev, uio)
dev_t dev;
struct uio *uio;
{
return (physio(wdstrategy, NULL, dev, B_READ, minphys, uio));
}
int
wdwrite(dev, uio)
dev_t dev;
struct uio *uio;
{
return (physio(wdstrategy, NULL, dev, B_WRITE, minphys, uio));
}
/* /*
* Start I/O on a controller. This does the calculation, and starts a read or * Start I/O on a controller. This does the calculation, and starts a read or
* write operation. Called to from wdstart() to start a transfer, from * write operation. Called to from wdstart() to start a transfer, from

View File

@ -1,4 +1,4 @@
/* $NetBSD: wt.c,v 1.25 1995/06/26 05:37:16 cgd Exp $ */ /* $NetBSD: wt.c,v 1.26 1995/07/04 07:23:58 mycroft Exp $ */
/* /*
* Streamer tape driver. * Streamer tape driver.
@ -595,6 +595,24 @@ xit:
return; return;
} }
int
wtread(dev, uio)
dev_t dev;
struct uio *uio;
{
return (physio(wtstrategy, NULL, dev, B_READ, minphys, uio));
}
int
wtwrite(dev, uio)
dev_t dev;
struct uio *uio;
{
return (physio(wtstrategy, NULL, dev, B_WRITE, minphys, uio));
}
/* /*
* Interrupt routine. * Interrupt routine.
*/ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: cd.c,v 1.69 1995/06/26 05:15:33 cgd Exp $ */ /* $NetBSD: cd.c,v 1.70 1995/07/04 07:21:00 mycroft Exp $ */
/* /*
* Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved. * Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved.
@ -373,23 +373,6 @@ cdclose(dev, flag, fmt)
return 0; return 0;
} }
/*
* trim the size of the transfer if needed,
* called by physio
* basically the smaller of our max and the scsi driver's
* minphys (note we have no max ourselves)
*
* Trim buffer length if buffer-size is bigger than page size
*/
void
cdminphys(bp)
struct buf *bp;
{
register struct cd_softc *cd = cdcd.cd_devs[CDUNIT(bp->b_dev)];
(cd->sc_link->adapter->scsi_minphys) (bp);
}
/* /*
* Actually translate the requested transfer into one the physical driver can * Actually translate the requested transfer into one the physical driver can
* understand. The transfer is described by a buf and will include only one * understand. The transfer is described by a buf and will include only one
@ -405,7 +388,6 @@ cdstrategy(bp)
SC_DEBUG(cd->sc_link, SDEV_DB2, ("cdstrategy ")); SC_DEBUG(cd->sc_link, SDEV_DB2, ("cdstrategy "));
SC_DEBUG(cd->sc_link, SDEV_DB1, SC_DEBUG(cd->sc_link, SDEV_DB1,
("%d bytes @ blk %d\n", bp->b_bcount, bp->b_blkno)); ("%d bytes @ blk %d\n", bp->b_bcount, bp->b_blkno));
cdminphys(bp);
/* /*
* If the device has been made invalid, error out * If the device has been made invalid, error out
* maybe the media changed * maybe the media changed
@ -556,6 +538,33 @@ cdstart(cd)
} }
} }
void
cdminphys(bp)
struct buf *bp;
{
register struct cd_softc *cd = cdcd.cd_devs[CDUNIT(bp->b_dev)];
(cd->sc_link->adapter->scsi_minphys)(bp);
}
int
cdread(dev, uio)
dev_t dev;
struct uio *uio;
{
return (physio(cdstrategy, NULL, dev, B_READ, cdminphys, uio));
}
int
cdwrite(dev, uio)
dev_t dev;
struct uio *uio;
{
return (physio(cdstrategy, NULL, dev, B_WRITE, cdminphys, uio));
}
/* /*
* Perform special action on behalf of the user. * Perform special action on behalf of the user.
* Knows about the internals of this device * Knows about the internals of this device

View File

@ -1,4 +1,4 @@
/* $NetBSD: sd.c,v 1.71 1995/06/26 05:16:55 cgd Exp $ */ /* $NetBSD: sd.c,v 1.72 1995/07/04 07:21:04 mycroft Exp $ */
/* /*
* Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved. * Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved.
@ -379,22 +379,6 @@ sdclose(dev, flag, fmt)
return 0; return 0;
} }
/*
* trim the size of the transfer if needed, called by physio
* basically the smaller of our max and the scsi driver's
* minphys (note we have no max)
*
* Trim buffer length if buffer-size is bigger than page size
*/
void
sdminphys(bp)
struct buf *bp;
{
register struct sd_softc *sd = sdcd.cd_devs[SDUNIT(bp->b_dev)];
(sd->sc_link->adapter->scsi_minphys) (bp);
}
/* /*
* Actually translate the requested transfer into one the physical driver * Actually translate the requested transfer into one the physical driver
* can understand. The transfer is described by a buf and will include * can understand. The transfer is described by a buf and will include
@ -410,7 +394,6 @@ sdstrategy(bp)
SC_DEBUG(sd->sc_link, SDEV_DB2, ("sdstrategy ")); SC_DEBUG(sd->sc_link, SDEV_DB2, ("sdstrategy "));
SC_DEBUG(sd->sc_link, SDEV_DB1, SC_DEBUG(sd->sc_link, SDEV_DB1,
("%d bytes @ blk %d\n", bp->b_bcount, bp->b_blkno)); ("%d bytes @ blk %d\n", bp->b_bcount, bp->b_blkno));
sdminphys(bp);
/* /*
* If the device has been made invalid, error out * If the device has been made invalid, error out
*/ */
@ -560,6 +543,33 @@ sdstart(sd)
} }
} }
void
sdminphys(bp)
struct buf *bp;
{
register struct sd_softc *sd = sdcd.cd_devs[SDUNIT(bp->b_dev)];
(sd->sc_link->adapter->scsi_minphys)(bp);
}
int
sdread(dev, uio)
dev_t dev;
struct uio *uio;
{
return (physio(sdstrategy, NULL, dev, B_READ, sdminphys, uio));
}
int
sdwrite(dev, uio)
dev_t dev;
struct uio *uio;
{
return (physio(sdstrategy, NULL, dev, B_WRITE, sdminphys, uio));
}
/* /*
* Perform special action on behalf of the user * Perform special action on behalf of the user
* Knows about the internals of this device * Knows about the internals of this device

View File

@ -1,4 +1,4 @@
/* $NetBSD: st.c,v 1.48 1995/06/26 05:15:37 cgd Exp $ */ /* $NetBSD: st.c,v 1.49 1995/07/04 07:21:07 mycroft Exp $ */
/* /*
* Copyright (c) 1994 Charles Hannum. All rights reserved. * Copyright (c) 1994 Charles Hannum. All rights reserved.
@ -239,7 +239,6 @@ int st_write_filemarks __P((struct st_softc *, int number, int flags));
int st_load __P((struct st_softc *, u_int type, int flags)); int st_load __P((struct st_softc *, u_int type, int flags));
int st_mode_select __P((struct st_softc *, int flags)); int st_mode_select __P((struct st_softc *, int flags));
void ststrategy(); void ststrategy();
void stminphys();
int st_check_eod(); int st_check_eod();
void ststart(); void ststart();
void st_unmount(); void st_unmount();
@ -764,21 +763,6 @@ done:
return 0; return 0;
} }
/*
* trim the size of the transfer if needed,
* called by physio
* basically the smaller of our min and the scsi driver's
* minphys
*/
void
stminphys(bp)
struct buf *bp;
{
register struct st_softc *st = stcd.cd_devs[STUNIT(bp->b_dev)];
(st->sc_link->adapter->scsi_minphys) (bp);
}
/* /*
* Actually translate the requested transfer into * Actually translate the requested transfer into
* one the physical driver can understand * one the physical driver can understand
@ -821,7 +805,6 @@ ststrategy(bp)
bp->b_error = EIO; bp->b_error = EIO;
goto bad; goto bad;
} }
stminphys(bp);
opri = splbio(); opri = splbio();
/* /*
@ -991,6 +974,33 @@ ststart(st)
} /* go back and see if we can cram more work in.. */ } /* go back and see if we can cram more work in.. */
} }
void
stminphys(bp)
struct buf *bp;
{
register struct st_softc *st = stcd.cd_devs[STUNIT(bp->b_dev)];
(st->sc_link->adapter->scsi_minphys)(bp);
}
int
stread(dev, uio)
dev_t dev;
struct uio *uio;
{
return (physio(ststrategy, NULL, dev, B_READ, stminphys, uio));
}
int
stwrite(dev, uio)
dev_t dev;
struct uio *uio;
{
return (physio(ststrategy, NULL, dev, B_WRITE, stminphys, uio));
}
/* /*
* Perform special action on behalf of the user; * Perform special action on behalf of the user;
* knows about the internals of this device * knows about the internals of this device

View File

@ -1,4 +1,4 @@
/* $NetBSD: vnd.c,v 1.19 1995/06/26 05:34:47 cgd Exp $ */ /* $NetBSD: vnd.c,v 1.20 1995/07/04 07:18:27 mycroft Exp $ */
/* /*
* Copyright (c) 1988 University of Utah. * Copyright (c) 1988 University of Utah.
@ -373,6 +373,32 @@ vndiodone(vbp)
splx(s); splx(s);
} }
int
vndread(dev, uio)
dev_t dev;
struct uio *uio;
{
#ifdef DEBUG
if (vnddebug & VDB_FOLLOW)
printf("vndread(%x, %x)\n", dev, uio);
#endif
return (physio(vndstrategy, NULL, dev, B_READ, minphys, uio));
}
int
vndwrite(dev, uio)
dev_t dev;
struct uio *uio;
{
#ifdef DEBUG
if (vnddebug & VDB_FOLLOW)
printf("vndwrite(%x, %x)\n", dev, uio);
#endif
return (physio(vndstrategy, NULL, dev, B_WRITE, minphys, uio));
}
/* ARGSUSED */ /* ARGSUSED */
int int
vndioctl(dev, cmd, data, flag, p) vndioctl(dev, cmd, data, flag, p)

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_physio.c,v 1.20 1994/06/29 06:32:34 cgd Exp $ */ /* $NetBSD: kern_physio.c,v 1.21 1995/07/04 07:18:57 mycroft Exp $ */
/*- /*-
* Copyright (c) 1994 Christopher G. Demetriou * Copyright (c) 1994 Christopher G. Demetriou
@ -301,25 +301,3 @@ minphys(bp)
bp->b_bcount = min(MAXPHYS, bp->b_bcount); bp->b_bcount = min(MAXPHYS, bp->b_bcount);
return bp->b_bcount; return bp->b_bcount;
} }
/*
* Do a read on a device for a user process.
*/
rawread(dev, uio)
dev_t dev;
struct uio *uio;
{
return (physio(cdevsw[major(dev)].d_strategy, (struct buf *)NULL,
dev, B_READ, minphys, uio));
}
/*
* Do a write on a device for a user process.
*/
rawwrite(dev, uio)
dev_t dev;
struct uio *uio;
{
return (physio(cdevsw[major(dev)].d_strategy, (struct buf *)NULL,
dev, B_WRITE, minphys, uio));
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: cd.c,v 1.69 1995/06/26 05:15:33 cgd Exp $ */ /* $NetBSD: cd.c,v 1.70 1995/07/04 07:21:00 mycroft Exp $ */
/* /*
* Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved. * Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved.
@ -373,23 +373,6 @@ cdclose(dev, flag, fmt)
return 0; return 0;
} }
/*
* trim the size of the transfer if needed,
* called by physio
* basically the smaller of our max and the scsi driver's
* minphys (note we have no max ourselves)
*
* Trim buffer length if buffer-size is bigger than page size
*/
void
cdminphys(bp)
struct buf *bp;
{
register struct cd_softc *cd = cdcd.cd_devs[CDUNIT(bp->b_dev)];
(cd->sc_link->adapter->scsi_minphys) (bp);
}
/* /*
* Actually translate the requested transfer into one the physical driver can * Actually translate the requested transfer into one the physical driver can
* understand. The transfer is described by a buf and will include only one * understand. The transfer is described by a buf and will include only one
@ -405,7 +388,6 @@ cdstrategy(bp)
SC_DEBUG(cd->sc_link, SDEV_DB2, ("cdstrategy ")); SC_DEBUG(cd->sc_link, SDEV_DB2, ("cdstrategy "));
SC_DEBUG(cd->sc_link, SDEV_DB1, SC_DEBUG(cd->sc_link, SDEV_DB1,
("%d bytes @ blk %d\n", bp->b_bcount, bp->b_blkno)); ("%d bytes @ blk %d\n", bp->b_bcount, bp->b_blkno));
cdminphys(bp);
/* /*
* If the device has been made invalid, error out * If the device has been made invalid, error out
* maybe the media changed * maybe the media changed
@ -556,6 +538,33 @@ cdstart(cd)
} }
} }
void
cdminphys(bp)
struct buf *bp;
{
register struct cd_softc *cd = cdcd.cd_devs[CDUNIT(bp->b_dev)];
(cd->sc_link->adapter->scsi_minphys)(bp);
}
int
cdread(dev, uio)
dev_t dev;
struct uio *uio;
{
return (physio(cdstrategy, NULL, dev, B_READ, cdminphys, uio));
}
int
cdwrite(dev, uio)
dev_t dev;
struct uio *uio;
{
return (physio(cdstrategy, NULL, dev, B_WRITE, cdminphys, uio));
}
/* /*
* Perform special action on behalf of the user. * Perform special action on behalf of the user.
* Knows about the internals of this device * Knows about the internals of this device

View File

@ -1,4 +1,4 @@
/* $NetBSD: sd.c,v 1.71 1995/06/26 05:16:55 cgd Exp $ */ /* $NetBSD: sd.c,v 1.72 1995/07/04 07:21:04 mycroft Exp $ */
/* /*
* Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved. * Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved.
@ -379,22 +379,6 @@ sdclose(dev, flag, fmt)
return 0; return 0;
} }
/*
* trim the size of the transfer if needed, called by physio
* basically the smaller of our max and the scsi driver's
* minphys (note we have no max)
*
* Trim buffer length if buffer-size is bigger than page size
*/
void
sdminphys(bp)
struct buf *bp;
{
register struct sd_softc *sd = sdcd.cd_devs[SDUNIT(bp->b_dev)];
(sd->sc_link->adapter->scsi_minphys) (bp);
}
/* /*
* Actually translate the requested transfer into one the physical driver * Actually translate the requested transfer into one the physical driver
* can understand. The transfer is described by a buf and will include * can understand. The transfer is described by a buf and will include
@ -410,7 +394,6 @@ sdstrategy(bp)
SC_DEBUG(sd->sc_link, SDEV_DB2, ("sdstrategy ")); SC_DEBUG(sd->sc_link, SDEV_DB2, ("sdstrategy "));
SC_DEBUG(sd->sc_link, SDEV_DB1, SC_DEBUG(sd->sc_link, SDEV_DB1,
("%d bytes @ blk %d\n", bp->b_bcount, bp->b_blkno)); ("%d bytes @ blk %d\n", bp->b_bcount, bp->b_blkno));
sdminphys(bp);
/* /*
* If the device has been made invalid, error out * If the device has been made invalid, error out
*/ */
@ -560,6 +543,33 @@ sdstart(sd)
} }
} }
void
sdminphys(bp)
struct buf *bp;
{
register struct sd_softc *sd = sdcd.cd_devs[SDUNIT(bp->b_dev)];
(sd->sc_link->adapter->scsi_minphys)(bp);
}
int
sdread(dev, uio)
dev_t dev;
struct uio *uio;
{
return (physio(sdstrategy, NULL, dev, B_READ, sdminphys, uio));
}
int
sdwrite(dev, uio)
dev_t dev;
struct uio *uio;
{
return (physio(sdstrategy, NULL, dev, B_WRITE, sdminphys, uio));
}
/* /*
* Perform special action on behalf of the user * Perform special action on behalf of the user
* Knows about the internals of this device * Knows about the internals of this device

View File

@ -1,4 +1,4 @@
/* $NetBSD: st.c,v 1.48 1995/06/26 05:15:37 cgd Exp $ */ /* $NetBSD: st.c,v 1.49 1995/07/04 07:21:07 mycroft Exp $ */
/* /*
* Copyright (c) 1994 Charles Hannum. All rights reserved. * Copyright (c) 1994 Charles Hannum. All rights reserved.
@ -239,7 +239,6 @@ int st_write_filemarks __P((struct st_softc *, int number, int flags));
int st_load __P((struct st_softc *, u_int type, int flags)); int st_load __P((struct st_softc *, u_int type, int flags));
int st_mode_select __P((struct st_softc *, int flags)); int st_mode_select __P((struct st_softc *, int flags));
void ststrategy(); void ststrategy();
void stminphys();
int st_check_eod(); int st_check_eod();
void ststart(); void ststart();
void st_unmount(); void st_unmount();
@ -764,21 +763,6 @@ done:
return 0; return 0;
} }
/*
* trim the size of the transfer if needed,
* called by physio
* basically the smaller of our min and the scsi driver's
* minphys
*/
void
stminphys(bp)
struct buf *bp;
{
register struct st_softc *st = stcd.cd_devs[STUNIT(bp->b_dev)];
(st->sc_link->adapter->scsi_minphys) (bp);
}
/* /*
* Actually translate the requested transfer into * Actually translate the requested transfer into
* one the physical driver can understand * one the physical driver can understand
@ -821,7 +805,6 @@ ststrategy(bp)
bp->b_error = EIO; bp->b_error = EIO;
goto bad; goto bad;
} }
stminphys(bp);
opri = splbio(); opri = splbio();
/* /*
@ -991,6 +974,33 @@ ststart(st)
} /* go back and see if we can cram more work in.. */ } /* go back and see if we can cram more work in.. */
} }
void
stminphys(bp)
struct buf *bp;
{
register struct st_softc *st = stcd.cd_devs[STUNIT(bp->b_dev)];
(st->sc_link->adapter->scsi_minphys)(bp);
}
int
stread(dev, uio)
dev_t dev;
struct uio *uio;
{
return (physio(ststrategy, NULL, dev, B_READ, stminphys, uio));
}
int
stwrite(dev, uio)
dev_t dev;
struct uio *uio;
{
return (physio(ststrategy, NULL, dev, B_WRITE, stminphys, uio));
}
/* /*
* Perform special action on behalf of the user; * Perform special action on behalf of the user;
* knows about the internals of this device * knows about the internals of this device

View File

@ -1,4 +1,4 @@
/* $NetBSD: conf.h,v 1.26 1995/06/26 05:14:17 cgd Exp $ */ /* $NetBSD: conf.h,v 1.27 1995/07/04 07:21:59 mycroft Exp $ */
/*- /*-
* Copyright (c) 1990, 1993 * Copyright (c) 1990, 1993
@ -117,9 +117,9 @@ extern struct bdevsw bdevsw[];
dev_init(c,n,strategy), dev_init(c,n,ioctl), \ dev_init(c,n,strategy), dev_init(c,n,ioctl), \
dev_init(c,n,dump), 0, D_TAPE } dev_init(c,n,dump), 0, D_TAPE }
#define bdev_swap_init() { \ #define bdev_swap_init(c,n) { \
(dev_type_open((*))) enodev, (dev_type_close((*))) enodev, \ (dev_type_open((*))) enodev, (dev_type_close((*))) enodev, \
swstrategy, (dev_type_ioctl((*))) enodev, \ dev_init(c,n,strategy), (dev_type_ioctl((*))) enodev, \
(dev_type_dump((*))) enodev, 0 } (dev_type_dump((*))) enodev, 0 }
#define bdev_lkm_dummy() { \ #define bdev_lkm_dummy() { \
@ -151,7 +151,6 @@ struct cdevsw {
(*d_tty) __P((dev_t dev)); (*d_tty) __P((dev_t dev));
int (*d_select) __P((dev_t dev, int which, struct proc *p)); int (*d_select) __P((dev_t dev, int which, struct proc *p));
int (*d_mmap) __P(()); int (*d_mmap) __P(());
void (*d_strategy) __P((struct buf *bp));
int d_type; int d_type;
}; };
@ -170,132 +169,129 @@ extern struct cdevsw cdevsw[];
#define cdev_decl(n) \ #define cdev_decl(n) \
dev_decl(n,open); dev_decl(n,close); dev_decl(n,read); \ dev_decl(n,open); dev_decl(n,close); dev_decl(n,read); \
dev_decl(n,write); dev_decl(n,ioctl); dev_decl(n,stop); \ dev_decl(n,write); dev_decl(n,ioctl); dev_decl(n,stop); \
dev_decl(n,tty); dev_decl(n,select); dev_decl(n,mmap); \ dev_decl(n,tty); dev_decl(n,select); dev_decl(n,mmap)
dev_decl(n,strategy)
/* open, close, read, write, ioctl, strategy */ /* open, close, read, write, ioctl */
#define cdev_disk_init(c,n) { \ #define cdev_disk_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), rawread, rawwrite, \ dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
dev_init(c,n,ioctl), (dev_type_stop((*))) enodev, \ dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) enodev, \
0, seltrue, (dev_type_mmap((*))) enodev, dev_init(c,n,strategy), \ 0, seltrue, (dev_type_mmap((*))) enodev, D_DISK }
D_DISK }
/* open, close, read, write, ioctl, strategy */ /* open, close, read, write, ioctl */
#define cdev_tape_init(c,n) { \ #define cdev_tape_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), rawread, rawwrite, \ dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
dev_init(c,n,ioctl), (dev_type_stop((*))) enodev, \ dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) enodev, \
0, seltrue, (dev_type_mmap((*))) enodev, dev_init(c,n,strategy), \ 0, seltrue, (dev_type_mmap((*))) enodev, D_TAPE }
D_TAPE }
/* open, close, read, write, ioctl, stop, tty */ /* open, close, read, write, ioctl, stop, tty */
#define cdev_tty_init(c,n) { \ #define cdev_tty_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \ dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
dev_init(c,n,write), dev_init(c,n,ioctl), dev_init(c,n,stop), \ dev_init(c,n,write), dev_init(c,n,ioctl), dev_init(c,n,stop), \
dev_init(c,n,tty), ttselect, (dev_type_mmap((*))) enodev, 0, D_TTY } dev_init(c,n,tty), ttselect, (dev_type_mmap((*))) enodev, D_TTY }
/* open, close, read, ioctl, select */ /* open, close, read, ioctl, select */
#define cdev_mouse_init(c,n) { \ #define cdev_mouse_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \ dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
(dev_type_write((*))) enodev, dev_init(c,n,ioctl), \ (dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
(dev_type_stop((*))) enodev, 0, dev_init(c,n,select), \ (dev_type_stop((*))) enodev, 0, dev_init(c,n,select), \
(dev_type_mmap((*))) enodev, 0 } (dev_type_mmap((*))) enodev }
#define cdev_lkm_dummy() { \ #define cdev_lkm_dummy() { \
(dev_type_open((*))) lkmenodev, (dev_type_close((*))) enodev, \ (dev_type_open((*))) lkmenodev, (dev_type_close((*))) enodev, \
(dev_type_read((*))) enodev, (dev_type_write((*))) enodev, \ (dev_type_read((*))) enodev, (dev_type_write((*))) enodev, \
(dev_type_ioctl((*))) enodev, (dev_type_stop((*))) enodev, \ (dev_type_ioctl((*))) enodev, (dev_type_stop((*))) enodev, \
0, seltrue, (dev_type_mmap((*))) enodev, 0 } 0, seltrue, (dev_type_mmap((*))) enodev }
#define cdev_notdef() { \ #define cdev_notdef() { \
(dev_type_open((*))) enodev, (dev_type_close((*))) enodev, \ (dev_type_open((*))) enodev, (dev_type_close((*))) enodev, \
(dev_type_read((*))) enodev, (dev_type_write((*))) enodev, \ (dev_type_read((*))) enodev, (dev_type_write((*))) enodev, \
(dev_type_ioctl((*))) enodev, (dev_type_stop((*))) enodev, \ (dev_type_ioctl((*))) enodev, (dev_type_stop((*))) enodev, \
0, seltrue, (dev_type_mmap((*))) enodev, 0 } 0, seltrue, (dev_type_mmap((*))) enodev }
/* open, close, read, write, ioctl, select -- XXX should be a tty */ /* open, close, read, write, ioctl, select -- XXX should be a tty */
#define cdev_cn_init(c,n) { \ #define cdev_cn_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \ dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
dev_init(c,n,write), dev_init(c,n,ioctl), dev_init(c,n,stop), \ dev_init(c,n,write), dev_init(c,n,ioctl), dev_init(c,n,stop), \
0, dev_init(c,n,select), (dev_type_mmap((*))) enodev, 0, D_TTY } 0, dev_init(c,n,select), (dev_type_mmap((*))) enodev, D_TTY }
/* open, read, write, ioctl, select -- XXX should be a tty */ /* open, read, write, ioctl, select -- XXX should be a tty */
#define cdev_ctty_init(c,n) { \ #define cdev_ctty_init(c,n) { \
dev_init(c,n,open), (dev_type_close((*))) nullop, dev_init(c,n,read), \ dev_init(c,n,open), (dev_type_close((*))) nullop, dev_init(c,n,read), \
dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) nullop, \ dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) nullop, \
0, dev_init(c,n,select), (dev_type_mmap((*))) enodev, 0, D_TTY } 0, dev_init(c,n,select), (dev_type_mmap((*))) enodev, D_TTY }
/* open, close, read, write, mmap */ /* open, close, read, write, mmap */
#define cdev_mm_init(c,n) { \ #define cdev_mm_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \ dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
dev_init(c,n,write), (dev_type_ioctl((*))) enodev, \ dev_init(c,n,write), (dev_type_ioctl((*))) enodev, \
(dev_type_stop((*))) enodev, 0, seltrue, dev_init(c,n,mmap), 0 } (dev_type_stop((*))) enodev, 0, seltrue, dev_init(c,n,mmap) }
/* read, write, strategy */ /* read, write */
#define cdev_swap_init(c,n) { \ #define cdev_swap_init(c,n) { \
(dev_type_open((*))) nullop, (dev_type_close((*))) nullop, rawread, \ (dev_type_open((*))) nullop, (dev_type_close((*))) nullop, \
rawwrite, (dev_type_ioctl((*))) enodev, (dev_type_stop((*))) enodev, \ dev_init(c,n,read), dev_init(c,n,write), (dev_type_ioctl((*))) enodev, \
0, (dev_type_select((*))) enodev, (dev_type_mmap((*))) enodev, \ (dev_type_stop((*))) enodev, 0, (dev_type_select((*))) enodev, \
dev_init(c,n,strategy) } (dev_type_mmap((*))) enodev }
/* open, close, read, write, ioctl, tty, select */ /* open, close, read, write, ioctl, tty, select */
#define cdev_ptc_init(c,n) { \ #define cdev_ptc_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \ dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) nullop, \ dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) nullop, \
dev_init(c,n,tty), dev_init(c,n,select), (dev_type_mmap((*))) enodev, \ dev_init(c,n,tty), dev_init(c,n,select), (dev_type_mmap((*))) enodev, \
0, D_TTY } D_TTY }
/* open, close, read, ioctl, select -- XXX should be a generic device */ /* open, close, read, ioctl, select -- XXX should be a generic device */
#define cdev_log_init(c,n) { \ #define cdev_log_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \ dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
(dev_type_write((*))) enodev, dev_init(c,n,ioctl), \ (dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
(dev_type_stop((*))) enodev, 0, dev_init(c,n,select), \ (dev_type_stop((*))) enodev, 0, dev_init(c,n,select), \
(dev_type_mmap((*))) enodev, 0 } (dev_type_mmap((*))) enodev }
/* open */ /* open */
#define cdev_fd_init(c,n) { \ #define cdev_fd_init(c,n) { \
dev_init(c,n,open), (dev_type_close((*))) enodev, \ dev_init(c,n,open), (dev_type_close((*))) enodev, \
(dev_type_read((*))) enodev, (dev_type_write((*))) enodev, \ (dev_type_read((*))) enodev, (dev_type_write((*))) enodev, \
(dev_type_ioctl((*))) enodev, (dev_type_stop((*))) enodev, \ (dev_type_ioctl((*))) enodev, (dev_type_stop((*))) enodev, \
0, (dev_type_select((*))) enodev, (dev_type_mmap((*))) enodev, 0 } 0, (dev_type_select((*))) enodev, (dev_type_mmap((*))) enodev }
/* open, close, read, write, ioctl, select -- XXX should be generic device */ /* open, close, read, write, ioctl, select -- XXX should be generic device */
#define cdev_bpftun_init(c,n) { \ #define cdev_bpftun_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \ dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) enodev, \ dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) enodev, \
0, dev_init(c,n,select), (dev_type_mmap((*))) enodev, 0 } 0, dev_init(c,n,select), (dev_type_mmap((*))) enodev }
/* open, close, ioctl */ /* open, close, ioctl */
#define cdev_lkm_init(c,n) { \ #define cdev_lkm_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \ dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
(dev_type_write((*))) enodev, dev_init(c,n,ioctl), \ (dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
(dev_type_stop((*))) enodev, 0, (dev_type_select((*))) enodev, \ (dev_type_stop((*))) enodev, 0, (dev_type_select((*))) enodev, \
(dev_type_mmap((*))) enodev, 0 } (dev_type_mmap((*))) enodev }
/* open, close, ioctl */ /* open, close, ioctl */
#define cdev_ch_init(c,n) { \ #define cdev_ch_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \ dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
(dev_type_write((*))) enodev, dev_init(c,n,ioctl), \ (dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
(dev_type_stop((*))) enodev, 0, (dev_type_select((*))) enodev, \ (dev_type_stop((*))) enodev, 0, (dev_type_select((*))) enodev, \
(dev_type_mmap((*))) enodev, 0 } (dev_type_mmap((*))) enodev }
/* open, close, ioctl, mmap */ /* open, close, ioctl, mmap */
#define cdev_fb_init(c,n) { \ #define cdev_fb_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \ dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
(dev_type_write((*))) enodev, dev_init(c,n,ioctl), \ (dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
(dev_type_stop((*))) enodev, 0, (dev_type_select((*))) enodev, \ (dev_type_stop((*))) enodev, 0, (dev_type_select((*))) enodev, \
dev_init(c,n,mmap), 0 } dev_init(c,n,mmap) }
/* open, close, read, write, ioctl */ /* open, close, read, write, ioctl */
#define cdev_audio_init(c,n) { \ #define cdev_audio_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \ dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) enodev, \ dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) enodev, \
0, dev_init(c,n,select), (dev_type_mmap((*))) enodev, 0 } 0, dev_init(c,n,select), (dev_type_mmap((*))) enodev }
#define cdev_svr4_net_init(c,n) { \ #define cdev_svr4_net_init(c,n) { \
dev_init(c,n,open), (dev_type_close((*))) enodev, \ dev_init(c,n,open), (dev_type_close((*))) enodev, \
(dev_type_read((*))) enodev, (dev_type_write((*))) enodev, \ (dev_type_read((*))) enodev, (dev_type_write((*))) enodev, \
(dev_type_ioctl((*))) enodev, (dev_type_stop((*))) nullop, \ (dev_type_ioctl((*))) enodev, (dev_type_stop((*))) nullop, \
0, (dev_type_select((*))) enodev, (dev_type_mmap((*))) enodev, 0 } 0, (dev_type_select((*))) enodev, (dev_type_mmap((*))) enodev }
/* symbolic sleep message strings */ /* symbolic sleep message strings */
extern char devopn[], devio[], devwait[], devin[], devout[]; extern char devopn[], devio[], devwait[], devin[], devout[];

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_swap.c,v 1.26 1995/01/09 02:47:38 cgd Exp $ */ /* $NetBSD: vm_swap.c,v 1.27 1995/07/04 07:22:19 mycroft Exp $ */
/* /*
* Copyright (c) 1982, 1986, 1989, 1993 * Copyright (c) 1982, 1986, 1989, 1993
@ -265,6 +265,24 @@ swstrategy(bp)
VOP_STRATEGY(bp); VOP_STRATEGY(bp);
} }
int
swread(dev, uio)
dev_t dev;
struct uio *uio;
{
return (physio(swstrategy, NULL, B_READ, minphys, uio));
}
int
swwrite(dev, uio)
dev_t dev;
struct uio *uio;
{
return (physio(swstrategy, NULL, B_WRITE, minphys, uio));
}
/* /*
* System call swapon(name) enables swapping on device name, * System call swapon(name) enables swapping on device name,
* which must be in the swdevsw. Return EBUSY * which must be in the swdevsw. Return EBUSY