aboutsummaryrefslogtreecommitdiff
path: root/sys/i386/i386/conf.c
blob: ccefbe7fa5fffb3bc66656f1cbc946762ac0a19a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
/*
 * Copyright (c) UNIX System Laboratories, Inc.  All or some portions
 * of this file are derived from material licensed to the
 * University of California by American Telephone and Telegraph Co.
 * or UNIX System Laboratories, Inc. and are reproduced herein with
 * the permission of UNIX System Laboratories, Inc.
 */

/*
 * Copyright (c) 1990 The Regents of the University of California.
 * All rights reserved.
 *
 * This code is derived from software contributed to Berkeley by
 * William Jolitz.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *	This product includes software developed by the University of
 *	California, Berkeley and its contributors.
 * 4. Neither the name of the University nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 *	from: @(#)conf.c	5.8 (Berkeley) 5/12/91
 *	$Id: conf.c,v 1.75 1995/03/04 20:52:38 dufault Exp $
 */

#include <sys/param.h>
#include <sys/systm.h>
#include <sys/buf.h>
#include <sys/ioctl.h>
#include <sys/proc.h>
#include <sys/vnode.h>
#include <sys/tty.h>
#include <sys/conf.h>

d_rdwr_t rawread, rawwrite;
d_strategy_t swstrategy;

/* Lots of bogus defines for shorthand purposes */
#define noopen		(d_open_t *)enodev
#define noclose		(d_close_t *)enodev
#define noread		(d_rdwr_t *)enodev
#define nowrite		noread
#define noioc		(d_ioctl_t *)enodev
#define nostop		(d_stop_t *)enodev
#define noreset		(d_reset_t *)enodev
#define noselect	(d_select_t *)enodev
#define nommap		(d_mmap_t *)enodev
#define nostrat		(d_strategy_t *)enodev
#define nodump		(d_dump_t *)enodev
#define	nodevtotty	(d_ttycv_t *)nullop

#define nxopen		(d_open_t *)enxio
#define	nxclose		(d_close_t *)enxio
#define	nxread		(d_rdwr_t *)enxio
#define	nxwrite		nxread
#define	nxstrategy	(d_strategy_t *)enxio
#define	nxioctl		(d_ioctl_t *)enxio
#define	nxdump		(d_dump_t *)enxio
#define nxstop		(d_stop_t *)enxio
#define nxreset		(d_reset_t *)enxio
#define nxselect	(d_select_t *)enxio
#define nxmmap		(d_mmap_t *)enxio
#define	nxdevtotty	(d_ttycv_t *)nullop

#define nullopen	(d_open_t *)nullop
#define nullclose	(d_close_t *)nullop
#define nullstop	(d_stop_t *)nullop
#define nullreset	(d_reset_t *)nullop

#define zerosize	(d_psize_t *)0

int lkmenodev();
#define	lkmopen		(d_open_t *)lkmenodev
#define	lkmclose	(d_close_t *)lkmenodev
#define lkmread		(d_rdwr_t *)lkmenodev
#define lkmwrite	(d_rdwr_t *)lkmenodev
#define	lkmstrategy	(d_strategy_t *)lkmenodev
#define	lkmioctl	(d_ioctl_t *)lkmenodev
#define	lkmdump		(d_dump_t *)lkmenodev
#define	lkmsize		zerosize
#define lkmstop		(d_stop_t *)lkmenodev
#define lkmreset	(d_reset_t *)lkmenodev
#define lkmmmap		(d_mmap_t *)lkmenodev
#define lkmselect	(d_select_t *)lkmenodev

#include "wd.h"
#if (NWD > 0)
d_open_t	wdopen;
d_close_t	wdclose;
d_strategy_t	wdstrategy;
d_ioctl_t	wdioctl;
d_dump_t	wddump;
d_psize_t	wdsize;
#else
#define	wdopen		nxopen
#define	wdclose		nxclose
#define	wdstrategy	nxstrategy
#define	wdioctl		nxioctl
#define	wddump		nxdump
#define	wdsize		zerosize
#endif

#include "worm.h"
#if WORM > 0
d_open_t	wormopen;
d_close_t	wormclose;
d_strategy_t	wormstrategy;
d_ioctl_t	wormioctl;
d_dump_t	wormdump;
d_psize_t	wormsize;
#else
#define	wormopen		nxopen
#define	wormclose		nxclose
#define	wormstrategy	nxstrategy
#define	wormioctl		nxioctl
#define	wormdump		nxdump
#define	wormsize		zerosize
#endif

#include "pt.h"
#if NPT > 0
d_open_t	ptopen;
d_close_t	ptclose;
d_strategy_t	ptstrategy;
d_ioctl_t	ptioctl;
d_dump_t	ptdump;
d_psize_t	ptsize;
#else
#define	ptopen		nxopen
#define	ptclose		nxclose
#define	ptstrategy	nxstrategy
#define	ptioctl		nxioctl
#define	ptdump		nxdump
#define	ptsize		zerosize
#endif

#include "sd.h"
#if NSD > 0
d_open_t	sdopen;
d_close_t	sdclose;
d_strategy_t	sdstrategy;
d_ioctl_t	sdioctl;
d_dump_t	sddump;
d_psize_t	sdsize;
#else
#define	sdopen		nxopen
#define	sdclose		nxclose
#define	sdstrategy	nxstrategy
#define	sdioctl		nxioctl
#define	sddump		nxdump
#define	sdsize		zerosize
#endif

