- Test m_pkthdr.fw_flags against DUMMYNET_MBUF_TAGGED before trying to locate
[dragonfly/netmp.git] / sys / sys / conf.h
blob666994fea27634439cb3c3a00e1017afdc0d2aa6
1 /*-
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
12 * are met:
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
36 * SUCH DAMAGE.
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.18 2007/05/09 00:53:35 dillon Exp $
43 #ifndef _SYS_CONF_H_
44 #define _SYS_CONF_H_
46 #if defined(_KERNEL) || defined(_KERNEL_STRUCTURES)
48 #ifndef _SYS_QUEUE_H_
49 #include <sys/queue.h>
50 #endif
51 #ifndef _SYS_TIME_H_
52 #include <sys/time.h>
53 #endif
54 #ifndef _SYS_BIOTRACK_H_
55 #include <sys/biotrack.h>
56 #endif
57 #ifndef _SYS_SYSREF_H_
58 #include <sys/sysref.h>
59 #endif
61 #define SPECNAMELEN 15
63 struct tty;
64 struct disk;
65 struct vnode;
66 struct dev_ops;
68 struct cdev {
69 u_int si_flags;
70 int si_uminor;
71 int si_umajor;
72 LIST_ENTRY(cdev) si_hash;
73 SLIST_HEAD(, vnode) si_hlist;
74 char si_name[SPECNAMELEN + 1];
75 void *si_drv1;
76 void *si_drv2;
77 struct dev_ops *si_ops; /* device operations vector */
78 int si_iosize_max; /* maximum I/O size (for physio &al) */
79 struct sysref si_sysref;
80 union {
81 struct {
82 struct tty *__sit_tty;
83 } __si_tty;
84 struct {
85 struct disk *__sid_disk;
86 struct mount *__sid_mountpoint;
87 int __sid_bsize_phys; /* min physical block size */
88 int __sid_bsize_best; /* optimal block size */
89 } __si_disk;
90 } __si_u;
91 struct bio_track si_track_read;
92 struct bio_track si_track_write;
93 time_t si_lastread; /* time_second */
94 time_t si_lastwrite; /* time_second */
97 #define SI_UNUSED01 0x0001
98 #define SI_HASHED 0x0002 /* in (maj,min) hash table */
99 #define SI_ADHOC 0x0004 /* created via make_adhoc_dev() or udev2dev() */
100 #define SI_INTERCEPTED 0x0008 /* device ops was intercepted */
102 #define si_tty __si_u.__si_tty.__sit_tty
103 #define si_disk __si_u.__si_disk.__sid_disk
104 #define si_mountpoint __si_u.__si_disk.__sid_mountpoint
105 #define si_bsize_phys __si_u.__si_disk.__sid_bsize_phys
106 #define si_bsize_best __si_u.__si_disk.__sid_bsize_best
108 #define CDEVSW_ALL_MINORS 0 /* mask of 0 always matches 0 */
111 * Special device management
113 #define SPECHSZ 64
114 #define SPECHASH(rdev) (((unsigned)(minor(rdev)))%SPECHSZ)
117 * Definitions of device driver entry switches
120 struct buf;
121 struct bio;
122 struct proc;
123 struct uio;
124 struct knote;
125 struct ucred;
127 struct thread;
129 typedef int l_open_t (struct cdev *dev, struct tty *tp);
130 typedef int l_close_t (struct tty *tp, int flag);
131 typedef int l_read_t (struct tty *tp, struct uio *uio, int flag);
132 typedef int l_write_t (struct tty *tp, struct uio *uio, int flag);
133 typedef int l_ioctl_t (struct tty *tp, u_long cmd, caddr_t data, int flag,
134 struct ucred *cred);
135 typedef int l_rint_t (int c, struct tty *tp);
136 typedef int l_start_t (struct tty *tp);
137 typedef int l_modem_t (struct tty *tp, int flag);
140 * Line discipline switch table
142 struct linesw {
143 l_open_t *l_open;
144 l_close_t *l_close;
145 l_read_t *l_read;
146 l_write_t *l_write;
147 l_ioctl_t *l_ioctl;
148 l_rint_t *l_rint;
149 l_start_t *l_start;
150 l_modem_t *l_modem;
151 u_char l_hotchar;
154 #ifdef _KERNEL
155 extern struct linesw linesw[];
156 extern int nlinesw;
158 int ldisc_register (int , struct linesw *);
159 void ldisc_deregister (int);
160 #define LDISC_LOAD -1 /* Loadable line discipline */
161 #endif
164 * Swap device table
166 struct swdevt {
167 udev_t sw_dev; /* For quasibogus swapdev reporting */
168 int sw_flags;
169 int sw_nblks;
170 struct vnode *sw_vp;
171 struct cdev *sw_device;
173 #define SW_FREED 0x01
174 #define SW_SEQUENTIAL 0x02
175 #define sw_freed sw_flags /* XXX compat */
177 #ifdef _KERNEL
179 l_ioctl_t l_nullioctl;
180 l_read_t l_noread;
181 l_write_t l_nowrite;
183 struct module;
185 struct devsw_module_data {
186 int (*chainevh)(struct module *, int, void *); /* next handler */
187 void *chainarg; /* arg for next event handler */
188 /* Do not initialize fields hereafter */
191 #define DEV_MODULE(name, evh, arg) \
192 static moduledata_t name##_mod = { \
193 #name, \
194 evh, \
195 arg \
196 }; \
197 DECLARE_MODULE(name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE)
199 int count_dev (cdev_t dev);
200 int count_udev (int x, int y);
201 void destroy_dev (cdev_t dev);
202 void release_dev (cdev_t dev);
203 cdev_t get_dev (int x, int y);
204 cdev_t reference_dev (cdev_t dev);
205 struct dev_ops *devsw (cdev_t dev);
206 const char *devtoname (cdev_t dev);
207 void freedev (cdev_t dev);
208 int iszerodev (cdev_t dev);
210 cdev_t make_sub_dev (cdev_t dev, int minor);
211 int lminor (cdev_t dev);
212 void setconf (void);
213 cdev_t kgetdiskbyname(const char *name);
214 int dev_is_good(cdev_t dev);
217 * XXX: This included for when DEVFS resurfaces
220 #define UID_ROOT 0
221 #define UID_BIN 3
222 #define UID_UUCP 66
224 #define GID_WHEEL 0
225 #define GID_KMEM 2
226 #define GID_OPERATOR 5
227 #define GID_BIN 7
228 #define GID_GAMES 13
229 #define GID_DIALER 68
231 #endif /* _KERNEL */
232 #endif /* _KERNEL || _KERNEL_STRUCTURES */
234 #endif /* !_SYS_CONF_H_ */