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.1 (Berkeley) 6/5/86 7: */ 8: 9: #include "param.h" 10: #include "systm.h" 11: #include "buf.h" 12: #include "ioctl.h" 13: #include "tty.h" 14: #include "conf.h" 15: 16: int nulldev(); 17: int nodev(); 18: 19: #include "hp.h" 20: #if NHP > 0 21: int hpopen(),hpstrategy(),hpread(),hpwrite(),hpdump(),hpioctl(),hpsize(); 22: #else 23: #define hpopen nodev 24: #define hpstrategy nodev 25: #define hpread nodev 26: #define hpwrite nodev 27: #define hpdump nodev 28: #define hpioctl nodev 29: #define hpsize 0 30: #endif 31: 32: #include "tu.h" 33: #if NHT > 0 34: int htopen(),htclose(),htstrategy(),htread(),htwrite(),htdump(),htioctl(); 35: #else 36: #define htopen nodev 37: #define htclose nodev 38: #define htstrategy nodev 39: #define htread nodev 40: #define htwrite nodev 41: #define htdump nodev 42: #define htioctl nodev 43: #endif 44: 45: #include "rk.h" 46: #if NHK > 0 47: int rkopen(),rkstrategy(),rkread(),rkwrite(),rkintr(); 48: int rkdump(),rkreset(),rksize(); 49: #else 50: #define rkopen nodev 51: #define rkstrategy nodev 52: #define rkread nodev 53: #define rkwrite nodev 54: #define rkintr nodev 55: #define rkdump nodev 56: #define rkreset nodev 57: #define rksize 0 58: #endif 59: 60: #include "te.h" 61: #if NTE > 0 62: int tmopen(),tmclose(),tmstrategy(),tmread(),tmwrite(); 63: int tmioctl(),tmdump(),tmreset(); 64: #else 65: #define tmopen nodev 66: #define tmclose nodev 67: #define tmstrategy nodev 68: #define tmread nodev 69: #define tmwrite nodev 70: #define tmioctl nodev 71: #define tmdump nodev 72: #define tmreset nulldev 73: #endif 74: 75: #include "tms.h" 76: #if NTMS > 0 77: int tmscpopen(),tmscpclose(),tmscpstrategy(),tmscpread(),tmscpwrite(); 78: int tmscpioctl(),tmscpdump(),tmscpreset(); 79: #else 80: #define tmscpopen nodev 81: #define tmscpclose nodev 82: #define tmscpstrategy nodev 83: #define tmscpread nodev 84: #define tmscpwrite nodev 85: #define tmscpioctl nodev 86: #define tmscpdump nodev 87: #define tmscpreset nulldev 88: #endif 89: 90: #include "ts.h" 91: #if NTS > 0 92: int tsopen(),tsclose(),tsstrategy(),tsread(),tswrite(); 93: int tsioctl(),tsdump(),tsreset(); 94: #else 95: #define tsopen nodev 96: #define tsclose nodev 97: #define tsstrategy nodev 98: #define tsread nodev 99: #define tswrite nodev 100: #define tsioctl nodev 101: #define tsdump nodev 102: #define tsreset nulldev 103: #endif 104: 105: #include "mu.h" 106: #if NMT > 0 107: int mtopen(),mtclose(),mtstrategy(),mtread(),mtwrite(); 108: int mtioctl(),mtdump(); 109: #else 110: #define mtopen nodev 111: #define mtclose nodev 112: #define mtstrategy nodev 113: #define mtread nodev 114: #define mtwrite nodev 115: #define mtioctl nodev 116: #define mtdump nodev 117: #endif 118: 119: #include "ra.h" 120: #if NUDA > 0 121: int udopen(),udstrategy(),udread(),udwrite(),udreset(),uddump(),udsize(); 122: #else 123: #define udopen nodev 124: #define udstrategy nodev 125: #define udread nodev 126: #define udwrite nodev 127: #define udreset nulldev 128: #define uddump nodev 129: #define udsize 0 130: #endif 131: 132: #include "up.h" 133: #if NSC > 0 134: int upopen(),upstrategy(),upread(),upwrite(),upreset(),updump(),upsize(); 135: #else 136: #define upopen nodev 137: #define upstrategy nodev 138: #define upread nodev 139: #define upwrite nodev 140: #define upreset nulldev 141: #define updump nodev 142: #define upsize 0 143: #endif 144: 145: #include "tj.h" 146: #if NUT > 0 147: int utopen(),utclose(),utstrategy(),utread(),utwrite(),utioctl(); 148: int utreset(),utdump(); 149: #else 150: #define utopen nodev 151: #define utclose nodev 152: #define utread nodev 153: #define utstrategy nodev 154: #define utwrite nodev 155: #define utreset nulldev 156: #define utioctl nodev 157: #define utdump nodev 158: #endif 159: 160: #include "rb.h" 161: #if NIDC > 0 162: int idcopen(),idcstrategy(),idcread(),idcwrite(); 163: int idcreset(),idcdump(),idcsize();; 164: #else 165: #define idcopen nodev 166: #define idcstrategy nodev 167: #define idcread nodev 168: #define idcwrite nodev 169: #define idcreset nulldev 170: #define idcdump nodev 171: #define idcsize 0 172: #endif 173: 174: #if defined(VAX750) || defined(VAX730) 175: int tuopen(),tuclose(),tustrategy(); 176: #else 177: #define tuopen nodev 178: #define tuclose nodev 179: #define tustrategy nodev 180: #endif 181: 182: #include "rx.h" 183: #if NFX > 0 184: int rxopen(),rxstrategy(),rxclose(),rxread(),rxwrite(),rxreset(),rxioctl(); 185: #else 186: #define rxopen nodev 187: #define rxstrategy nodev 188: #define rxclose nodev 189: #define rxread nodev 190: #define rxwrite nodev 191: #define rxreset nulldev 192: #define rxioctl nodev 193: #endif 194: 195: #include "uu.h" 196: #if NUU > 0 197: int uuopen(),uustrategy(),uuclose(),uureset(),uuioctl(); 198: #else 199: #define uuopen nodev 200: #define uustrategy nodev 201: #define uuclose nodev 202: #define uureset nulldev 203: #define uuioctl nodev 204: #endif 205: 206: #include "rl.h" 207: #if NRL > 0 208: int rlopen(),rlstrategy(),rlread(),rlwrite(); 209: int rlreset(),rldump(),rlsize(); 210: #else 211: #define rlopen nodev 212: #define rlstrategy nodev 213: #define rlread nodev 214: #define rlwrite nodev 215: #define rlreset nulldev 216: #define rldump nodev 217: #define rlsize 0 218: #endif 219: 220: int swstrategy(),swread(),swwrite(); 221: 222: struct bdevsw bdevsw[] = 223: { 224: { hpopen, nulldev, hpstrategy, hpdump, /*0*/ 225: hpsize, 0 }, 226: { htopen, htclose, htstrategy, htdump, /*1*/ 227: 0, B_TAPE }, 228: { upopen, nulldev, upstrategy, updump, /*2*/ 229: upsize, 0 }, 230: { rkopen, nulldev, rkstrategy, rkdump, /*3*/ 231: rksize, 0 }, 232: { nodev, nodev, swstrategy, nodev, /*4*/ 233: 0, 0 }, 234: { tmopen, tmclose, tmstrategy, tmdump, /*5*/ 235: 0, B_TAPE }, 236: { tsopen, tsclose, tsstrategy, tsdump, /*6*/ 237: 0, B_TAPE }, 238: { mtopen, mtclose, mtstrategy, mtdump, /*7*/ 239: 0, B_TAPE }, 240: { tuopen, tuclose, tustrategy, nodev, /*8*/ 241: 0, B_TAPE }, 242: { udopen, nulldev, udstrategy, uddump, /*9*/ 243: udsize, 0 }, 244: { utopen, utclose, utstrategy, utdump, /*10*/ 245: 0, B_TAPE }, 246: { idcopen, nodev, idcstrategy, idcdump, /*11*/ 247: idcsize, 0 }, 248: { rxopen, rxclose, rxstrategy, nodev, /*12*/ 249: 0, 0 }, 250: { uuopen, uuclose, uustrategy, nodev, /*13*/ 251: 0, 0 }, 252: { rlopen, nodev, rlstrategy, rldump, /*14*/ 253: rlsize, 0 }, 254: { tmscpopen, tmscpclose, tmscpstrategy, tmscpdump, /*15*/ 255: 0, B_TAPE }, 256: }; 257: int nblkdev = sizeof (bdevsw) / sizeof (bdevsw[0]); 258: 259: int cnopen(),cnclose(),cnread(),cnwrite(),cnioctl(); 260: struct tty cons; 261: 262: #include "acc.h" 263: #if NACC > 0 264: int accreset(); 265: #else 266: #define accreset nulldev 267: #endif 268: 269: #include "ct.h" 270: #if NCT > 0 271: int ctopen(),ctclose(),ctwrite(); 272: #else 273: #define ctopen nulldev 274: #define ctclose nulldev 275: #define ctwrite nulldev 276: #endif 277: 278: #include "dh.h" 279: #if NDH == 0 280: #define dhopen nodev 281: #define dhclose nodev 282: #define dhread nodev 283: #define dhwrite nodev 284: #define dhioctl nodev 285: #define dhstop nodev 286: #define dhreset nulldev 287: #define dh11 0 288: #else 289: int dhopen(),dhclose(),dhread(),dhwrite(),dhioctl(),dhstop(),dhreset(); 290: struct tty dh11[]; 291: #endif 292: 293: #include "dmf.h" 294: #if NDMF == 0 295: #define dmfopen nodev 296: #define dmfclose nodev 297: #define dmfread nodev 298: #define dmfwrite nodev 299: #define dmfioctl nodev 300: #define dmfstop nodev 301: #define dmfreset nulldev 302: #define dmf_tty 0 303: #else 304: int dmfopen(),dmfclose(),dmfread(),dmfwrite(),dmfioctl(),dmfstop(),dmfreset(); 305: struct tty dmf_tty[]; 306: #endif 307: 308: #if VAX8600 309: int crlopen(),crlclose(),crlread(),crlwrite(); 310: #else 311: #define crlopen nodev 312: #define crlclose nodev 313: #define crlread nodev 314: #define crlwrite nodev 315: #endif 316: 317: #if VAX780 318: int flopen(),flclose(),flread(),flwrite(); 319: #else 320: #define flopen nodev 321: #define flclose nodev 322: #define flread nodev 323: #define flwrite nodev 324: #endif 325: 326: #include "dz.h" 327: #if NDZ == 0 328: #define dzopen nodev 329: #define dzclose nodev 330: #define dzread nodev 331: #define dzwrite nodev 332: #define dzioctl nodev 333: #define dzstop nodev 334: #define dzreset nulldev 335: #define dz_tty 0 336: #else 337: int dzopen(),dzclose(),dzread(),dzwrite(),dzioctl(),dzstop(),dzreset(); 338: struct tty dz_tty[]; 339: #endif 340: 341: #include "lp.h" 342: #if NLP > 0 343: int lpopen(),lpclose(),lpwrite(),lpreset(); 344: #else 345: #define lpopen nodev 346: #define lpclose nodev 347: #define lpwrite nodev 348: #define lpreset nulldev 349: #endif 350: 351: int syopen(),syread(),sywrite(),syioctl(),syselect(); 352: 353: int mmread(),mmwrite(); 354: #define mmselect seltrue 355: 356: #include "va.h" 357: #if NVA > 0 358: int vaopen(),vaclose(),vawrite(),vaioctl(),vareset(),vaselect(); 359: #else 360: #define vaopen nodev 361: #define vaclose nodev 362: #define vawrite nodev 363: #define vaopen nodev 364: #define vaioctl nodev 365: #define vareset nulldev 366: #define vaselect nodev 367: #endif 368: 369: #include "vp.h" 370: #if NVP > 0 371: int vpopen(),vpclose(),vpwrite(),vpioctl(),vpreset(),vpselect(); 372: #else 373: #define vpopen nodev 374: #define vpclose nodev 375: #define vpwrite nodev 376: #define vpioctl nodev 377: #define vpreset nulldev 378: #define vpselect nodev 379: #endif 380: 381: #include "pty.h" 382: #if NPTY > 0 383: int ptsopen(),ptsclose(),ptsread(),ptswrite(),ptsstop(); 384: int ptcopen(),ptcclose(),ptcread(),ptcwrite(),ptcselect(); 385: int ptyioctl(); 386: struct tty pt_tty[]; 387: #else 388: #define ptsopen nodev 389: #define ptsclose nodev 390: #define ptsread nodev 391: #define ptswrite nodev 392: #define ptcopen nodev 393: #define ptcclose nodev 394: #define ptcread nodev 395: #define ptcwrite nodev 396: #define ptyioctl nodev 397: #define pt_tty 0 398: #define ptcselect nodev 399: #define ptsstop nulldev 400: #endif 401: 402: #include "lpa.h" 403: #if NLPA > 0 404: int lpaopen(),lpaclose(),lparead(),lpawrite(),lpaioctl(); 405: #else 406: #define lpaopen nodev 407: #define lpaclose nodev 408: #define lparead nodev 409: #define lpawrite nodev 410: #define lpaioctl nodev 411: #endif 412: 413: #include "dn.h" 414: #if NDN > 0 415: int dnopen(),dnclose(),dnwrite(); 416: #else 417: #define dnopen nodev 418: #define dnclose nodev 419: #define dnwrite nodev 420: #endif 421: 422: #include "ik.h" 423: #if NIK > 0 424: int ikopen(),ikclose(),ikread(),ikwrite(),ikioctl(),ikreset(); 425: #else 426: #define ikopen nodev 427: #define ikclose nodev 428: #define ikread nodev 429: #define ikwrite nodev 430: #define ikioctl nodev 431: #define ikreset nulldev 432: #endif 433: 434: #include "ps.h" 435: #if NPS > 0 436: int psopen(),psclose(),psread(),pswrite(),psioctl(),psreset(); 437: #else 438: #define psopen nodev 439: #define psclose nodev 440: #define psread nodev 441: #define pswrite nodev 442: #define psopen nodev 443: #define psioctl nodev 444: #define psreset nulldev 445: #endif 446: 447: #include "ad.h" 448: #if NAD > 0 449: int adopen(),adclose(),adioctl(),adreset(); 450: #else 451: #define adopen nodev 452: #define adclose nodev 453: #define adioctl nodev 454: #define adreset nulldev 455: #endif 456: 457: int logopen(),logclose(),logread(),logioctl(),logselect(); 458: 459: #include "dhu.h" 460: #if NDHU > 0 461: int dhuopen(),dhuclose(),dhuread(),dhuwrite(),dhuioctl(),dhustop(),dhureset(); 462: struct tty dhu_tty[]; 463: #else 464: #define dhuopen nodev 465: #define dhuclose nodev 466: #define dhuread nodev 467: #define dhuwrite nodev 468: #define dhuioctl nodev 469: #define dhustop nodev 470: #define dhureset nulldev 471: #define dhu_tty 0 472: #endif 473: 474: #include "vs.h" 475: #if NVS > 0 476: int vsopen(),vsclose(),vsioctl(),vsreset(),vsselect(); 477: #else 478: #define vsopen nodev 479: #define vsclose nodev 480: #define vsioctl nodev 481: #define vsreset nodev 482: #define vsselect nodev 483: #endif 484: 485: #include "dmz.h" 486: #if NDMZ > 0 487: int dmzopen(),dmzclose(),dmzread(),dmzwrite(),dmzioctl(),dmzstop(),dmzreset(); 488: struct tty dmz_tty[]; 489: #else 490: #define dmzopen nodev 491: #define dmzclose nodev 492: #define dmzread nodev 493: #define dmzwrite nodev 494: #define dmzioctl nodev 495: #define dmzstop nodev 496: #define dmzreset nulldev 497: #define dmz_tty 0 498: #endif 499: 500: int ttselect(), seltrue(); 501: 502: struct cdevsw cdevsw[] = 503: { 504: cnopen, cnclose, cnread, cnwrite, /*0*/ 505: cnioctl, nulldev, nulldev, &cons, 506: ttselect, nodev, 507: dzopen, dzclose, dzread, dzwrite, /*1*/ 508: dzioctl, dzstop, dzreset, dz_tty, 509: ttselect, nodev, 510: syopen, nulldev, syread, sywrite, /*2*/ 511: syioctl, nulldev, nulldev, 0, 512: syselect, nodev, 513: nulldev, nulldev, mmread, mmwrite, /*3*/ 514: nodev, nulldev, nulldev, 0, 515: mmselect, nodev, 516: hpopen, nulldev, hpread, hpwrite, /*4*/ 517: hpioctl, nodev, nulldev, 0, 518: seltrue, nodev, 519: htopen, htclose, htread, htwrite, /*5*/ 520: htioctl, nodev, nulldev, 0, 521: seltrue, nodev, 522: vpopen, vpclose, nodev, vpwrite, /*6*/ 523: vpioctl, nulldev, vpreset, 0, 524: vpselect, nodev, 525: nulldev, nulldev, swread, swwrite, /*7*/ 526: nodev, nodev, nulldev, 0, 527: nodev, nodev, 528: flopen, flclose, flread, flwrite, /*8*/ 529: nodev, nodev, nulldev, 0, 530: seltrue, nodev, 531: udopen, nulldev, udread, udwrite, /*9*/ 532: nodev, nodev, udreset, 0, 533: seltrue, nodev, 534: vaopen, vaclose, nodev, vawrite, /*10*/ 535: vaioctl, nulldev, vareset, 0, 536: vaselect, nodev, 537: rkopen, nulldev, rkread, rkwrite, /*11*/ 538: nodev, nodev, rkreset, 0, 539: seltrue, nodev, 540: dhopen, dhclose, dhread, dhwrite, /*12*/ 541: dhioctl, dhstop, dhreset, dh11, 542: ttselect, nodev, 543: upopen, nulldev, upread, upwrite, /*13*/ 544: nodev, nodev, upreset, 0, 545: seltrue, nodev, 546: tmopen, tmclose, tmread, tmwrite, /*14*/ 547: tmioctl, nodev, tmreset, 0, 548: seltrue, nodev, 549: lpopen, lpclose, nodev, lpwrite, /*15*/ 550: nodev, nodev, lpreset, 0, 551: seltrue, nodev, 552: tsopen, tsclose, tsread, tswrite, /*16*/ 553: tsioctl, nodev, tsreset, 0, 554: seltrue, nodev, 555: utopen, utclose, utread, utwrite, /*17*/ 556: utioctl, nodev, utreset, 0, 557: seltrue, nodev, 558: ctopen, ctclose, nodev, ctwrite, /*18*/ 559: nodev, nodev, nulldev, 0, 560: seltrue, nodev, 561: mtopen, mtclose, mtread, mtwrite, /*19*/ 562: mtioctl, nodev, nodev, 0, 563: seltrue, nodev, 564: ptsopen, ptsclose, ptsread, ptswrite, /*20*/ 565: ptyioctl, ptsstop, nulldev, pt_tty, 566: ttselect, nodev, 567: ptcopen, ptcclose, ptcread, ptcwrite, /*21*/ 568: ptyioctl, nulldev, nulldev, pt_tty, 569: ptcselect, nodev, 570: dmfopen, dmfclose, dmfread, dmfwrite, /*22*/ 571: dmfioctl, dmfstop, dmfreset, dmf_tty, 572: ttselect, nodev, 573: idcopen, nulldev, idcread, idcwrite, /*23*/ 574: nodev, nodev, idcreset, 0, 575: seltrue, nodev, 576: dnopen, dnclose, nodev, dnwrite, /*24*/ 577: nodev, nodev, nulldev, 0, 578: seltrue, nodev, 579: /* 25-29 reserved to local sites */ 580: nodev, nodev, nodev, nodev, /*25*/ 581: nodev, nulldev, nulldev, 0, 582: nodev, nodev, 583: lpaopen, lpaclose, lparead, lpawrite, /*26*/ 584: lpaioctl, nodev, nulldev, 0, 585: seltrue, nodev, 586: psopen, psclose, psread, pswrite, /*27*/ 587: psioctl, nodev, psreset, 0, 588: seltrue, nodev, 589: nodev, nodev, nodev, nodev, /*28*/ 590: nodev, nulldev, nulldev, 0, 591: nodev, nodev, 592: adopen, adclose, nodev, nodev, /*29*/ 593: adioctl, nodev, adreset, 0, 594: seltrue, nodev, 595: rxopen, rxclose, rxread, rxwrite, /*30*/ 596: rxioctl, nodev, rxreset, 0, 597: seltrue, nodev, 598: ikopen, ikclose, ikread, ikwrite, /*31*/ 599: ikioctl, nodev, ikreset, 0, 600: seltrue, nodev, 601: rlopen, nodev, rlread, rlwrite, /*32*/ 602: nodev, nodev, rlreset, 0, 603: seltrue, nodev, 604: logopen, logclose, logread, nodev, /*33*/ 605: logioctl, nodev, nulldev, 0, 606: logselect, nodev, 607: dhuopen, dhuclose, dhuread, dhuwrite, /*34*/ 608: dhuioctl, dhustop, dhureset, dhu_tty, 609: ttselect, nodev, 610: crlopen, crlclose, crlread, crlwrite, /*35*/ 611: nodev, nodev, nulldev, 0, 612: seltrue, nodev, 613: vsopen, vsclose, nodev, nodev, /*36*/ 614: vsioctl, nodev, vsreset, 0, 615: vsselect, nodev, 616: dmzopen, dmzclose, dmzread, dmzwrite, /*37*/ 617: dmzioctl, dmzstop, dmzreset, dmz_tty, 618: ttselect, nodev, 619: tmscpopen, tmscpclose, tmscpread, tmscpwrite, /*38*/ 620: tmscpioctl, nodev, tmscpreset, 0, 621: seltrue, nodev, 622: nodev, nodev, nodev, nodev, /*39*/ 623: nodev, nulldev, nulldev, 0, 624: nodev, nodev, 625: nodev, nodev, nodev, nodev, /*40*/ 626: nodev, nulldev, nulldev, 0, 627: nodev, nodev, 628: nodev, nodev, nodev, nodev, /*41*/ 629: nodev, nulldev, nulldev, 0, 630: nodev, nodev, 631: /* 42-50 reserved to local sites */ 632: nodev, nodev, nodev, nodev, /*42*/ 633: nodev, nulldev, nulldev, 0, 634: nodev, nodev, 635: }; 636: int nchrdev = sizeof (cdevsw) / sizeof (cdevsw[0]); 637: 638: int mem_no = 3; /* major device number of memory special file */ 639: 640: /* 641: * Swapdev is a fake device implemented 642: * in sw.c used only internally to get to swstrategy. 643: * It cannot be provided to the users, because the 644: * swstrategy routine munches the b_dev and b_blkno entries 645: * before calling the appropriate driver. This would horribly 646: * confuse, e.g. the hashing routines. Instead, /dev/drum is 647: * provided as a character (raw) device. 648: */ 649: dev_t swapdev = makedev(4, 0);