Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / altq / altq_conf.h
blobb6d46a2310cac56de4950f62bf0693d4f117da7e
1 /* $NetBSD: altq_conf.h,v 1.9 2006/10/12 19:59:08 peter Exp $ */
2 /* $KAME: altq_conf.h,v 1.10 2005/04/13 03:44:24 suz Exp $ */
4 /*
5 * Copyright (C) 1998-2002
6 * Sony Computer Science Laboratories Inc. All rights reserved.
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.
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.
29 #ifndef _ALTQ_ALTQ_CONF_H_
30 #define _ALTQ_ALTQ_CONF_H_
31 #ifdef ALTQ3_COMPAT
33 #ifdef _KERNEL
35 #include <sys/param.h>
36 #include <sys/conf.h>
37 #include <sys/kernel.h>
39 #if (__FreeBSD_version > 300000)
40 #define ALTQ_KLD
41 #endif
43 #ifdef ALTQ_KLD
44 #include <sys/module.h>
45 #endif
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
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__ */
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 *);
66 #define noopen (dev_type_open((*))) enodev
67 #define noclose (dev_type_close((*))) enodev
68 #define noioctl (dev_type_ioctl((*))) enodev
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
76 * altq queueing discipline switch structure
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
88 #define altqdev_decl(n) \
89 dev_decl(n,open); dev_decl(n,close); dev_decl(n,ioctl)
91 #ifdef ALTQ_KLD
93 struct altq_module_data {
94 int type; /* discipline type */
95 int ref; /* reference count */
96 struct altqsw *altqsw; /* discipline functions */
99 #define ALTQ_MODULE(name, type, devsw) \
100 static struct altq_module_data name##_moddata = { type, 0, devsw }; \
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)
109 void altq_module_incref(int);
110 void altq_module_declref(int);
111 int altq_module_handler(module_t, int, void *);
113 #endif /* ALTQ_KLD */
115 #endif /* _KERNEL */
116 #endif /* ALTQ3_COMPAT */
117 #endif /* _ALTQ_ALTQ_CONF_H_ */