#include "st.h"
#if NST > 0
d_open_t	stopen;
d_close_t	stclose;
d_strategy_t	ststrategy;
d_ioctl_t	stioctl;
/*int	stdump(),stsize();*/
#define	stdump		nxdump
#define	stsize		zerosize
#else
#define	stopen		nxopen
#define	stclose		nxclose
#define	ststrategy	nxstrategy
#define	stioctl		nxioctl
#define	stdump		nxdump
#define	stsize		zerosize
#endif

#include "cd.h"
#if NCD > 0
d_open_t	cdopen;
d_close_t	cdclose;
d_strategy_t	cdstrategy;
d_ioctl_t	cdioctl;
d_psize_t	cdsize;
#define	cddump		nxdump
#else
#define	cdopen		nxopen
#define	cdclose		nxclose
#define	cdstrategy	nxstrategy
#define	cdioctl		nxioctl
#define	cddump		nxdump
#define	cdsize		zerosize
#endif

#include "mcd.h"
#if NMCD > 0
d_open_t	mcdopen;
d_close_t	mcdclose;
d_strategy_t	mcdstrategy;
d_ioctl_t	mcdioctl;
d_psize_t	mcdsize;
#define	mcddump		nxdump
#else
#define	mcdopen		nxopen
#define	mcdclose	nxclose
#define	mcdstrategy	nxstrategy
#define	mcdioctl	nxioctl
#define	mcddump		nxdump
#define	mcdsize		zerosize
#endif

#include "scd.h"
#if NSCD > 0
d_open_t	scdopen;
d_close_t	scdclose;
d_strategy_t	scdstrategy;
d_ioctl_t	scdioctl;
d_psize_t	scdsize;
#define	scddump		nxdump
#else
#define	scdopen		nxopen
#define	scdclose	nxclose
#define	scdstrategy	nxstrategy
#define	scdioctl	nxioctl
#define	scddump		nxdump
#define	scdsize		zerosize
#endif

#include "matcd.h"
#if NMATCD > 0
d_open_t  matcdopen;
d_close_t matcdclose;
d_strategy_t matcdstrategy;
d_ioctl_t matcdioctl;
d_dump_t matcddump;
d_psize_t matcdsize;
#define       matcddump       nxdump
#else
#define       matcdopen       nxopen
#define       matcdclose      nxclose
#define       matcdstrategy   nxstrategy
#define       matcdioctl      nxioctl
#define       matcddump       nxdump
#define       matcdsize       (d_psize_t *)0
#endif

#include "ch.h"
#if NCH > 0
d_open_t	chopen;
d_close_t	chclose;
d_ioctl_t	chioctl;
#else
#define	chopen		nxopen
#define	chclose		nxclose
#define	chioctl		nxioctl
#endif

#include "wt.h"
#if NWT > 0
d_open_t	wtopen;
d_close_t	wtclose;
d_strategy_t	wtstrategy;
d_ioctl_t	wtioctl;
d_dump_t	wtdump;
d_psize_t	wtsize;
#else
#define	wtopen		nxopen
#define	wtclose		nxclose
#define	wtstrategy	nxstrategy
#define	wtioctl		nxioctl
#define	wtdump		nxdump
#define	wtsize		zerosize
#endif

#include "fd.h"
#if NFD > 0
d_open_t	Fdopen;
d_close_t	fdclose;
d_strategy_t	fdstrategy;
d_ioctl_t	fdioctl;
#define	fddump		nxdump
#define	fdsize		zerosize
#else
#define	Fdopen		nxopen
#define	fdclose		nxclose
#define	fdstrategy	nxstrategy
#define	fdioctl		nxioctl
#define	fddump		nxdump
#define	fdsize		zerosize
#endif

#include "vn.h"
#if NVN > 0
d_open_t	vnopen;
d_close_t	vnclose;
d_strategy_t	vnstrategy;
d_ioctl_t	vnioctl;
d_dump_t	vndump;
d_psize_t	vnsize;
#else
#define	vnopen		nxopen
#define	vnclose		nxclose
#define	vnstrategy	nxstrategy
#define	vnioctl		nxioctl
#define	vndump		nxdump
#define	vnsize		zerosize
#endif

#define swopen		noopen
#define swclose		noclose
#define swioctl		noioc
#define swdump		nodump
#define swsize		(d_psize_t *)enodev

d_rdwr_t swread, swwrite;

