Commit | Line | Data |
---|---|---|
88859601 KM |
1 | /* |
2 | * Copyright (c) 1990 The Regents of the University of California. | |
3 | * All rights reserved. | |
4 | * | |
6dc0e27a | 5 | * %sccs.include.redist.c% |
88859601 | 6 | * |
184ba363 | 7 | * @(#)specdev.h 7.3 (Berkeley) %G% |
88859601 KM |
8 | */ |
9 | ||
10 | /* | |
11 | * This structure defines the information maintained about | |
12 | * special devices. It is allocated in checkalias and freed | |
13 | * in vgone. | |
14 | */ | |
15 | struct specinfo { | |
16 | struct vnode **si_hashchain; | |
17 | struct vnode *si_specnext; | |
18 | long si_flags; | |
19 | dev_t si_rdev; | |
20 | }; | |
21 | /* | |
22 | * Exported shorthand | |
23 | */ | |
24 | #define v_rdev v_specinfo->si_rdev | |
25 | #define v_hashchain v_specinfo->si_hashchain | |
26 | #define v_specnext v_specinfo->si_specnext | |
27 | #define v_specflags v_specinfo->si_flags | |
28 | ||
29 | /* | |
30 | * Flags for specinfo | |
31 | */ | |
32 | #define SI_MOUNTEDON 0x0001 /* block special device is mounted on */ | |
33 | ||
34 | /* | |
35 | * Special device management | |
36 | */ | |
37 | #define SPECHSZ 64 | |
38 | #if ((SPECHSZ&(SPECHSZ-1)) == 0) | |
39 | #define SPECHASH(rdev) (((rdev>>5)+(rdev))&(SPECHSZ-1)) | |
40 | #else | |
41 | #define SPECHASH(rdev) (((unsigned)((rdev>>5)+(rdev)))%SPECHSZ) | |
42 | #endif | |
43 | ||
44 | struct vnode *speclisth[SPECHSZ]; | |
184ba363 KM |
45 | |
46 | /* | |
47 | * Prototypes for special file operations on vnodes. | |
48 | */ | |
49 | int spec_badop(), | |
50 | spec_ebadf(); | |
51 | ||
52 | int spec_lookup __P(( | |
53 | struct vnode *vp, | |
54 | struct nameidata *ndp, | |
55 | struct proc *p)); | |
56 | #define spec_create ((int (*) __P(( \ | |
57 | struct nameidata *ndp, \ | |
58 | struct vattr *vap, \ | |
59 | struct proc *p))) spec_badop) | |
60 | #define spec_mknod ((int (*) __P(( \ | |
61 | struct nameidata *ndp, \ | |
62 | struct vattr *vap, \ | |
63 | struct ucred *cred, \ | |
64 | struct proc *p))) spec_badop) | |
65 | int spec_open __P(( | |
66 | struct vnode *vp, | |
67 | int mode, | |
68 | struct ucred *cred, | |
69 | struct proc *p)); | |
70 | int spec_close __P(( | |
71 | struct vnode *vp, | |
72 | int fflag, | |
73 | struct ucred *cred, | |
74 | struct proc *p)); | |
75 | #define spec_access ((int (*) __P(( \ | |
76 | struct vnode *vp, \ | |
77 | int mode, \ | |
78 | struct ucred *cred, \ | |
79 | struct proc *p))) spec_ebadf) | |
80 | #define spec_getattr ((int (*) __P(( \ | |
81 | struct vnode *vp, \ | |
82 | struct vattr *vap, \ | |
83 | struct ucred *cred, \ | |
84 | struct proc *p))) spec_ebadf) | |
85 | #define spec_setattr ((int (*) __P(( \ | |
86 | struct vnode *vp, \ | |
87 | struct vattr *vap, \ | |
88 | struct ucred *cred, \ | |
89 | struct proc *p))) spec_ebadf) | |
90 | int spec_read __P(( | |
91 | struct vnode *vp, | |
92 | struct uio *uio, | |
93 | int ioflag, | |
94 | struct ucred *cred)); | |
95 | int spec_write __P(( | |
96 | struct vnode *vp, | |
97 | struct uio *uio, | |
98 | int ioflag, | |
99 | struct ucred *cred)); | |
100 | int spec_ioctl __P(( | |
101 | struct vnode *vp, | |
102 | int command, | |
103 | caddr_t data, | |
104 | int fflag, | |
105 | struct ucred *cred, | |
106 | struct proc *p)); | |
107 | int spec_select __P(( | |
108 | struct vnode *vp, | |
109 | int which, | |
110 | int fflags, | |
111 | struct ucred *cred, | |
112 | struct proc *p)); | |
113 | #define spec_mmap ((int (*) __P(( \ | |
114 | struct vnode *vp, \ | |
115 | int fflags, \ | |
116 | struct ucred *cred, \ | |
117 | struct proc *p))) spec_badop) | |
118 | #define spec_fsync ((int (*) __P(( \ | |
119 | struct vnode *vp, \ | |
120 | int fflags, \ | |
121 | struct ucred *cred, \ | |
122 | int waitfor, \ | |
123 | struct proc *p))) nullop) | |
124 | #define spec_seek ((int (*) __P(( \ | |
125 | struct vnode *vp, \ | |
126 | off_t oldoff, \ | |
127 | off_t newoff, \ | |
128 | struct ucred *cred))) spec_badop) | |
129 | #define spec_remove ((int (*) __P(( \ | |
130 | struct nameidata *ndp, \ | |
131 | struct proc *p))) spec_badop) | |
132 | #define spec_link ((int (*) __P(( \ | |
133 | struct vnode *vp, \ | |
134 | struct nameidata *ndp, \ | |
135 | struct proc *p))) spec_badop) | |
136 | #define spec_rename ((int (*) __P(( \ | |
137 | struct nameidata *fndp, \ | |
138 | struct nameidata *tdnp, \ | |
139 | struct proc *p))) spec_badop) | |
140 | #define spec_mkdir ((int (*) __P(( \ | |
141 | struct nameidata *ndp, \ | |
142 | struct vattr *vap, \ | |
143 | struct proc *p))) spec_badop) | |
144 | #define spec_rmdir ((int (*) __P(( \ | |
145 | struct nameidata *ndp, \ | |
146 | struct proc *p))) spec_badop) | |
147 | #define spec_symlink ((int (*) __P(( \ | |
148 | struct nameidata *ndp, \ | |
149 | struct vattr *vap, \ | |
150 | char *target, \ | |
151 | struct proc *p))) spec_badop) | |
152 | #define spec_readdir ((int (*) __P(( \ | |
153 | struct vnode *vp, \ | |
154 | struct uio *uio, \ | |
155 | struct ucred *cred, \ | |
156 | int *eofflagp))) spec_badop) | |
157 | #define spec_readlink ((int (*) __P(( \ | |
158 | struct vnode *vp, \ | |
159 | struct uio *uio, \ | |
160 | struct ucred *cred))) spec_badop) | |
161 | #define spec_abortop ((int (*) __P(( \ | |
162 | struct nameidata *ndp))) spec_badop) | |
163 | #define spec_inactive ((int (*) __P(( \ | |
164 | struct vnode *vp, \ | |
165 | struct proc *p))) nullop) | |
166 | #define spec_reclaim ((int (*) __P(( \ | |
167 | struct vnode *vp))) nullop) | |
168 | int spec_lock __P(( | |
169 | struct vnode *vp)); | |
170 | int spec_unlock __P(( | |
171 | struct vnode *vp)); | |
172 | int spec_bmap __P(( | |
173 | struct vnode *vp, | |
174 | daddr_t bn, | |
175 | struct vnode **vpp, | |
176 | daddr_t *bnp)); | |
177 | int spec_strategy __P(( | |
178 | struct buf *bp)); | |
179 | int spec_print __P(( | |
180 | struct vnode *vp)); | |
181 | #define spec_islocked ((int (*) __P(( \ | |
182 | struct vnode *vp))) nullop) | |
183 | int spec_advlock __P(( | |
184 | struct vnode *vp, | |
185 | caddr_t id, | |
186 | int op, | |
187 | struct flock *fl, | |
188 | int flags)); |