use the new compatibility routines to allow mmap() to work

(in the same non-coherent fashion that it worked pre-UBC)
until someone has time to do it the right way.
This commit is contained in:
chs 2001-12-18 07:51:16 +00:00
parent 40bf5f0e12
commit 0d70d731c2
8 changed files with 81 additions and 20 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ntfs_inode.h,v 1.9 2000/02/08 16:17:58 jdolecek Exp $ */
/* $NetBSD: ntfs_inode.h,v 1.10 2001/12/18 07:51:16 chs Exp $ */
/*-
* Copyright (c) 1998, 1999 Semen Ustimenko
@ -28,6 +28,8 @@
* Id: ntfs_inode.h,v 1.4 1999/05/12 09:43:00 semenu Exp
*/
#include <miscfs/genfs/genfs_node.h>
/* These flags are kept in i_flag. */
#if defined(__FreeBSD__)
#define IN_ACCESS 0x0001 /* Access time update request. */
@ -87,6 +89,7 @@ struct fnode {
#ifdef __FreeBSD__
struct lock f_lock; /* fnode lock >Keep this first< */
#endif
struct genfs_node f_gnode;
LIST_ENTRY(fnode) f_fnlist;
struct vnode *f_vp; /* Associatied vnode */

View File

@ -1,4 +1,4 @@
/* $NetBSD: ntfs_vfsops.c,v 1.39 2001/11/10 13:24:54 lukem Exp $ */
/* $NetBSD: ntfs_vfsops.c,v 1.40 2001/12/18 07:51:16 chs Exp $ */
/*-
* Copyright (c) 1998, 1999 Semen Ustimenko
@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ntfs_vfsops.c,v 1.39 2001/11/10 13:24:54 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: ntfs_vfsops.c,v 1.40 2001/12/18 07:51:16 chs Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -112,6 +112,12 @@ static int ntfs_fhtovp __P((struct mount *, struct fid *,
int *, struct ucred **));
#endif
struct genfs_ops ntfs_genfsops = {
NULL,
NULL,
genfs_compat_gop_write,
};
#ifdef __NetBSD__
/*
* Verify a remote client has export rights and return these rights via.
@ -1005,10 +1011,10 @@ ntfs_vgetex(
}
}
genfs_node_init(vp, &ntfs_genfsops);
VREF(ip->i_devvp);
*vpp = vp;
return (0);
}
static int

View File

@ -1,4 +1,4 @@
/* $NetBSD: ntfs_vnops.c,v 1.39 2001/12/06 04:27:43 chs Exp $ */
/* $NetBSD: ntfs_vnops.c,v 1.40 2001/12/18 07:51:16 chs Exp $ */
/*
* Copyright (c) 1992, 1993
@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ntfs_vnops.c,v 1.39 2001/12/06 04:27:43 chs Exp $");
__KERNEL_RCSID(0, "$NetBSD: ntfs_vnops.c,v 1.40 2001/12/18 07:51:16 chs Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -949,7 +949,7 @@ const struct vnodeopv_entry_desc ntfs_vnodeop_entries[] = {
{ &vop_ioctl_desc, genfs_enoioctl }, /* ioctl */
{ &vop_poll_desc, genfs_poll }, /* poll */
{ &vop_revoke_desc, genfs_revoke }, /* revoke */
{ &vop_mmap_desc, genfs_eopnotsupp }, /* mmap */
{ &vop_mmap_desc, genfs_mmap }, /* mmap */
{ &vop_fsync_desc, genfs_fsync }, /* fsync */
{ &vop_seek_desc, genfs_seek }, /* seek */
{ &vop_remove_desc, genfs_eopnotsupp }, /* remove */
@ -978,7 +978,8 @@ const struct vnodeopv_entry_desc ntfs_vnodeop_entries[] = {
{ &vop_truncate_desc, genfs_eopnotsupp }, /* truncate */
{ &vop_update_desc, genfs_eopnotsupp }, /* update */
{ &vop_bwrite_desc, vn_bwrite }, /* bwrite */
{ &vop_putpages_desc, genfs_null_putpages }, /* putpages */
{ &vop_getpages_desc, genfs_compat_getpages }, /* getpages */
{ &vop_putpages_desc, genfs_putpages }, /* putpages */
{ NULL, NULL }
};
const struct vnodeopv_desc ntfs_vnodeop_opv_desc =

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_alloc.c,v 1.53 2001/11/23 21:44:26 chs Exp $ */
/* $NetBSD: lfs_alloc.c,v 1.54 2001/12/18 07:51:17 chs Exp $ */
/*-
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_alloc.c,v 1.53 2001/11/23 21:44:26 chs Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_alloc.c,v 1.54 2001/12/18 07:51:17 chs Exp $");
#if defined(_KERNEL_OPT)
#include "opt_quota.h"
@ -413,6 +413,7 @@ lfs_ialloc(struct lfs *fs, struct vnode *pvp, ino_t new_ino, int new_gen,
++fs->lfs_nadirop;
ip->i_flag |= IN_ADIROP;
#endif
genfs_node_init(vp, &lfs_genfsops);
VREF(ip->i_devvp);
/* Set superblock modified bit and increment file count. */
fs->lfs_fmod = 1;

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_extern.h,v 1.26 2001/09/15 16:13:05 chs Exp $ */
/* $NetBSD: lfs_extern.h,v 1.27 2001/12/18 07:51:17 chs Exp $ */
/*-
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@ -224,9 +224,12 @@ int lfs_inactive(void *);
int lfs_reclaim (void *);
int lfs_write (void *);
int lfs_whiteout(void *);
int lfs_getpages(void *);
int lfs_putpages(void *);
__END_DECLS
extern int lfs_mount_type;
extern int (**lfs_vnodeop_p)(void *);
extern int (**lfs_specop_p)(void *);
extern int (**lfs_fifoop_p)(void *);
extern struct genfs_ops lfs_genfsops;

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_syscalls.c,v 1.62 2001/11/23 21:44:28 chs Exp $ */
/* $NetBSD: lfs_syscalls.c,v 1.63 2001/12/18 07:51:17 chs Exp $ */
/*-
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_syscalls.c,v 1.62 2001/11/23 21:44:28 chs Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_syscalls.c,v 1.63 2001/12/18 07:51:17 chs Exp $");
#define LFS /* for prototypes in syscallargs.h */
@ -1222,6 +1222,8 @@ lfs_fastvget(struct mount *mp, ino_t ino, ufs_daddr_t daddr, struct vnode **vpp,
/*
* Finish inode initialization now that aliasing has been resolved.
*/
genfs_node_init(vp, &lfs_genfsops);
ip->i_devvp = ump->um_devvp;
VREF(ip->i_devvp);
*vpp = vp;

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_vfsops.c,v 1.70 2001/11/23 21:44:28 chs Exp $ */
/* $NetBSD: lfs_vfsops.c,v 1.71 2001/12/18 07:51:18 chs Exp $ */
/*-
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.70 2001/11/23 21:44:28 chs Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.71 2001/12/18 07:51:18 chs Exp $");
#if defined(_KERNEL_OPT)
#include "opt_quota.h"
@ -141,6 +141,12 @@ struct vfsops lfs_vfsops = {
lfs_vnodeopv_descs,
};
struct genfs_ops lfs_genfsops = {
NULL,
NULL,
genfs_compat_gop_write,
};
struct pool lfs_inode_pool;
extern int locked_queue_count;
@ -1413,6 +1419,8 @@ lfs_vget(struct mount *mp, ino_t ino, struct vnode **vpp)
/*
* Finish inode initialization now that aliasing has been resolved.
*/
genfs_node_init(vp, &lfs_genfsops);
ip->i_devvp = ump->um_devvp;
VREF(ip->i_devvp);
*vpp = vp;

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_vnops.c,v 1.59 2001/11/23 21:44:29 chs Exp $ */
/* $NetBSD: lfs_vnops.c,v 1.60 2001/12/18 07:51:18 chs Exp $ */
/*-
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.59 2001/11/23 21:44:29 chs Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.60 2001/12/18 07:51:18 chs Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -121,9 +121,7 @@ const struct vnodeopv_entry_desc lfs_vnodeop_entries[] = {
{ &vop_fcntl_desc, ufs_fcntl }, /* fcntl */
{ &vop_poll_desc, ufs_poll }, /* poll */
{ &vop_revoke_desc, ufs_revoke }, /* revoke */
#if 0 /* XXX until LFS is fixed */
{ &vop_mmap_desc, ufs_mmap }, /* mmap */
#endif
{ &vop_fsync_desc, lfs_fsync }, /* fsync */
{ &vop_seek_desc, ufs_seek }, /* seek */
{ &vop_remove_desc, lfs_remove }, /* remove */
@ -152,6 +150,8 @@ const struct vnodeopv_entry_desc lfs_vnodeop_entries[] = {
{ &vop_truncate_desc, lfs_truncate }, /* truncate */
{ &vop_update_desc, lfs_update }, /* update */
{ &vop_bwrite_desc, lfs_bwrite }, /* bwrite */
{ &vop_getpages_desc, lfs_getpages }, /* getpages */
{ &vop_putpages_desc, lfs_putpages }, /* putpages */
{ NULL, NULL }
};
const struct vnodeopv_desc lfs_vnodeop_opv_desc =
@ -290,12 +290,20 @@ lfs_fsync(void *v)
off_t offhi;
struct proc *a_p;
} */ *ap = v;
struct vnode *vp = ap->a_vp;
int error;
/* Ignore the trickle syncer */
if (ap->a_flags & FSYNC_LAZY)
return 0;
return (VOP_UPDATE(ap->a_vp, NULL, NULL,
simple_lock(&vp->v_interlock);
error = VOP_PUTPAGES(vp, ap->a_offlo, ap->a_offhi,
PGO_CLEANIT | PGO_SYNCIO);
if (error) {
return error;
}
return (VOP_UPDATE(vp, NULL, NULL,
(ap->a_flags & FSYNC_WAIT) != 0 ? UPDATE_WAIT : 0));
}
@ -850,3 +858,32 @@ lfs_reclaim(void *v)
vp->v_data = NULL;
return (0);
}
int
lfs_getpages(void *v)
{
struct vop_getpages_args /* {
struct vnode *a_vp;
voff_t a_offset;
struct vm_page **a_m;
int *a_count;
int a_centeridx;
vm_prot_t a_access_type;
int a_advice;
int a_flags;
} */ *ap = v;
if ((ap->a_access_type & VM_PROT_WRITE) != 0) {
LFS_SET_UINO(VTOI(ap->a_vp), IN_MODIFIED);
}
return genfs_compat_getpages(v);
}
int
lfs_putpages(void *v)
{
int error;
error = genfs_putpages(v);
return error;
}