conf.h revision 33322
1184588Sdfr/*- 2184588Sdfr * Copyright (c) 1990, 1993 3184588Sdfr * The Regents of the University of California. All rights reserved. 4184588Sdfr * (c) UNIX System Laboratories, Inc. 5184588Sdfr * All or some portions of this file are derived from material licensed 6184588Sdfr * to the University of California by American Telephone and Telegraph 7184588Sdfr * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8184588Sdfr * the permission of UNIX System Laboratories, Inc. 9184588Sdfr * 10184588Sdfr * Redistribution and use in source and binary forms, with or without 11184588Sdfr * modification, are permitted provided that the following conditions 12184588Sdfr * are met: 13184588Sdfr * 1. Redistributions of source code must retain the above copyright 14184588Sdfr * notice, this list of conditions and the following disclaimer. 15184588Sdfr * 2. Redistributions in binary form must reproduce the above copyright 16184588Sdfr * notice, this list of conditions and the following disclaimer in the 17184588Sdfr * documentation and/or other materials provided with the distribution. 18184588Sdfr * 3. All advertising materials mentioning features or use of this software 19184588Sdfr * must display the following acknowledgement: 20184588Sdfr * This product includes software developed by the University of 21184588Sdfr * California, Berkeley and its contributors. 22184588Sdfr * 4. Neither the name of the University nor the names of its contributors 23184588Sdfr * may be used to endorse or promote products derived from this software 24184588Sdfr * without specific prior written permission. 25184588Sdfr * 26184588Sdfr * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 27184588Sdfr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28184588Sdfr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29184588Sdfr * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 30184588Sdfr * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31184588Sdfr * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32184588Sdfr * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33184588Sdfr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34184588Sdfr * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35184588Sdfr * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36184588Sdfr * SUCH DAMAGE. 37184588Sdfr * 38184588Sdfr * @(#)conf.h 8.5 (Berkeley) 1/9/95 39184588Sdfr * $Id: conf.h,v 1.38 1998/01/24 02:01:29 dyson Exp $ 40184588Sdfr */ 41184588Sdfr 42184588Sdfr#ifndef _SYS_CONF_H_ 43184588Sdfr#define _SYS_CONF_H_ 44184588Sdfr 45184588Sdfr/* 46184588Sdfr * Definitions of device driver entry switches 47184588Sdfr */ 48184588Sdfr 49184588Sdfrstruct buf; 50184588Sdfrstruct proc; 51184588Sdfrstruct tty; 52184588Sdfrstruct uio; 53184588Sdfrstruct vnode; 54184588Sdfr 55184588Sdfrtypedef int d_open_t __P((dev_t dev, int oflags, int devtype, struct proc *p)); 56184588Sdfrtypedef int d_close_t __P((dev_t dev, int fflag, int devtype, struct proc *p)); 57184588Sdfrtypedef void d_strategy_t __P((struct buf *bp)); 58184588Sdfrtypedef int d_ioctl_t __P((dev_t dev, int cmd, caddr_t data, 59184588Sdfr int fflag, struct proc *p)); 60184588Sdfrtypedef int d_dump_t __P((dev_t dev)); 61184588Sdfrtypedef int d_psize_t __P((dev_t dev)); 62184588Sdfr 63184588Sdfrtypedef int d_read_t __P((dev_t dev, struct uio *uio, int ioflag)); 64184588Sdfrtypedef int d_write_t __P((dev_t dev, struct uio *uio, int ioflag)); 65184588Sdfrtypedef void d_stop_t __P((struct tty *tp, int rw)); 66184588Sdfrtypedef int d_reset_t __P((dev_t dev)); 67184588Sdfrtypedef struct tty *d_devtotty_t __P((dev_t dev)); 68184588Sdfrtypedef int d_poll_t __P((dev_t dev, int events, struct proc *p)); 69184588Sdfrtypedef int d_mmap_t __P((dev_t dev, int offset, int nprot)); 70184588Sdfr 71184588Sdfrtypedef int l_open_t __P((dev_t dev, struct tty *tp)); 72184588Sdfrtypedef int l_close_t __P((struct tty *tp, int flag)); 73184588Sdfrtypedef int l_read_t __P((struct tty *tp, struct uio *uio, int flag)); 74184588Sdfrtypedef int l_write_t __P((struct tty *tp, struct uio *uio, int flag)); 75184588Sdfrtypedef int l_ioctl_t __P((struct tty *tp, int cmd, caddr_t data, 76184588Sdfr int flag, struct proc *p)); 77184588Sdfrtypedef int l_rint_t __P((int c, struct tty *tp)); 78184588Sdfrtypedef int l_start_t __P((struct tty *tp)); 79184588Sdfrtypedef int l_modem_t __P((struct tty *tp, int flag)); 80184588Sdfr 81184588Sdfr/* 82184588Sdfr * Types for d_type. 83184588Sdfr */ 84184588Sdfr#define D_TAPE 1 85253049Srmacklem#define D_DISK 2 86253049Srmacklem#define D_TTY 3 87184588Sdfr 88184588Sdfr#define D_TYPEMASK 0xffff 89184588Sdfr 90184588Sdfr/* 91184588Sdfr * Flags for d_flags. 92184588Sdfr */ 93184588Sdfr#define D_NOCLUSTERR 0x10000 /* disables cluter read */ 94184588Sdfr#define D_NOCLUSTERW 0x20000 /* disables cluster write */ 95184588Sdfr#define D_NOCLUSTERRW (D_NOCLUSTERR | D_NOCLUSTERW) 96184588Sdfr 97184588Sdfr/* 98184588Sdfr * Block device switch table 99184588Sdfr */ 100184588Sdfrstruct bdevsw { 101184588Sdfr d_open_t *d_open; 102184588Sdfr d_close_t *d_close; 103184588Sdfr d_strategy_t *d_strategy; 104184588Sdfr d_ioctl_t *d_ioctl; 105184588Sdfr d_dump_t *d_dump; 106184588Sdfr d_psize_t *d_psize; 107184588Sdfr u_int d_flags; 108184588Sdfr char *d_name; /* name of the driver e.g. audio */ 109184588Sdfr struct cdevsw *d_cdev; /* cross pointer to the cdev */ 110184588Sdfr int d_maj; /* the major number we were assigned */ 111184588Sdfr int d_maxio; 112184588Sdfr}; 113184588Sdfr 114184588Sdfr#ifdef KERNEL 115184588Sdfrextern struct bdevsw *bdevsw[]; 116184588Sdfr#endif 117184588Sdfr 118184588Sdfr/* 119184588Sdfr * Character device switch table 120184588Sdfr */ 121184588Sdfrstruct cdevsw { 122184588Sdfr d_open_t *d_open; 123184588Sdfr d_close_t *d_close; 124184588Sdfr d_read_t *d_read; 125184588Sdfr d_write_t *d_write; 126184588Sdfr d_ioctl_t *d_ioctl; 127253049Srmacklem d_stop_t *d_stop; 128184588Sdfr d_reset_t *d_reset; /* XXX not used */ 129184588Sdfr d_devtotty_t *d_devtotty; 130184588Sdfr d_poll_t *d_poll; 131184588Sdfr d_mmap_t *d_mmap; 132184588Sdfr d_strategy_t *d_strategy; 133184588Sdfr char *d_name; /* see above */ 134184588Sdfr struct bdevsw *d_bdev; 135184588Sdfr int d_maj; 136184588Sdfr}; 137184588Sdfr 138184588Sdfr#ifdef KERNEL 139184588Sdfrextern struct cdevsw *cdevsw[]; 140184588Sdfr#endif 141184588Sdfr 142184588Sdfr/* 143184588Sdfr * Line discipline switch table 144184588Sdfr */ 145184588Sdfrstruct linesw { 146184588Sdfr l_open_t *l_open; 147184588Sdfr l_close_t *l_close; 148184588Sdfr l_read_t *l_read; 149184588Sdfr l_write_t *l_write; 150184588Sdfr l_ioctl_t *l_ioctl; 151184588Sdfr l_rint_t *l_rint; 152184588Sdfr l_start_t *l_start; 153184588Sdfr l_modem_t *l_modem; 154184588Sdfr u_char l_hotchar; 155184588Sdfr}; 156184588Sdfr 157184588Sdfr#ifdef KERNEL 158184588Sdfrextern struct linesw linesw[]; 159253049Srmacklemextern int nlinesw; 160184588Sdfr 161184588Sdfrint ldisc_register __P((int , struct linesw *)); 162184588Sdfrvoid ldisc_deregister __P((int)); 163184588Sdfr#define LDISC_LOAD -1 /* Loadable line discipline */ 164184588Sdfr#endif 165184588Sdfr 166184588Sdfr/* 167184588Sdfr * Swap device table 168184588Sdfr */ 169184588Sdfrstruct swdevt { 170184588Sdfr dev_t sw_dev; 171184588Sdfr int sw_flags; 172184588Sdfr int sw_nblks; 173184588Sdfr struct vnode *sw_vp; 174184588Sdfr}; 175184588Sdfr#define SW_FREED 0x01 176184588Sdfr#define SW_SEQUENTIAL 0x02 177184588Sdfr#define sw_freed sw_flags /* XXX compat */ 178184588Sdfr 179184588Sdfr#ifdef KERNEL 180184588Sdfrd_open_t noopen; 181184588Sdfrd_close_t noclose; 182184588Sdfrd_read_t noread; 183184588Sdfrd_write_t nowrite; 184184588Sdfrd_ioctl_t noioctl; 185184588Sdfrd_stop_t nostop; 186184588Sdfrd_reset_t noreset; 187184588Sdfrd_devtotty_t nodevtotty; 188184588Sdfrd_mmap_t nommap; 189184588Sdfr 190184588Sdfr/* Bogus defines for compatibility. */ 191184588Sdfr#define noioc noioctl 192184588Sdfr#define nostrat nostrategy 193184588Sdfr#define zerosize nopsize 194184588Sdfr/* 195184588Sdfr * XXX d_strategy seems to be unused for cdevs that aren't associated with 196184588Sdfr * bdevs and called without checking for it being non-NULL for bdevs. 197184588Sdfr */ 198184588Sdfr#define nostrategy ((d_strategy_t *)NULL) 199194878Srmacklem 200184588Sdfrd_dump_t nodump; 201184588Sdfr 202184588Sdfr/* 203184588Sdfr * nopsize is little used, so not worth having dummy functions for. 204184588Sdfr */ 205184588Sdfr#define nopsize ((d_psize_t *)NULL) 206184588Sdfr 207184588Sdfrd_open_t nullopen; 208184588Sdfrd_close_t nullclose; 209184588Sdfr#define nullstop nostop /* one void return is as good as another */ 210184588Sdfr#define nullreset noreset /* one unused function is as good as another */ 211184588Sdfr 212184588Sdfrd_open_t nxopen; 213184588Sdfrd_close_t nxclose; 214184588Sdfrd_read_t nxread; 215184588Sdfrd_write_t nxwrite; 216184588Sdfrd_ioctl_t nxioctl; 217184588Sdfr#define nxstop nostop /* one void return is as good as another */ 218184588Sdfr#define nxreset noreset /* one unused function is as good as another */ 219184588Sdfr#define nxdevtotty nodevtotty /* one NULL return is as good as another */ 220184588Sdfr#define nxmmap nommap /* one -1 return is as good as another */ 221184588Sdfr#define nxstrategy nostrategy /* one NULL value is as good as another */ 222184588Sdfrd_dump_t nxdump; 223184588Sdfr#define nxpsize nopsize /* one NULL value is as good as another */ 224184588Sdfr 225184588Sdfrd_read_t rawread; 226184588Sdfrd_write_t rawwrite; 227184588Sdfr 228184588Sdfrl_read_t l_noread; 229184588Sdfrl_write_t l_nowrite; 230184588Sdfr 231184588Sdfrint bdevsw_add __P((dev_t *descrip,struct bdevsw *new,struct bdevsw **old)); 232184588Sdfrint cdevsw_add __P((dev_t *descrip,struct cdevsw *new,struct cdevsw **old)); 233184588Sdfrvoid bdevsw_add_generic __P((int bdev, int cdev, struct bdevsw *bdevsw)); 234184588Sdfrdev_t chrtoblk __P((dev_t dev)); 235184588Sdfrint iskmemdev __P((dev_t dev)); 236184588Sdfrint iszerodev __P((dev_t dev)); 237184588Sdfrvoid setconf __P((void)); 238194878Srmacklem#endif /* KERNEL */ 239194878Srmacklem 240194878Srmacklem#include <machine/conf.h> 241194878Srmacklem 242194878Srmacklem#endif /* !_SYS_CONF_H_ */ 243194878Srmacklem