xref: /original-bsd/sys/sys/conf.h (revision 0997b878)
1 /*-
2  * Copyright (c) 1990, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  * (c) UNIX System Laboratories, Inc.
5  * All or some portions of this file are derived from material licensed
6  * to the University of California by American Telephone and Telegraph
7  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8  * the permission of UNIX System Laboratories, Inc.
9  *
10  * %sccs.include.redist.c%
11  *
12  *	@(#)conf.h	8.5 (Berkeley) 01/09/95
13  */
14 
15 /*
16  * Definitions of device driver entry switches
17  */
18 
19 struct buf;
20 struct proc;
21 struct tty;
22 struct uio;
23 struct vnode;
24 
25 /*
26  * Types for d_type.
27  */
28 #define	D_TAPE	1
29 #define	D_DISK	2
30 #define	D_TTY	3
31 
32 /*
33  * Block device switch table
34  */
35 struct bdevsw {
36 	int	(*d_open)	__P((dev_t dev, int oflags, int devtype,
37 				     struct proc *p));
38 	int	(*d_close)	__P((dev_t dev, int fflag, int devtype,
39 				     struct proc *p));
40 	void	(*d_strategy)	__P((struct buf *bp));
41 	int	(*d_ioctl)	__P((dev_t dev, u_long cmd, caddr_t data,
42 				     int fflag, struct proc *p));
43 	int	(*d_dump)	();	/* parameters vary by architecture */
44 	int	(*d_psize)	__P((dev_t dev));
45 	int	d_type;
46 };
47 
48 #ifdef KERNEL
49 extern struct bdevsw bdevsw[];
50 #endif
51 
52 /*
53  * Character device switch table
54  */
55 struct cdevsw {
56 	int	(*d_open)	__P((dev_t dev, int oflags, int devtype,
57 				     struct proc *p));
58 	int	(*d_close)	__P((dev_t dev, int fflag, int devtype,
59 				     struct proc *));
60 	int	(*d_read)	__P((dev_t dev, struct uio *uio, int ioflag));
61 	int	(*d_write)	__P((dev_t dev, struct uio *uio, int ioflag));
62 	int	(*d_ioctl)	__P((dev_t dev, u_long cmd, caddr_t data,
63 				     int fflag, struct proc *p));
64 	int	(*d_stop)	__P((struct tty *tp, int rw));
65 	int	(*d_reset)	__P((int uban));	/* XXX */
66 	struct	tty *d_ttys;
67 	int	(*d_select)	__P((dev_t dev, int which, struct proc *p));
68 	int	(*d_mmap)	__P(());
69 	void	(*d_strategy)	__P((struct buf *bp));
70 	int	d_type;
71 };
72 
73 #ifdef KERNEL
74 extern struct cdevsw cdevsw[];
75 
76 /* symbolic sleep message strings */
77 extern char devopn[], devio[], devwait[], devin[], devout[];
78 extern char devioc[], devcls[];
79 #endif
80 
81 /*
82  * Line discipline switch table
83  */
84 struct linesw {
85 	int	(*l_open)	__P((dev_t dev, struct tty *tp));
86 	int	(*l_close)	__P((struct tty *tp, int flag));
87 	int	(*l_read)	__P((struct tty *tp, struct uio *uio,
88 				     int flag));
89 	int	(*l_write)	__P((struct tty *tp, struct uio *uio,
90 				     int flag));
91 	int	(*l_ioctl)	__P((struct tty *tp, u_long cmd, caddr_t data,
92 				     int flag, struct proc *p));
93 	int	(*l_rint)	__P((int c, struct tty *tp));
94 	int	(*l_start)	__P((struct tty *tp));
95 	int	(*l_modem)	__P((struct tty *tp, int flag));
96 };
97 
98 #ifdef KERNEL
99 extern struct linesw linesw[];
100 #endif
101 
102 /*
103  * Swap device table
104  */
105 struct swdevt {
106 	dev_t	sw_dev;
107 	int	sw_flags;
108 	int	sw_nblks;
109 	struct	vnode *sw_vp;
110 };
111 #define	SW_FREED	0x01
112 #define	SW_SEQUENTIAL	0x02
113 #define	sw_freed	sw_flags	/* XXX compat */
114 
115 #ifdef KERNEL
116 extern struct swdevt swdevt[];
117 #endif
118