#ifndef _SYS_CONF_H_
#define _SYS_CONF_H_
#if defined(_KERNEL) || defined(_KERNEL_STRUCTURES)
#ifndef _SYS_QUEUE_H_
#include <sys/queue.h>
#endif
#ifndef _SYS_TIME_H_
#include <sys/time.h>
#endif
#ifndef _SYS_BIOTRACK_H_
#include <sys/biotrack.h>
#endif
#ifndef _SYS_SYSREF_H_
#include <sys/sysref.h>
#endif
#ifndef _SYS_EVENT_H_
#include <sys/event.h>
#endif
#include <libprop/proplib.h>
#include <sys/param.h>
struct tty;
struct disk;
struct vnode;
struct dev_ops;
struct vm_object;
struct cdev {
u_int si_flags;
__uint64_t si_inode;
uid_t si_uid;
gid_t si_gid;
int si_perms;
TAILQ_ENTRY(cdev) link;
int si_uminor;
int si_umajor;
struct cdev *si_parent;
LIST_ENTRY(cdev) si_hash;
SLIST_HEAD(, vnode) si_hlist;
char si_name[SPECNAMELEN + 1];
void *si_drv1;
void *si_drv2;
struct dev_ops *si_ops;
struct dev_ops *si_bops;
int si_iosize_max;
struct sysref si_sysref;
union {
struct {
struct tty *__sit_tty;
} __si_tty;
struct {
struct disk *__sid_disk;
struct mount *__sid_mountpoint;
int __sid_bsize_phys;
int __sid_bsize_best;
} __si_disk;
} __si_u;
struct bio_track si_track_read;
struct bio_track si_track_write;
time_t si_lastread;
time_t si_lastwrite;
struct vm_object *si_object;
prop_dictionary_t si_dict;
struct kqinfo si_kqinfo;
};
#define SI_UNUSED01 0x0001
#define SI_HASHED 0x0002
#define SI_OVERRIDE 0x0004
#define SI_INTERCEPTED 0x0008
#define SI_DEVFS_LINKED 0x0010
#define SI_REPROBE_TEST 0x0020
#define SI_CANFREE 0x0040
#define si_tty __si_u.__si_tty.__sit_tty
#define si_disk __si_u.__si_disk.__sid_disk
#define si_mountpoint __si_u.__si_disk.__sid_mountpoint
#define si_bsize_phys __si_u.__si_disk.__sid_bsize_phys
#define si_bsize_best __si_u.__si_disk.__sid_bsize_best
#define CDEVSW_ALL_MINORS 0
#define SPECHSZ 64
#define SPECHASH(rdev) (((unsigned)(minor(rdev)))%SPECHSZ)
struct buf;
struct bio;
struct proc;
struct uio;
struct knote;
struct ucred;
struct thread;
typedef int l_open_t (struct cdev *dev, struct tty *tp);
typedef int l_close_t (struct tty *tp, int flag);
typedef int l_read_t (struct tty *tp, struct uio *uio, int flag);
typedef int l_write_t (struct tty *tp, struct uio *uio, int flag);
typedef int l_ioctl_t (struct tty *tp, u_long cmd, caddr_t data, int flag,
struct ucred *cred);
typedef int l_rint_t (int c, struct tty *tp);
typedef int l_start_t (struct tty *tp);
typedef int l_modem_t (struct tty *tp, int flag);
struct linesw {
l_open_t *l_open;
l_close_t *l_close;
l_read_t *l_read;
l_write_t *l_write;
l_ioctl_t *l_ioctl;
l_rint_t *l_rint;
l_start_t *l_start;
l_modem_t *l_modem;
u_char l_hotchar;
};
#ifdef _KERNEL
extern struct linesw linesw[];
extern int nlinesw;
int ldisc_register (int , struct linesw *);
void ldisc_deregister (int);
#define LDISC_LOAD -1
#endif
struct swdevt {
dev_t sw_dev;
int sw_flags;
int sw_nblks;
int sw_nused;
struct vnode *sw_vp;
struct cdev *sw_device;
};
#define SW_FREED 0x01
#define SW_SEQUENTIAL 0x02
#define SW_CLOSING 0x04
#define sw_freed sw_flags
#ifdef _KERNEL
l_ioctl_t l_nullioctl;
l_read_t l_noread;
l_write_t l_nowrite;
struct module;
struct devsw_module_data {
int (*chainevh)(struct module *, int, void *);
void *chainarg;
};
#define DEV_MODULE(name, evh, arg) \
static moduledata_t name##_mod = { \
#name, \
evh, \
arg \
}; \
DECLARE_MODULE(name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE)
#define dev2unit(x) ((minor(x) & 0xff) | (minor(x) >> 8))
int count_dev (cdev_t dev);
void destroy_dev (cdev_t dev);
void release_dev (cdev_t dev);
cdev_t reference_dev (cdev_t dev);
const char *devtoname (cdev_t dev);
int iszerodev (cdev_t dev);
int lminor (cdev_t dev);
cdev_t kgetdiskbyname(const char *name);
int dev_is_good(cdev_t dev);
#define UID_ROOT 0
#define UID_BIN 3
#define UID_UUCP 66
#define GID_WHEEL 0
#define GID_KMEM 2
#define GID_TTY 4
#define GID_OPERATOR 5
#define GID_BIN 7
#define GID_GAMES 13
#define GID_VIDEO 44
#define GID_DIALER 68
#define GID_NVMM 90
#endif
#endif
#endif