|
|
1.1 root 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: *
33: * @(#)specdev.h 7.4 (Berkeley) 4/19/91
34: */
35:
36: /*
37: * This structure defines the information maintained about
38: * special devices. It is allocated in checkalias and freed
39: * in vgone.
40: */
41: struct specinfo {
42: struct vnode **si_hashchain;
43: struct vnode *si_specnext;
44: long si_flags;
45: dev_t si_rdev;
46: };
47: /*
48: * Exported shorthand
49: */
50: #define v_rdev v_specinfo->si_rdev
51: #define v_hashchain v_specinfo->si_hashchain
52: #define v_specnext v_specinfo->si_specnext
53: #define v_specflags v_specinfo->si_flags
54:
55: /*
56: * Flags for specinfo
57: */
58: #define SI_MOUNTEDON 0x0001 /* block special device is mounted on */
59:
60: /*
61: * Special device management
62: */
63: #define SPECHSZ 64
64: #if ((SPECHSZ&(SPECHSZ-1)) == 0)
65: #define SPECHASH(rdev) (((rdev>>5)+(rdev))&(SPECHSZ-1))
66: #else
67: #define SPECHASH(rdev) (((unsigned)((rdev>>5)+(rdev)))%SPECHSZ)
68: #endif
69:
70: struct vnode *speclisth[SPECHSZ];
71:
72: /*
73: * Prototypes for special file operations on vnodes.
74: */
75: struct nameidata;
76: struct ucred;
77: struct flock;
78: struct buf;
79: struct uio;
80:
81: int spec_badop(),
82: spec_ebadf();
83:
84: int spec_lookup __P((
85: struct vnode *vp,
86: struct nameidata *ndp,
87: struct proc *p));
88: #define spec_create ((int (*) __P(( \
89: struct nameidata *ndp, \
90: struct vattr *vap, \
91: struct proc *p))) spec_badop)
92: #define spec_mknod ((int (*) __P(( \
93: struct nameidata *ndp, \
94: struct vattr *vap, \
95: struct ucred *cred, \
96: struct proc *p))) spec_badop)
97: int spec_open __P((
98: struct vnode *vp,
99: int mode,
100: struct ucred *cred,
101: struct proc *p));
102: int spec_close __P((
103: struct vnode *vp,
104: int fflag,
105: struct ucred *cred,
106: struct proc *p));
107: #define spec_access ((int (*) __P(( \
108: struct vnode *vp, \
109: int mode, \
110: struct ucred *cred, \
111: struct proc *p))) spec_ebadf)
112: #define spec_getattr ((int (*) __P(( \
113: struct vnode *vp, \
114: struct vattr *vap, \
115: struct ucred *cred, \
116: struct proc *p))) spec_ebadf)
117: #define spec_setattr ((int (*) __P(( \
118: struct vnode *vp, \
119: struct vattr *vap, \
120: struct ucred *cred, \
121: struct proc *p))) spec_ebadf)
122: int spec_read __P((
123: struct vnode *vp,
124: struct uio *uio,
125: int ioflag,
126: struct ucred *cred));
127: int spec_write __P((
128: struct vnode *vp,
129: struct uio *uio,
130: int ioflag,
131: struct ucred *cred));
132: int spec_ioctl __P((
133: struct vnode *vp,
134: int command,
135: caddr_t data,
136: int fflag,
137: struct ucred *cred,
138: struct proc *p));
139: int spec_select __P((
140: struct vnode *vp,
141: int which,
142: int fflags,
143: struct ucred *cred,
144: struct proc *p));
145: #define spec_mmap ((int (*) __P(( \
146: struct vnode *vp, \
147: int fflags, \
148: struct ucred *cred, \
149: struct proc *p))) spec_badop)
150: #define spec_fsync ((int (*) __P(( \
151: struct vnode *vp, \
152: int fflags, \
153: struct ucred *cred, \
154: int waitfor, \
155: struct proc *p))) nullop)
156: #define spec_seek ((int (*) __P(( \
157: struct vnode *vp, \
158: off_t oldoff, \
159: off_t newoff, \
160: struct ucred *cred))) spec_badop)
161: #define spec_remove ((int (*) __P(( \
162: struct nameidata *ndp, \
163: struct proc *p))) spec_badop)
164: #define spec_link ((int (*) __P(( \
165: struct vnode *vp, \
166: struct nameidata *ndp, \
167: struct proc *p))) spec_badop)
168: #define spec_rename ((int (*) __P(( \
169: struct nameidata *fndp, \
170: struct nameidata *tdnp, \
171: struct proc *p))) spec_badop)
172: #define spec_mkdir ((int (*) __P(( \
173: struct nameidata *ndp, \
174: struct vattr *vap, \
175: struct proc *p))) spec_badop)
176: #define spec_rmdir ((int (*) __P(( \
177: struct nameidata *ndp, \
178: struct proc *p))) spec_badop)
179: #define spec_symlink ((int (*) __P(( \
180: struct nameidata *ndp, \
181: struct vattr *vap, \
182: char *target, \
183: struct proc *p))) spec_badop)
184: #define spec_readdir ((int (*) __P(( \
185: struct vnode *vp, \
186: struct uio *uio, \
187: struct ucred *cred, \
188: int *eofflagp))) spec_badop)
189: #define spec_readlink ((int (*) __P(( \
190: struct vnode *vp, \
191: struct uio *uio, \
192: struct ucred *cred))) spec_badop)
193: #define spec_abortop ((int (*) __P(( \
194: struct nameidata *ndp))) spec_badop)
195: #define spec_inactive ((int (*) __P(( \
196: struct vnode *vp, \
197: struct proc *p))) nullop)
198: #define spec_reclaim ((int (*) __P(( \
199: struct vnode *vp))) nullop)
200: int spec_lock __P((
201: struct vnode *vp));
202: int spec_unlock __P((
203: struct vnode *vp));
204: int spec_bmap __P((
205: struct vnode *vp,
206: daddr_t bn,
207: struct vnode **vpp,
208: daddr_t *bnp));
209: int spec_strategy __P((
210: struct buf *bp));
211: int spec_print __P((
212: struct vnode *vp));
213: #define spec_islocked ((int (*) __P(( \
214: struct vnode *vp))) nullop)
215: int spec_advlock __P((
216: struct vnode *vp,
217: caddr_t id,
218: int op,
219: struct flock *fl,
220: int flags));
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.