FreeBSD/Linux Kernel Cross Reference
sys/altq/altq_conf.h
1 /* $NetBSD: altq_conf.h,v 1.10 2007/03/04 05:59:01 christos Exp $ */
2 /* $KAME: altq_conf.h,v 1.10 2005/04/13 03:44:24 suz Exp $ */
3
4 /*
5 * Copyright (C) 1998-2002
6 * Sony Computer Science Laboratories Inc. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY SONY CSL AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL SONY CSL OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29 #ifndef _ALTQ_ALTQ_CONF_H_
30 #define _ALTQ_ALTQ_CONF_H_
31 #ifdef ALTQ3_COMPAT
32
33 #ifdef _KERNEL
34
35 #include <sys/param.h>
36 #include <sys/conf.h>
37 #include <sys/kernel.h>
38
39 #if (__FreeBSD_version > 300000)
40 #define ALTQ_KLD
41 #endif
42
43 #ifdef ALTQ_KLD
44 #include <sys/module.h>
45 #endif
46
47 #ifndef dev_decl
48 #ifdef __STDC__
49 #define dev_decl(n,t) d_ ## t ## _t n ## t
50 #else
51 #define dev_decl(n,t) d_/**/t/**/_t n/**/t
52 #endif
53 #endif
54
55 #if defined(__NetBSD__)
56 typedef int d_open_t(dev_t, int, int, struct lwp *);
57 typedef int d_close_t(dev_t, int, int, struct lwp *);
58 typedef int d_ioctl_t(dev_t, u_long, void *, int, struct lwp *);
59 #endif /* __NetBSD__ */
60
61 #if defined(__OpenBSD__)
62 typedef int d_open_t(dev_t, int, int, struct proc *);
63 typedef int d_close_t(dev_t, int, int, struct proc *);
64 typedef int d_ioctl_t(dev_t, u_long, void *, int, struct proc *);
65
66 #define noopen (dev_type_open((*))) enodev
67 #define noclose (dev_type_close((*))) enodev
68 #define noioctl (dev_type_ioctl((*))) enodev
69
70 int altqopen(dev_t, int, int, struct proc *);
71 int altqclose(dev_t, int, int, struct proc *);
72 int altqioctl(dev_t, u_long, void *, int, struct proc *);
73 #endif
74
75 /*
76 * altq queueing discipline switch structure
77 */
78 struct altqsw {
79 const char *d_name;
80 d_open_t *d_open;
81 d_close_t *d_close;
82 d_ioctl_t *d_ioctl;
83 #ifdef __FreeBSD__
84 dev_t dev; /* make_dev result for later destroy_dev */
85 #endif
86 };
87
88 #define altqdev_decl(n) \
89 dev_decl(n,open); dev_decl(n,close); dev_decl(n,ioctl)
90
91 #ifdef ALTQ_KLD
92
93 struct altq_module_data {
94 int type; /* discipline type */
95 int ref; /* reference count */
96 struct altqsw *altqsw; /* discipline functions */
97 };
98
99 #define ALTQ_MODULE(name, type, devsw) \
100 static struct altq_module_data name##_moddata = { type, 0, devsw }; \
101 \
102 moduledata_t name##_mod = { \
103 #name, \
104 altq_module_handler, \
105 &name##_moddata \
106 }; \
107 DECLARE_MODULE(name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE+96)
108
109 void altq_module_incref(int);
110 void altq_module_declref(int);
111 int altq_module_handler(module_t, int, void *);
112
113 #endif /* ALTQ_KLD */
114
115 #endif /* _KERNEL */
116 #endif /* ALTQ3_COMPAT */
117 #endif /* _ALTQ_ALTQ_CONF_H_ */
Cache object: e97ab98c0eaa39a4239f17319947694c
|