]>
git.saurik.com Git - apple/xnu.git/blob - bsd/sys/conf.h
2 * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
28 /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
30 * Copyright (c) 1990, 1993
31 * The Regents of the University of California. All rights reserved.
32 * (c) UNIX System Laboratories, Inc.
33 * All or some portions of this file are derived from material licensed
34 * to the University of California by American Telephone and Telegraph
35 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
36 * the permission of UNIX System Laboratories, Inc.
38 * Redistribution and use in source and binary forms, with or without
39 * modification, are permitted provided that the following conditions
41 * 1. Redistributions of source code must retain the above copyright
42 * notice, this list of conditions and the following disclaimer.
43 * 2. Redistributions in binary form must reproduce the above copyright
44 * notice, this list of conditions and the following disclaimer in the
45 * documentation and/or other materials provided with the distribution.
46 * 3. All advertising materials mentioning features or use of this software
47 * must display the following acknowledgement:
48 * This product includes software developed by the University of
49 * California, Berkeley and its contributors.
50 * 4. Neither the name of the University nor the names of its contributors
51 * may be used to endorse or promote products derived from this software
52 * without specific prior written permission.
54 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
55 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
56 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
57 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
58 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
59 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
60 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
61 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
62 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
63 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
66 * @(#)conf.h 8.5 (Berkeley) 1/9/95
70 #define _SYS_CONF_H_ 1
72 #include <sys/appleapiopts.h>
73 #include <sys/cdefs.h>
76 * Definitions of device driver entry switches
87 * These are returned by ioctl FIODTYPE
95 * Device switch function types.
97 typedef int open_close_fcn_t(dev_t dev
, int flags
, int devtype
,
100 typedef struct tty
*d_devtotty_t(dev_t dev
);
102 typedef void strategy_fcn_t(struct buf
*bp
);
103 typedef int ioctl_fcn_t(dev_t dev
, u_long cmd
, caddr_t data
,
104 int fflag
, struct proc
*p
);
105 typedef int dump_fcn_t(void); /* parameters vary by architecture */
106 typedef int psize_fcn_t(dev_t dev
);
107 typedef int read_write_fcn_t(dev_t dev
, struct uio
*uio
, int ioflag
);
108 typedef int stop_fcn_t(struct tty
*tp
, int rw
);
109 typedef int reset_fcn_t(int uban
);
110 typedef int select_fcn_t(dev_t dev
, int which
, void * wql
, struct proc
*p
);
111 typedef int mmap_fcn_t(void);
112 typedef int getc_fcn_t(dev_t dev
);
113 typedef int putc_fcn_t(dev_t dev
, char c
);
114 typedef int d_poll_t(dev_t dev
, int events
, struct proc
*p
);
116 #define d_open_t open_close_fcn_t
117 #define d_close_t open_close_fcn_t
118 #define d_read_t read_write_fcn_t
119 #define d_write_t read_write_fcn_t
120 #define d_ioctl_t ioctl_fcn_t
121 #define d_stop_t stop_fcn_t
122 #define d_reset_t reset_fcn_t
123 #define d_select_t select_fcn_t
124 #define d_mmap_t mmap_fcn_t
125 #define d_strategy_t strategy_fcn_t
126 #define d_getc_t getc_fcn_t
127 #define d_putc_t putc_fcn_t
131 void enodev_strat(void);
135 * Versions of enodev() pointer, cast to appropriate function type. For use
136 * in empty devsw slots.
138 #define eno_opcl ((open_close_fcn_t *)&enodev)
139 #define eno_strat ((strategy_fcn_t *)&enodev_strat)
140 #define eno_ioctl ((ioctl_fcn_t *)&enodev)
141 #define eno_dump ((dump_fcn_t *)&enodev)
142 #define eno_psize ((psize_fcn_t *)&enodev)
143 #define eno_rdwrt ((read_write_fcn_t *)&enodev)
144 #define eno_stop ((stop_fcn_t *)&enodev)
145 #define eno_reset ((reset_fcn_t *)&enodev)
146 #define eno_mmap ((mmap_fcn_t *)&enodev)
147 #define eno_getc ((getc_fcn_t *)&enodev)
148 #define eno_putc ((putc_fcn_t *)&enodev)
149 #define eno_select ((select_fcn_t *)&enodev)
153 * Block device switch table
156 open_close_fcn_t
*d_open
;
157 open_close_fcn_t
*d_close
;
158 strategy_fcn_t
*d_strategy
;
159 ioctl_fcn_t
*d_ioctl
;
161 psize_fcn_t
*d_psize
;
166 d_devtotty_t nodevtotty
;
169 #ifdef KERNEL_PRIVATE
170 extern struct bdevsw bdevsw
[];
171 #endif /* KERNEL_PRIVATE */
174 * Contents of empty bdevsw slot.
177 { eno_opcl, eno_opcl, eno_strat, eno_ioctl, \
178 eno_dump, eno_psize, 0 }
182 * Character device switch table
185 open_close_fcn_t
*d_open
;
186 open_close_fcn_t
*d_close
;
187 read_write_fcn_t
*d_read
;
188 read_write_fcn_t
*d_write
;
189 ioctl_fcn_t
*d_ioctl
;
191 reset_fcn_t
*d_reset
;
193 select_fcn_t
*d_select
;
195 strategy_fcn_t
*d_strategy
;
202 #ifdef KERNEL_PRIVATE
203 extern struct cdevsw cdevsw
[];
204 #endif /* KERNEL_PRIVATE */
207 * Contents of empty cdevsw slot.
212 eno_opcl, eno_opcl, eno_rdwrt, eno_rdwrt, \
213 eno_ioctl, eno_stop, eno_reset, 0, \
214 (select_fcn_t *)seltrue, eno_mmap, eno_strat, eno_getc, \
220 #ifdef KERNEL_PRIVATE
221 typedef int l_open_t (dev_t dev
, struct tty
*tp
);
222 typedef int l_close_t(struct tty
*tp
, int flags
);
223 typedef int l_read_t (struct tty
*tp
, struct uio
*uio
, int flag
);
224 typedef int l_write_t(struct tty
*tp
, struct uio
*uio
, int flag
);
225 typedef int l_ioctl_t(struct tty
*tp
, u_long cmd
, caddr_t data
, int flag
,
227 typedef int l_rint_t (int c
, struct tty
*tp
);
228 typedef void l_start_t(struct tty
*tp
);
229 typedef int l_modem_t(struct tty
*tp
, int flag
);
232 * Line discipline switch table
246 extern struct linesw linesw
[];
249 int ldisc_register(int , struct linesw
*);
250 void ldisc_deregister(int);
251 #define LDISC_LOAD -1 /* Loadable line discipline */
253 #endif /* KERNEL_PRIVATE */
255 #ifdef BSD_KERNEL_PRIVATE
265 #define SW_FREED 0x01
266 #define SW_SEQUENTIAL 0x02
267 #define sw_freed sw_flags /* XXX compat */
269 extern struct swdevt swdevt
[];
271 #endif /* BSD_KERNEL_PRIVATE */
276 * ***_free finds free slot;
277 * ***_add adds entries to the devsw table
278 * If int arg is -1; finds a free slot
279 * Returns the major number if successful
283 int bdevsw_isfree(int);
284 int bdevsw_add(int, struct bdevsw
*);
285 int bdevsw_remove(int, struct bdevsw
*);
286 int cdevsw_isfree(int);
287 int cdevsw_add(int, struct cdevsw
*);
288 int cdevsw_add_with_bdev(int index
, struct cdevsw
* csw
, int bdev
);
289 int cdevsw_remove(int, struct cdevsw
*);
293 #endif /* _SYS_CONF_H_ */