struct bdevsw	bdevsw[] =
{
	{ wdopen,	wdclose,	wdstrategy,	wdioctl,	/*0*/
	  wddump,	wdsize,		0 },
	{ swopen,	swclose,	swstrategy,	swioctl,	/*1*/
	  swdump,	swsize,		0 },
	{ Fdopen,	fdclose,	fdstrategy,	fdioctl,	/*2*/
	  fddump,	fdsize,		0 },
	{ wtopen,	wtclose,	wtstrategy,	wtioctl,	/*3*/
	  wtdump,	wtsize,		B_TAPE },
	{ sdopen,	sdclose,	sdstrategy,	sdioctl,	/*4*/
	  sddump,	sdsize,		0 },
	{ stopen,	stclose,	ststrategy,	stioctl,	/*5*/
	  stdump,	stsize,		0 },
	{ cdopen,	cdclose,	cdstrategy,	cdioctl,	/*6*/
	  cddump,	cdsize,		0 },
	{ mcdopen,	mcdclose,	mcdstrategy,	mcdioctl,	/*7*/
	  mcddump,	mcdsize,	0 },
	{ lkmopen,	lkmclose,	lkmstrategy,	lkmioctl,	/*8*/
	  lkmdump,	lkmsize,	NULL },
	{ lkmopen,	lkmclose,	lkmstrategy,	lkmioctl,	/*9*/
	  lkmdump,	lkmsize,	NULL },
	{ lkmopen,	lkmclose,	lkmstrategy,	lkmioctl,	/*10*/
	  lkmdump,	lkmsize,	NULL },
	{ lkmopen,	lkmclose,	lkmstrategy,	lkmioctl,	/*11*/
	  lkmdump,	lkmsize,	NULL },
	{ lkmopen,	lkmclose,	lkmstrategy,	lkmioctl,	/*12*/
	  lkmdump,	lkmsize,	NULL },
	{ lkmopen,	lkmclose,	lkmstrategy,	lkmioctl,	/*13*/
	  lkmdump,	lkmsize,	NULL },
	/* block device 14 is reserved for local use */
	{ nxopen,	nxclose,	nxstrategy,	nxioctl,	/*14*/
	  nxdump,	zerosize,	NULL },
	{ vnopen,	vnclose,	vnstrategy,	vnioctl,	/*15*/
	  vndump,	vnsize,		0 },
	{ scdopen,	scdclose,	scdstrategy,	scdioctl,	/*16*/
	  scddump,	scdsize,	0 },
	{ matcdopen,	matcdclose,	matcdstrategy,	matcdioctl,	/*17*/
	  matcddump,	matcdsize,	0 }
/*
 * If you need a bdev major number for a driver that you intend to donate
 * back to the group or release publically, please contact the FreeBSD team
 * by sending mail to "FreeBSD-hackers@freefall.cdrom.com".
 * If you assign one yourself it may conflict with someone else.
 * Otherwise, simply use the one reserved for local use.
 */
};
int	nblkdev = sizeof (bdevsw) / sizeof (bdevsw[0]);

/* console */
#include "machine/cons.h"

/* more console */
#include "sc.h"
#include "vt.h"
#if NSC > 0
d_open_t	scopen;
d_close_t	scclose;
d_rdwr_t	scread, scwrite;
d_ioctl_t	scioctl;
d_mmap_t	scmmap;
d_ttycv_t	scdevtotty;
#else
#define scopen		nxopen
#define scclose		nxclose
#define scread		nxread
#define scwrite		nxwrite
#define scioctl		nxioctl
#define scmmap		nxmmap
#define	scdevtotty	nxdevtotty
#endif

/* controlling TTY */
d_open_t	cttyopen;
d_rdwr_t	cttyread;
d_rdwr_t	cttywrite;
d_ioctl_t	cttyioctl;
d_select_t	cttyselect;
d_ttycv_t	cttydevtotty;

/* /dev/mem */
d_open_t	mmopen;
d_close_t	mmclose;
d_rdwr_t	mmrw;
d_mmap_t	memmmap;
#define	mmselect	seltrue

#include "pty.h"
#if NPTY > 0
d_open_t	ptsopen;
d_close_t	ptsclose;
d_rdwr_t	ptsread;
d_rdwr_t	ptswrite;
d_stop_t	ptsstop;
d_open_t	ptcopen;
d_close_t	ptcclose;
d_rdwr_t	ptcread;
d_rdwr_t	ptcwrite;
d_select_t	ptcselect;
d_ttycv_t	ptydevtotty;
d_ioctl_t	ptyioctl;
#else
#define ptsopen		nxopen
#define ptsclose	nxclose
#define ptsread		nxread
#define ptswrite	nxwrite
#define ptcopen		nxopen
#define ptcclose	nxclose
#define ptcread		nxread
#define ptcwrite	nxwrite
#define ptyioctl	nxioctl
#define	ptcselect	nxselect
#define	ptsstop		nullstop
#define	ptydevtotty	nxdevtotty
#endif


#include "snp.h"
#if NSNP > 0
d_open_t	snpopen;
d_close_t	snpclose;
d_rdwr_t	snpread;
d_rdwr_t	snpwrite;
d_select_t	snpselect;
d_ioctl_t	snpioctl;
#else
#define snpopen		nxopen
#define snpclose	nxclose
#define snpread		nxread
#define snpwrite	nxwrite
#define snpioctl	nxioctl
#define	snpselect	nxselect
#endif


/* /dev/klog */
d_open_t	logopen;
d_close_t	logclose;
d_rdwr_t	logread;
d_ioctl_t	logioctl;
d_select_t	logselect;

#include "bqu.h"
#if NBQU > 0
d_open_t	bquopen;
d_close_t	bquclose;
d_rdwr_t	bquread, bquwrite;
d_select_t	bquselect; 
d_ioctl_t	bquioctl;
#else 
#define bquopen         nxopen 
#define bquclose        nxclose
#define bquread         nxread
#define bquwrite        nxwrite
#define bquselect       nxselect
#define bquioctl        nxioctl 
#endif

#include "lpt.h"
#if NLPT > 0
d_open_t	lptopen;
d_close_t	lptclose;
d_rdwr_t	lptwrite;
d_ioctl_t	lptioctl;
#else
#define	lptopen		nxopen
#define	lptclose	nxclose
#define	lptwrite	nxwrite
#define	lptioctl	nxioctl
#endif

#include "tw.h"
#if NTW > 0
d_open_t	twopen;
d_close_t	twclose;
d_rdwr_t	twread, twwrite;
d_select_t	twselect;
d_ttycv_t	twdevtotty;
#else
#define twopen		nxopen
#define twclose		nxclose
#define twread		nxread
#define twwrite		nxwrite
#define twselect	nxselect
#define	twdevtotty	nxdevtotty
#endif

