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