Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/miscfs/fifofs/fifo_vnops.c,v rcsdiff: /ftp/cvs/cvsroot/src/sys/miscfs/fifofs/fifo_vnops.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.51.4.6 retrieving revision 1.52 diff -u -p -r1.51.4.6 -r1.52 --- src/sys/miscfs/fifofs/fifo_vnops.c 2008/03/24 09:39:09 1.51.4.6 +++ src/sys/miscfs/fifofs/fifo_vnops.c 2005/08/30 20:08:01 1.52 @@ -1,4 +1,4 @@ -/* $NetBSD: fifo_vnops.c,v 1.51.4.6 2008/03/24 09:39:09 yamt Exp $ */ +/* $NetBSD: fifo_vnops.c,v 1.52 2005/08/30 20:08:01 xtraeme Exp $ */ /* * Copyright (c) 1990, 1993, 1995 @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fifo_vnops.c,v 1.51.4.6 2008/03/24 09:39:09 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fifo_vnops.c,v 1.52 2005/08/30 20:08:01 xtraeme Exp $"); #include #include @@ -51,7 +51,6 @@ __KERNEL_RCSID(0, "$NetBSD: fifo_vnops.c #include #include #include -#include #include #include @@ -80,6 +79,7 @@ const struct vnodeopv_entry_desc fifo_vn { &vop_setattr_desc, fifo_setattr }, /* setattr */ { &vop_read_desc, fifo_read }, /* read */ { &vop_write_desc, fifo_write }, /* write */ + { &vop_lease_desc, fifo_lease_check }, /* lease */ { &vop_ioctl_desc, fifo_ioctl }, /* ioctl */ { &vop_poll_desc, fifo_poll }, /* poll */ { &vop_kqfilter_desc, fifo_kqfilter }, /* kqfilter */ @@ -106,6 +106,11 @@ const struct vnodeopv_entry_desc fifo_vn { &vop_islocked_desc, fifo_islocked }, /* islocked */ { &vop_pathconf_desc, fifo_pathconf }, /* pathconf */ { &vop_advlock_desc, fifo_advlock }, /* advlock */ + { &vop_blkatoff_desc, fifo_blkatoff }, /* blkatoff */ + { &vop_valloc_desc, fifo_valloc }, /* valloc */ + { &vop_vfree_desc, fifo_vfree }, /* vfree */ + { &vop_truncate_desc, fifo_truncate }, /* truncate */ + { &vop_update_desc, fifo_update }, /* update */ { &vop_bwrite_desc, fifo_bwrite }, /* bwrite */ { &vop_putpages_desc, fifo_putpages }, /* putpages */ { (struct vnodeop_desc*)NULL, (int(*)(void *))NULL } @@ -141,9 +146,9 @@ fifo_open(void *v) struct vop_open_args /* { struct vnode *a_vp; int a_mode; - kauth_cred_t a_cred; + struct ucred *a_cred; + struct proc *a_p; } */ *ap = v; - struct lwp *l = curlwp; struct vnode *vp; struct fifoinfo *fip; struct proc *p; @@ -151,25 +156,24 @@ fifo_open(void *v) int error; vp = ap->a_vp; - p = l->l_proc; + p = ap->a_p; - KERNEL_LOCK(1, NULL); if ((fip = vp->v_fifoinfo) == NULL) { MALLOC(fip, struct fifoinfo *, sizeof(*fip), M_VNODE, M_WAITOK); vp->v_fifoinfo = fip; - error = socreate(AF_LOCAL, &rso, SOCK_STREAM, 0, l); + error = socreate(AF_LOCAL, &rso, SOCK_STREAM, 0, p); if (error != 0) { free(fip, M_VNODE); vp->v_fifoinfo = NULL; - goto done; + return (error); } fip->fi_readsock = rso; - error = socreate(AF_LOCAL, &wso, SOCK_STREAM, 0, l); + error = socreate(AF_LOCAL, &wso, SOCK_STREAM, 0, p); if (error != 0) { (void)soclose(rso); free(fip, M_VNODE); vp->v_fifoinfo = NULL; - goto done; + return (error); } fip->fi_writesock = wso; if ((error = unp_connect2(wso, rso, PRU_CONNECT2)) != 0) { @@ -177,7 +181,7 @@ fifo_open(void *v) (void)soclose(rso); free(fip, M_VNODE); vp->v_fifoinfo = NULL; - goto done; + return (error); } fip->fi_readers = fip->fi_writers = 0; wso->so_state |= SS_CANTRCVMORE; @@ -227,12 +231,9 @@ fifo_open(void *v) } } } - KERNEL_UNLOCK_ONE(NULL); return (0); bad: - VOP_CLOSE(vp, ap->a_mode, ap->a_cred); - done: - KERNEL_UNLOCK_ONE(NULL); + VOP_CLOSE(vp, ap->a_mode, ap->a_cred, p); return (error); } @@ -247,7 +248,7 @@ fifo_read(void *v) struct vnode *a_vp; struct uio *a_uio; int a_ioflag; - kauth_cred_t a_cred; + struct ucred *a_cred; } */ *ap = v; struct uio *uio; struct socket *rso; @@ -262,9 +263,8 @@ fifo_read(void *v) #endif if (uio->uio_resid == 0) return (0); - KERNEL_LOCK(1, NULL); if (ap->a_ioflag & IO_NDELAY) - rso->so_nbio = 1; + rso->so_state |= SS_NBIO; startresid = uio->uio_resid; VOP_UNLOCK(ap->a_vp, 0); error = (*rso->so_receive)(rso, (struct mbuf **)0, uio, @@ -276,12 +276,11 @@ fifo_read(void *v) if (uio->uio_resid == startresid) rso->so_state &= ~SS_CANTRCVMORE; if (ap->a_ioflag & IO_NDELAY) { - rso->so_nbio = 0; + rso->so_state &= ~SS_NBIO; if (error == EWOULDBLOCK && ap->a_vp->v_fifoinfo->fi_writers == 0) error = 0; } - KERNEL_UNLOCK_ONE(NULL); return (error); } @@ -296,7 +295,7 @@ fifo_write(void *v) struct vnode *a_vp; struct uio *a_uio; int a_ioflag; - kauth_cred_t a_cred; + struct ucred *a_cred; } */ *ap = v; struct socket *wso; int error; @@ -306,16 +305,14 @@ fifo_write(void *v) if (ap->a_uio->uio_rw != UIO_WRITE) panic("fifo_write mode"); #endif - KERNEL_LOCK(1, NULL); if (ap->a_ioflag & IO_NDELAY) - wso->so_nbio = 1; + wso->so_state |= SS_NBIO; VOP_UNLOCK(ap->a_vp, 0); error = (*wso->so_send)(wso, (struct mbuf *)0, ap->a_uio, 0, - (struct mbuf *)0, 0, curlwp /*XXX*/); + (struct mbuf *)0, 0, curproc /*XXX*/); vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY); if (ap->a_ioflag & IO_NDELAY) - wso->so_nbio = 0; - KERNEL_UNLOCK_ONE(NULL); + wso->so_state &= ~SS_NBIO; return (error); } @@ -331,8 +328,8 @@ fifo_ioctl(void *v) u_long a_command; void *a_data; int a_fflag; - kauth_cred_t a_cred; - struct lwp *a_l; + struct ucred *a_cred; + struct proc *a_p; } */ *ap = v; struct file filetmp; int error; @@ -341,13 +338,13 @@ fifo_ioctl(void *v) return (0); if (ap->a_fflag & FREAD) { filetmp.f_data = ap->a_vp->v_fifoinfo->fi_readsock; - error = soo_ioctl(&filetmp, ap->a_command, ap->a_data); + error = soo_ioctl(&filetmp, ap->a_command, ap->a_data, ap->a_p); if (error) return (error); } if (ap->a_fflag & FWRITE) { filetmp.f_data = ap->a_vp->v_fifoinfo->fi_writesock; - error = soo_ioctl(&filetmp, ap->a_command, ap->a_data); + error = soo_ioctl(&filetmp, ap->a_command, ap->a_data, ap->a_p); if (error) return (error); } @@ -361,7 +358,7 @@ fifo_poll(void *v) struct vop_poll_args /* { struct vnode *a_vp; int a_events; - struct lwp *a_l; + struct proc *a_p; } */ *ap = v; struct file filetmp; int revents; @@ -370,12 +367,12 @@ fifo_poll(void *v) if (ap->a_events & (POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND)) { filetmp.f_data = ap->a_vp->v_fifoinfo->fi_readsock; if (filetmp.f_data) - revents |= soo_poll(&filetmp, ap->a_events); + revents |= soo_poll(&filetmp, ap->a_events, ap->a_p); } if (ap->a_events & (POLLOUT | POLLWRNORM | POLLWRBAND)) { filetmp.f_data = ap->a_vp->v_fifoinfo->fi_writesock; if (filetmp.f_data) - revents |= soo_poll(&filetmp, ap->a_events); + revents |= soo_poll(&filetmp, ap->a_events, ap->a_p); } return (revents); @@ -386,7 +383,7 @@ fifo_inactive(void *v) { struct vop_inactive_args /* { struct vnode *a_vp; - struct lwp *a_l; + struct proc *a_p; } */ *ap = v; VOP_UNLOCK(ap->a_vp, 0); @@ -426,8 +423,8 @@ fifo_close(void *v) struct vop_close_args /* { struct vnode *a_vp; int a_fflag; - kauth_cred_t a_cred; - struct lwp *a_l; + struct ucred *a_cred; + struct proc *a_p; } */ *ap = v; struct vnode *vp; struct fifoinfo *fip; @@ -436,7 +433,6 @@ fifo_close(void *v) vp = ap->a_vp; fip = vp->v_fifoinfo; isrevoke = (ap->a_fflag & (FREAD | FWRITE | FNONBLOCK)) == FNONBLOCK; - KERNEL_LOCK(1, NULL); if (isrevoke) { if (fip->fi_readers != 0) { fip->fi_readers = 0; @@ -459,7 +455,6 @@ fifo_close(void *v) FREE(fip, M_VNODE); vp->v_fifoinfo = NULL; } - KERNEL_UNLOCK_ONE(NULL); return (0); } @@ -602,7 +597,7 @@ fifo_kqfilter(void *v) sb = &so->so_snd; break; default: - return (EINVAL); + return (1); } ap->a_kn->kn_hook = so;