xref: /original-bsd/sys/tahoe/tahoe/conf.c (revision ad93c43e)
1 /*	conf.c	1.10	87/11/17	*/
2 
3 #include "param.h"
4 #include "systm.h"
5 #include "buf.h"
6 #include "ioctl.h"
7 #include "tty.h"
8 #include "conf.h"
9 
10 int	nulldev();
11 int	nodev();
12 
13 #include "dk.h"
14 #if NVD > 0
15 int	vdopen(),vdclose(),vdstrategy(),vdread(),vdwrite(),vdioctl();
16 int	vddump(),vdsize();
17 #else
18 #define	vdopen		nodev
19 #define	vdclose		nodev
20 #define	vdstrategy	nodev
21 #define	vdread		nodev
22 #define	vdwrite		nodev
23 #define	vdioctl		nodev
24 #define	vddump		nodev
25 #define	vdsize		0
26 #endif
27 
28 #include "yc.h"
29 #if NCY > 0
30 int	cyopen(),cyclose(),cystrategy(),cyread(),cywrite(),cydump(),cyioctl(),cyreset();
31 #else
32 #define	cyopen		nodev
33 #define	cyclose		nodev
34 #define	cystrategy	nodev
35 #define	cyread		nodev
36 #define	cywrite		nodev
37 #define	cydump		nodev
38 #define	cyioctl		nodev
39 #define	cyreset		nulldev
40 #endif
41 
42 int	swstrategy(),swread(),swwrite();
43 
44 struct bdevsw	bdevsw[] =
45 {
46 	{ nodev,	nulldev,	nodev,		nodev,		/*0*/
47 	  nodev,	0,		0 },
48 	{ vdopen,	vdclose,	vdstrategy,	vdioctl,	/*1*/
49 	  vddump,	vdsize,		0 },
50 	{ nodev,	nulldev,	nodev,		nodev,		/*2*/
51 	  nodev,	0,		0 },
52 	{ cyopen,	cyclose,	cystrategy,	cyioctl,	/*3*/
53 	  cydump,	0,		B_TAPE },
54 	{ nodev,	nodev,		swstrategy,	nodev,		/*4*/
55 	  nodev,	0,		0 },
56 };
57 int	nblkdev = sizeof (bdevsw) / sizeof (bdevsw[0]);
58 
59 int	cnopen(),cnclose(),cnread(),cnwrite(),cnioctl();
60 extern	struct tty cons;
61 
62 #include "vx.h"
63 #if NVX == 0
64 #define	vxopen	nodev
65 #define	vxclose	nodev
66 #define	vxread	nodev
67 #define	vxwrite	nodev
68 #define	vxioctl	nodev
69 #define	vxstop	nodev
70 #define	vxreset	nulldev
71 #define	vx_tty	0
72 #else
73 int	vxopen(),vxclose(),vxread(),vxwrite(),vxioctl(),vxstop(),vxreset();
74 struct	tty vx_tty[];
75 #endif
76 
77 int	syopen(),syread(),sywrite(),syioctl(),syselect();
78 
79 int 	mmread(),mmwrite();
80 #define	mmselect	seltrue
81 
82 #include "pty.h"
83 #if NPTY > 0
84 int	ptsopen(),ptsclose(),ptsread(),ptswrite(),ptsstop();
85 int	ptcopen(),ptcclose(),ptcread(),ptcwrite(),ptcselect();
86 int	ptyioctl();
87 struct	tty pt_tty[];
88 #else
89 #define ptsopen		nodev
90 #define ptsclose	nodev
91 #define ptsread		nodev
92 #define ptswrite	nodev
93 #define ptcopen		nodev
94 #define ptcclose	nodev
95 #define ptcread		nodev
96 #define ptcwrite	nodev
97 #define ptyioctl	nodev
98 #define	pt_tty		0
99 #define	ptcselect	nodev
100 #define	ptsstop		nulldev
101 #endif
102 
103 #if NMP > 0
104 int	mpopen(), mpclose(), mpread(), mpwrite(), mpioctl(), mpstop();
105 int	mpdlopen(), mpdlclose(), mpdlwrite(), mpdlioctl();
106 extern	struct tty mp_tty[];
107 #else
108 #define	mpopen		nodev
109 #define	mpclose		nodev
110 #define	mpread		nodev
111 #define	mpwrite		nodev
112 #define	mpioctl		nodev
113 #define	mpstop		nodev
114 #define	mpdlopen	nodev
115 #define	mpdlclose	nodev
116 #define	mpdlwrite	nodev
117 #define	mpdlioctl	nodev
118 #define	mp_tty		0
119 #endif
120 
121 #if NII > 0
122 int	iiioctl(), iiclose(), iiopen();
123 #else
124 #define	iiopen	nodev
125 #define	iiclose	nodev
126 #define	iiioctl	nodev
127 #endif
128 
129 #include "enp.h"
130 #if NENP > 0
131 int	enpr_open(), enpr_close(), enpr_read(), enpr_write(), enpr_ioctl();
132 #else
133 #define enpr_open	nodev
134 #define enpr_close	nodev
135 #define enpr_read	nodev
136 #define enpr_write	nodev
137 #define enpr_ioctl	nodev
138 #endif
139 
140 #include "dr.h"
141 #if NDR > 0
142 int     dropen(),drclose(),drread(),drwrite(),drioctl(),drreset();
143 #else
144 #define dropen nodev
145 #define drclose nodev
146 #define drread nodev
147 #define drwrite nodev
148 #define drioctl nodev
149 #define drreset nodev
150 #endif
151 
152 #include "ik.h"
153 #if NIK > 0
154 int     ikopen(),ikclose(),ikread(),ikwrite(),ikioctl();
155 #else
156 #define ikopen nodev
157 #define ikclose nodev
158 #define ikread nodev
159 #define ikwrite nodev
160 #define ikioctl nodev
161 #endif
162 
163 int	logopen(),logclose(),logread(),logioctl(),logselect();
164 
165 int	ttselect(), seltrue();
166 
167 struct cdevsw	cdevsw[] =
168 {
169 	cnopen,		cnclose,	cnread,		cnwrite,	/*0*/
170 	cnioctl,	nulldev,	nulldev,	&cons,
171 	ttselect,	nodev,
172 	vxopen,		vxclose,	vxread,		vxwrite,	/*1*/
173 	vxioctl,	vxstop,		vxreset,	vx_tty,
174 	ttselect,	nodev,
175 	syopen,		nulldev,	syread,		sywrite,	/*2*/
176 	syioctl,	nulldev,	nulldev,	0,
177 	syselect,	nodev,
178 	nulldev,	nulldev,	mmread,		mmwrite,	/*3*/
179 	nodev,		nulldev,	nulldev,	0,
180 	mmselect,	nodev,
181 	nodev,		nulldev,	nodev,		nodev,		/*4*/
182 	nodev,		nodev,		nulldev,	0,
183 	seltrue,	nodev,
184 	vdopen,		vdclose,	vdread,		vdwrite,	/*5*/
185 	vdioctl,	nodev,		nulldev,	0,
186 	seltrue,	nodev,
187 	nodev,		nulldev,	nodev,		nodev,		/*6*/
188 	nodev,		nodev,		nulldev,	0,
189 	seltrue,	nodev,
190 	cyopen,		cyclose,	cyread,		cywrite,	/*7*/
191 	cyioctl,	nodev,		cyreset,	0,
192 	seltrue,	nodev,
193 	nulldev,	nulldev,	swread,		swwrite,	/*8*/
194 	nodev,		nodev,		nulldev,	0,
195 	nodev,		nodev,
196 	ptsopen,	ptsclose,	ptsread,	ptswrite,	/*9*/
197 	ptyioctl,	ptsstop,	nodev,		pt_tty,
198 	ttselect,	nodev,
199 	ptcopen,	ptcclose,	ptcread,	ptcwrite,	/*10*/
200 	ptyioctl,	nulldev,	nodev,		pt_tty,
201 	ptcselect,	nodev,
202 	mpdlopen,	mpdlclose,	nodev,		mpdlwrite,	/*11*/
203 	mpdlioctl,	nodev,		nulldev,	0,
204 	seltrue,	nodev,
205 	mpopen,		mpclose,	mpread,		mpwrite,	/*12*/
206 	mpioctl,	mpstop,		nulldev,	mp_tty,
207 	ttselect,	nodev,
208 	nodev,		nodev,		nodev,		nodev,		/*13*/
209 	nodev,		nodev,		nulldev,	0,
210 	nodev,		nodev,
211 	iiopen,		iiclose,	nulldev,	nulldev,	/*14*/
212 	iiioctl,	nulldev,	nulldev,	0,
213 	seltrue,	nodev,
214 	logopen,	logclose,	logread,	nodev,		/*15*/
215 	logioctl,	nodev,		nulldev,	0,
216 	logselect,	nodev,
217 	enpr_open,	enpr_close,	enpr_read,	enpr_write,	/*16*/
218 	enpr_ioctl,	nodev,		nulldev,	0,
219 	nodev,		nodev,
220 	nodev,		nodev,		nodev,		nodev,		/*17*/
221 	nodev,		nodev,		nulldev,	0,
222 	nodev,		nodev,
223 	dropen,		drclose,	drread,		drwrite,	/*18*/
224 	drioctl,	nodev,		drreset,	0,
225 	nodev,		nodev,
226 	nodev,		nodev,		nodev,		nodev,		/*19*/
227 	nodev,		nodev,		nulldev,	0,
228 	nodev,		nodev,
229 /* 20-30 are reserved for local use */
230 	ikopen,		ikclose,	ikread,		ikwrite,	/*20*/
231 	ikioctl,	nodev,		nulldev,	0,
232 	nodev,		nodev,
233 };
234 int	nchrdev = sizeof (cdevsw) / sizeof (cdevsw[0]);
235 
236 int	mem_no = 3; 	/* major device number of memory special file */
237 
238 /*
239  * Swapdev is a fake device implemented
240  * in sw.c used only internally to get to swstrategy.
241  * It cannot be provided to the users, because the
242  * swstrategy routine munches the b_dev and b_blkno entries
243  * before calling the appropriate driver.  This would horribly
244  * confuse, e.g. the hashing routines. Instead, /dev/drum is
245  * provided as a character (raw) device.
246  */
247 dev_t	swapdev = makedev(4, 0);
248