#include "psm.h"
#if NPSM > 0
d_open_t	psmopen;
d_close_t	psmclose;
d_rdwr_t	psmread;
d_select_t	psmselect;
d_ioctl_t	psmioctl;
#else
#define psmopen		nxopen
#define psmclose	nxclose
#define psmread		nxread
#define psmselect	nxselect
#define psmioctl	nxioctl
#endif

#include "snd.h"                 /* General Sound Driver */
#if     NSND > 0
d_open_t	sndopen;
d_close_t	sndclose;
d_ioctl_t	sndioctl;
d_rdwr_t	sndread, sndwrite;
d_select_t	sndselect;
#else
#define sndopen         nxopen
#define sndclose        nxclose
#define sndioctl       	nxioctl
#define sndread         nxread
#define sndwrite        nxwrite
#define sndselect       seltrue
#endif

#include "vat_audio.h"		/* BSD audio driver emulator for voxware */
#if     NVAT_AUDIO > 0		/* not general purpose, just vat */
d_open_t	vaopen;
d_close_t	vaclose;
d_ioctl_t	vaioctl;
d_rdwr_t	varead, vawrite;
d_select_t	vaselect;
#else
#define vaopen          nxopen
#define vaclose         nxclose
#define vaioctl         nxioctl
#define varead          nxread
#define vawrite         nxwrite
#define vaselect        seltrue
#endif

/* /dev/fd/NNN */
d_open_t fdopen;

#include "bpfilter.h"
#if NBPFILTER > 0
d_open_t	bpfopen;
d_close_t	bpfclose;
d_rdwr_t	bpfread, bpfwrite;
d_select_t	bpfselect;
d_ioctl_t	bpfioctl;
#else
#define	bpfopen		nxopen
#define	bpfclose	nxclose
#define	bpfread		nxread
#define	bpfwrite	nxwrite
#define	bpfselect	nxselect
#define	bpfioctl	nxioctl
#endif

#include "speaker.h"
#if NSPEAKER > 0
d_open_t	spkropen;
d_close_t	spkrclose;
d_rdwr_t	spkrwrite;
d_ioctl_t	spkrioctl;
#else
#define spkropen	nxopen
#define spkrclose	nxclose
#define spkrwrite	nxwrite
#define spkrioctl	nxioctl
#endif

#include "pca.h"
#if NPCA > 0
d_open_t	pcaopen;
d_close_t	pcaclose;
d_rdwr_t	pcawrite;
d_ioctl_t	pcaioctl;
d_select_t	pcaselect;
#else
#define pcaopen		nxopen
#define pcaclose	nxclose
#define pcawrite	nxwrite
#define pcaioctl	nxioctl
#define pcaselect	nxselect
#endif

#include "mse.h"
#if NMSE > 0
d_open_t	mseopen;
d_close_t	mseclose;
d_rdwr_t	mseread;
d_select_t	mseselect;
#else
#define	mseopen		nxopen
#define	mseclose	nxclose
#define	mseread		nxread
#define	mseselect	nxselect
#endif

#include "sio.h"
#if NSIO > 0
d_open_t	sioopen;
d_close_t	sioclose;
d_rdwr_t	sioread, siowrite;
d_ioctl_t	sioioctl;
d_stop_t	siostop;
d_ttycv_t	siodevtotty;
#define sioreset	nxreset
#else
#define sioopen		nxopen
#define sioclose	nxclose
#define sioread		nxread
#define siowrite	nxwrite
#define sioioctl	nxioctl
#define siostop		nxstop
#define sioreset	nxreset
#define	siodevtotty	nxdevtotty
#endif

#include "su.h"
#if NSU > 0
d_open_t	suopen;
d_close_t	suclose;
d_ioctl_t	suioctl;
d_rdwr_t	suread, suwrite;
d_select_t	suselect;
#define	summap		nxmmap
d_strategy_t	sustrategy;
#else
#define	suopen		nxopen
#define	suclose		nxclose
#define	suioctl		nxioctl
#define	suread		nxread
#define	suwrite		nxwrite
#define	suselect	nxselect
#define	summap		nxmmap
#define	sustrategy	nxstrategy
#endif

#include "scbus.h"
#if NSCBUS > 0
d_open_t	ukopen;
d_close_t	ukclose;
d_ioctl_t	ukioctl;
#else
#define	ukopen		nxopen
#define	ukclose		nxclose
#define	ukioctl		nxioctl
#endif

d_open_t	lkmcopen;
d_close_t	lkmcclose;
d_ioctl_t	lkmcioctl;

#include "apm.h"
#if NAPM > 0
d_open_t	apmopen;
d_close_t	apmclose;
d_ioctl_t	apmioctl;
#else
#define	apmopen		nxopen
#define	apmclose	nxclose
#define	apmioctl	nxioctl
#endif

#ifdef IBCS2
d_open_t	sockopen;
d_close_t	sockclose;
d_ioctl_t	sockioctl;
#else
#define	sockopen	nxopen
#define	sockclose	nxclose
#define	sockioctl	nxioctl
#endif

#include "ctx.h"
#if NCTX > 0
d_open_t	ctxopen;
d_close_t	ctxclose;
d_rdwr_t	ctxread;
d_rdwr_t	ctxwrite;
d_ioctl_t	ctxioctl;
#else
#define ctxopen		nxopen
#define ctxclose	nxclose
#define ctxread		nxread
#define ctxwrite	nxwrite
#define ctxioctl	nxioctl
#endif

