Home | History | Annotate | Line # | Download | only in fifofs
fifo_vnops.c revision 1.78
      1 /*	$NetBSD: fifo_vnops.c,v 1.78 2017/04/11 14:25:00 riastradh 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.78 2017/04/11 14:25:00 riastradh 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_v2_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 static int
    120 fifo_open(void *v)
    121 {
    122 	struct vop_open_args /* {
    123 		struct vnode	*a_vp;
    124 		int		a_mode;
    125 		kauth_cred_t	a_cred;
    126 	} */ *ap = v;
    127 	struct lwp	*l = curlwp;
    128 	struct vnode	*vp;
    129 	struct fifoinfo	*fip;
    130 	struct socket	*rso, *wso;
    131 	int		error;
    132 
    133 	vp = ap->a_vp;
    134 	KASSERT(VOP_ISLOCKED(vp));
    135 
    136 	if ((fip = vp->v_fifoinfo) == NULL) {
    137 		fip = kmem_alloc(sizeof(*fip), KM_SLEEP);
    138 		error = socreate(AF_LOCAL, &rso, SOCK_STREAM, 0, l, NULL);
    139 		if (error != 0) {
    140 			kmem_free(fip, sizeof(*fip));
    141 			return (error);
    142 		}
    143 		fip->fi_readsock = rso;
    144 		error = socreate(AF_LOCAL, &wso, SOCK_STREAM, 0, l, rso);
    145 		if (error != 0) {
    146 			(void)soclose(rso);
    147 			kmem_free(fip, sizeof(*fip));
    148 			return (error);
    149 		}
    150 		fip->fi_writesock = wso;
    151 		solock(wso);
    152 		if ((error = unp_connect2(wso, rso)) != 0) {
    153 			sounlock(wso);
    154 			(void)soclose(wso);
    155 			(void)soclose(rso);
    156 			kmem_free(fip, sizeof(*fip));
    157 			return (error);
    158 		}
    159 		fip->fi_readers = 0;
    160 		fip->fi_writers = 0;
    161 		wso->so_state |= SS_CANTRCVMORE;
    162 		rso->so_state |= SS_CANTSENDMORE;
    163 		cv_init(&fip->fi_rcv, "fiford");
    164 		cv_init(&fip->fi_wcv, "fifowr");
    165 		vp->v_fifoinfo = fip;
    166 	} else {
    167 		wso = fip->fi_writesock;
    168 		rso = fip->fi_readsock;
    169 		solock(wso);
    170 	}
    171 
    172 	if (ap->a_mode & FREAD) {
    173 		if (fip->fi_readers++ == 0) {
    174 			wso->so_state &= ~SS_CANTSENDMORE;
    175 			cv_broadcast(&fip->fi_wcv);
    176 		}
    177 	}
    178 	if (ap->a_mode & FWRITE) {
    179 		if (fip->fi_writers++ == 0) {
    180 			rso->so_state &= ~SS_CANTRCVMORE;
    181 			cv_broadcast(&fip->fi_rcv);
    182 		}
    183 	}
    184 	if (ap->a_mode & FREAD) {
    185 		if (ap->a_mode & O_NONBLOCK) {
    186 		} else {
    187 			while (!soreadable(rso) && fip->fi_writers == 0) {
    188 				VOP_UNLOCK(vp);
    189 				error = cv_wait_sig(&fip->fi_rcv,
    190 				    wso->so_lock);
    191 				sounlock(wso);
    192 				vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
    193 				if (error)
    194 					goto bad;
    195 				solock(wso);
    196 			}
    197 		}
    198 	}
    199 	if (ap->a_mode & FWRITE) {
    200 		if (ap->a_mode & O_NONBLOCK) {
    201 			if (fip->fi_readers == 0) {
    202 				error = ENXIO;
    203 				sounlock(wso);
    204 				goto bad;
    205 			}
    206 		} else {
    207 			while (fip->fi_readers == 0) {
    208 				VOP_UNLOCK(vp);
    209 				error = cv_wait_sig(&fip->fi_wcv,
    210 				    wso->so_lock);
    211 				sounlock(wso);
    212 				vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
    213 				if (error)
    214 					goto bad;
    215 				solock(wso);
    216 			}
    217 		}
    218 	}
    219 	sounlock(wso);
    220 	return (0);
    221  bad:
    222 	VOP_CLOSE(vp, ap->a_mode, ap->a_cred);
    223 	return (error);
    224 }
    225 
    226 /*
    227  * Vnode op for read
    228  */
    229 /* ARGSUSED */
    230 static int
    231 fifo_read(void *v)
    232 {
    233 	struct vop_read_args /* {
    234 		struct vnode	*a_vp;
    235 		struct uio	*a_uio;
    236 		int		a_ioflag;
    237 		kauth_cred_t	a_cred;
    238 	} */ *ap = v;
    239 	struct uio	*uio;
    240 	struct socket	*rso;
    241 	int		error, sflags;
    242 	size_t		startresid;
    243 
    244 	uio = ap->a_uio;
    245 	rso = ap->a_vp->v_fifoinfo->fi_readsock;
    246 #ifdef DIAGNOSTIC
    247 	if (uio->uio_rw != UIO_READ)
    248 		panic("fifo_read mode");
    249 #endif
    250 	if (uio->uio_resid == 0)
    251 		return (0);
    252 	startresid = uio->uio_resid;
    253 	VOP_UNLOCK(ap->a_vp);
    254 	sflags = (ap->a_ioflag & IO_NDELAY) ? MSG_NBIO : 0;
    255 	error = (*rso->so_receive)(rso, NULL, uio, NULL, NULL, &sflags);
    256 	/*
    257 	 * Clear EOF indication after first such return.
    258 	 */
    259 	if (error == 0 && uio->uio_resid == startresid)
    260 		rso->so_state &= ~SS_CANTRCVMORE;
    261 	if (ap->a_ioflag & IO_NDELAY) {
    262 		if (error == EWOULDBLOCK &&
    263 		    ap->a_vp->v_fifoinfo->fi_writers == 0)
    264 			error = 0;
    265 	}
    266 	vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY);
    267 	return (error);
    268 }
    269 
    270 /*
    271  * Vnode op for write
    272  */
    273 /* ARGSUSED */
    274 static int
    275 fifo_write(void *v)
    276 {
    277 	struct vop_write_args /* {
    278 		struct vnode	*a_vp;
    279 		struct uio	*a_uio;
    280 		int		a_ioflag;
    281 		kauth_cred_t	a_cred;
    282 	} */ *ap = v;
    283 	struct socket	*wso;
    284 	int		error, sflags;
    285 
    286 	wso = ap->a_vp->v_fifoinfo->fi_writesock;
    287 #ifdef DIAGNOSTIC
    288 	if (ap->a_uio->uio_rw != UIO_WRITE)
    289 		panic("fifo_write mode");
    290 #endif
    291 	VOP_UNLOCK(ap->a_vp);
    292 	sflags = (ap->a_ioflag & IO_NDELAY) ? MSG_NBIO : 0;
    293 	error = (*wso->so_send)(wso, NULL, ap->a_uio, 0, NULL, sflags, curlwp);
    294 	vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY);
    295 	return (error);
    296 }
    297 
    298 /*
    299  * Device ioctl operation.
    300  */
    301 /* ARGSUSED */
    302 static int
    303 fifo_ioctl(void *v)
    304 {
    305 	struct vop_ioctl_args /* {
    306 		struct vnode	*a_vp;
    307 		u_long		a_command;
    308 		void		*a_data;
    309 		int		a_fflag;
    310 		kauth_cred_t	a_cred;
    311 		struct lwp	*a_l;
    312 	} */ *ap = v;
    313 	struct file	filetmp;
    314 	int		error;
    315 
    316 	if (ap->a_command == FIONBIO)
    317 		return (0);
    318 	if (ap->a_fflag & FREAD) {
    319 		filetmp.f_data = ap->a_vp->v_fifoinfo->fi_readsock;
    320 		error = soo_ioctl(&filetmp, ap->a_command, ap->a_data);
    321 		if (error)
    322 			return (error);
    323 	}
    324 	if (ap->a_fflag & FWRITE) {
    325 		filetmp.f_data = ap->a_vp->v_fifoinfo->fi_writesock;
    326 		error = soo_ioctl(&filetmp, ap->a_command, ap->a_data);
    327 		if (error)
    328 			return (error);
    329 	}
    330 	return (0);
    331 }
    332 
    333 /* ARGSUSED */
    334 static int
    335 fifo_poll(void *v)
    336 {
    337 	struct vop_poll_args /* {
    338 		struct vnode	*a_vp;
    339 		int		a_events;
    340 		struct lwp	*a_l;
    341 	} */ *ap = v;
    342 	struct socket	*so;
    343 	int		revents;
    344 
    345 	revents = 0;
    346 	if (ap->a_events & (POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND)) {
    347 		so = ap->a_vp->v_fifoinfo->fi_readsock;
    348 		if (so)
    349 			revents |= sopoll(so, ap->a_events);
    350 	}
    351 	if (ap->a_events & (POLLOUT | POLLWRNORM | POLLWRBAND)) {
    352 		so = ap->a_vp->v_fifoinfo->fi_writesock;
    353 		if (so)
    354 			revents |= sopoll(so, ap->a_events);
    355 	}
    356 
    357 	return (revents);
    358 }
    359 
    360 static int
    361 fifo_inactive(void *v)
    362 {
    363 	struct vop_inactive_v2_args /* {
    364 		struct vnode	*a_vp;
    365 		struct lwp	*a_l;
    366 	} */ *ap __unused = v;
    367 
    368 	return (0);
    369 }
    370 
    371 /*
    372  * This is a noop, simply returning what one has been given.
    373  */
    374 static int
    375 fifo_bmap(void *v)
    376 {
    377 	struct vop_bmap_args /* {
    378 		struct vnode	*a_vp;
    379 		daddr_t		a_bn;
    380 		struct vnode	**a_vpp;
    381 		daddr_t		*a_bnp;
    382 		int		*a_runp;
    383 	} */ *ap = v;
    384 
    385 	if (ap->a_vpp != NULL)
    386 		*ap->a_vpp = ap->a_vp;
    387 	if (ap->a_bnp != NULL)
    388 		*ap->a_bnp = ap->a_bn;
    389 	if (ap->a_runp != NULL)
    390 		*ap->a_runp = 0;
    391 	return (0);
    392 }
    393 
    394 /*
    395  * Device close routine
    396  */
    397 /* ARGSUSED */
    398 static int
    399 fifo_close(void *v)
    400 {
    401 	struct vop_close_args /* {
    402 		struct vnode	*a_vp;
    403 		int		a_fflag;
    404 		kauth_cred_t	a_cred;
    405 		struct lwp	*a_l;
    406 	} */ *ap = v;
    407 	struct vnode	*vp;
    408 	struct fifoinfo	*fip;
    409 	struct socket *wso, *rso;
    410 	int isrevoke;
    411 
    412 	vp = ap->a_vp;
    413 	fip = vp->v_fifoinfo;
    414 	isrevoke = (ap->a_fflag & (FREAD | FWRITE | FNONBLOCK)) == FNONBLOCK;
    415 	wso = fip->fi_writesock;
    416 	rso = fip->fi_readsock;
    417 	solock(wso);
    418 	if (isrevoke) {
    419 		if (fip->fi_readers != 0) {
    420 			fip->fi_readers = 0;
    421 			socantsendmore(wso);
    422 		}
    423 		if (fip->fi_writers != 0) {
    424 			fip->fi_writers = 0;
    425 			socantrcvmore(rso);
    426 		}
    427 	} else {
    428 		if ((ap->a_fflag & FREAD) && --fip->fi_readers == 0)
    429 			socantsendmore(wso);
    430 		if ((ap->a_fflag & FWRITE) && --fip->fi_writers == 0)
    431 			socantrcvmore(rso);
    432 	}
    433 	if ((fip->fi_readers + fip->fi_writers) == 0) {
    434 		sounlock(wso);
    435 		(void) soclose(rso);
    436 		(void) soclose(wso);
    437 		cv_destroy(&fip->fi_rcv);
    438 		cv_destroy(&fip->fi_wcv);
    439 		kmem_free(fip, sizeof(*fip));
    440 		vp->v_fifoinfo = NULL;
    441 	} else
    442 		sounlock(wso);
    443 	return (0);
    444 }
    445 
    446 /*
    447  * Print out internal contents of a fifo vnode.
    448  */
    449 static void
    450 fifo_printinfo(struct vnode *vp)
    451 {
    452 	struct fifoinfo	*fip;
    453 
    454 	fip = vp->v_fifoinfo;
    455 	printf(", fifo with %d readers and %d writers",
    456 	    fip->fi_readers, fip->fi_writers);
    457 }
    458 
    459 /*
    460  * Print out the contents of a fifo vnode.
    461  */
    462 static int
    463 fifo_print(void *v)
    464 {
    465 	struct vop_print_args /* {
    466 		struct vnode	*a_vp;
    467 	} */ *ap = v;
    468 
    469 	/*
    470 	 * We are most likely being called with the vnode belonging
    471 	 * to some file system and this is not printed.
    472 	 */
    473 	if (ap->a_vp->v_tag == VT_NON)
    474 		printf("tag VT_NON");
    475 
    476 	fifo_printinfo(ap->a_vp);
    477 	printf("\n");
    478 	return 0;
    479 }
    480 
    481 /*
    482  * Return POSIX pathconf information applicable to fifo's.
    483  */
    484 static int
    485 fifo_pathconf(void *v)
    486 {
    487 	struct vop_pathconf_args /* {
    488 		struct vnode	*a_vp;
    489 		int		a_name;
    490 		register_t	*a_retval;
    491 	} */ *ap = v;
    492 
    493 	switch (ap->a_name) {
    494 	case _PC_LINK_MAX:
    495 		*ap->a_retval = LINK_MAX;
    496 		return (0);
    497 	case _PC_PIPE_BUF:
    498 		*ap->a_retval = PIPE_BUF;
    499 		return (0);
    500 	case _PC_CHOWN_RESTRICTED:
    501 		*ap->a_retval = 1;
    502 		return (0);
    503 	case _PC_SYNC_IO:
    504 		*ap->a_retval = 1;
    505 		return (0);
    506 	default:
    507 		return (EINVAL);
    508 	}
    509 	/* NOTREACHED */
    510 }
    511 
    512 static void
    513 filt_fifordetach(struct knote *kn)
    514 {
    515 	struct socket *so;
    516 
    517 	so = (struct socket *)kn->kn_hook;
    518 	solock(so);
    519 	SLIST_REMOVE(&so->so_rcv.sb_sel.sel_klist, kn, knote, kn_selnext);
    520 	if (SLIST_EMPTY(&so->so_rcv.sb_sel.sel_klist))
    521 		so->so_rcv.sb_flags &= ~SB_KNOTE;
    522 	sounlock(so);
    523 }
    524 
    525 static int
    526 filt_fiforead(struct knote *kn, long hint)
    527 {
    528 	struct socket *so;
    529 	int rv;
    530 
    531 	so = (struct socket *)kn->kn_hook;
    532 	if (hint != NOTE_SUBMIT)
    533 		solock(so);
    534 	kn->kn_data = so->so_rcv.sb_cc;
    535 	if (so->so_state & SS_CANTRCVMORE) {
    536 		kn->kn_flags |= EV_EOF;
    537 		rv = 1;
    538 	} else {
    539 		kn->kn_flags &= ~EV_EOF;
    540 		rv = (kn->kn_data > 0);
    541 	}
    542 	if (hint != NOTE_SUBMIT)
    543 		sounlock(so);
    544 	return rv;
    545 }
    546 
    547 static void
    548 filt_fifowdetach(struct knote *kn)
    549 {
    550 	struct socket *so;
    551 
    552 	so = (struct socket *)kn->kn_hook;
    553 	solock(so);
    554 	SLIST_REMOVE(&so->so_snd.sb_sel.sel_klist, kn, knote, kn_selnext);
    555 	if (SLIST_EMPTY(&so->so_snd.sb_sel.sel_klist))
    556 		so->so_snd.sb_flags &= ~SB_KNOTE;
    557 	sounlock(so);
    558 }
    559 
    560 static int
    561 filt_fifowrite(struct knote *kn, long hint)
    562 {
    563 	struct socket *so;
    564 	int rv;
    565 
    566 	so = (struct socket *)kn->kn_hook;
    567 	if (hint != NOTE_SUBMIT)
    568 		solock(so);
    569 	kn->kn_data = sbspace(&so->so_snd);
    570 	if (so->so_state & SS_CANTSENDMORE) {
    571 		kn->kn_flags |= EV_EOF;
    572 		rv = 1;
    573 	} else {
    574 		kn->kn_flags &= ~EV_EOF;
    575 		rv = (kn->kn_data >= so->so_snd.sb_lowat);
    576 	}
    577 	if (hint != NOTE_SUBMIT)
    578 		sounlock(so);
    579 	return rv;
    580 }
    581 
    582 static const struct filterops fiforead_filtops =
    583 	{ 1, NULL, filt_fifordetach, filt_fiforead };
    584 static const struct filterops fifowrite_filtops =
    585 	{ 1, NULL, filt_fifowdetach, filt_fifowrite };
    586 
    587 /* ARGSUSED */
    588 static int
    589 fifo_kqfilter(void *v)
    590 {
    591 	struct vop_kqfilter_args /* {
    592 		struct vnode *a_vp;
    593 		struct knote *a_kn;
    594 	} */ *ap = v;
    595 	struct socket	*so;
    596 	struct sockbuf	*sb;
    597 
    598 	so = (struct socket *)ap->a_vp->v_fifoinfo->fi_readsock;
    599 	switch (ap->a_kn->kn_filter) {
    600 	case EVFILT_READ:
    601 		ap->a_kn->kn_fop = &fiforead_filtops;
    602 		sb = &so->so_rcv;
    603 		break;
    604 	case EVFILT_WRITE:
    605 		ap->a_kn->kn_fop = &fifowrite_filtops;
    606 		sb = &so->so_snd;
    607 		break;
    608 	default:
    609 		return (EINVAL);
    610 	}
    611 
    612 	ap->a_kn->kn_hook = so;
    613 
    614 	solock(so);
    615 	SLIST_INSERT_HEAD(&sb->sb_sel.sel_klist, ap->a_kn, kn_selnext);
    616 	sb->sb_flags |= SB_KNOTE;
    617 	sounlock(so);
    618 
    619 	return (0);
    620 }
    621 
    622 int (**fifo_vnodeop_p)(void *);
    623 const struct vnodeopv_entry_desc fifo_vnodeop_entries[] = {
    624 	{ &vop_default_desc, vn_default_error },
    625 	{ &vop_lookup_desc, fifo_lookup },		/* lookup */
    626 	{ &vop_create_desc, genfs_badop },		/* create */
    627 	{ &vop_mknod_desc, genfs_badop },		/* mknod */
    628 	{ &vop_open_desc, fifo_open },			/* open */
    629 	{ &vop_close_desc, fifo_close },		/* close */
    630 	{ &vop_access_desc, genfs_ebadf },		/* access */
    631 	{ &vop_getattr_desc, genfs_ebadf },		/* getattr */
    632 	{ &vop_setattr_desc, genfs_ebadf },		/* setattr */
    633 	{ &vop_read_desc, fifo_read },			/* read */
    634 	{ &vop_write_desc, fifo_write },		/* write */
    635 	{ &vop_fallocate_desc, genfs_eopnotsupp },	/* fallocate */
    636 	{ &vop_fdiscard_desc, genfs_eopnotsupp },	/* fdiscard */
    637 	{ &vop_ioctl_desc, fifo_ioctl },		/* ioctl */
    638 	{ &vop_poll_desc, fifo_poll },			/* poll */
    639 	{ &vop_kqfilter_desc, fifo_kqfilter },		/* kqfilter */
    640 	{ &vop_revoke_desc, genfs_revoke },		/* revoke */
    641 	{ &vop_mmap_desc, genfs_badop },		/* mmap */
    642 	{ &vop_fsync_desc, genfs_nullop },		/* fsync */
    643 	{ &vop_seek_desc, genfs_badop },		/* seek */
    644 	{ &vop_remove_desc, genfs_badop },		/* remove */
    645 	{ &vop_link_desc, genfs_badop },		/* link */
    646 	{ &vop_rename_desc, genfs_badop },		/* rename */
    647 	{ &vop_mkdir_desc, genfs_badop },		/* mkdir */
    648 	{ &vop_rmdir_desc, genfs_badop },		/* rmdir */
    649 	{ &vop_symlink_desc, genfs_badop },		/* symlink */
    650 	{ &vop_readdir_desc, genfs_badop },		/* readdir */
    651 	{ &vop_readlink_desc, genfs_badop },		/* readlink */
    652 	{ &vop_abortop_desc, genfs_badop },		/* abortop */
    653 	{ &vop_inactive_desc, fifo_inactive },		/* inactive */
    654 	{ &vop_reclaim_desc, genfs_nullop },		/* reclaim */
    655 	{ &vop_lock_desc, genfs_lock },			/* lock */
    656 	{ &vop_unlock_desc, genfs_unlock },		/* unlock */
    657 	{ &vop_bmap_desc, fifo_bmap },			/* bmap */
    658 	{ &vop_strategy_desc, genfs_badop },		/* strategy */
    659 	{ &vop_print_desc, fifo_print },		/* print */
    660 	{ &vop_islocked_desc, genfs_islocked },		/* islocked */
    661 	{ &vop_pathconf_desc, fifo_pathconf },		/* pathconf */
    662 	{ &vop_advlock_desc, genfs_einval },		/* advlock */
    663 	{ &vop_bwrite_desc, genfs_nullop },		/* bwrite */
    664 	{ &vop_putpages_desc, genfs_null_putpages },	/* putpages */
    665 	{ NULL, NULL }
    666 };
    667 const struct vnodeopv_desc fifo_vnodeop_opv_desc =
    668 	{ &fifo_vnodeop_p, fifo_vnodeop_entries };
    669