1 /* 2 * Copyright (c) 1982, 1986 Regents of the University of California. 3 * All rights reserved. The Berkeley software License Agreement 4 * specifies the terms and conditions for redistribution. 5 * 6 * @(#)conf.c 7.3 (Berkeley) 08/03/87 7 */ 8 9 #include "../machine/pte.h" 10 11 #include "../h/param.h" 12 #include "../h/inode.h" 13 #include "../h/fs.h" 14 15 #include "../vaxmba/mbareg.h" 16 17 #include "saio.h" 18 19 devread(io) 20 register struct iob *io; 21 { 22 int cc; 23 24 io->i_flgs |= F_RDDATA; 25 io->i_error = 0; 26 cc = (*devsw[io->i_ino.i_dev].dv_strategy)(io, READ); 27 io->i_flgs &= ~F_TYPEMASK; 28 return (cc); 29 } 30 31 devwrite(io) 32 register struct iob *io; 33 { 34 int cc; 35 36 io->i_flgs |= F_WRDATA; 37 io->i_error = 0; 38 cc = (*devsw[io->i_ino.i_dev].dv_strategy)(io, WRITE); 39 io->i_flgs &= ~F_TYPEMASK; 40 return (cc); 41 } 42 43 devopen(io) 44 register struct iob *io; 45 { 46 47 return (*devsw[io->i_ino.i_dev].dv_open)(io); 48 } 49 50 devclose(io) 51 register struct iob *io; 52 { 53 54 (*devsw[io->i_ino.i_dev].dv_close)(io); 55 } 56 57 devioctl(io, cmd, arg) 58 register struct iob *io; 59 int cmd; 60 caddr_t arg; 61 { 62 63 return ((*devsw[io->i_ino.i_dev].dv_ioctl)(io, cmd, arg)); 64 } 65 66 /*ARGSUSED*/ 67 nullsys(io) 68 struct iob *io; 69 { 70 71 ; 72 } 73 74 /*ARGSUSED*/ 75 nodev(io) 76 struct iob *io; 77 { 78 79 errno = EBADF; 80 } 81 82 /*ARGSUSED*/ 83 noioctl(io, cmd, arg) 84 struct iob *io; 85 int cmd; 86 caddr_t arg; 87 { 88 89 return (ECMD); 90 } 91 92 #if defined(VAX780) || defined(VAX750) || defined(VAX8600) 93 #define HP "hp" 94 int hpstrategy(), hpopen(), hpioctl(); 95 #else 96 #define HP "" 97 #define hpstrategy nodev 98 #define hpopen nodev 99 #define hpioctl noioctl 100 #endif 101 int upstrategy(), upopen(), upioctl(); 102 int rkstrategy(), rkopen(), rkioctl(); 103 int rastrategy(), raopen(), raioctl(); 104 #if defined(VAX730) 105 #define RB "rb" 106 int idcstrategy(), idcopen(), idcioctl(); 107 #else 108 #define RB "" 109 #define idcstrategy nodev 110 #define idcopen nodev 111 #define idcioctl noioctl 112 #endif 113 int rlstrategy(), rlopen(), rlioctl(); 114 115 #ifndef BOOT 116 #define TM "tm" 117 int tmstrategy(), tmopen(), tmclose(); 118 #define TS "ts" 119 int tsstrategy(), tsopen(), tsclose(); 120 #if defined(VAX780) || defined(VAX750) || defined(VAX8600) 121 #define HT "ht" 122 int htstrategy(), htopen(), htclose(); 123 #define MT "mt" 124 int mtstrategy(), mtopen(), mtclose(); 125 126 #else massbus vax 127 #define HT "" 128 #define htstrategy nodev 129 #define htopen nodev 130 #define htclose nodev 131 #define MT "" 132 #define mtstrategy nodev 133 #define mtopen nodev 134 #define mtclose nodev 135 #endif massbus vax 136 137 #define UT "ut" 138 int utstrategy(), utopen(), utclose(); 139 #else BOOT 140 #define TM "" 141 #define tmstrategy nodev 142 #define tmopen nodev 143 #define tmclose nodev 144 #define TS "" 145 #define tsstrategy nodev 146 #define tsopen nodev 147 #define tsclose nodev 148 #define HT "" 149 #define htstrategy nodev 150 #define htopen nodev 151 #define htclose nodev 152 #define MT "" 153 #define mtstrategy nodev 154 #define mtopen nodev 155 #define mtclose nodev 156 #define UT "" 157 #define utstrategy nodev 158 #define utopen nodev 159 #define utclose nodev 160 #endif 161 162 struct devsw devsw[] = { 163 { HP, hpstrategy, hpopen, nullsys, hpioctl }, /* 0 = hp */ 164 { HT, htstrategy, htopen, htclose, noioctl }, /* 1 = ht */ 165 { "up", upstrategy, upopen, nullsys, upioctl }, /* 2 = up */ 166 { "hk", rkstrategy, rkopen, nullsys, rkioctl }, /* 3 = hk */ 167 { "", nodev, nodev, nullsys, noioctl }, /* 4 = sw */ 168 { TM, tmstrategy, tmopen, tmclose, noioctl }, /* 5 = tm */ 169 { TS, tsstrategy, tsopen, tsclose, noioctl }, /* 6 = ts */ 170 { MT, mtstrategy, mtopen, mtclose, noioctl }, /* 7 = mt */ 171 { "", nodev, nodev, nullsys, noioctl }, /* 8 = tu */ 172 { "ra", rastrategy, raopen, nullsys, raioctl }, /* 9 = ra */ 173 { UT, utstrategy, utopen, utclose, noioctl }, /* 10 = ut */ 174 { RB, idcstrategy, idcopen,nullsys, idcioctl },/* 11 = rb */ 175 { "", nodev, nodev, nullsys, noioctl }, /* 12 = uu */ 176 { "", nodev, nodev, nullsys, noioctl }, /* 13 = rx */ 177 { "rl", rlstrategy, rlopen, nullsys, rlioctl }, /* 14 = rl */ 178 { 0, 0, 0, 0, 0 }, 179 }; 180 181 int ndevs = (sizeof(devsw) / sizeof(devsw[0]) - 1); 182