#include "ssc.h"
#if NSSC > 0
d_open_t	sscopen;
d_close_t	sscclose;
d_ioctl_t	sscioctl;
d_rdwr_t	sscread, sscwrite;
d_select_t	sscselect;
#define	sscmmap		nxmmap
d_strategy_t	sscstrategy;
#else
#define	sscopen		nxopen
#define	sscclose	nxclose
#define	sscioctl	nxioctl
#define	sscread		nxread
#define	sscwrite	nxwrite
#define	sscselect	nxselect
#define	sscmmap		nxmmap
#define	sscstrategy	nxstrategy
#endif

#include "cx.h"
#if NCX > 0
d_open_t	cxopen;
d_close_t	cxclose;
d_rdwr_t	cxread, cxwrite;
d_ioctl_t	cxioctl;
d_select_t	cxselect;
d_stop_t	cxstop;
d_ttycv_t	cxdevtotty;
#else
#define cxopen		nxopen
#define cxclose		nxclose
#define cxread		nxread
#define cxwrite		nxwrite
#define cxioctl		nxioctl
#define cxstop		nxstop
#define cxselect	nxselect
#define	cxdevtotty	nxdevtotty
#endif

#include "gp.h"
#if NGP > 0
d_open_t	gpopen;
d_close_t	gpclose;
d_rdwr_t	gpwrite;
d_ioctl_t	gpioctl; 
#else   
#define gpopen  	nxopen
#define gpclose 	nxclose
#define gpwrite 	nxwrite
#define gpioctl 	nxioctl
#endif

#include "gsc.h"
#if NGSC > 0
d_open_t	gscopen;
d_close_t	gscclose;
d_rdwr_t	gscread;
d_ioctl_t	gscioctl; 
#else   
#define gscopen		nxopen
#define gscclose	nxclose
#define gscread		nxread
#define gscioctl	nxioctl
#endif

#include "joy.h"
#if NJOY > 0
d_open_t	joyopen;
d_close_t	joyclose;
d_rdwr_t	joyread;
d_ioctl_t	joyioctl;
#else
#define joyopen		nxopen
#define joyclose	nxclose
#define joyread		nxread
#define	joyioctl	nxioctl
#endif

#include "tun.h"
#if NTUN > 0
d_open_t	tunopen;
d_close_t	tunclose;
d_rdwr_t	tunread, tunwrite;
d_ioctl_t	tunioctl;
d_select_t	tunselect;
#else
#define tunopen         nxopen
#define tunclose        nxclose
#define tunread         nxread
#define tunwrite        nxwrite
#define tunioctl        nxioctl
#define tunselect       nxselect
#endif

#include "spigot.h"     
#if     NSPIGOT > 0     
d_open_t        spigot_open;
d_close_t       spigot_close;
d_ioctl_t       spigot_ioctl;
d_rdwr_t        spigot_read, spigot_write;
d_select_t      spigot_select;
d_mmap_t        spigot_mmap;
#else
#define spigot_open     nxopen     
#define spigot_close    nxclose     
#define spigot_ioctl    nxioctl     
#define spigot_read     nxread     
#define spigot_write    nxwrite     
#define spigot_select   seltrue     
#define spigot_mmap     nommap
#endif

/* Cyclades serial driver */
#include "cy.h"
#if	NCY > 0
d_open_t        cyopen;
d_close_t       cyclose;
d_read_t        cyread;
d_write_t       cywrite;
d_ioctl_t	cyioctl;
d_stop_t        cystop;
d_ttycv_t	cydevtotty;
#define cyreset	nxreset
#define	cymmap	nxmmap
#define cystrategy nxstrategy
#else
#define	cyopen		nxopen
#define cyclose		nxclose
#define cyread		nxread
#define cywrite		nxwrite
#define cyioctl		nxioctl
#define cystop		nxstop
#define cyreset		nxreset
#define cymmap		nxmmap
#define cystrategy	nxstrategy
#define	cydevtotty	nxdevtotty
#endif

#include "ity.h"
#if NITY > 0
d_open_t	ityopen;
d_close_t	ityclose;
d_read_t	ityread;
d_write_t	itywrite;
d_ioctl_t	ityioctl;
d_ttycv_t	itydevtotty;
#define ityreset	nxreset
#else
#define ityopen		nxopen
#define ityclose	nxclose
#define ityread		nxread
#define itywrite	nxwrite
#define ityioctl	nxioctl
#define ityreset	nxreset
#define	itydevtotty	nxdevtotty
#endif

#include "nic.h"
#if NNIC > 0
d_open_t	nicopen;
d_close_t	nicclose;
d_ioctl_t	nicioctl;
#else
#define nicopen		nxopen
#define nicclose	nxclose
#define nicioctl	nxioctl
#endif

#include "nnic.h"
#if NNNIC > 0
d_open_t  nnicopen;
d_close_t nnicclose;
d_ioctl_t nnicioctl;
#else
#define nnicopen        nxopen
#define nnicclose       nxclose
#define nnicioctl       nxioctl
#endif

#include "isdn.h"
#if NISDN > 0
d_open_t isdnopen;
d_close_t isdnclose;
d_read_t isdnread;
d_ioctl_t isdnioctl;
#else
#define isdnopen	nxopen
#define isdnclose	nxclose
#define isdnread	nxread
#define isdnioctl	nxioctl
#endif

#include "itel.h"
#if NITEL > 0
d_open_t itelopen;
d_close_t itelclose;
d_read_t itelread;
d_write_t itelwrite;
d_ioctl_t itelioctl;
#else
#define itelopen	nxopen
#define itelclose	nxclose
#define itelread	nxread
#define itelwrite	nxwrite
#define itelioctl	nxioctl
#endif

