This source file includes following definitions.
- vop_generic_revoke
- vop_generic_bwrite
- vop_generic_abortop
- vop_generic_lock
- vop_generic_unlock
- vop_generic_islocked
- vop_generic_kqfilter
- filt_generic_detach
- filt_generic_readwrite
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39 #include <sys/param.h>
40 #include <sys/systm.h>
41 #include <sys/proc.h>
42 #include <sys/mount.h>
43 #include <sys/vnode.h>
44 #include <sys/namei.h>
45 #include <sys/malloc.h>
46 #include <sys/pool.h>
47 #include <sys/event.h>
48 #include <miscfs/specfs/specdev.h>
49
50 int filt_generic_readwrite(struct knote *, long);
51 void filt_generic_detach(struct knote *);
52
53
54
55
56
57 int
58 vop_generic_revoke(void *v)
59 {
60 struct vop_revoke_args *ap = v;
61 struct vnode *vp, *vq;
62 struct proc *p = curproc;
63
64 #ifdef DIAGNOSTIC
65 if ((ap->a_flags & REVOKEALL) == 0)
66 panic("vop_generic_revoke");
67 #endif
68
69 vp = ap->a_vp;
70
71 if (vp->v_flag & VALIASED) {
72
73
74
75
76 if (vp->v_flag & VXLOCK) {
77 vp->v_flag |= VXWANT;
78 tsleep(vp, PINOD, "vop_generic_revokeall", 0);
79
80 return(0);
81 }
82
83
84
85
86
87 vp->v_flag |= VXLOCK;
88 while (vp->v_flag & VALIASED) {
89 for (vq = *vp->v_hashchain; vq; vq = vq->v_specnext) {
90 if (vq->v_rdev != vp->v_rdev ||
91 vq->v_type != vp->v_type || vp == vq)
92 continue;
93 vgone(vq);
94 break;
95 }
96 }
97
98
99
100
101
102
103 vp->v_flag &= ~VXLOCK;
104 }
105
106 vgonel(vp, p);
107
108 return (0);
109 }
110
111 int
112 vop_generic_bwrite(void *v)
113 {
114 struct vop_bwrite_args *ap = v;
115
116 return (bwrite(ap->a_bp));
117 }
118
119 int
120 vop_generic_abortop(void *v)
121 {
122 struct vop_abortop_args *ap = v;
123
124 if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF)
125 pool_put(&namei_pool, ap->a_cnp->cn_pnbuf);
126
127 return (0);
128 }
129
130
131
132
133
134
135
136
137 int
138 vop_generic_lock(void *v)
139 {
140 return (0);
141 }
142
143
144
145
146 int
147 vop_generic_unlock(void *v)
148 {
149 return (0);
150 }
151
152
153
154
155 int
156 vop_generic_islocked(void *v)
157 {
158 return (0);
159 }
160
161 struct filterops generic_filtops =
162 { 1, NULL, filt_generic_detach, filt_generic_readwrite };
163
164 int
165 vop_generic_kqfilter(void *v)
166 {
167 struct vop_kqfilter_args *ap = v;
168 struct knote *kn = ap->a_kn;
169
170 switch (kn->kn_filter) {
171 case EVFILT_READ:
172 case EVFILT_WRITE:
173 kn->kn_fop = &generic_filtops;
174 break;
175 default:
176 return (1);
177 }
178
179 return (0);
180 }
181
182 void
183 filt_generic_detach(struct knote *kn)
184 {
185 }
186
187 int
188 filt_generic_readwrite(struct knote *kn, long hint)
189 {
190
191
192
193
194 if (hint == NOTE_REVOKE) {
195 kn->kn_flags |= (EV_EOF | EV_ONESHOT);
196 return (1);
197 }
198
199 kn->kn_data = 0;
200
201 return (1);
202 }