diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2001-12-04 22:44:33 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2001-12-04 22:44:33 +0000 |
commit | f1bec1965343db9a80a80e7ed55ee2fe5dd36253 (patch) | |
tree | 079f5363174a8394c440390c31604f27f1101bc3 | |
parent | 2ae3b1f139f1a10569ee4341888c32f5a70281cb (diff) |
Readd VOP_MMAP, will be used soon. Right now it's just a question to
the filesystem if we're allowed to mmap the file.
30 files changed, 144 insertions, 73 deletions
diff --git a/sys/adosfs/advnops.c b/sys/adosfs/advnops.c index 19bfdcc5738..5f3fac9977d 100644 --- a/sys/adosfs/advnops.c +++ b/sys/adosfs/advnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: advnops.c,v 1.18 2001/11/27 05:27:11 art Exp $ */ +/* $OpenBSD: advnops.c,v 1.19 2001/12/04 22:44:31 art Exp $ */ /* $NetBSD: advnops.c,v 1.32 1996/10/13 02:52:09 christos Exp $ */ /* @@ -133,6 +133,7 @@ struct vnodeopv_entry_desc adosfs_vnodeop_entries[] = { { &vop_bwrite_desc, adosfs_bwrite }, /* bwrite */ { &vop_getpages_desc, genfs_getpages }, { &vop_size_desc, genfs_size }, + { &vop_mmap_desc, genfs_mmap }, { NULL, NULL } }; diff --git a/sys/isofs/cd9660/cd9660_vnops.c b/sys/isofs/cd9660/cd9660_vnops.c index cd5567a77b4..395769c7d6e 100644 --- a/sys/isofs/cd9660/cd9660_vnops.c +++ b/sys/isofs/cd9660/cd9660_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cd9660_vnops.c,v 1.15 2001/11/27 05:27:11 art Exp $ */ +/* $OpenBSD: cd9660_vnops.c,v 1.16 2001/12/04 22:44:31 art Exp $ */ /* $NetBSD: cd9660_vnops.c,v 1.42 1997/10/16 23:56:57 christos Exp $ */ /*- @@ -1069,6 +1069,7 @@ struct vnodeopv_entry_desc cd9660_vnodeop_entries[] = { { &vop_bwrite_desc, vop_generic_bwrite }, { &vop_getpages_desc, genfs_getpages }, { &vop_size_desc, genfs_size }, + { &vop_mmap_desc, cd9660_mmap }, { NULL, NULL } }; struct vnodeopv_desc cd9660_vnodeop_opv_desc = @@ -1115,7 +1116,8 @@ struct vnodeopv_entry_desc cd9660_specop_entries[] = { { &vop_pathconf_desc, spec_pathconf }, /* pathconf */ { &vop_advlock_desc, spec_advlock }, /* advlock */ { &vop_bwrite_desc, vop_generic_bwrite }, - { (struct vnodeop_desc*)NULL, (int(*) __P((void *)))NULL } + { &vop_mmap_desc, spec_mmap }, + { NULL, NULL } }; struct vnodeopv_desc cd9660_specop_opv_desc = { &cd9660_specop_p, cd9660_specop_entries }; @@ -1159,7 +1161,8 @@ struct vnodeopv_entry_desc cd9660_fifoop_entries[] = { { &vop_pathconf_desc, fifo_pathconf }, /* pathconf */ { &vop_advlock_desc, fifo_advlock }, /* advlock */ { &vop_bwrite_desc, vop_generic_bwrite }, - { (struct vnodeop_desc*)NULL, (int(*) __P((void *)))NULL } + { &vop_mmap_desc, fifo_mmap }, + { NULL, NULL } }; struct vnodeopv_desc cd9660_fifoop_opv_desc = { &cd9660_fifoop_p, cd9660_fifoop_entries }; diff --git a/sys/kern/spec_vnops.c b/sys/kern/spec_vnops.c index 219572773e6..2022279f6d8 100644 --- a/sys/kern/spec_vnops.c +++ b/sys/kern/spec_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: spec_vnops.c,v 1.20 2001/06/23 02:14:26 csapuntz Exp $ */ +/* $OpenBSD: spec_vnops.c,v 1.21 2001/12/04 22:44:32 art Exp $ */ /* $NetBSD: spec_vnops.c,v 1.29 1996/04/22 01:42:38 christos Exp $ */ /* @@ -104,7 +104,8 @@ struct vnodeopv_entry_desc spec_vnodeop_entries[] = { { &vop_pathconf_desc, spec_pathconf }, /* pathconf */ { &vop_advlock_desc, spec_advlock }, /* advlock */ { &vop_bwrite_desc, spec_bwrite }, /* bwrite */ - { (struct vnodeop_desc*)NULL, (int(*) __P((void *)))NULL } + { &vop_mmap_desc, spec_mmap }, + { NULL, NULL } }; struct vnodeopv_desc spec_vnodeop_opv_desc = { &spec_vnodeop_p, spec_vnodeop_entries }; diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c index c7de1c4dcae..d857390b0ec 100644 --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_default.c,v 1.12 2001/11/30 05:45:33 csapuntz Exp $ */ +/* $OpenBSD: vfs_default.c,v 1.13 2001/12/04 22:44:31 art Exp $ */ /* * Portions of this code are: @@ -993,3 +993,10 @@ genfs_size(v) *ap->a_eobp = (ap->a_size + bsize - 1) & ~(bsize - 1); return 0; } + +int +genfs_mmap(v) + void *v; +{ + return 0; +} diff --git a/sys/kern/vnode_if.c b/sys/kern/vnode_if.c index 986936fc8b6..6ef2712d257 100644 --- a/sys/kern/vnode_if.c +++ b/sys/kern/vnode_if.c @@ -1364,6 +1364,37 @@ int VOP_SIZE(vp, size, eobp) return (VCALL(vp, VOFFSET(vop_size), &a)); } +int vop_mmap_vp_offsets[] = { + VOPARG_OFFSETOF(struct vop_mmap_args,a_vp), + VDESC_NO_OFFSET +}; +struct vnodeop_desc vop_mmap_desc = { + 0, + "vop_mmap", + 0, + vop_mmap_vp_offsets, + VDESC_NO_OFFSET, + VOPARG_OFFSETOF(struct vop_mmap_args, a_cred), + VOPARG_OFFSETOF(struct vop_mmap_args, a_p), + VDESC_NO_OFFSET, + NULL, +}; + +int VOP_MMAP(vp, fflags, cred, p) + struct vnode *vp; + int fflags; + struct ucred *cred; + struct proc *p; +{ + struct vop_mmap_args a; + a.a_desc = VDESC(vop_mmap); + a.a_vp = vp; + a.a_fflags = fflags; + a.a_cred = cred; + a.a_p = p; + return (VCALL(vp, VOFFSET(vop_mmap), &a)); +} + /* Special cases: */ int vop_strategy_vp_offsets[] = { @@ -1461,6 +1492,7 @@ struct vnodeop_desc *vfs_op_descs[] = { &vop_getpages_desc, &vop_putpages_desc, &vop_size_desc, + &vop_mmap_desc, NULL }; diff --git a/sys/kern/vnode_if.src b/sys/kern/vnode_if.src index 87b37e82a1d..fc1a45351cd 100644 --- a/sys/kern/vnode_if.src +++ b/sys/kern/vnode_if.src @@ -1,4 +1,4 @@ -# $OpenBSD: vnode_if.src,v 1.15 2001/11/28 16:24:26 art Exp $ +# $OpenBSD: vnode_if.src,v 1.16 2001/12/04 22:44:31 art Exp $ # $NetBSD: vnode_if.src,v 1.10 1996/05/11 18:26:27 mycroft Exp $ # # Copyright (c) 1992, 1993 @@ -512,3 +512,13 @@ vop_size { IN off_t size; OUT off_t *eobp; }; + +# +#% mmap vp = = = +# +vop_mmap { + IN struct vnode *vp; + IN int fflags; + IN struct ucred *cred; + IN struct proc *p; +}; diff --git a/sys/miscfs/deadfs/dead_vnops.c b/sys/miscfs/deadfs/dead_vnops.c index fc5f2f4ecbf..97dc05349c0 100644 --- a/sys/miscfs/deadfs/dead_vnops.c +++ b/sys/miscfs/deadfs/dead_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dead_vnops.c,v 1.8 2001/06/23 02:14:23 csapuntz Exp $ */ +/* $OpenBSD: dead_vnops.c,v 1.9 2001/12/04 22:44:31 art Exp $ */ /* $NetBSD: dead_vnops.c,v 1.16 1996/02/13 13:12:48 mycroft Exp $ */ /* @@ -84,6 +84,7 @@ int dead_print __P((void *)); #define dead_pathconf dead_ebadf #define dead_advlock dead_ebadf #define dead_bwrite nullop +#define dead_mmap dead_badop int chkvnlock __P((struct vnode *)); @@ -124,7 +125,8 @@ struct vnodeopv_entry_desc dead_vnodeop_entries[] = { { &vop_pathconf_desc, dead_pathconf }, /* pathconf */ { &vop_advlock_desc, dead_advlock }, /* advlock */ { &vop_bwrite_desc, dead_bwrite }, /* bwrite */ - { (struct vnodeop_desc*)NULL, (int(*) __P((void *)))NULL } + { &vop_mmap_desc, dead_mmap }, + { NULL, NULL } }; struct vnodeopv_desc dead_vnodeop_opv_desc = { &dead_vnodeop_p, dead_vnodeop_entries }; diff --git a/sys/miscfs/fdesc/fdesc_vnops.c b/sys/miscfs/fdesc/fdesc_vnops.c index 56a6f17b146..9196ed10067 100644 --- a/sys/miscfs/fdesc/fdesc_vnops.c +++ b/sys/miscfs/fdesc/fdesc_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fdesc_vnops.c,v 1.25 2001/11/06 19:53:20 miod Exp $ */ +/* $OpenBSD: fdesc_vnops.c,v 1.26 2001/12/04 22:44:31 art Exp $ */ /* $NetBSD: fdesc_vnops.c,v 1.32 1996/04/11 11:24:29 mrg Exp $ */ /* @@ -123,6 +123,7 @@ int fdesc_pathconf __P((void *)); #define fdesc_islocked vop_generic_islocked #define fdesc_advlock eopnotsupp #define fdesc_bwrite eopnotsupp +#define fdesc_mmap eopnotsupp int (**fdesc_vnodeop_p) __P((void *)); struct vnodeopv_entry_desc fdesc_vnodeop_entries[] = { @@ -161,7 +162,8 @@ struct vnodeopv_entry_desc fdesc_vnodeop_entries[] = { { &vop_pathconf_desc, fdesc_pathconf }, /* pathconf */ { &vop_advlock_desc, fdesc_advlock }, /* advlock */ { &vop_bwrite_desc, fdesc_bwrite }, /* bwrite */ - { (struct vnodeop_desc*)NULL, (int(*) __P((void *)))NULL } + { &vop_mmap_desc, fdesc_mmap }, + { NULL, NULL } }; struct vnodeopv_desc fdesc_vnodeop_opv_desc = diff --git a/sys/miscfs/fifofs/fifo.h b/sys/miscfs/fifofs/fifo.h index 2e59d7076dd..6e8bae9a060 100644 --- a/sys/miscfs/fifofs/fifo.h +++ b/sys/miscfs/fifofs/fifo.h @@ -1,4 +1,4 @@ -/* $OpenBSD: fifo.h,v 1.8 2001/06/23 02:14:24 csapuntz Exp $ */ +/* $OpenBSD: fifo.h,v 1.9 2001/12/04 22:44:31 art Exp $ */ /* $NetBSD: fifo.h,v 1.10 1996/02/09 22:40:15 christos Exp $ */ /* @@ -80,6 +80,7 @@ int fifo_pathconf __P((void *)); int fifo_advlock __P((void *)); #define fifo_reallocblks fifo_badop #define fifo_bwrite nullop +#define fifo_mmap fifo_badop void fifo_printinfo __P((struct vnode *)); diff --git a/sys/miscfs/fifofs/fifo_vnops.c b/sys/miscfs/fifofs/fifo_vnops.c index d6672bfc6ef..174f02cca6f 100644 --- a/sys/miscfs/fifofs/fifo_vnops.c +++ b/sys/miscfs/fifofs/fifo_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fifo_vnops.c,v 1.10 2001/06/23 02:14:24 csapuntz Exp $ */ +/* $OpenBSD: fifo_vnops.c,v 1.11 2001/12/04 22:44:31 art Exp $ */ /* $NetBSD: fifo_vnops.c,v 1.18 1996/03/16 23:52:42 christos Exp $ */ /* @@ -103,7 +103,8 @@ struct vnodeopv_entry_desc fifo_vnodeop_entries[] = { { &vop_pathconf_desc, fifo_pathconf }, /* pathconf */ { &vop_advlock_desc, fifo_advlock }, /* advlock */ { &vop_bwrite_desc, fifo_bwrite }, /* bwrite */ - { (struct vnodeop_desc*)NULL, (int(*) __P((void *)))NULL } + { &vop_mmap_desc, fifo_mmap }, + { NULL, NULL } }; void filt_fifordetach(struct knote *kn); diff --git a/sys/miscfs/kernfs/kernfs_vnops.c b/sys/miscfs/kernfs/kernfs_vnops.c index e3a2e4381ce..e5729717d15 100644 --- a/sys/miscfs/kernfs/kernfs_vnops.c +++ b/sys/miscfs/kernfs/kernfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kernfs_vnops.c,v 1.22 2001/11/06 19:53:20 miod Exp $ */ +/* $OpenBSD: kernfs_vnops.c,v 1.23 2001/12/04 22:44:31 art Exp $ */ /* $NetBSD: kernfs_vnops.c,v 1.43 1996/03/16 23:52:47 christos Exp $ */ /* @@ -201,7 +201,7 @@ struct vnodeopv_entry_desc kernfs_vnodeop_entries[] = { { &vop_pathconf_desc, kernfs_pathconf },/* pathconf */ { &vop_advlock_desc, kernfs_advlock }, /* advlock */ { &vop_bwrite_desc, kernfs_bwrite }, /* bwrite */ - { (struct vnodeop_desc*)NULL, (int(*) __P((void *)))NULL } + { NULL, NULL } }; struct vnodeopv_desc kernfs_vnodeop_opv_desc = { &kernfs_vnodeop_p, kernfs_vnodeop_entries }; diff --git a/sys/miscfs/nullfs/null_vnops.c b/sys/miscfs/nullfs/null_vnops.c index e6022faa0ff..b2596a69997 100644 --- a/sys/miscfs/nullfs/null_vnops.c +++ b/sys/miscfs/nullfs/null_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: null_vnops.c,v 1.13 1999/02/08 22:25:29 art Exp $ */ +/* $OpenBSD: null_vnops.c,v 1.14 2001/12/04 22:44:32 art Exp $ */ /* $NetBSD: null_vnops.c,v 1.7 1996/05/10 22:51:01 jtk Exp $ */ /* @@ -452,7 +452,6 @@ null_print(v) /* * XXX - vop_strategy must be hand coded because it has no * vnode in its arguments. - * This goes away with a merged VM/buffer cache. */ int null_strategy(v) @@ -479,7 +478,6 @@ null_strategy(v) /* * XXX - like vop_strategy, vop_bwrite must be hand coded because it has no * vnode in its arguments. - * This goes away with a merged VM/buffer cache. */ int null_bwrite(v) @@ -633,7 +631,7 @@ struct vnodeopv_entry_desc null_vnodeop_entries[] = { { &vop_strategy_desc, null_strategy }, { &vop_bwrite_desc, null_bwrite }, - { (struct vnodeop_desc*)NULL, (int(*) __P((void *)))NULL } + { NULL, NULL } }; struct vnodeopv_desc null_vnodeop_opv_desc = { &null_vnodeop_p, null_vnodeop_entries }; diff --git a/sys/miscfs/portal/portal_vnops.c b/sys/miscfs/portal/portal_vnops.c index 9a08301852e..fd4489984e1 100644 --- a/sys/miscfs/portal/portal_vnops.c +++ b/sys/miscfs/portal/portal_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: portal_vnops.c,v 1.9 2001/06/23 02:14:25 csapuntz Exp $ */ +/* $OpenBSD: portal_vnops.c,v 1.10 2001/12/04 22:44:32 art Exp $ */ /* $NetBSD: portal_vnops.c,v 1.17 1996/02/13 13:12:57 mycroft Exp $ */ /* @@ -144,7 +144,7 @@ struct vnodeopv_entry_desc portal_vnodeop_entries[] = { { &vop_pathconf_desc, portal_pathconf }, /* pathconf */ { &vop_advlock_desc, portal_advlock }, /* advlock */ { &vop_bwrite_desc, portal_bwrite }, /* bwrite */ - { (struct vnodeop_desc*)NULL, (int(*) __P((void *)))NULL } + { NULL, NULL } }; struct vnodeopv_desc portal_vnodeop_opv_desc = { &portal_vnodeop_p, portal_vnodeop_entries }; diff --git a/sys/miscfs/procfs/procfs_vnops.c b/sys/miscfs/procfs/procfs_vnops.c index ce99ed3834b..29e162374b5 100644 --- a/sys/miscfs/procfs/procfs_vnops.c +++ b/sys/miscfs/procfs/procfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: procfs_vnops.c,v 1.20 2001/11/06 19:53:20 miod Exp $ */ +/* $OpenBSD: procfs_vnops.c,v 1.21 2001/12/04 22:44:32 art Exp $ */ /* $NetBSD: procfs_vnops.c,v 1.40 1996/03/16 23:52:55 christos Exp $ */ /* @@ -194,7 +194,7 @@ struct vnodeopv_entry_desc procfs_vnodeop_entries[] = { { &vop_islocked_desc, procfs_islocked }, /* islocked */ { &vop_pathconf_desc, procfs_pathconf }, /* pathconf */ { &vop_advlock_desc, procfs_advlock }, /* advlock */ - { (struct vnodeop_desc*)NULL, (int(*) __P((void *)))NULL } + { NULL, NULL } }; struct vnodeopv_desc procfs_vnodeop_opv_desc = { &procfs_vnodeop_p, procfs_vnodeop_entries }; diff --git a/sys/miscfs/specfs/spec_vnops.c b/sys/miscfs/specfs/spec_vnops.c index 219572773e6..2022279f6d8 100644 --- a/sys/miscfs/specfs/spec_vnops.c +++ b/sys/miscfs/specfs/spec_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: spec_vnops.c,v 1.20 2001/06/23 02:14:26 csapuntz Exp $ */ +/* $OpenBSD: spec_vnops.c,v 1.21 2001/12/04 22:44:32 art Exp $ */ /* $NetBSD: spec_vnops.c,v 1.29 1996/04/22 01:42:38 christos Exp $ */ /* @@ -104,7 +104,8 @@ struct vnodeopv_entry_desc spec_vnodeop_entries[] = { { &vop_pathconf_desc, spec_pathconf }, /* pathconf */ { &vop_advlock_desc, spec_advlock }, /* advlock */ { &vop_bwrite_desc, spec_bwrite }, /* bwrite */ - { (struct vnodeop_desc*)NULL, (int(*) __P((void *)))NULL } + { &vop_mmap_desc, spec_mmap }, + { NULL, NULL } }; struct vnodeopv_desc spec_vnodeop_opv_desc = { &spec_vnodeop_p, spec_vnodeop_entries }; diff --git a/sys/miscfs/specfs/specdev.h b/sys/miscfs/specfs/specdev.h index 7f4ab6fdecd..51fb9564c51 100644 --- a/sys/miscfs/specfs/specdev.h +++ b/sys/miscfs/specfs/specdev.h @@ -1,4 +1,4 @@ -/* $OpenBSD: specdev.h,v 1.10 2001/06/23 02:14:26 csapuntz Exp $ */ +/* $OpenBSD: specdev.h,v 1.11 2001/12/04 22:44:32 art Exp $ */ /* $NetBSD: specdev.h,v 1.12 1996/02/13 13:13:01 mycroft Exp $ */ /* @@ -121,3 +121,4 @@ int spec_advlock __P((void *)); #define spec_reallocblks spec_badop #define spec_bwrite vop_generic_bwrite #define spec_revoke vop_generic_revoke +#define spec_mmap spec_badop diff --git a/sys/miscfs/tcfs/tcfs_vnops.c b/sys/miscfs/tcfs/tcfs_vnops.c index 13d07e4ff0a..20818166975 100644 --- a/sys/miscfs/tcfs/tcfs_vnops.c +++ b/sys/miscfs/tcfs/tcfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcfs_vnops.c,v 1.3 2000/06/17 20:25:55 provos Exp $ */ +/* $OpenBSD: tcfs_vnops.c,v 1.4 2001/12/04 22:44:32 art Exp $ */ /* * Copyright 2000 The TCFS Project at http://tcfs.dia.unisa.it/ * All rights reserved. @@ -454,7 +454,7 @@ struct vnodeopv_entry_desc tcfs_vnodeop_entries[] = { { &vop_link_desc, tcfs_link }, { &vop_rename_desc, tcfs_rename }, { &vop_symlink_desc, tcfs_symlink }, - { (struct vnodeop_desc*)NULL, (int(*) __P((void *)))NULL } + { NULL, NULL } }; struct vnodeopv_desc tcfs_vnodeop_opv_desc = diff --git a/sys/miscfs/umapfs/umap_vnops.c b/sys/miscfs/umapfs/umap_vnops.c index 40b98f46375..9b545d0cdc8 100644 --- a/sys/miscfs/umapfs/umap_vnops.c +++ b/sys/miscfs/umapfs/umap_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umap_vnops.c,v 1.12 1999/01/11 05:12:27 millert Exp $ */ +/* $OpenBSD: umap_vnops.c,v 1.13 2001/12/04 22:44:32 art Exp $ */ /* $NetBSD: umap_vnops.c,v 1.5.4.1 1996/05/25 22:13:35 jtc Exp $ */ /* @@ -91,7 +91,7 @@ struct vnodeopv_entry_desc umap_vnodeop_entries[] = { { &vop_strategy_desc, umap_strategy }, { &vop_bwrite_desc, umap_bwrite }, - { (struct vnodeop_desc*) NULL, (int(*) __P((void *))) NULL } + { NULL, NULL } }; struct vnodeopv_desc umap_vnodeop_opv_desc = { &umap_vnodeop_p, umap_vnodeop_entries }; diff --git a/sys/miscfs/union/union_vnops.c b/sys/miscfs/union/union_vnops.c index 54e4a2cae05..46f27a40e62 100644 --- a/sys/miscfs/union/union_vnops.c +++ b/sys/miscfs/union/union_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: union_vnops.c,v 1.15 2001/07/26 20:46:29 millert Exp $ */ +/* $OpenBSD: union_vnops.c,v 1.16 2001/12/04 22:44:32 art Exp $ */ /* $NetBSD: union_vnops.c,v 1.30.4.1 1996/05/25 22:10:14 jtc Exp $ */ /* @@ -94,6 +94,7 @@ int union_islocked __P((void *)); int union_pathconf __P((void *)); int union_advlock __P((void *)); int union_strategy __P((void *)); +int union_mmap __P((void *)); int (**union_vnodeop_p) __P((void *)); struct vnodeopv_entry_desc union_vnodeop_entries[] = { @@ -133,7 +134,8 @@ struct vnodeopv_entry_desc union_vnodeop_entries[] = { { &vop_islocked_desc, union_islocked }, /* islocked */ { &vop_pathconf_desc, union_pathconf }, /* pathconf */ { &vop_advlock_desc, union_advlock }, /* advlock */ - { (struct vnodeop_desc*)NULL, (int(*) __P((void *)))NULL } + { &vop_mmap_desc, union_mmap }, + { NULL, NULL } }; struct vnodeopv_desc union_vnodeop_opv_desc = { &union_vnodeop_p, union_vnodeop_entries }; @@ -1842,3 +1844,13 @@ union_strategy(v) return (error); } +int +union_mmap(v) + void *v; +{ + struct vop_mmap_args *ap = v; + struct vnode *vp = OTHERVP(ap->a_vp); + + ap->a_vp = vp; + return (VCALL(vp, VOFFSET(vop_mmap), ap)); +}
\ No newline at end of file diff --git a/sys/msdosfs/msdosfs_vnops.c b/sys/msdosfs/msdosfs_vnops.c index bcc927897ef..c62141667f8 100644 --- a/sys/msdosfs/msdosfs_vnops.c +++ b/sys/msdosfs/msdosfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: msdosfs_vnops.c,v 1.31 2001/12/02 18:30:30 drahn Exp $ */ +/* $OpenBSD: msdosfs_vnops.c,v 1.32 2001/12/04 22:44:32 art Exp $ */ /* $NetBSD: msdosfs_vnops.c,v 1.63 1997/10/17 11:24:19 ws Exp $ */ /*- @@ -1879,6 +1879,7 @@ struct vnodeopv_entry_desc msdosfs_vnodeop_entries[] = { { &vop_getpages_desc, genfs_getpages }, { &vop_putpages_desc, genfs_putpages }, { &vop_size_desc, genfs_size }, + { &vop_mmap_desc, genfs_mmap }, { NULL, NULL } }; struct vnodeopv_desc msdosfs_vnodeop_opv_desc = diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c index 4c176c1c1ec..7aceef9300e 100644 --- a/sys/nfs/nfs_vnops.c +++ b/sys/nfs/nfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_vnops.c,v 1.40 2001/11/27 05:27:12 art Exp $ */ +/* $OpenBSD: nfs_vnops.c,v 1.41 2001/12/04 22:44:32 art Exp $ */ /* $NetBSD: nfs_vnops.c,v 1.62.4.1 1996/07/08 20:26:52 jtc Exp $ */ /* @@ -128,6 +128,7 @@ struct vnodeopv_entry_desc nfsv2_vnodeop_entries[] = { { &vop_bwrite_desc, nfs_bwrite }, { &vop_getpages_desc, nfs_getpages }, /* getpages */ { &vop_putpages_desc, nfs_putpages }, /* putpages */ + { &vop_mmap_desc, genfs_mmap }, { NULL, NULL } }; struct vnodeopv_desc nfsv2_vnodeop_opv_desc = @@ -175,7 +176,8 @@ struct vnodeopv_entry_desc spec_nfsv2nodeop_entries[] = { { &vop_advlock_desc, spec_advlock }, /* advlock */ { &vop_reallocblks_desc, spec_reallocblks }, /* reallocblks */ { &vop_bwrite_desc, vop_generic_bwrite }, - { (struct vnodeop_desc*)NULL, (int(*) __P((void *)))NULL } + { &vop_mmap_desc, spec_mmap }, + { NULL, NULL } }; struct vnodeopv_desc spec_nfsv2nodeop_opv_desc = { &spec_nfsv2nodeop_p, spec_nfsv2nodeop_entries }; @@ -220,7 +222,8 @@ struct vnodeopv_entry_desc fifo_nfsv2nodeop_entries[] = { { &vop_advlock_desc, fifo_advlock }, /* advlock */ { &vop_reallocblks_desc, fifo_reallocblks }, /* reallocblks */ { &vop_bwrite_desc, vop_generic_bwrite }, - { (struct vnodeop_desc*)NULL, (int(*) __P((void *)))NULL } + { &vop_mmap_desc, fifo_mmap }, + { NULL, NULL } }; struct vnodeopv_desc fifo_nfsv2nodeop_opv_desc = { &fifo_nfsv2nodeop_p, fifo_nfsv2nodeop_entries }; diff --git a/sys/sys/specdev.h b/sys/sys/specdev.h index 7f4ab6fdecd..51fb9564c51 100644 --- a/sys/sys/specdev.h +++ b/sys/sys/specdev.h @@ -1,4 +1,4 @@ -/* $OpenBSD: specdev.h,v 1.10 2001/06/23 02:14:26 csapuntz Exp $ */ +/* $OpenBSD: specdev.h,v 1.11 2001/12/04 22:44:32 art Exp $ */ /* $NetBSD: specdev.h,v 1.12 1996/02/13 13:13:01 mycroft Exp $ */ /* @@ -121,3 +121,4 @@ int spec_advlock __P((void *)); #define spec_reallocblks spec_badop #define spec_bwrite vop_generic_bwrite #define spec_revoke vop_generic_revoke +#define spec_mmap spec_badop diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 9eaf484201f..6d7d28f9a02 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vnode.h,v 1.42 2001/11/27 05:27:12 art Exp $ */ +/* $OpenBSD: vnode.h,v 1.43 2001/12/04 22:44:32 art Exp $ */ /* $NetBSD: vnode.h,v 1.38 1996/02/29 20:59:05 cgd Exp $ */ /* @@ -454,7 +454,7 @@ int vop_generic_kqfilter __P((void *)); int genfs_getpages __P((void *)); int genfs_putpages __P((void *)); int genfs_size __P((void *)); - +int genfs_mmap __P((void *)); int vn_stat __P((struct vnode *vp, struct stat *sb, struct proc *p)); int vn_statfile __P((struct file *fp, struct stat *sb, struct proc *p)); diff --git a/sys/sys/vnode_if.h b/sys/sys/vnode_if.h index dccc2db465c..99ab9670bc0 100644 --- a/sys/sys/vnode_if.h +++ b/sys/sys/vnode_if.h @@ -443,6 +443,16 @@ struct vop_size_args { extern struct vnodeop_desc vop_size_desc; int VOP_SIZE __P((struct vnode *, off_t, off_t *)); +struct vop_mmap_args { + struct vnodeop_desc *a_desc; + struct vnode *a_vp; + int a_fflags; + struct ucred *a_cred; + struct proc *a_p; +}; +extern struct vnodeop_desc vop_mmap_desc; +int VOP_MMAP __P((struct vnode *, int, struct ucred *, struct proc *)); + /* Special cases: */ #include <sys/buf.h> diff --git a/sys/ufs/ext2fs/ext2fs_vnops.c b/sys/ufs/ext2fs/ext2fs_vnops.c index fffdd494d5a..defbaedf0cb 100644 --- a/sys/ufs/ext2fs/ext2fs_vnops.c +++ b/sys/ufs/ext2fs/ext2fs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ext2fs_vnops.c,v 1.18 2001/11/27 05:27:12 art Exp $ */ +/* $OpenBSD: ext2fs_vnops.c,v 1.19 2001/12/04 22:44:32 art Exp $ */ /* $NetBSD: ext2fs_vnops.c,v 1.30 2000/11/27 08:39:53 chs Exp $ */ /* @@ -1471,6 +1471,7 @@ struct vnodeopv_entry_desc ext2fs_vnodeop_entries[] = { { &vop_getpages_desc, genfs_getpages }, { &vop_putpages_desc, genfs_putpages }, { &vop_size_desc, genfs_size }, + { &vop_mmap_desc, ufs_mmap }, { NULL, NULL } }; struct vnodeopv_desc ext2fs_vnodeop_opv_desc = @@ -1514,7 +1515,8 @@ struct vnodeopv_entry_desc ext2fs_specop_entries[] = { { &vop_pathconf_desc, spec_pathconf }, /* pathconf */ { &vop_advlock_desc, spec_advlock }, /* advlock */ { &vop_bwrite_desc, vop_generic_bwrite }, /* bwrite */ - { (struct vnodeop_desc*)NULL, (int(*) __P((void *)))NULL } + { &vop_mmap_desc, spec_mmap }, + { NULL, NULL } }; struct vnodeopv_desc ext2fs_specop_opv_desc = { &ext2fs_specop_p, ext2fs_specop_entries }; @@ -1558,7 +1560,8 @@ struct vnodeopv_entry_desc ext2fs_fifoop_entries[] = { { &vop_pathconf_desc, fifo_pathconf }, /* pathconf */ { &vop_advlock_desc, fifo_advlock }, /* advlock */ { &vop_bwrite_desc, vop_generic_bwrite }, /* bwrite */ - { (struct vnodeop_desc*)NULL, (int(*) __P((void *)))NULL } + { &vop_mmap_desc, fifo_mmap }, + { NULL, NULL } }; struct vnodeopv_desc ext2fs_fifoop_opv_desc = { &ext2fs_fifoop_p, ext2fs_fifoop_entries }; diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index 8190ef82eb3..f3cfb4c3f46 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_vnops.c,v 1.21 2001/11/27 05:27:12 art Exp $ */ +/* $OpenBSD: ffs_vnops.c,v 1.22 2001/12/04 22:44:32 art Exp $ */ /* $NetBSD: ffs_vnops.c,v 1.7 1996/05/11 18:27:24 mycroft Exp $ */ /* @@ -111,6 +111,7 @@ struct vnodeopv_entry_desc ffs_vnodeop_entries[] = { { &vop_getpages_desc, genfs_getpages }, { &vop_putpages_desc, genfs_putpages }, { &vop_size_desc, ffs_size }, + { &vop_mmap_desc, ufs_mmap }, { NULL, NULL } }; diff --git a/sys/ufs/mfs/mfs_vnops.c b/sys/ufs/mfs/mfs_vnops.c index a0a666222e1..cacf6fce8ee 100644 --- a/sys/ufs/mfs/mfs_vnops.c +++ b/sys/ufs/mfs/mfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mfs_vnops.c,v 1.16 2001/06/23 02:07:56 csapuntz Exp $ */ +/* $OpenBSD: mfs_vnops.c,v 1.17 2001/12/04 22:44:32 art Exp $ */ /* $NetBSD: mfs_vnops.c,v 1.8 1996/03/17 02:16:32 christos Exp $ */ /* @@ -93,7 +93,8 @@ struct vnodeopv_entry_desc mfs_vnodeop_entries[] = { { &vop_pathconf_desc, mfs_pathconf }, /* pathconf */ { &vop_advlock_desc, mfs_advlock }, /* advlock */ { &vop_bwrite_desc, mfs_bwrite }, /* bwrite */ - { (struct vnodeop_desc*)NULL, (int(*) __P((void *)))NULL } + { &vop_mmap_desc, mfs_mmap }, + { NULL, NULL } }; struct vnodeopv_desc mfs_vnodeop_opv_desc = { &mfs_vnodeop_p, mfs_vnodeop_entries }; diff --git a/sys/ufs/mfs/mfsnode.h b/sys/ufs/mfs/mfsnode.h index cdae3c783a2..dbf8b7dd2c2 100644 --- a/sys/ufs/mfs/mfsnode.h +++ b/sys/ufs/mfs/mfsnode.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mfsnode.h,v 1.7 1998/08/06 19:35:11 csapuntz Exp $ */ +/* $OpenBSD: mfsnode.h,v 1.8 2001/12/04 22:44:32 art Exp $ */ /* $NetBSD: mfsnode.h,v 1.3 1996/02/09 22:31:31 christos Exp $ */ /* @@ -87,3 +87,4 @@ struct mfsnode { #define mfs_truncate mfs_badop #define mfs_update nullop #define mfs_bwrite vop_generic_bwrite +#define mfs_mmap mfs_badop
\ No newline at end of file diff --git a/sys/ufs/ufs/ufs_extern.h b/sys/ufs/ufs/ufs_extern.h index fc39e16b45e..a89656344c0 100644 --- a/sys/ufs/ufs/ufs_extern.h +++ b/sys/ufs/ufs/ufs_extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ufs_extern.h,v 1.13 2001/11/27 05:27:12 art Exp $ */ +/* $OpenBSD: ufs_extern.h,v 1.14 2001/12/04 22:44:32 art Exp $ */ /* $NetBSD: ufs_extern.h,v 1.5 1996/02/09 22:36:03 christos Exp $ */ /*- @@ -78,7 +78,6 @@ int ufs_lock __P((void *)); int ufs_lookup __P((void *)); int ufs_mkdir __P((void *)); int ufs_mknod __P((void *)); -int ufs_mmap __P((void *)); int ufs_open __P((void *)); int ufs_pathconf __P((void *)); int ufs_print __P((void *)); @@ -99,6 +98,7 @@ int ufs_whiteout __P((void *)); int ufsspec_close __P((void *)); int ufsspec_read __P((void *)); int ufsspec_write __P((void *)); +#define ufs_mmap genfs_mmap #ifdef FIFO int ufsfifo_read __P((void *)); diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index e926ee7aff6..e61259fa820 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ufs_vnops.c,v 1.40 2001/11/27 05:27:12 art Exp $ */ +/* $OpenBSD: ufs_vnops.c,v 1.41 2001/12/04 22:44:32 art Exp $ */ /* $NetBSD: ufs_vnops.c,v 1.18 1996/05/11 18:28:04 mycroft Exp $ */ /* @@ -604,28 +604,6 @@ ufs_select(v) } /* - * Mmap a file - * - * NB Currently unsupported. - */ -/* ARGSUSED */ -int -ufs_mmap(v) - void *v; -{ -#if 0 - struct vop_mmap_args /* { - struct vnode *a_vp; - int a_fflags; - struct ucred *a_cred; - struct proc *a_p; - } */ *ap = v; -#endif - - return (EINVAL); -} - -/* * Seek on a file * * Nothing to do, so just return. |