summaryrefslogtreecommitdiff
path: root/sys/kern/vfs_vnops.c
diff options
context:
space:
mode:
authorDavid Greenman <dg@FreeBSD.org>1994-10-05 09:48:45 +0000
committerDavid Greenman <dg@FreeBSD.org>1994-10-05 09:48:45 +0000
commit8e58bf687510147b5cd664eab7a2bf7ddb4025f6 (patch)
tree9c109936447aaa693cde32bdf5eba383172d10b9 /sys/kern/vfs_vnops.c
parent5cedf6806bff121131a20e468d594bd67740c91c (diff)
downloadsrc-test2-8e58bf687510147b5cd664eab7a2bf7ddb4025f6.tar.gz
src-test2-8e58bf687510147b5cd664eab7a2bf7ddb4025f6.zip
Notes
Diffstat (limited to 'sys/kern/vfs_vnops.c')
-rw-r--r--sys/kern/vfs_vnops.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
index de89705ae933..79b92cbd40ef 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.4 1994/08/18 03:53:38 davidg Exp $
+ * $Id: vfs_vnops.c,v 1.5 1994/10/02 17:35:40 phk Exp $
*/
#include <sys/param.h>
@@ -152,6 +152,30 @@ vn_open(ndp, fmode, cmode)
goto bad;
if (fmode & FWRITE)
vp->v_writecount++;
+ /*
+ * this is here for VMIO support
+ */
+ if( vp->v_type == VREG) {
+ vm_object_t object;
+ vm_pager_t pager;
+ if( (vp->v_flag & VVMIO) == 0) {
+ pager = (vm_pager_t) vnode_pager_alloc(vp, 0, 0, 0);
+ object = (vm_object_t) vp->v_vmdata;
+ if( object->pager != pager)
+ panic("ufs_open: pager/object mismatch");
+ (void) vm_object_lookup( pager);
+ pager_cache( object, TRUE);
+ vp->v_flag |= VVMIO;
+ } else {
+ object = (vm_object_t) vp->v_vmdata;
+ if( !object)
+ panic("ufs_open: VMIO object missing");
+ pager = object->pager;
+ if( !pager)
+ panic("ufs_open: VMIO pager missing");
+ (void) vm_object_lookup( pager);
+ }
+ }
return (0);
bad:
vput(vp);
@@ -206,6 +230,15 @@ vn_close(vp, flags, cred, p)
if (flags & FWRITE)
vp->v_writecount--;
error = VOP_CLOSE(vp, flags, cred, p);
+ /*
+ * this code is here for VMIO support, will eventually
+ * be in vfs code.
+ */
+ if (vp->v_flag & VVMIO) {
+ if( vp->v_vmdata == NULL)
+ panic("ufs_close: VMIO object missing");
+ vm_object_deallocate( (vm_object_t) vp->v_vmdata);
+ }
vrele(vp);
return (error);
}