#ifndef _ALTQ_ALTQ_CONF_H_
#define _ALTQ_ALTQ_CONF_H_
#ifdef ALTQ3_COMPAT
#ifdef _KERNEL
#include <sys/param.h>
#include <sys/conf.h>
#include <sys/kernel.h>
#if (__FreeBSD_version > 300000)
#define ALTQ_KLD
#endif
#ifdef ALTQ_KLD
#include <sys/module.h>
#endif
#ifndef dev_decl
#ifdef __STDC__
#define dev_decl(n,t) d_ ## t ## _t n ## t
#else
#define dev_decl(n,t) d_t_t nt
#endif
#endif
#if defined(__NetBSD__)
typedef int d_open_t(dev_t, int, int, struct lwp *);
typedef int d_close_t(dev_t, int, int, struct lwp *);
typedef int d_ioctl_t(dev_t, u_long, void *, int, struct lwp *);
#endif
#if defined(__OpenBSD__)
typedef int d_open_t(dev_t, int, int, struct proc *);
typedef int d_close_t(dev_t, int, int, struct proc *);
typedef int d_ioctl_t(dev_t, u_long, void *, int, struct proc *);
#define noopen (dev_type_open((*))) enodev
#define noclose (dev_type_close((*))) enodev
#define noioctl (dev_type_ioctl((*))) enodev
int altqopen(dev_t, int, int, struct proc *);
int altqclose(dev_t, int, int, struct proc *);
int altqioctl(dev_t, u_long, void *, int, struct proc *);
#endif
struct altqsw {
const char *d_name;
d_open_t *d_open;
d_close_t *d_close;
d_ioctl_t *d_ioctl;
#ifdef __FreeBSD__
dev_t dev;
#endif
};
#define altqdev_decl(n) \
dev_decl(n,open); dev_decl(n,close); dev_decl(n,ioctl)
#ifdef ALTQ_KLD
struct altq_module_data {
int type;
int ref;
struct altqsw *altqsw;
};
#define ALTQ_MODULE(name, type, devsw) \
static struct altq_module_data name##_moddata = { type, 0, devsw }; \
\
moduledata_t name##_mod = { \
#name, \
altq_module_handler, \
&name##_moddata \
}; \
DECLARE_MODULE(name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE+96)
void altq_module_incref(int);
void altq_module_declref(int);
int altq_module_handler(module_t, int, void *);
#endif
#endif
#endif
#endif