2 * Copyright (c) 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the University of
21 * California, Berkeley and its contributors.
22 * 4. Neither the name of the University nor the names of its contributors
23 * may be used to endorse or promote products derived from this software
24 * without specific prior written permission.
26 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 * @(#)conf.h 8.5 (Berkeley) 1/9/95
39 * $FreeBSD: src/sys/sys/conf.h,v 1.103.2.6 2002/03/11 01:14:55 dd Exp $
40 * $DragonFly: src/sys/sys/conf.h,v 1.15 2006/09/26 18:57:14 dillon Exp $
46 #include <sys/queue.h>
48 #include <sys/biotrack.h>
50 #define SPECNAMELEN 15
60 LIST_ENTRY(cdev) si_hash;
61 SLIST_HEAD(, vnode) si_hlist;
62 char si_name[SPECNAMELEN + 1];
65 struct dev_ops *si_ops; /* device operations vector */
66 int si_iosize_max; /* maximum I/O size (for physio &al) */
70 struct tty *__sit_tty;
73 struct disk *__sid_disk;
74 struct mount *__sid_mountpoint;
75 int __sid_bsize_phys; /* min physical block size */
76 int __sid_bsize_best; /* optimal block size */
79 struct bio_track si_track_read;
80 struct bio_track si_track_write;
81 time_t si_lastread; /* time_second */
82 time_t si_lastwrite; /* time_second */
85 #define SI_STASHED 0x0001 /* created in stashed storage */
86 #define SI_HASHED 0x0002 /* in (maj,min) hash table */
87 #define SI_ADHOC 0x0004 /* created via make_adhoc_dev() or udev2dev() */
88 #define SI_INTERCEPTED 0x0008 /* device ops was intercepted */
90 #define si_tty __si_u.__si_tty.__sit_tty
91 #define si_disk __si_u.__si_disk.__sid_disk
92 #define si_mountpoint __si_u.__si_disk.__sid_mountpoint
93 #define si_bsize_phys __si_u.__si_disk.__sid_bsize_phys
94 #define si_bsize_best __si_u.__si_disk.__sid_bsize_best
96 #define CDEVSW_ALL_MINORS 0 /* mask of 0 always matches 0 */
99 * Special device management
102 #define SPECHASH(rdev) (((unsigned)(minor(rdev)))%SPECHSZ)
105 * Definitions of device driver entry switches
117 typedef int l_open_t (struct cdev *dev, struct tty *tp);
118 typedef int l_close_t (struct tty *tp, int flag);
119 typedef int l_read_t (struct tty *tp, struct uio *uio, int flag);
120 typedef int l_write_t (struct tty *tp, struct uio *uio, int flag);
121 typedef int l_ioctl_t (struct tty *tp, u_long cmd, caddr_t data, int flag,
123 typedef int l_rint_t (int c, struct tty *tp);
124 typedef int l_start_t (struct tty *tp);
125 typedef int l_modem_t (struct tty *tp, int flag);
128 * Line discipline switch table
143 extern struct linesw linesw[];
146 int ldisc_register (int , struct linesw *);
147 void ldisc_deregister (int);
148 #define LDISC_LOAD -1 /* Loadable line discipline */
155 udev_t sw_dev; /* For quasibogus swapdev reporting */
159 struct cdev *sw_device;
161 #define SW_FREED 0x01
162 #define SW_SEQUENTIAL 0x02
163 #define sw_freed sw_flags /* XXX compat */
167 #define NUMCDEVSW 256
169 l_ioctl_t l_nullioctl;
175 struct devsw_module_data {
176 int (*chainevh)(struct module *, int, void *); /* next handler */
177 void *chainarg; /* arg for next event handler */
178 /* Do not initialize fields hereafter */
181 #define DEV_MODULE(name, evh, arg) \
182 static moduledata_t name##_mod = { \
187 DECLARE_MODULE(name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE)
189 int count_dev (cdev_t dev);
190 int count_udev (udev_t dev);
191 void destroy_dev (cdev_t dev);
192 void release_dev (cdev_t dev);
193 cdev_t reference_dev (cdev_t dev);
194 struct dev_ops *devsw (cdev_t dev);
195 const char *devtoname (cdev_t dev);
196 void freedev (cdev_t dev);
197 int iszerodev (cdev_t dev);
199 cdev_t make_sub_dev (cdev_t dev, int minor);
200 int lminor (cdev_t dev);
202 cdev_t kgetdiskbyname(const char *name);
203 int dev_is_good(cdev_t dev);
206 * XXX: This included for when DEVFS resurfaces
215 #define GID_OPERATOR 5
218 #define GID_DIALER 68
222 #endif /* !_SYS_CONF_H_ */