1: /* 2: * SCCS id %W% (Berkeley) %G% 3: */ 4: 5: #include "param.h" 6: #include <sys/systm.h> 7: #include <sys/buf.h> 8: #include <sys/tty.h> 9: #include <sys/conf.h> 10: #include <sys/proc.h> 11: #include <sys/text.h> 12: #include <sys/dir.h> 13: #include <sys/user.h> 14: #include <sys/file.h> 15: #include <sys/inode.h> 16: #include <sys/acct.h> 17: #include <sys/map.h> 18: #include <sys/filsys.h> 19: #include <sys/mount.h> 20: 21: 22: int nulldev(); 23: int nodev(); 24: int nullioctl(); 25: 26: #include "bk.h" 27: #if NBK > 0 28: int bkopen(), bkclose(), bkread(), bkioctl(), bkinput(); 29: #else 30: #define bkopen nodev 31: #define bkclose nodev 32: #define bkread nodev 33: #define bkioctl nodev 34: #define bkinput nodev 35: #endif NBK 36: 37: #include "dh.h" 38: #if NDH > 0 39: int dhopen(), dhclose(), dhread(), dhwrite(), dhioctl(), dhstop(); 40: extern struct tty dh11[]; 41: #else 42: #define dhopen nodev 43: #define dhclose nodev 44: #define dhread nodev 45: #define dhwrite nodev 46: #define dhioctl nodev 47: #define dhstop nodev 48: #define dh11 ((struct tty *) NULL) 49: #endif NDH 50: 51: #include "dn.h" 52: #if NDN > 0 53: int dnopen(), dnclose(), dnwrite(); 54: #else 55: #define dnopen nodev 56: #define dnclose nodev 57: #define dnwrite nodev 58: #endif NDN 59: 60: #include "dz.h" 61: #if NDZ > 0 62: int dzopen(), dzclose(), dzread(), dzwrite(), dzioctl(); 63: #ifdef DZ_PDMA 64: int dzstop(); 65: #else 66: #define dzstop nulldev 67: #endif 68: extern struct tty dz11[]; 69: #else 70: #define dzopen nodev 71: #define dzclose nodev 72: #define dzread nodev 73: #define dzwrite nodev 74: #define dzioctl nodev 75: #define dzstop nodev 76: #define dz11 ((struct tty *) NULL) 77: #endif NDZ 78: 79: #include "hk.h" 80: #if NHK > 0 81: int hkstrategy(), hkread(), hkwrite(), hkroot(); 82: extern struct buf hktab; 83: #define hkopen nulldev 84: #define hkclose nulldev 85: #define _hktab &hktab 86: #else 87: #define hkopen nodev 88: #define hkclose nodev 89: #define hkstrategy nodev 90: #define hkread nodev 91: #define hkwrite nodev 92: #define hkroot nulldev 93: #define _hktab ((struct buf *) NULL) 94: #endif NHK 95: 96: #include "hp.h" 97: #if NHP > 0 98: int hpstrategy(), hpread(), hpwrite(), hproot(); 99: extern struct buf hptab; 100: #define hpopen nulldev 101: #define hpclose nulldev 102: #define _hptab &hptab 103: #else 104: #define hpopen nodev 105: #define hpclose nodev 106: #define hproot nulldev 107: #define hpstrategy nodev 108: #define hpread nodev 109: #define hpwrite nodev 110: #define _hptab ((struct buf *) NULL) 111: #endif NHP 112: 113: #include "hs.h" 114: #if NHS > 0 115: int hsstrategy(), hsread(), hswrite(), hsroot(); 116: extern struct buf hstab; 117: #define _hstab &hstab 118: #define hsopen nulldev 119: #define hsclose nulldev 120: #else 121: #define hsopen nodev 122: #define hsclose nodev 123: #define hsstrategy nodev 124: #define hsread nodev 125: #define hswrite nodev 126: #define hsroot nulldev 127: #define _hstab ((struct buf *) NULL) 128: #endif NHS 129: 130: #include "ht.h" 131: #if NHT > 0 132: int htopen(), htclose(), htread(), htwrite(), htstrategy(); 133: #ifdef HT_IOCTL 134: int htioctl(); 135: #else 136: #define htioctl nodev 137: #endif 138: extern struct buf httab; 139: #define _httab &httab 140: #else 141: #define htopen nodev 142: #define htclose nodev 143: #define htread nodev 144: #define htwrite nodev 145: #define htioctl nodev 146: #define htstrategy nodev 147: #define _httab ((struct buf *) NULL) 148: #endif NHT 149: 150: #include "lp.h" 151: #if NLP > 0 152: int lpopen(), lpclose(), lpwrite(); 153: #else 154: #define lpopen nodev 155: #define lpclose nodev 156: #define lpwrite nodev 157: #endif NLP 158: 159: #include "rk.h" 160: #if NRK > 0 161: int rkstrategy(), rkread(), rkwrite(); 162: extern struct buf rktab; 163: #define rkopen nulldev 164: #define rkclose nulldev 165: #define _rktab &rktab 166: #else 167: #define rkopen nodev 168: #define rkclose nodev 169: #define rkstrategy nodev 170: #define rkread nodev 171: #define rkwrite nodev 172: #define _rktab ((struct buf *) NULL) 173: #endif NRK 174: 175: #include "rl.h" 176: #if NRL > 0 177: int rlstrategy(), rlread(), rlwrite(); 178: extern struct buf rltab; 179: #define rlopen nulldev 180: #define rlclose nulldev 181: #define _rltab &rltab 182: #else 183: #define rlopen nodev 184: #define rlclose nodev 185: #define rlstrategy nodev 186: #define rlread nodev 187: #define rlwrite nodev 188: #define _rltab ((struct buf *) NULL) 189: #endif NRL 190: 191: #include "rm.h" 192: #if NRM > 0 193: int rmstrategy(), rmread(), rmwrite(), rmroot(); 194: extern struct buf rmtab; 195: #define rmopen nulldev 196: #define rmclose nulldev 197: #define _rmtab &rmtab 198: #else 199: #define rmopen nodev 200: #define rmclose nodev 201: #define rmroot nulldev 202: #define rmstrategy nodev 203: #define rmread nodev 204: #define rmwrite nodev 205: #define _rmtab ((struct buf *) NULL) 206: #endif NRM 207: 208: #include "rp.h" 209: #if NRP > 0 210: int rpstrategy(), rpread(), rpwrite(); 211: extern struct buf rptab; 212: #define rpopen nulldev 213: #define rpclose nulldev 214: #define _rptab &rptab 215: #else 216: #define rpopen nodev 217: #define rpclose nodev 218: #define rpstrategy nodev 219: #define rpread nodev 220: #define rpwrite nodev 221: #define _rptab ((struct buf *) NULL) 222: #endif NRP 223: 224: #include "tm.h" 225: #if NTM > 0 226: int tmopen(), tmclose(), tmread(), tmwrite(), tmstrategy(); 227: #ifdef TM_IOCTL 228: int tmioctl(); 229: #else 230: #define tmioctl nodev 231: #endif 232: extern struct buf tmtab; 233: #define _tmtab &tmtab 234: #else 235: #define tmopen nodev 236: #define tmclose nodev 237: #define tmread nodev 238: #define tmwrite nodev 239: #define tmioctl nodev 240: #define tmstrategy nodev 241: #define _tmtab ((struct buf *) NULL) 242: #endif NTM 243: 244: #include "ts.h" 245: #if NTS > 0 246: int tsopen(), tsclose(), tsread(), tswrite(), tsstrategy(); 247: #ifdef TS_IOCTL 248: int tsioctl(); 249: #else 250: #define tsioctl nodev 251: #endif 252: extern struct buf tstab; 253: #define _tstab &tstab 254: #else 255: #define tsopen nodev 256: #define tsclose nodev 257: #define tsread nodev 258: #define tswrite nodev 259: #define tsioctl nodev 260: #define tsstrategy nodev 261: #define _tstab ((struct buf *) NULL) 262: #endif NTS 263: 264: #include "vp.h" 265: #if NVP > 0 266: int vpopen(), vpclose(), vpwrite(), vpioctl(); 267: #else 268: #define vpopen nodev 269: #define vpclose nodev 270: #define vpwrite nodev 271: #define vpioctl nodev 272: #endif NVP 273: 274: #include "xp.h" 275: #if NXP > 0 276: int xpstrategy(), xpread(), xpwrite(), xproot(); 277: extern struct buf xptab; 278: #define xpopen nulldev 279: #define xpclose nulldev 280: #define _xptab &xptab 281: #else 282: #define xpopen nodev 283: #define xpclose nodev 284: #define xproot nulldev 285: #define xpstrategy nodev 286: #define xpread nodev 287: #define xpwrite nodev 288: #define _xptab ((struct buf *) NULL) 289: #endif NXP 290: 291: struct bdevsw bdevsw[] = 292: { 293: rkopen, rkclose, rkstrategy, 294: nulldev, _rktab, /* rk = 0 */ 295: 296: rpopen, rpclose, rpstrategy, 297: nulldev, _rptab, /* rp = 1 */ 298: 299: nodev, nodev, nodev, 300: nulldev, 0, /* rf = 2 */ 301: 302: tmopen, tmclose, tmstrategy, 303: nulldev, _tmtab, /* tm = 3 */ 304: 305: hkopen, hkclose, hkstrategy, 306: hkroot, _hktab, /* hk = 4 */ 307: 308: hsopen, hsclose, hsstrategy, 309: hsroot, _hstab, /* hs = 5 */ 310: 311: #if NXP > 0 312: xpopen, xpclose, xpstrategy, 313: xproot, _xptab, /* xp = 6 */ 314: #else 315: 316: #if NHP > 0 317: hpopen, hpclose, hpstrategy, 318: hproot, _hptab, /* hp = 6 */ 319: #else 320: 321: rmopen, rmclose, rmstrategy, 322: rmroot, _rmtab, /* rm = 6 */ 323: #endif 324: #endif 325: 326: htopen, htclose, htstrategy, 327: nulldev, _httab, /* ht = 7 */ 328: 329: rlopen, rlclose, rlstrategy, 330: nulldev, _rltab, /* rl = 8 */ 331: 332: tsopen, tsclose, tsstrategy, 333: nulldev, _tstab, /* ts = 9 */ 334: }; 335: int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]); 336: 337: int klopen(), klclose(), klread(), klwrite(), klioctl(); 338: extern struct tty kl11[]; 339: int mmread(), mmwrite(); 340: int syopen(), syread(), sywrite(), sysioctl(); 341: 342: struct cdevsw cdevsw[] = 343: { 344: klopen, klclose, klread, klwrite, 345: klioctl, nulldev, kl11, /* kl = 0 */ 346: 347: nodev, nodev, nodev, nodev, 348: nodev, nodev, 0, /* pc = 1 */ 349: 350: vpopen, vpclose, nodev, vpwrite, 351: vpioctl, nulldev, 0, /* vp = 2 */ 352: 353: lpopen, lpclose, nodev, lpwrite, 354: nodev, nulldev, 0, /* lp = 3 */ 355: 356: dhopen, dhclose, dhread, dhwrite, 357: dhioctl, dhstop, dh11, /* dh = 4 */ 358: 359: nodev, nodev, nodev, nodev, 360: nodev, nodev, 0, /* dp = 5 */ 361: 362: nodev, nodev, nodev, nodev, 363: nodev, nodev, 0, /* dj = 6 */ 364: 365: dnopen, dnclose, nodev, dnwrite, 366: nodev, nulldev, 0, /* dn = 7 */ 367: 368: nulldev, nulldev, mmread, mmwrite, 369: nodev, nulldev, 0, /* mem = 8 */ 370: 371: rkopen, rkclose, rkread, rkwrite, 372: nodev, nulldev, 0, /* rk = 9 */ 373: 374: nodev, nodev, nodev, nodev, 375: nodev, nodev, 0, /* rf = 10 */ 376: 377: rpopen, rpclose, rpread, rpwrite, 378: nodev, nulldev, 0, /* rp = 11 */ 379: 380: tmopen, tmclose, tmread, tmwrite, 381: tmioctl, nulldev, 0, /* tm = 12 */ 382: 383: hsopen, hsclose, hsread, hswrite, 384: nodev, nulldev, 0, /* hs = 13 */ 385: 386: #if NXP > 0 387: xpopen, xpclose, xpread, xpwrite, 388: nodev, nulldev, 0, /* xp = 14 */ 389: #else 390: #if NHP > 0 391: 392: hpopen, hpclose, hpread, hpwrite, 393: nodev, nulldev, 0, /* hp = 14 */ 394: #else 395: 396: rmopen, rmclose, rmread, rmwrite, 397: nodev, nulldev, 0, /* rm = 14 */ 398: #endif 399: #endif 400: 401: htopen, htclose, htread, htwrite, 402: htioctl, nulldev, 0, /* ht = 15 */ 403: 404: nodev, nodev, nodev, nodev, 405: nodev, nodev, 0, /* du = 16 */ 406: 407: syopen, nulldev, syread, sywrite, 408: sysioctl, nulldev, 0, /* tty = 17 */ 409: 410: rlopen, rlclose, rlread, rlwrite, 411: nodev, nulldev, 0, /* rl = 18 */ 412: 413: hkopen, hkclose, hkread, hkwrite, 414: nodev, nulldev, 0, /* hk = 19 */ 415: 416: tsopen, tsclose, tsread, tswrite, 417: tsioctl, nulldev, 0, /* ts = 20 */ 418: 419: dzopen, dzclose, dzread, dzwrite, 420: dzioctl, dzstop, dz11, /* dz = 21 */ 421: 422: }; 423: 424: int nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]); 425: 426: #ifdef OLDTTY 427: int ttread(), ttyinput(), ttyoutput(); 428: caddr_t ttwrite(); 429: #define ttopen nulldev 430: #define ttclose nulldev 431: #define ttioctl nullioctl 432: #define ttmodem nulldev 433: #else 434: #define ttopen nodev 435: #define ttclose nodev 436: #define ttread nodev 437: #define ttwrite nodev 438: #define ttioctl nodev 439: #define ttyinput nodev 440: #define ttyoutput nodev 441: #define ttmodem nodev 442: #endif 443: 444: 445: #ifdef UCB_NTTY 446: int ntyopen(), ntyclose(), ntread(), ntyinput(), ntyoutput(); 447: caddr_t ntwrite(); 448: #define ntyioctl nullioctl 449: #define ntymodem nulldev 450: #else 451: #define ntyopen nodev 452: #define ntyclose nodev 453: #define ntread nodev 454: #define ntwrite nodev 455: #define ntyioctl nodev 456: #define ntyinput nodev 457: #define ntyoutput nodev 458: #define ntymodem nodev 459: #endif 460: 461: struct linesw linesw[] = 462: { 463: ttopen, ttclose, ttread, ttwrite, 464: ttioctl, ttyinput, ttyoutput, ttmodem, /*0*/ 465: 466: ntyopen, ntyclose, ntread, ntwrite, 467: ntyioctl, ntyinput, ntyoutput, ntymodem, /*1*/ 468: 469: #if NBK > 0 470: bkopen, bkclose, bkread, ttwrite, 471: bkioctl, bkinput, nodev, nulldev /*2*/ 472: #endif 473: }; 474: 475: #ifndef MPX_FILS 476: int nldisp = sizeof(linesw) / sizeof(linesw[0]); 477: #else 478: int nldisp = sizeof(linesw) / sizeof(linesw[0]) - 1; 479: int mpxchan(); 480: int (*ldmpx)() = mpxchan; 481: #endif