|
|
1.1 root 1: /*
2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7: * Reserved. This file contains Original Code and/or Modifications of
8: * Original Code as defined in and that are subject to the Apple Public
9: * Source License Version 1.1 (the "License"). You may not use this file
10: * except in compliance with the License. Please obtain a copy of the
11: * License at http://www.apple.com/publicsource and read it before using
12: * this file.
13: *
14: * The Original Code and all software distributed under the License are
15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
19: * License for the specific language governing rights and limitations
20: * under the License.
21: *
22: * @APPLE_LICENSE_HEADER_END@
23: */
24:
25: /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
26: /*-
27: * Copyright (c) 1990, 1993
28: * The Regents of the University of California. All rights reserved.
29: * (c) UNIX System Laboratories, Inc.
30: * All or some portions of this file are derived from material licensed
31: * to the University of California by American Telephone and Telegraph
32: * Co. or Unix System Laboratories, Inc. and are reproduced herein with
33: * the permission of UNIX System Laboratories, Inc.
34: *
35: * Redistribution and use in source and binary forms, with or without
36: * modification, are permitted provided that the following conditions
37: * are met:
38: * 1. Redistributions of source code must retain the above copyright
39: * notice, this list of conditions and the following disclaimer.
40: * 2. Redistributions in binary form must reproduce the above copyright
41: * notice, this list of conditions and the following disclaimer in the
42: * documentation and/or other materials provided with the distribution.
43: * 3. All advertising materials mentioning features or use of this software
44: * must display the following acknowledgement:
45: * This product includes software developed by the University of
46: * California, Berkeley and its contributors.
47: * 4. Neither the name of the University nor the names of its contributors
48: * may be used to endorse or promote products derived from this software
49: * without specific prior written permission.
50: *
51: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
52: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
53: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
54: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
55: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
56: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
57: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
58: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
59: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
60: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
61: * SUCH DAMAGE.
62: *
63: * @(#)conf.h 8.5 (Berkeley) 1/9/95
64: */
65:
66: #ifndef _SYS_CONF_H_
67: #define _SYS_CONF_H_ 1
68:
69: /*
70: * Definitions of device driver entry switches
71: */
72:
73: struct buf;
74: struct proc;
75: struct tty;
76: struct uio;
77: struct vnode;
78:
79: /*
80: * Device switch function types.
81: */
82: typedef int open_close_fcn_t __P((dev_t dev, int flags, int devtype,
83: struct proc *p));
84: typedef void strategy_fcn_t __P((struct buf *bp));
85: typedef int ioctl_fcn_t __P((dev_t dev, u_long cmd, caddr_t data,
86: int fflag, struct proc *p));
87: typedef int dump_fcn_t (); /* parameters vary by architecture */
88: typedef int psize_fcn_t __P((dev_t dev));
89: typedef int read_write_fcn_t __P((dev_t dev, struct uio *uio, int ioflag));
90: typedef int stop_fcn_t __P((struct tty *tp, int rw));
91: typedef int reset_fcn_t __P((int uban));
92: typedef int select_fcn_t __P((dev_t dev, int which, struct proc *p));
93: typedef int mmap_fcn_t __P(());
94: typedef int getc_fcn_t __P((dev_t dev));
95: typedef int putc_fcn_t __P((dev_t dev, char c));
96:
97: /*
98: * Versions of enodev() pointer, cast to appropriate function type. For use
99: * in empty devsw slots.
100: */
101: #define eno_opcl ((open_close_fcn_t *)&enodev)
102: #define eno_strat ((strategy_fcn_t *)&enodev_strat)
103: #define eno_ioctl ((ioctl_fcn_t *)&enodev)
104: #define eno_dump ((dump_fcn_t *)&enodev)
105: #define eno_psize ((psize_fcn_t *)&enodev)
106: #define eno_rdwrt ((read_write_fcn_t *)&enodev)
107: #define eno_stop ((stop_fcn_t *)&enodev)
108: #define eno_reset ((reset_fcn_t *)&enodev)
109: #define eno_mmap ((mmap_fcn_t *)&enodev)
110: #define eno_getc ((getc_fcn_t *)&enodev)
111: #define eno_putc ((putc_fcn_t *)&enodev)
112: #define eno_select ((select_fcn_t *)&enodev)
113:
114: /*
115: * Types for d_type.
116: */
117: #define D_TAPE 1
118: #define D_DISK 2
119: #define D_TTY 3
120:
121: /*
122: * Block device switch table
123: */
124: struct bdevsw {
125: open_close_fcn_t *d_open;
126: open_close_fcn_t *d_close;
127: strategy_fcn_t *d_strategy;
128: ioctl_fcn_t *d_ioctl;
129: dump_fcn_t *d_dump;
130: psize_fcn_t *d_psize;
131: int d_type;
132: };
133:
134: #ifdef _KERNEL
135:
136: extern struct bdevsw bdevsw[];
137:
138: /*
139: * Contents of empty bdevsw slot.
140: */
141: #define NO_BDEVICE \
142: { eno_opcl, eno_opcl, eno_strat, eno_ioctl, \
143: eno_dump, eno_psize, 0 }
144:
145: #endif /* _KERNEL */
146:
147: /*
148: * Character device switch table
149: */
150: struct cdevsw {
151: open_close_fcn_t *d_open;
152: open_close_fcn_t *d_close;
153: read_write_fcn_t *d_read;
154: read_write_fcn_t *d_write;
155: ioctl_fcn_t *d_ioctl;
156: stop_fcn_t *d_stop;
157: reset_fcn_t *d_reset;
158: struct tty **d_ttys;
159: select_fcn_t *d_select;
160: mmap_fcn_t *d_mmap;
161: strategy_fcn_t *d_strategy;
162: getc_fcn_t *d_getc;
163: putc_fcn_t *d_putc;
164: int d_type;
165: };
166:
167: #ifdef _KERNEL
168:
169: extern struct cdevsw cdevsw[];
170:
171: /*
172: * Contents of empty cdevsw slot.
173: */
174:
175: #define NO_CDEVICE \
176: { \
177: eno_opcl, eno_opcl, eno_rdwrt, eno_rdwrt, \
178: eno_ioctl, eno_stop, eno_reset, 0, \
179: seltrue, eno_mmap, eno_strat, eno_getc, \
180: eno_putc, 0 \
181: }
182:
183: #endif /* _KERNEL */
184:
185: /*
186: * Line discipline switch table
187: */
188: struct linesw {
189: int (*l_open) __P((dev_t dev, struct tty *tp));
190: int (*l_close) __P((struct tty *tp, int flags));
191: int (*l_read) __P((struct tty *tp, struct uio *uio,
192: int flag));
193: int (*l_write) __P((struct tty *tp, struct uio *uio,
194: int flag));
195: int (*l_ioctl) __P((struct tty *tp, u_long cmd, caddr_t data,
196: int flag, struct proc *p));
197: int (*l_rint) __P((int c, struct tty *tp));
198: int (*l_start) __P((struct tty *tp));
199: int (*l_modem) __P((struct tty *tp, int flag));
200: };
201:
202: #ifdef _KERNEL
203: extern struct linesw linesw[];
204: extern int nlinesw;
205:
206: int ldisc_register __P((int , struct linesw *));
207: void ldisc_deregister __P((int));
208: #define LDISC_LOAD -1 /* Loadable line discipline */
209: #endif
210:
211: /*
212: * Swap device table
213: */
214: struct swdevt {
215: dev_t sw_dev;
216: int sw_flags;
217: int sw_nblks;
218: struct vnode *sw_vp;
219: };
220: #define SW_FREED 0x01
221: #define SW_SEQUENTIAL 0x02
222: #define sw_freed sw_flags /* XXX compat */
223:
224: #ifdef _KERNEL
225: extern struct swdevt swdevt[];
226: #endif
227:
228: #endif /* _SYS_CONF_H_ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.