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 $ */
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
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
29 #ifndef _ALTQ_ALTQ_CONF_H_
30 #define _ALTQ_ALTQ_CONF_H_
35 #include <sys/param.h>
37 #include <sys/kernel.h>
39 #if (__FreeBSD_version > 300000)
44 #include <sys/module.h>
49 #define dev_decl(n,t) d_ ## t ## _t n ## t
51 #define dev_decl(n,t) d_/**/t/**/_t n/**/t
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
*);
76 * altq queueing discipline switch structure
84 dev_t dev
; /* make_dev result for later destroy_dev */
88 #define altqdev_decl(n) \
89 dev_decl(n,open); dev_decl(n,close); dev_decl(n,ioctl)
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 = { \
104 altq_module_handler, \
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 */
116 #endif /* ALTQ3_COMPAT */
117 #endif /* _ALTQ_ALTQ_CONF_H_ */