This commit was manufactured by cvs2svn to create tag 'FreeBSD-release/1.0'.
[unix-history] / sys / sys / specdev.h
CommitLineData
15637ed4
RG
1/*
2 * Copyright (c) 1990 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
78ed81a3 33 * from: @(#)specdev.h 7.4 (Berkeley) 4/19/91
34 * $Id$
15637ed4
RG
35 */
36
37/*
38 * This structure defines the information maintained about
39 * special devices. It is allocated in checkalias and freed
40 * in vgone.
41 */
42struct specinfo {
43 struct vnode **si_hashchain;
44 struct vnode *si_specnext;
45 long si_flags;
46 dev_t si_rdev;
47};
48/*
49 * Exported shorthand
50 */
51#define v_rdev v_specinfo->si_rdev
52#define v_hashchain v_specinfo->si_hashchain
53#define v_specnext v_specinfo->si_specnext
54#define v_specflags v_specinfo->si_flags
55
56/*
57 * Flags for specinfo
58 */
59#define SI_MOUNTEDON 0x0001 /* block special device is mounted on */
60
61/*
62 * Special device management
63 */
64#define SPECHSZ 64
65#if ((SPECHSZ&(SPECHSZ-1)) == 0)
66#define SPECHASH(rdev) (((rdev>>5)+(rdev))&(SPECHSZ-1))
67#else
68#define SPECHASH(rdev) (((unsigned)((rdev>>5)+(rdev)))%SPECHSZ)
69#endif
70
71struct vnode *speclisth[SPECHSZ];
72
73/*
74 * Prototypes for special file operations on vnodes.
75 */
76struct nameidata;
77struct ucred;
78struct flock;
79struct buf;
80struct uio;
81
82int spec_badop(),
83 spec_ebadf();
84
85int spec_lookup __P((
86 struct vnode *vp,
87 struct nameidata *ndp,
88 struct proc *p));
89#define spec_create ((int (*) __P(( \
90 struct nameidata *ndp, \
91 struct vattr *vap, \
92 struct proc *p))) spec_badop)
93#define spec_mknod ((int (*) __P(( \
94 struct nameidata *ndp, \
95 struct vattr *vap, \
96 struct ucred *cred, \
97 struct proc *p))) spec_badop)
98int spec_open __P((
99 struct vnode *vp,
100 int mode,
101 struct ucred *cred,
102 struct proc *p));
103int spec_close __P((
104 struct vnode *vp,
105 int fflag,
106 struct ucred *cred,
107 struct proc *p));
108#define spec_access ((int (*) __P(( \
109 struct vnode *vp, \
110 int mode, \
111 struct ucred *cred, \
112 struct proc *p))) spec_ebadf)
113#define spec_getattr ((int (*) __P(( \
114 struct vnode *vp, \
115 struct vattr *vap, \
116 struct ucred *cred, \
117 struct proc *p))) spec_ebadf)
118#define spec_setattr ((int (*) __P(( \
119 struct vnode *vp, \
120 struct vattr *vap, \
121 struct ucred *cred, \
122 struct proc *p))) spec_ebadf)
123int spec_read __P((
124 struct vnode *vp,
125 struct uio *uio,
126 int ioflag,
127 struct ucred *cred));
128int spec_write __P((
129 struct vnode *vp,
130 struct uio *uio,
131 int ioflag,
132 struct ucred *cred));
133int spec_ioctl __P((
134 struct vnode *vp,
135 int command,
136 caddr_t data,
137 int fflag,
138 struct ucred *cred,
139 struct proc *p));
140int spec_select __P((
141 struct vnode *vp,
142 int which,
143 int fflags,
144 struct ucred *cred,
145 struct proc *p));
146#define spec_mmap ((int (*) __P(( \
147 struct vnode *vp, \
148 int fflags, \
149 struct ucred *cred, \
150 struct proc *p))) spec_badop)
151#define spec_fsync ((int (*) __P(( \
152 struct vnode *vp, \
153 int fflags, \
154 struct ucred *cred, \
155 int waitfor, \
156 struct proc *p))) nullop)
157#define spec_seek ((int (*) __P(( \
158 struct vnode *vp, \
159 off_t oldoff, \
160 off_t newoff, \
161 struct ucred *cred))) spec_badop)
162#define spec_remove ((int (*) __P(( \
163 struct nameidata *ndp, \
164 struct proc *p))) spec_badop)
165#define spec_link ((int (*) __P(( \
166 struct vnode *vp, \
167 struct nameidata *ndp, \
168 struct proc *p))) spec_badop)
169#define spec_rename ((int (*) __P(( \
170 struct nameidata *fndp, \
171 struct nameidata *tdnp, \
172 struct proc *p))) spec_badop)
173#define spec_mkdir ((int (*) __P(( \
174 struct nameidata *ndp, \
175 struct vattr *vap, \
176 struct proc *p))) spec_badop)
177#define spec_rmdir ((int (*) __P(( \
178 struct nameidata *ndp, \
179 struct proc *p))) spec_badop)
180#define spec_symlink ((int (*) __P(( \
181 struct nameidata *ndp, \
182 struct vattr *vap, \
183 char *target, \
184 struct proc *p))) spec_badop)
185#define spec_readdir ((int (*) __P(( \
186 struct vnode *vp, \
187 struct uio *uio, \
188 struct ucred *cred, \
189 int *eofflagp))) spec_badop)
190#define spec_readlink ((int (*) __P(( \
191 struct vnode *vp, \
192 struct uio *uio, \
193 struct ucred *cred))) spec_badop)
194#define spec_abortop ((int (*) __P(( \
195 struct nameidata *ndp))) spec_badop)
196#define spec_inactive ((int (*) __P(( \
197 struct vnode *vp, \
198 struct proc *p))) nullop)
199#define spec_reclaim ((int (*) __P(( \
200 struct vnode *vp))) nullop)
201int spec_lock __P((
202 struct vnode *vp));
203int spec_unlock __P((
204 struct vnode *vp));
205int spec_bmap __P((
206 struct vnode *vp,
207 daddr_t bn,
208 struct vnode **vpp,
209 daddr_t *bnp));
210int spec_strategy __P((
211 struct buf *bp));
212int spec_print __P((
213 struct vnode *vp));
214#define spec_islocked ((int (*) __P(( \
215 struct vnode *vp))) nullop)
216int spec_advlock __P((
217 struct vnode *vp,
218 caddr_t id,
219 int op,
220 struct flock *fl,
221 int flags));