xref: /netbsd-src/sys/miscfs/fifofs/fifo_vnops.c (revision 9ddb6ab554e70fb9bbd90c3d96b812bc57755a14)
1 /*	$NetBSD: fifo_vnops.c,v 1.72 2011/12/21 15:27:50 christos Exp $	*/
2 
3 /*-
4  * Copyright (c) 2008 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
17  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26  * POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 /*
30  * Copyright (c) 1990, 1993, 1995
31  *	The Regents of the University of California.  All rights reserved.
32  *
33  * Redistribution and use in source and binary forms, with or without
34  * modification, are permitted provided that the following conditions
35  * are met:
36  * 1. Redistributions of source code must retain the above copyright
37  *    notice, this list of conditions and the following disclaimer.
38  * 2. Redistributions in binary form must reproduce the above copyright
39  *    notice, this list of conditions and the following disclaimer in the
40  *    documentation and/or other materials provided with the distribution.
41  * 3. Neither the name of the University nor the names of its contributors
42  *    may be used to endorse or promote products derived from this software
43  *    without specific prior written permission.
44  *
45  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
46  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
47  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
48  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
49  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
50  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
51  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
52  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
53  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
54  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
55  * SUCH DAMAGE.
56  *
57  *	@(#)fifo_vnops.c	8.10 (Berkeley) 5/27/95
58  */
59 
60 #include <sys/cdefs.h>
61 __KERNEL_RCSID(0, "$NetBSD: fifo_vnops.c,v 1.72 2011/12/21 15:27:50 christos Exp $");
62 
63 #include <sys/param.h>
64 #include <sys/systm.h>
65 #include <sys/proc.h>
66 #include <sys/time.h>
67 #include <sys/namei.h>
68 #include <sys/vnode.h>
69 #include <sys/socket.h>
70 #include <sys/protosw.h>
71 #include <sys/socketvar.h>
72 #include <sys/stat.h>
73 #include <sys/ioctl.h>
74 #include <sys/file.h>
75 #include <sys/errno.h>
76 #include <sys/kmem.h>
77 #include <sys/un.h>
78 #include <sys/poll.h>
79 #include <sys/event.h>
80 #include <sys/condvar.h>
81 
82 #include <miscfs/fifofs/fifo.h>
83 #include <miscfs/genfs/genfs.h>
84 
85 /*
86  * This structure is associated with the FIFO vnode and stores
87  * the state associated with the FIFO.
88  */
89 struct fifoinfo {
90 	struct socket	*fi_readsock;
91 	struct socket	*fi_writesock;
92 	kcondvar_t	fi_rcv;
93 	int		fi_readers;
94 	kcondvar_t	fi_wcv;
95 	int		fi_writers;
96 };
97 
98 /*
99  * Trivial lookup routine that always fails.
100  */
101 /* ARGSUSED */
102 static int
103 fifo_lookup(void *v)
104 {
105 	struct vop_lookup_args /* {
106 		struct vnode		*a_dvp;
107 		struct vnode		**a_vpp;
108 		struct componentname	*a_cnp;
109 	} */ *ap = v;
110 
111 	*ap->a_vpp = NULL;
112 	return (ENOTDIR);
113 }
114 
115 /*
116  * Open called to set up a new instance of a fifo or
117  * to find an active instance of a fifo.
118  */
119 /* ARGSUSED */
120 static int
121 fifo_open(void *v)
122 {
123 	struct vop_open_args /* {
124 		struct vnode	*a_vp;
125 		int		a_mode;
126 		kauth_cred_t	a_cred;
127 	} */ *ap = v;
128 	struct lwp	*l = curlwp;
129 	struct vnode	*vp;
130 	struct fifoinfo	*fip;
131 	struct proc	*p;
132 	struct socket	*rso, *wso;
133 	int		error;
134 
135 	vp = ap->a_vp;
136 	p = l->l_proc;
137 
138 	if ((fip = vp->v_fifoinfo) == NULL) {
139 		fip = kmem_alloc(sizeof(*fip), KM_SLEEP);
140 		vp->v_fifoinfo = fip;
141 		error = socreate(AF_LOCAL, &rso, SOCK_STREAM, 0, l, NULL);
142 		if (error != 0) {
143 			kmem_free(fip, sizeof(*fip));
144 			vp->v_fifoinfo = NULL;
145 			return (error);
146 		}
147 		fip->fi_readsock = rso;
148 		error = socreate(AF_LOCAL, &wso, SOCK_STREAM, 0, l, rso);
149 		if (error != 0) {
150 			(void)soclose(rso);
151 			kmem_free(fip, sizeof(*fip));
152 			vp->v_fifoinfo = NULL;
153 			return (error);
154 		}
155 		fip->fi_writesock = wso;
156 		solock(wso);
157 		if ((error = unp_connect2(wso, rso, PRU_CONNECT2)) != 0) {
158 			sounlock(wso);
159 			(void)soclose(wso);
160 			(void)soclose(rso);
161 			kmem_free(fip, sizeof(*fip));
162 			vp->v_fifoinfo = NULL;
163 			return (error);
164 		}
165 		fip->fi_readers = 0;
166 		fip->fi_writers = 0;
167 		wso->so_state |= SS_CANTRCVMORE;
168 		rso->so_state |= SS_CANTSENDMORE;
169 		cv_init(&fip->fi_rcv, "fiford");
170 		cv_init(&fip->fi_wcv, "fifowr");
171 	} else {
172 		wso = fip->fi_writesock;
173 		rso = fip->fi_readsock;
174 		solock(wso);
175 	}
176 
177 	if (ap->a_mode & FREAD) {
178 		if (fip->fi_readers++ == 0) {
179 			wso->so_state &= ~SS_CANTSENDMORE;
180 			cv_broadcast(&fip->fi_wcv);
181 		}
182 	}
183 	if (ap->a_mode & FWRITE) {
184 		if (fip->fi_writers++ == 0) {
185 			rso->so_state &= ~SS_CANTRCVMORE;
186 			cv_broadcast(&fip->fi_rcv);
187 		}
188 	}
189 	if (ap->a_mode & FREAD) {
190 		if (ap->a_mode & O_NONBLOCK) {
191 		} else {
192 			while (!soreadable(rso) && fip->fi_writers == 0) {
193 				VOP_UNLOCK(vp);
194 				error = cv_wait_sig(&fip->fi_rcv,
195 				    wso->so_lock);
196 				sounlock(wso);
197 				vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
198 				if (error)
199 					goto bad;
200 				solock(wso);
201 			}
202 		}
203 	}
204 	if (ap->a_mode & FWRITE) {
205 		if (ap->a_mode & O_NONBLOCK) {
206 			if (fip->fi_readers == 0) {
207 				error = ENXIO;
208 				sounlock(wso);
209 				goto bad;
210 			}
211 		} else {
212 			while (fip->fi_readers == 0) {
213 				VOP_UNLOCK(vp);
214 				error = cv_wait_sig(&fip->fi_wcv,
215 				    wso->so_lock);
216 				sounlock(wso);
217 				vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
218 				if (error)
219 					goto bad;
220 				solock(wso);
221 			}
222 		}
223 	}
224 	sounlock(wso);
225 	return (0);
226  bad:
227 	VOP_CLOSE(vp, ap->a_mode, ap->a_cred);
228 	return (error);
229 }
230 
231 /*
232  * Vnode op for read
233  */
234 /* ARGSUSED */
235 static int
236 fifo_read(void *v)
237 {
238 	struct vop_read_args /* {
239 		struct vnode	*a_vp;
240 		struct uio	*a_uio;
241 		int		a_ioflag;
242 		kauth_cred_t	a_cred;
243 	} */ *ap = v;
244 	struct uio	*uio;
245 	struct socket	*rso;
246 	int		error, sflags;
247 	size_t		startresid;
248 
249 	uio = ap->a_uio;
250 	rso = ap->a_vp->v_fifoinfo->fi_readsock;
251 #ifdef DIAGNOSTIC
252 	if (uio->uio_rw != UIO_READ)
253 		panic("fifo_read mode");
254 #endif
255 	if (uio->uio_resid == 0)
256 		return (0);
257 	startresid = uio->uio_resid;
258 	VOP_UNLOCK(ap->a_vp);
259 	sflags = (ap->a_ioflag & IO_NDELAY) ? MSG_NBIO : 0;
260 	error = (*rso->so_receive)(rso, NULL, uio, NULL, NULL, &sflags);
261 	/*
262 	 * Clear EOF indication after first such return.
263 	 */
264 	if (error == 0 && uio->uio_resid == startresid)
265 		rso->so_state &= ~SS_CANTRCVMORE;
266 	if (ap->a_ioflag & IO_NDELAY) {
267 		if (error == EWOULDBLOCK &&
268 		    ap->a_vp->v_fifoinfo->fi_writers == 0)
269 			error = 0;
270 	}
271 	vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY);
272 	return (error);
273 }
274 
275 /*
276  * Vnode op for write
277  */
278 /* ARGSUSED */
279 static int
280 fifo_write(void *v)
281 {
282 	struct vop_write_args /* {
283 		struct vnode	*a_vp;
284 		struct uio	*a_uio;
285 		int		a_ioflag;
286 		kauth_cred_t	a_cred;
287 	} */ *ap = v;
288 	struct socket	*wso;
289 	int		error, sflags;
290 
291 	wso = ap->a_vp->v_fifoinfo->fi_writesock;
292 #ifdef DIAGNOSTIC
293 	if (ap->a_uio->uio_rw != UIO_WRITE)
294 		panic("fifo_write mode");
295 #endif
296 	VOP_UNLOCK(ap->a_vp);
297 	sflags = (ap->a_ioflag & IO_NDELAY) ? MSG_NBIO : 0;
298 	error = (*wso->so_send)(wso, NULL, ap->a_uio, 0, NULL, sflags, curlwp);
299 	vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY);
300 	return (error);
301 }
302 
303 /*
304  * Device ioctl operation.
305  */
306 /* ARGSUSED */
307 static int
308 fifo_ioctl(void *v)
309 {
310 	struct vop_ioctl_args /* {
311 		struct vnode	*a_vp;
312 		u_long		a_command;
313 		void		*a_data;
314 		int		a_fflag;
315 		kauth_cred_t	a_cred;
316 		struct lwp	*a_l;
317 	} */ *ap = v;
318 	struct file	filetmp;
319 	int		error;
320 
321 	if (ap->a_command == FIONBIO)
322 		return (0);
323 	if (ap->a_fflag & FREAD) {
324 		filetmp.f_data = ap->a_vp->v_fifoinfo->fi_readsock;
325 		error = soo_ioctl(&filetmp, ap->a_command, ap->a_data);
326 		if (error)
327 			return (error);
328 	}
329 	if (ap->a_fflag & FWRITE) {
330 		filetmp.f_data = ap->a_vp->v_fifoinfo->fi_writesock;
331 		error = soo_ioctl(&filetmp, ap->a_command, ap->a_data);
332 		if (error)
333 			return (error);
334 	}
335 	return (0);
336 }
337 
338 /* ARGSUSED */
339 static int
340 fifo_poll(void *v)
341 {
342 	struct vop_poll_args /* {
343 		struct vnode	*a_vp;
344 		int		a_events;
345 		struct lwp	*a_l;
346 	} */ *ap = v;
347 	struct socket	*so;
348 	int		revents;
349 
350 	revents = 0;
351 	if (ap->a_events & (POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND)) {
352 		so = ap->a_vp->v_fifoinfo->fi_readsock;
353 		if (so)
354 			revents |= sopoll(so, ap->a_events);
355 	}
356 	if (ap->a_events & (POLLOUT | POLLWRNORM | POLLWRBAND)) {
357 		so = ap->a_vp->v_fifoinfo->fi_writesock;
358 		if (so)
359 			revents |= sopoll(so, ap->a_events);
360 	}
361 
362 	return (revents);
363 }
364 
365 static int
366 fifo_inactive(void *v)
367 {
368 	struct vop_inactive_args /* {
369 		struct vnode	*a_vp;
370 		struct lwp	*a_l;
371 	} */ *ap = v;
372 
373 	VOP_UNLOCK(ap->a_vp);
374 	return (0);
375 }
376 
377 /*
378  * This is a noop, simply returning what one has been given.
379  */
380 static int
381 fifo_bmap(void *v)
382 {
383 	struct vop_bmap_args /* {
384 		struct vnode	*a_vp;
385 		daddr_t		a_bn;
386 		struct vnode	**a_vpp;
387 		daddr_t		*a_bnp;
388 		int		*a_runp;
389 	} */ *ap = v;
390 
391 	if (ap->a_vpp != NULL)
392 		*ap->a_vpp = ap->a_vp;
393 	if (ap->a_bnp != NULL)
394 		*ap->a_bnp = ap->a_bn;
395 	if (ap->a_runp != NULL)
396 		*ap->a_runp = 0;
397 	return (0);
398 }
399 
400 /*
401  * Device close routine
402  */
403 /* ARGSUSED */
404 static int
405 fifo_close(void *v)
406 {
407 	struct vop_close_args /* {
408 		struct vnode	*a_vp;
409 		int		a_fflag;
410 		kauth_cred_t	a_cred;
411 		struct lwp	*a_l;
412 	} */ *ap = v;
413 	struct vnode	*vp;
414 	struct fifoinfo	*fip;
415 	struct socket *wso, *rso;
416 	int isrevoke;
417 
418 	vp = ap->a_vp;
419 	fip = vp->v_fifoinfo;
420 	isrevoke = (ap->a_fflag & (FREAD | FWRITE | FNONBLOCK)) == FNONBLOCK;
421 	wso = fip->fi_writesock;
422 	rso = fip->fi_readsock;
423 	solock(wso);
424 	if (isrevoke) {
425 		if (fip->fi_readers != 0) {
426 			fip->fi_readers = 0;
427 			socantsendmore(wso);
428 		}
429 		if (fip->fi_writers != 0) {
430 			fip->fi_writers = 0;
431 			socantrcvmore(rso);
432 		}
433 	} else {
434 		if ((ap->a_fflag & FREAD) && --fip->fi_readers == 0)
435 			socantsendmore(wso);
436 		if ((ap->a_fflag & FWRITE) && --fip->fi_writers == 0)
437 			socantrcvmore(rso);
438 	}
439 	if ((fip->fi_readers + fip->fi_writers) == 0) {
440 		sounlock(wso);
441 		(void) soclose(rso);
442 		(void) soclose(wso);
443 		cv_destroy(&fip->fi_rcv);
444 		cv_destroy(&fip->fi_wcv);
445 		kmem_free(fip, sizeof(*fip));
446 		vp->v_fifoinfo = NULL;
447 	} else
448 		sounlock(wso);
449 	return (0);
450 }
451 
452 /*
453  * Print out internal contents of a fifo vnode.
454  */
455 static void
456 fifo_printinfo(struct vnode *vp)
457 {
458 	struct fifoinfo	*fip;
459 
460 	fip = vp->v_fifoinfo;
461 	printf(", fifo with %d readers and %d writers",
462 	    fip->fi_readers, fip->fi_writers);
463 }
464 
465 /*
466  * Print out the contents of a fifo vnode.
467  */
468 static int
469 fifo_print(void *v)
470 {
471 	struct vop_print_args /* {
472 		struct vnode	*a_vp;
473 	} */ *ap = v;
474 
475 	/*
476 	 * We are most likely being called with the vnode belonging
477 	 * to some file system and this is not printed.
478 	 */
479 	if (ap->a_vp->v_tag == VT_NON)
480 		printf("tag VT_NON");
481 
482 	fifo_printinfo(ap->a_vp);
483 	printf("\n");
484 	return 0;
485 }
486 
487 /*
488  * Return POSIX pathconf information applicable to fifo's.
489  */
490 static int
491 fifo_pathconf(void *v)
492 {
493 	struct vop_pathconf_args /* {
494 		struct vnode	*a_vp;
495 		int		a_name;
496 		register_t	*a_retval;
497 	} */ *ap = v;
498 
499 	switch (ap->a_name) {
500 	case _PC_LINK_MAX:
501 		*ap->a_retval = LINK_MAX;
502 		return (0);
503 	case _PC_PIPE_BUF:
504 		*ap->a_retval = PIPE_BUF;
505 		return (0);
506 	case _PC_CHOWN_RESTRICTED:
507 		*ap->a_retval = 1;
508 		return (0);
509 	case _PC_SYNC_IO:
510 		*ap->a_retval = 1;
511 		return (0);
512 	default:
513 		return (EINVAL);
514 	}
515 	/* NOTREACHED */
516 }
517 
518 static void
519 filt_fifordetach(struct knote *kn)
520 {
521 	struct socket *so;
522 
523 	so = (struct socket *)kn->kn_hook;
524 	solock(so);
525 	SLIST_REMOVE(&so->so_rcv.sb_sel.sel_klist, kn, knote, kn_selnext);
526 	if (SLIST_EMPTY(&so->so_rcv.sb_sel.sel_klist))
527 		so->so_rcv.sb_flags &= ~SB_KNOTE;
528 	sounlock(so);
529 }
530 
531 static int
532 filt_fiforead(struct knote *kn, long hint)
533 {
534 	struct socket *so;
535 	int rv;
536 
537 	so = (struct socket *)kn->kn_hook;
538 	if (hint != NOTE_SUBMIT)
539 		solock(so);
540 	kn->kn_data = so->so_rcv.sb_cc;
541 	if (so->so_state & SS_CANTRCVMORE) {
542 		kn->kn_flags |= EV_EOF;
543 		rv = 1;
544 	} else {
545 		kn->kn_flags &= ~EV_EOF;
546 		rv = (kn->kn_data > 0);
547 	}
548 	if (hint != NOTE_SUBMIT)
549 		sounlock(so);
550 	return rv;
551 }
552 
553 static void
554 filt_fifowdetach(struct knote *kn)
555 {
556 	struct socket *so;
557 
558 	so = (struct socket *)kn->kn_hook;
559 	solock(so);
560 	SLIST_REMOVE(&so->so_snd.sb_sel.sel_klist, kn, knote, kn_selnext);
561 	if (SLIST_EMPTY(&so->so_snd.sb_sel.sel_klist))
562 		so->so_snd.sb_flags &= ~SB_KNOTE;
563 	sounlock(so);
564 }
565 
566 static int
567 filt_fifowrite(struct knote *kn, long hint)
568 {
569 	struct socket *so;
570 	int rv;
571 
572 	so = (struct socket *)kn->kn_hook;
573 	if (hint != NOTE_SUBMIT)
574 		solock(so);
575 	kn->kn_data = sbspace(&so->so_snd);
576 	if (so->so_state & SS_CANTSENDMORE) {
577 		kn->kn_flags |= EV_EOF;
578 		rv = 1;
579 	} else {
580 		kn->kn_flags &= ~EV_EOF;
581 		rv = (kn->kn_data >= so->so_snd.sb_lowat);
582 	}
583 	if (hint != NOTE_SUBMIT)
584 		sounlock(so);
585 	return rv;
586 }
587 
588 static const struct filterops fiforead_filtops =
589 	{ 1, NULL, filt_fifordetach, filt_fiforead };
590 static const struct filterops fifowrite_filtops =
591 	{ 1, NULL, filt_fifowdetach, filt_fifowrite };
592 
593 /* ARGSUSED */
594 static int
595 fifo_kqfilter(void *v)
596 {
597 	struct vop_kqfilter_args /* {
598 		struct vnode *a_vp;
599 		struct knote *a_kn;
600 	} */ *ap = v;
601 	struct socket	*so;
602 	struct sockbuf	*sb;
603 
604 	so = (struct socket *)ap->a_vp->v_fifoinfo->fi_readsock;
605 	switch (ap->a_kn->kn_filter) {
606 	case EVFILT_READ:
607 		ap->a_kn->kn_fop = &fiforead_filtops;
608 		sb = &so->so_rcv;
609 		break;
610 	case EVFILT_WRITE:
611 		ap->a_kn->kn_fop = &fifowrite_filtops;
612 		sb = &so->so_snd;
613 		break;
614 	default:
615 		return (EINVAL);
616 	}
617 
618 	ap->a_kn->kn_hook = so;
619 
620 	solock(so);
621 	SLIST_INSERT_HEAD(&sb->sb_sel.sel_klist, ap->a_kn, kn_selnext);
622 	sb->sb_flags |= SB_KNOTE;
623 	sounlock(so);
624 
625 	return (0);
626 }
627 
628 int (**fifo_vnodeop_p)(void *);
629 const struct vnodeopv_entry_desc fifo_vnodeop_entries[] = {
630 	{ &vop_default_desc, vn_default_error },
631 	{ &vop_lookup_desc, fifo_lookup },		/* lookup */
632 	{ &vop_create_desc, genfs_badop },		/* create */
633 	{ &vop_mknod_desc, genfs_badop },		/* mknod */
634 	{ &vop_open_desc, fifo_open },			/* open */
635 	{ &vop_close_desc, fifo_close },		/* close */
636 	{ &vop_access_desc, genfs_ebadf },		/* access */
637 	{ &vop_getattr_desc, genfs_ebadf },		/* getattr */
638 	{ &vop_setattr_desc, genfs_ebadf },		/* setattr */
639 	{ &vop_read_desc, fifo_read },			/* read */
640 	{ &vop_write_desc, fifo_write },		/* write */
641 	{ &vop_ioctl_desc, fifo_ioctl },		/* ioctl */
642 	{ &vop_poll_desc, fifo_poll },			/* poll */
643 	{ &vop_kqfilter_desc, fifo_kqfilter },		/* kqfilter */
644 	{ &vop_revoke_desc, genfs_revoke },		/* revoke */
645 	{ &vop_mmap_desc, genfs_badop },		/* mmap */
646 	{ &vop_fsync_desc, genfs_nullop },		/* fsync */
647 	{ &vop_seek_desc, genfs_badop },		/* seek */
648 	{ &vop_remove_desc, genfs_badop },		/* remove */
649 	{ &vop_link_desc, genfs_badop },		/* link */
650 	{ &vop_rename_desc, genfs_badop },		/* rename */
651 	{ &vop_mkdir_desc, genfs_badop },		/* mkdir */
652 	{ &vop_rmdir_desc, genfs_badop },		/* rmdir */
653 	{ &vop_symlink_desc, genfs_badop },		/* symlink */
654 	{ &vop_readdir_desc, genfs_badop },		/* readdir */
655 	{ &vop_readlink_desc, genfs_badop },		/* readlink */
656 	{ &vop_abortop_desc, genfs_badop },		/* abortop */
657 	{ &vop_inactive_desc, fifo_inactive },		/* inactive */
658 	{ &vop_reclaim_desc, genfs_nullop },		/* reclaim */
659 	{ &vop_lock_desc, genfs_lock },			/* lock */
660 	{ &vop_unlock_desc, genfs_unlock },		/* unlock */
661 	{ &vop_bmap_desc, fifo_bmap },			/* bmap */
662 	{ &vop_strategy_desc, genfs_badop },		/* strategy */
663 	{ &vop_print_desc, fifo_print },		/* print */
664 	{ &vop_islocked_desc, genfs_islocked },		/* islocked */
665 	{ &vop_pathconf_desc, fifo_pathconf },		/* pathconf */
666 	{ &vop_advlock_desc, genfs_einval },		/* advlock */
667 	{ &vop_bwrite_desc, genfs_nullop },		/* bwrite */
668 	{ &vop_putpages_desc, genfs_null_putpages },	/* putpages */
669 	{ NULL, NULL }
670 };
671 const struct vnodeopv_desc fifo_vnodeop_opv_desc =
672 	{ &fifo_vnodeop_p, fifo_vnodeop_entries };
673