1 /* $NetBSD: genfs_vnops.c,v 1.5 1998/01/05 19:20:11 perry Exp $ */ 2 3 #include <sys/param.h> 4 #include <sys/systm.h> 5 #include <sys/kernel.h> 6 #include <sys/mount.h> 7 #include <sys/namei.h> 8 #include <sys/vnode.h> 9 #include <sys/malloc.h> 10 #include <sys/poll.h> 11 12 #include <miscfs/genfs/genfs.h> 13 14 int 15 genfs_poll(v) 16 void *v; 17 { 18 struct vop_poll_args /* { 19 struct vnode *a_vp; 20 int a_events; 21 struct proc *a_p; 22 } */ *ap = v; 23 24 return (ap->a_events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM)); 25 } 26 27 int 28 genfs_fsync(v) 29 void *v; 30 { 31 struct vop_fsync_args /* { 32 struct vnode *a_vp; 33 struct ucred *a_cred; 34 int a_waitfor; 35 struct proc *a_p; 36 } */ *ap = v; 37 register struct vnode *vp = ap->a_vp; 38 struct timespec ts; 39 40 vflushbuf(vp, ap->a_waitfor == MNT_WAIT); 41 TIMEVAL_TO_TIMESPEC(&time, &ts); 42 return (VOP_UPDATE(ap->a_vp, &ts, &ts, ap->a_waitfor == MNT_WAIT)); 43 } 44 45 int 46 genfs_seek(v) 47 void *v; 48 { 49 struct vop_seek_args /* { 50 struct vnode *a_vp; 51 off_t a_oldoff; 52 off_t a_newoff; 53 struct ucred *a_ucred; 54 } */ *ap = v; 55 56 if (ap->a_newoff < 0) 57 return (EINVAL); 58 59 return (0); 60 } 61 62 int 63 genfs_abortop(v) 64 void *v; 65 { 66 struct vop_abortop_args /* { 67 struct vnode *a_dvp; 68 struct componentname *a_cnp; 69 } */ *ap = v; 70 71 if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF) 72 FREE(ap->a_cnp->cn_pnbuf, M_NAMEI); 73 return (0); 74 } 75 76 /*ARGSUSED*/ 77 int 78 genfs_badop(v) 79 void *v; 80 { 81 82 panic("genfs: bad op"); 83 } 84 85 /*ARGSUSED*/ 86 int 87 genfs_nullop(v) 88 void *v; 89 { 90 91 return (0); 92 } 93 94 /*ARGSUSED*/ 95 int 96 genfs_eopnotsupp(v) 97 void *v; 98 { 99 100 return (EOPNOTSUPP); 101 } 102 103 /*ARGSUSED*/ 104 int 105 genfs_ebadf(v) 106 void *v; 107 { 108 109 return (EBADF); 110 } 111