1 /* conf.c 1.4 87/10/27 */ 2 /* conf.c 6.1 83/07/29 */ 3 4 #include "../machine/pte.h" 5 6 #include "param.h" 7 #include "inode.h" 8 #include "fs.h" 9 10 #include "saio.h" 11 12 devread(io) 13 register struct iob *io; 14 { 15 int cc; 16 17 io->i_flgs |= F_RDDATA; 18 io->i_error = 0; 19 cc = (*devsw[io->i_ino.i_dev].dv_strategy)(io, READ); 20 io->i_flgs &= ~F_TYPEMASK; 21 return (cc); 22 } 23 24 devwrite(io) 25 register struct iob *io; 26 { 27 int cc; 28 29 io->i_flgs |= F_WRDATA; 30 io->i_error = 0; 31 cc = (*devsw[io->i_ino.i_dev].dv_strategy)(io, WRITE); 32 io->i_flgs &= ~F_TYPEMASK; 33 return (cc); 34 } 35 36 devopen(io) 37 register struct iob *io; 38 { 39 40 (*devsw[io->i_ino.i_dev].dv_open)(io); 41 } 42 43 devclose(io) 44 register struct iob *io; 45 { 46 47 (*devsw[io->i_ino.i_dev].dv_close)(io); 48 } 49 50 devioctl(io, cmd, arg) 51 register struct iob *io; 52 int cmd; 53 caddr_t arg; 54 { 55 56 return ((*devsw[io->i_ino.i_dev].dv_ioctl)(io, cmd, arg)); 57 } 58 59 /*ARGSUSED*/ 60 nullsys(io) struct iob *io; {} 61 nullopen(io) struct iob *io; { _stop("bad device type"); } 62 63 /*ARGSUSED*/ 64 noioctl(io, cmd, arg) 65 struct iob *io; 66 int cmd; 67 caddr_t arg; 68 { 69 70 return (ECMD); 71 } 72 73 int udstrategy(), udopen(); 74 int vdstrategy(), vdopen(); 75 int hdstrategy(), hdopen(); 76 int cystrategy(), cyopen(), cyclose(); 77 78 struct devsw devsw[] = { 79 { "ud", udstrategy, udopen, nullsys, noioctl }, 80 { "dk", vdstrategy, vdopen, nullsys, noioctl }, 81 { "hd", hdstrategy, hdopen, nullsys, noioctl }, 82 #ifdef notdef 83 { "xp", xpstrategy, xpopen, nullsys, noioctl }, 84 #else 85 { "xp", nullopen, nullsys, nullsys, noioctl }, 86 #endif 87 { "cy", cystrategy, cyopen, cyclose, noioctl }, 88 { 0 } 89 }; 90 int ndevs = (sizeof(devsw) / sizeof(devsw[0]) - 1); 91