#include "ispy.h"
#if NISPY > 0
d_open_t  ispyopen;
d_close_t ispyclose;
d_read_t ispyread;
d_write_t ispywrite;
d_ioctl_t ispyioctl;
#else
#define ispyopen        nxopen
#define ispyclose       nxclose
#define ispyread        nxread
#define ispywrite       nxwrite
#define ispyioctl       nxioctl
#endif

/* open, close, read, write, ioctl, stop, reset, ttys, select, mmap, strat */
struct cdevsw	cdevsw[] =
{
	{ cnopen,	cnclose,	cnread,		cnwrite,	/*0*/
	  cnioctl,	nullstop,	nullreset,	nodevtotty,/* console */
	  cnselect,	nommap,		NULL },
	{ cttyopen,	nullclose,	cttyread,	cttywrite,	/*1*/
	  cttyioctl,	nullstop,	nullreset,	nodevtotty,/* tty */
	  cttyselect,	nommap,		NULL },
	{ mmopen,	mmclose,	mmrw,		mmrw,		/*2*/
	  noioc,	nullstop,	nullreset,	nodevtotty,/* memory */
	  mmselect,	memmmap,	NULL },
	{ wdopen,	wdclose,	rawread,	rawwrite,	/*3*/
	  wdioctl,	nostop,		nullreset,	nodevtotty,/* wd */
	  seltrue,	nommap,		wdstrategy },
	{ nullopen,	nullclose,	rawread,	rawwrite,	/*4*/
	  noioc,	nostop,		noreset,	nodevtotty,/* swap */
	  noselect,	nommap,		swstrategy },
	{ ptsopen,	ptsclose,	ptsread,	ptswrite,	/*5*/
	  ptyioctl,	ptsstop,	nullreset,	ptydevtotty,/* ttyp */
	  ttselect,	nommap,		NULL },
	{ ptcopen,	ptcclose,	ptcread,	ptcwrite,	/*6*/
	  ptyioctl,	nullstop,	nullreset,	ptydevtotty,/* ptyp */
	  ptcselect,	nommap,		NULL },
	{ logopen,	logclose,	logread,	nowrite,	/*7*/
	  logioctl,	nostop,		nullreset,	nodevtotty,/* klog */
	  logselect,	nommap,		NULL },
	{ bquopen,      bquclose,       bquread,        bquwrite,       /*8*/
	  bquioctl,     nostop,         nullreset,      nodevtotty,/* tputer */
	  bquselect,    nommap,         NULL },
	{ Fdopen,	fdclose,	rawread,	rawwrite,	/*9*/
	  fdioctl,	nostop,		nullreset,	nodevtotty,/* Fd (!=fd) */
	  seltrue,	nommap,		fdstrategy },
	{ wtopen,	wtclose,	rawread,	rawwrite,	/*10*/
	  wtioctl,	nostop,		nullreset,	nodevtotty,/* wt */
	  seltrue,	nommap,		wtstrategy },
	{ spigot_open,	spigot_close,	spigot_read,	spigot_write,	/*11*/
	  spigot_ioctl,	nostop,		nullreset,	nodevtotty,/* Spigot */
	  spigot_select, spigot_mmap,	NULL },
	{ scopen,	scclose,	scread,		scwrite,	/*12*/
	  scioctl,	nullstop,	nullreset,	scdevtotty,/* sc */
	  ttselect,	scmmap,		NULL },
	{ sdopen,	sdclose,	rawread,	rawwrite,	/*13*/
	  sdioctl,	nostop,		nullreset,	nodevtotty,/* sd */
	  seltrue,	nommap,		sdstrategy },
	{ stopen,	stclose,	rawread,	rawwrite,	/*14*/
	  stioctl,	nostop,		nullreset,	nodevtotty,/* st */
	  seltrue,	nommap,		ststrategy },
	{ cdopen,	cdclose,	rawread,	nowrite,	/*15*/
	  cdioctl,	nostop,		nullreset,	nodevtotty,/* cd */
	  seltrue,	nommap,		cdstrategy },
	{ lptopen,	lptclose,	noread,		lptwrite,	/*16*/
	  lptioctl,	nullstop,	nullreset,	nodevtotty,/* lpt */
	  seltrue,	nommap,		nostrat},
	{ chopen,	chclose,	noread,		nowrite,	/*17*/
	  chioctl,	nostop,		nullreset,	nodevtotty,/* ch */
	  noselect,	nommap,		nostrat },
	{ suopen,	suclose,	suread,		suwrite,	/*18*/
	  suioctl,	nostop,		nullreset,	nodevtotty,/* scsi */
	  suselect,	summap,		sustrategy },		/* 'generic' */
	{ twopen,	twclose,	twread,		twwrite,	/*19*/
	  noioc,	nullstop,	nullreset,	nodevtotty,/* tw */
	  twselect,	nommap,		nostrat },
/*
 * If you need a cdev major number for a driver that you intend to donate
 * back to the group or release publically, please contact the FreeBSD team
 * by sending mail to "hackers@freebsd.org".
 * If you assign one yourself it may conflict with someone else.
 * Otherwise, simply use the one reserved for local use.
 */
	/* character device 20 is reserved for local use */
	{ nxopen, nxclose, nxread,	/*20*/
	  nxwrite, nxioctl, nxstop,
	  nxreset, nxdevtotty, nxselect,
	  nxmmap, NULL },
	{ psmopen,	psmclose,	psmread,	nowrite,	/*21*/
	  psmioctl,	nostop,		nullreset,	nodevtotty,/* psm mice */
	  psmselect,	nommap,		NULL },
	{ fdopen,	noclose,	noread,		nowrite,	/*22*/
	  noioc,	nostop,		nullreset,	nodevtotty,/* fd (!=Fd) */
	  noselect,	nommap,		nostrat },
 	{ bpfopen,	bpfclose,	bpfread,	bpfwrite,	/*23*/
 	  bpfioctl,	nostop,		nullreset,	nodevtotty,/* bpf */
 	  bpfselect,	nommap,		NULL },
 	{ pcaopen,      pcaclose,       noread,         pcawrite,       /*24*/
 	  pcaioctl,     nostop,         nullreset,      nodevtotty,/* pcaudio */
 	  pcaselect,	nommap,		NULL },
	{ vaopen,	vaclose,	varead,		vawrite,	/*25*/
  	  vaioctl,	nostop,		nullreset,	nodevtotty,/* vat */
  	  vaselect,	nommap,		NULL },
	{ spkropen,     spkrclose,      noread,         spkrwrite,      /*26*/
	  spkrioctl,    nostop,         nullreset,      nodevtotty,/* spkr */
	  seltrue,	nommap,		NULL },
	{ mseopen,	mseclose,	mseread,	nowrite,	/*27*/
	  noioc,	nostop,		nullreset,	nodevtotty,/* mse */
	  mseselect,	nommap,		NULL },
	{ sioopen,	sioclose,	sioread,	siowrite,	/*28*/
	  sioioctl,	siostop,	sioreset,	siodevtotty,/* sio */
	  ttselect,	nommap,		NULL },
	{ mcdopen,	mcdclose,	rawread,	nowrite,	/*29*/
	  mcdioctl,	nostop,		nullreset,	nodevtotty,/* mitsumi cd */
	  seltrue,	nommap,		mcdstrategy },
	{ sndopen,	sndclose,	sndread,	sndwrite,	/*30*/
  	  sndioctl,	nostop,		nullreset,	nodevtotty,/* sound */
  	  sndselect,	nommap,		NULL },
	{ ukopen,	ukclose,	noread,         nowrite,      	/*31*/
	  ukioctl,	nostop,		nullreset,	nodevtotty,/* unknown */
	  seltrue,	nommap,		NULL },			   /* scsi */
	{ lkmcopen,	lkmcclose,	noread,		nowrite,	/*32*/
	  lkmcioctl,	nostop,		nullreset,	nodevtotty,
	  noselect,	nommap,		NULL },
	{ lkmopen,	lkmclose,	lkmread,	lkmwrite,	/*33*/
	  lkmioctl,	lkmstop,	lkmreset,	nodevtotty,
	  lkmselect,	lkmmmap,	NULL },
	{ lkmopen,	lkmclose,	lkmread,	lkmwrite,	/*34*/
	  lkmioctl,	lkmstop,	lkmreset,	nodevtotty,
	  lkmselect,	lkmmmap,	NULL },
	{ lkmopen,	lkmclose,	lkmread,	lkmwrite,	/*35*/
	  lkmioctl,	lkmstop,	lkmreset,	nodevtotty,
	  lkmselect,	lkmmmap,	NULL },
	{ lkmopen,	lkmclose,	lkmread,	lkmwrite,	/*36*/
	  lkmioctl,	lkmstop,	lkmreset,	nodevtotty,
	  lkmselect,	lkmmmap,	NULL },
	{ lkmopen,	lkmclose,	lkmread,	lkmwrite,	/*37*/
	  lkmioctl,	lkmstop,	lkmreset,	nodevtotty,
	  lkmselect,	lkmmmap,	NULL },
	{ lkmopen,	lkmclose,	lkmread,	lkmwrite,	/*38*/
	  lkmioctl,	lkmstop,	lkmreset,	nodevtotty,
	  lkmselect,	lkmmmap,	NULL },
	{ apmopen,	apmclose,	noread,		nowrite,	/*39*/
	  apmioctl,	nostop,		nullreset,	nodevtotty,/* APM */
	  seltrue,	nommap,		NULL },
	{ ctxopen,	ctxclose,	ctxread,	ctxwrite,	/*40*/
	  ctxioctl,	nostop,		nullreset,	nodevtotty,/* cortex */
	  seltrue,	nommap,		NULL },
	{ sockopen,	sockclose,	noread,		nowrite,	/*41*/
	  sockioctl,	nostop,		nullreset,	nodevtotty,/* socksys */
	  seltrue,	nommap,		NULL },
	{ cxopen,	cxclose,	cxread,		cxwrite,	/*42*/
	  cxioctl,	cxstop,		nullreset,	cxdevtotty,/* cronyx */
	  cxselect,	nommap,		NULL },
	{ vnopen,	vnclose,	rawread,	rawwrite,	/*43*/
	  vnioctl,	nostop,		nullreset,	nodevtotty,/* vn */
	  seltrue,	nommap,		vnstrategy },
	{ gpopen,	gpclose,	noread,		gpwrite,	/*44*/
	  gpioctl,	nostop,		nullreset,	nodevtotty,/* GPIB */
          seltrue,	nommap,		NULL },                 
	{ scdopen,	scdclose,	rawread,	nowrite,	/*45*/
	  scdioctl,	nostop,		nullreset,	nodevtotty,/* sony cd */
	  seltrue,	nommap,		scdstrategy },
	{ matcdopen,	matcdclose,	rawread,	nowrite,	/*46*/
	  matcdioctl,	nostop,		nullreset,	nodevtotty,/* SB cd */
	  seltrue,	nommap,		matcdstrategy },
	{ gscopen,      gscclose,       gscread,        nowrite,	/*47*/
	  gscioctl,     nostop,         nullreset,      nodevtotty,/* gsc */
	  seltrue,      nommap,         NULL },
	{ cyopen,	cyclose,	cyread,		cywrite,	/*48*/
	  cyioctl,	cystop,		cyreset,	cydevtotty,/*cyclades*/
	  ttselect,	cymmap,		cystrategy },
	{ sscopen,	sscclose,	sscread,	sscwrite,	/*49*/
	  sscioctl,	nostop,		nullreset,	nodevtotty,/* scsi super */
	  sscselect,	sscmmap,	sscstrategy },
	{ nxopen,	nxclose,	nxread,		nxwrite,	/*50*/
	  nxioctl,	nxstop,		nxreset,	nodevtotty,/* pcmcia */
	  nxselect,	nxmmap,		NULL },
	{ joyopen,	joyclose,	joyread,	nowrite,	/*51*/
	  joyioctl,	nostop,		nullreset,	nodevtotty,/*joystick */
	  seltrue,	nommap,		NULL},
	{ tunopen,      tunclose,       tunread,        tunwrite,       /*52*/
	  tunioctl,     nostop,         nullreset,      nodevtotty,/* tunnel */
	  tunselect,    nommap,         NULL },
	{ snpopen,	snpclose,	snpread,	snpwrite,	/*53*/
	  snpioctl,	nostop,		nullreset,	nodevtotty,/* snoop */
	  snpselect,	nommap,		NULL },
	{ nicopen,	nicclose,	noread,		nowrite,	/*54*/
	  nicioctl,	nostop,		nullreset,	nodevtotty,/* nic */
	  seltrue,	nommap,		NULL },
	{ isdnopen,	isdnclose,	isdnread,	nowrite,	/*55*/
	  isdnioctl,	nostop,		nullreset,	nodevtotty,/* isdn */
	  seltrue,	nommap,		NULL },
	{ ityopen,	ityclose,	ityread,	itywrite,	/*56*/
	  ityioctl,	nostop,		ityreset,	itydevtotty,/* ity */
	  ttselect,	nommap,		NULL },
	{ itelopen,	itelclose,	itelread,	itelwrite,	/*57*/
	  itelioctl,	nostop,		nullreset,	nodevtotty,/* itel */
	  seltrue,	nommap,		NULL },
	{ nxopen,	nxclose,	nxread,		nxwrite,	/*58*/
	  nxioctl,	nxstop,		nxreset,	nxdevtotty,/* unused */
	  seltrue,	nxmmap,		NULL },
	{ ispyopen,	ispyclose,	ispyread,	nowrite,	/*59*/
	  ispyioctl,	nostop,		nullreset,	nodevtotty,/* ispy */
	  seltrue,	nommap,         NULL },
	{ nnicopen,	nnicclose,	noread,		nowrite,	/*60*/
	  nnicioctl,	nostop,		nullreset,	nodevtotty,/* nnic */
	  seltrue,	nommap,		NULL },
	{ ptopen,	ptclose,	rawread,	rawwrite,	/*61*/
	  ptioctl,	nostop,		nullreset,	nodevtotty,/* pt */
	  seltrue,	nommap,		ptstrategy },
	{ wormopen,	wormclose,	rawread,	rawwrite,	/*62*/
	  wormioctl,	nostop,		nullreset,	nodevtotty,/* worm */
	  seltrue,	nommap,		wormstrategy },
	{ nxopen, nxclose, nxread,					/*63*/
	  nxwrite, nxioctl, nxstop,				   /* Talisman*/
	  nxreset, nxdevtotty, nxselect,
	  nxmmap, NULL },
};
int	nchrdev = sizeof (cdevsw) / sizeof (cdevsw[0]);

