From 32e4d4c5e60637e363d257d2cea2d3eed2c97f86 Mon Sep 17 00:00:00 2001 From: Bruce Evans Date: Mon, 27 Oct 1997 15:26:23 +0000 Subject: [PATCH] Use 127 instead of CHAR_MAX for the limit on the sequence count. The limit doesn't have anything to do with characters. The count mainly needs to fit in the VOP_READ() ioflag after being left shifted by 16. Moved vn_lock() before vn_closefile(). vn_lock() was mismerged from Lite2. Removed some gratuitous braces. --- sys/kern/vfs_vnops.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 1117ef5ff3d3..19f35b0a7003 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_vnops.c 8.2 (Berkeley) 1/21/94 - * $Id: vfs_vnops.c,v 1.38 1997/09/14 02:51:16 peter Exp $ + * $Id: vfs_vnops.c,v 1.39 1997/10/06 02:38:27 dyson Exp $ */ #include @@ -298,8 +298,8 @@ vn_read(fp, uio, cred) * are. */ tmpseq += ((count + BKVASIZE - 1) / BKVASIZE); - if (tmpseq >= CHAR_MAX) - tmpseq = CHAR_MAX; + if (tmpseq >= 127) + tmpseq = 127; fp->f_seqcount = tmpseq; flag |= (fp->f_seqcount << 16); } else { @@ -490,19 +490,6 @@ vn_poll(fp, events, cred, p) return (VOP_POLL(((struct vnode *)fp->f_data), events, cred, p)); } -/* - * File table vnode close routine. - */ -static int -vn_closefile(fp, p) - struct file *fp; - struct proc *p; -{ - - return (vn_close(((struct vnode *)fp->f_data), fp->f_flag, - fp->f_cred, p)); -} - /* * Check that the vnode is still valid, and if so * acquire requested lock. @@ -516,9 +503,8 @@ vn_lock(vp, flags, p) int error; do { - if ((flags & LK_INTERLOCK) == 0) { + if ((flags & LK_INTERLOCK) == 0) simple_lock(&vp->v_interlock); - } if (vp->v_flag & VXLOCK) { vp->v_flag |= VXWANT; simple_unlock(&vp->v_interlock); @@ -533,3 +519,16 @@ vn_lock(vp, flags, p) } while (flags & LK_RETRY); return (error); } + +/* + * File table vnode close routine. + */ +static int +vn_closefile(fp, p) + struct file *fp; + struct proc *p; +{ + + return (vn_close(((struct vnode *)fp->f_data), fp->f_flag, + fp->f_cred, p)); +}