diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1996-02-27 07:53:44 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1996-02-27 07:53:44 +0000 |
commit | 90a020136c624f2d26b04b43b131e0dd2a8a7c95 (patch) | |
tree | 22db9f27f6798618ae0db01e446057b2b987756f /sys/miscfs/fifofs/fifo_vnops.c | |
parent | 50cfedd2bbd1eee2cfdff477ecce0e6d0393ba5d (diff) |
From NetBSD: update to 960217 sources
Diffstat (limited to 'sys/miscfs/fifofs/fifo_vnops.c')
-rw-r--r-- | sys/miscfs/fifofs/fifo_vnops.c | 133 |
1 files changed, 77 insertions, 56 deletions
diff --git a/sys/miscfs/fifofs/fifo_vnops.c b/sys/miscfs/fifofs/fifo_vnops.c index 9d7193d92a9..751380c1f89 100644 --- a/sys/miscfs/fifofs/fifo_vnops.c +++ b/sys/miscfs/fifofs/fifo_vnops.c @@ -1,4 +1,5 @@ -/* $NetBSD: fifo_vnops.c,v 1.16 1995/04/14 23:30:14 mycroft Exp $ */ +/* $OpenBSD: fifo_vnops.c,v 1.2 1996/02/27 07:53:43 niklas Exp $ */ +/* $NetBSD: fifo_vnops.c,v 1.17 1996/02/09 22:40:16 christos Exp $ */ /* * Copyright (c) 1990, 1993 @@ -48,6 +49,7 @@ #include <sys/file.h> #include <sys/errno.h> #include <sys/malloc.h> +#include <sys/un.h> #include <miscfs/fifofs/fifo.h> /* @@ -61,7 +63,7 @@ struct fifoinfo { long fi_writers; }; -int (**fifo_vnodeop_p)(); +int (**fifo_vnodeop_p) __P((void *)); struct vnodeopv_entry_desc fifo_vnodeop_entries[] = { { &vop_default_desc, vn_default_error }, { &vop_lookup_desc, fifo_lookup }, /* lookup */ @@ -105,7 +107,7 @@ struct vnodeopv_entry_desc fifo_vnodeop_entries[] = { { &vop_truncate_desc, fifo_truncate }, /* truncate */ { &vop_update_desc, fifo_update }, /* update */ { &vop_bwrite_desc, fifo_bwrite }, /* bwrite */ - { (struct vnodeop_desc*)NULL, (int(*)())NULL } + { (struct vnodeop_desc*)NULL, (int(*) __P((void *)))NULL } }; struct vnodeopv_desc fifo_vnodeop_opv_desc = { &fifo_vnodeop_p, fifo_vnodeop_entries }; @@ -114,13 +116,15 @@ struct vnodeopv_desc fifo_vnodeop_opv_desc = * Trivial lookup routine that always fails. */ /* ARGSUSED */ -fifo_lookup(ap) +int +fifo_lookup(v) + void *v; +{ struct vop_lookup_args /* { struct vnode * a_dvp; struct vnode ** a_vpp; struct componentname * a_cnp; - } */ *ap; -{ + } */ *ap = v; *ap->a_vpp = NULL; return (ENOTDIR); @@ -131,14 +135,16 @@ fifo_lookup(ap) * to find an active instance of a fifo. */ /* ARGSUSED */ -fifo_open(ap) +int +fifo_open(v) + void *v; +{ struct vop_open_args /* { struct vnode *a_vp; int a_mode; struct ucred *a_cred; struct proc *a_p; - } */ *ap; -{ + } */ *ap = v; register struct vnode *vp = ap->a_vp; register struct fifoinfo *fip; struct socket *rso, *wso; @@ -148,20 +154,20 @@ fifo_open(ap) if ((fip = vp->v_fifoinfo) == NULL) { MALLOC(fip, struct fifoinfo *, sizeof(*fip), M_VNODE, M_WAITOK); vp->v_fifoinfo = fip; - if (error = socreate(AF_LOCAL, &rso, SOCK_STREAM, 0)) { + if ((error = socreate(AF_LOCAL, &rso, SOCK_STREAM, 0)) != 0) { free(fip, M_VNODE); vp->v_fifoinfo = NULL; return (error); } fip->fi_readsock = rso; - if (error = socreate(AF_LOCAL, &wso, SOCK_STREAM, 0)) { + if ((error = socreate(AF_LOCAL, &wso, SOCK_STREAM, 0)) != 0) { (void)soclose(rso); free(fip, M_VNODE); vp->v_fifoinfo = NULL; return (error); } fip->fi_writesock = wso; - if (error = unp_connect2(wso, rso)) { + if ((error = unp_connect2(wso, rso)) != 0) { (void)soclose(wso); (void)soclose(rso); free(fip, M_VNODE); @@ -226,14 +232,16 @@ bad: * Vnode op for read */ /* ARGSUSED */ -fifo_read(ap) +int +fifo_read(v) + void *v; +{ struct vop_read_args /* { struct vnode *a_vp; struct uio *a_uio; int a_ioflag; struct ucred *a_cred; - } */ *ap; -{ + } */ *ap = v; register struct uio *uio = ap->a_uio; register struct socket *rso = ap->a_vp->v_fifoinfo->fi_readsock; int error, startresid; @@ -265,14 +273,16 @@ fifo_read(ap) * Vnode op for write */ /* ARGSUSED */ -fifo_write(ap) +int +fifo_write(v) + void *v; +{ struct vop_write_args /* { struct vnode *a_vp; struct uio *a_uio; int a_ioflag; struct ucred *a_cred; - } */ *ap; -{ + } */ *ap = v; struct socket *wso = ap->a_vp->v_fifoinfo->fi_writesock; int error; @@ -294,7 +304,10 @@ fifo_write(ap) * Device ioctl operation. */ /* ARGSUSED */ -fifo_ioctl(ap) +int +fifo_ioctl(v) + void *v; +{ struct vop_ioctl_args /* { struct vnode *a_vp; u_long a_command; @@ -302,8 +315,7 @@ fifo_ioctl(ap) int a_fflag; struct ucred *a_cred; struct proc *a_p; - } */ *ap; -{ + } */ *ap = v; struct file filetmp; int error; @@ -325,15 +337,17 @@ fifo_ioctl(ap) } /* ARGSUSED */ -fifo_select(ap) +int +fifo_select(v) + void *v; +{ struct vop_select_args /* { struct vnode *a_vp; int a_which; int a_fflags; struct ucred *a_cred; struct proc *a_p; - } */ *ap; -{ + } */ *ap = v; struct file filetmp; int ready; @@ -355,14 +369,16 @@ fifo_select(ap) /* * This is a noop, simply returning what one has been given. */ -fifo_bmap(ap) +int +fifo_bmap(v) + void *v; +{ struct vop_bmap_args /* { struct vnode *a_vp; daddr_t a_bn; struct vnode **a_vpp; daddr_t *a_bnp; - } */ *ap; -{ + } */ *ap = v; if (ap->a_vpp != NULL) *ap->a_vpp = ap->a_vp; @@ -375,20 +391,17 @@ fifo_bmap(ap) * At the moment we do not do any locking. */ /* ARGSUSED */ -fifo_lock(ap) - struct vop_lock_args /* { - struct vnode *a_vp; - } */ *ap; +int +fifo_lock(v) + void *v; { - return (0); } /* ARGSUSED */ -fifo_unlock(ap) - struct vop_unlock_args /* { - struct vnode *a_vp; - } */ *ap; +int +fifo_unlock(v) + void *v; { return (0); @@ -398,14 +411,16 @@ fifo_unlock(ap) * Device close routine */ /* ARGSUSED */ -fifo_close(ap) +int +fifo_close(v) + void *v; +{ struct vop_close_args /* { struct vnode *a_vp; int a_fflag; struct ucred *a_cred; struct proc *a_p; - } */ *ap; -{ + } */ *ap = v; register struct vnode *vp = ap->a_vp; register struct fifoinfo *fip = vp->v_fifoinfo; int error1, error2; @@ -432,20 +447,24 @@ fifo_close(ap) /* * Print out the contents of a fifo vnode. */ -fifo_print(ap) +int +fifo_print(v) + void *v; +{ struct vop_print_args /* { struct vnode *a_vp; - } */ *ap; -{ + } */ *ap = v; printf("tag VT_NON"); fifo_printinfo(ap->a_vp); printf("\n"); + return 0; } /* * Print out internal contents of a fifo vnode. */ +void fifo_printinfo(vp) struct vnode *vp; { @@ -458,13 +477,15 @@ fifo_printinfo(vp) /* * Return POSIX pathconf information applicable to fifo's. */ -fifo_pathconf(ap) +int +fifo_pathconf(v) + void *v; +{ struct vop_pathconf_args /* { struct vnode *a_vp; int a_name; register_t *a_retval; - } */ *ap; -{ + } */ *ap = v; switch (ap->a_name) { case _PC_LINK_MAX: @@ -485,7 +506,10 @@ fifo_pathconf(ap) /* * Fifo failed operation */ -fifo_ebadf() +/*ARGSUSED*/ +int +fifo_ebadf(v) + void *v; { return (EBADF); @@ -495,23 +519,20 @@ fifo_ebadf() * Fifo advisory byte-level locks. */ /* ARGSUSED */ -fifo_advlock(ap) - struct vop_advlock_args /* { - struct vnode *a_vp; - caddr_t a_id; - int a_op; - struct flock *a_fl; - int a_flags; - } */ *ap; +int +fifo_advlock(v) + void *v; { - return (EOPNOTSUPP); } /* * Fifo bad operation */ -fifo_badop() +/*ARGSUSED*/ +int +fifo_badop(v) + void *v; { panic("fifo_badop called"); |