/*
 * Swapdev is a fake device implemented
 * in sw.c used only internally to get to swstrategy.
 * It cannot be provided to the users, because the
 * swstrategy routine munches the b_dev and b_blkno entries
 * before calling the appropriate driver.  This would horribly
 * confuse, e.g. the hashing routines. Instead, /dev/drum is
 * provided as a character (raw) device.
 */
dev_t	swapdev = makedev(1, 0);

/*
 * Routine that identifies /dev/mem and /dev/kmem.
 *
 * A minimal stub routine can always return 0.
 */
int
iskmemdev(dev)
	dev_t dev;
{

	return (major(dev) == 2 && (minor(dev) == 0 || minor(dev) == 1));
}

int
iszerodev(dev)
	dev_t dev;
{
	return (major(dev) == 2 && minor(dev) == 12);
}

/*
 * Routine to determine if a device is a disk.
 *
 * A minimal stub routine can always return 0.
 */
int
isdisk(dev, type)
	dev_t dev;
	int type;
{

	switch (major(dev)) {
	case 15:
		return (1);
	case 0:
	case 2:
	case 4:
	case 6:
	case 7:
		if (type == VBLK)
			return (1);
		return (0);
	case 3:
	case 9:
	case 13:
	case 29:
	case 43:
		if (type == VCHR)
			return (1);
		/* fall through */
	default:
		return (0);
	}
	/* NOTREACHED */
}

/*
 * Routine to convert from character to block device number.
 *
 * A minimal stub routine can always return NODEV.
 */
dev_t
chrtoblk(dev)
	dev_t dev;
{
	int blkmaj;

	switch (major(dev)) {
	case 3:		blkmaj = 0;  break;
	case 9:		blkmaj = 2;  break;
	case 10:	blkmaj = 3;  break;
	case 13:	blkmaj = 4;  break;
	case 14:	blkmaj = 5;  break;
	case 15:	blkmaj = 6;  break;
	case 29:	blkmaj = 7;  break;
	case 43:	blkmaj = 15; break;
	default:
		return (NODEV);
	}
	return (makedev(blkmaj, minor(dev)));
}