summaryrefslogtreecommitdiff
path: root/sys/miscfs/umapfs
diff options
context:
space:
mode:
authorConstantine Sapuntzakis <csapuntz@cvs.openbsd.org>1997-11-06 05:59:40 +0000
committerConstantine Sapuntzakis <csapuntz@cvs.openbsd.org>1997-11-06 05:59:40 +0000
commit4e165724f1631d1deee6fd89b941fabdbcc855d4 (patch)
tree3aca36af68e90377984b00e9f0050674b0763db5 /sys/miscfs/umapfs
parentfec1be888534eb37405f6bf7a195f28670e1392b (diff)
Updates for VFS Lite 2 + soft update.
Diffstat (limited to 'sys/miscfs/umapfs')
-rw-r--r--sys/miscfs/umapfs/umap.h4
-rw-r--r--sys/miscfs/umapfs/umap_subr.c16
-rw-r--r--sys/miscfs/umapfs/umap_vfsops.c22
-rw-r--r--sys/miscfs/umapfs/umap_vnops.c54
4 files changed, 75 insertions, 21 deletions
diff --git a/sys/miscfs/umapfs/umap.h b/sys/miscfs/umapfs/umap.h
index 2b8d97ae56d..4b9e9971884 100644
--- a/sys/miscfs/umapfs/umap.h
+++ b/sys/miscfs/umapfs/umap.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: umap.h,v 1.7 1997/10/06 20:20:40 deraadt Exp $ */
+/* $OpenBSD: umap.h,v 1.8 1997/11/06 05:58:46 csapuntz Exp $ */
/* $NetBSD: umap.h,v 1.6 1996/02/09 22:41:00 christos Exp $ */
/*
@@ -94,6 +94,6 @@ extern struct vnode *umap_checkvp __P((struct vnode *vp, char *fil, int lno));
extern int (**umap_vnodeop_p) __P((void *));
extern struct vfsops umap_vfsops;
-void umapfs_init __P((void));
+int umapfs_init __P((struct vfsconf *));
#endif /* _KERNEL */
diff --git a/sys/miscfs/umapfs/umap_subr.c b/sys/miscfs/umapfs/umap_subr.c
index fd234f356c9..d3f8d9d801b 100644
--- a/sys/miscfs/umapfs/umap_subr.c
+++ b/sys/miscfs/umapfs/umap_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: umap_subr.c,v 1.10 1997/10/06 20:20:41 deraadt Exp $ */
+/* $OpenBSD: umap_subr.c,v 1.11 1997/11/06 05:58:47 csapuntz Exp $ */
/* $NetBSD: umap_subr.c,v 1.8 1996/03/05 02:35:39 thorpej Exp $ */
/*
@@ -42,6 +42,7 @@
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/proc.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/vnode.h>
@@ -75,14 +76,15 @@ static int umap_node_alloc __P((struct mount *, struct vnode *,
/*
* Initialise cache headers
*/
-void
-umapfs_init()
+int
+umapfs_init(struct vfsconf *vfsp)
{
#ifdef UMAPFS_DIAGNOSTIC
printf("umapfs_init\n"); /* printed during system boot */
#endif
umap_node_hashtbl = hashinit(NUMAPNODECACHE, M_CACHE, &umap_node_hash);
+ return (0);
}
/*
@@ -141,6 +143,7 @@ umap_node_find(mp, targetvp)
struct mount *mp;
struct vnode *targetvp;
{
+ struct proc *p = curproc;
struct umap_node_hashhead *hd;
struct umap_node *a;
struct vnode *vp;
@@ -166,7 +169,7 @@ loop:
* stuff, but we don't want to lock
* the lower node.
*/
- if (vget(vp, 0)) {
+ if (vget(vp, 0, p)) {
#ifdef UMAPFS_DIAGNOSTIC
printf ("umap_node_find: vget failed.\n");
#endif
@@ -198,6 +201,7 @@ umap_node_alloc(mp, lowervp, vpp)
struct umap_node *xp;
struct vnode *vp, *nvp;
int error;
+ struct proc *p = curproc;
extern int (**dead_vnodeop_p) __P((void *));
if ((error = getnewvnode(VT_UMAP, mp, umap_vnodeop_p, &vp)) != 0)
@@ -259,14 +263,14 @@ loop:
vgone(cvp);
goto loop;
}
- if (vget(cvp, 0)) /* can't lock; will die! */
+ if (vget(cvp, 0, p)) /* can't lock; will die! */
goto loop;
break;
}
vp->v_hashchain = cvpp;
vp->v_specnext = *cvpp;
- vp->v_specflags = 0;
+ vp->v_specmountpoint = NULL;
*cvpp = vp;
#ifdef DIAGNOSTIC
if (cvp == NULLVP)
diff --git a/sys/miscfs/umapfs/umap_vfsops.c b/sys/miscfs/umapfs/umap_vfsops.c
index e8dd5a9044d..67cf09a0a70 100644
--- a/sys/miscfs/umapfs/umap_vfsops.c
+++ b/sys/miscfs/umapfs/umap_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: umap_vfsops.c,v 1.10 1997/10/06 20:20:41 deraadt Exp $ */
+/* $OpenBSD: umap_vfsops.c,v 1.11 1997/11/06 05:58:48 csapuntz Exp $ */
/* $NetBSD: umap_vfsops.c,v 1.9 1996/02/09 22:41:05 christos Exp $ */
/*
@@ -48,6 +48,7 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/time.h>
+#include <sys/proc.h>
#include <sys/types.h>
#include <sys/vnode.h>
#include <sys/mount.h>
@@ -181,7 +182,7 @@ umapfs_mount(mp, path, data, ndp, p)
/*
* Unlock the node (either the lower or the alias)
*/
- VOP_UNLOCK(vp);
+ VOP_UNLOCK(vp, 0, p);
/*
* Make sure the node alias worked
*/
@@ -201,7 +202,7 @@ umapfs_mount(mp, path, data, ndp, p)
if (UMAPVPTOLOWERVP(umapm_rootvp)->v_mount->mnt_flag & MNT_LOCAL)
mp->mnt_flag |= MNT_LOCAL;
mp->mnt_data = (qaddr_t) amp;
- getnewfsid(mp, makefstype(MOUNT_UMAP));
+ vfs_getnewfsid(mp);
(void) copyinstr(path, mp->mnt_stat.f_mntonname, MNAMELEN - 1, &size);
bzero(mp->mnt_stat.f_mntonname + size, MNAMELEN - size);
@@ -242,16 +243,12 @@ umapfs_unmount(mp, mntflags, p)
struct vnode *umapm_rootvp = MOUNTTOUMAPMOUNT(mp)->umapm_rootvp;
int error;
int flags = 0;
- extern int doforce;
#ifdef UMAPFS_DIAGNOSTIC
printf("umapfs_unmount(mp = %p)\n", mp);
#endif
if (mntflags & MNT_FORCE) {
- /* lofs can never be rootfs so don't check for it */
- if (!doforce)
- return (EINVAL);
flags |= FORCECLOSE;
}
@@ -294,6 +291,7 @@ umapfs_root(mp, vpp)
struct mount *mp;
struct vnode **vpp;
{
+ struct proc *p = curproc;
struct vnode *vp;
#ifdef UMAPFS_DIAGNOSTIC
@@ -308,7 +306,7 @@ umapfs_root(mp, vpp)
*/
vp = MOUNTTOUMAPMOUNT(mp)->umapm_rootvp;
VREF(vp);
- VOP_LOCK(vp);
+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
*vpp = vp;
return (0);
}
@@ -361,7 +359,7 @@ umapfs_statfs(mp, sbp, p)
bcopy(mp->mnt_stat.f_mntonname, sbp->f_mntonname, MNAMELEN);
bcopy(mp->mnt_stat.f_mntfromname, sbp->f_mntfromname, MNAMELEN);
}
- strncpy(sbp->f_fstypename, mp->mnt_op->vfs_name, MFSNAMELEN);
+ strncpy(sbp->f_fstypename, mp->mnt_vfc->vfc_name, MFSNAMELEN);
return (0);
}
@@ -407,8 +405,11 @@ umapfs_vptofh(vp, fhp)
return VFS_VPTOFH(UMAPVPTOLOWERVP(vp), fhp);
}
+#define umapfs_sysctl ((int (*) __P((int *, u_int, void *, size_t *, void *, \
+ size_t, struct proc *)))eopnotsupp)
+
+
struct vfsops umap_vfsops = {
- MOUNT_UMAP,
umapfs_mount,
umapfs_start,
umapfs_unmount,
@@ -420,4 +421,5 @@ struct vfsops umap_vfsops = {
umapfs_fhtovp,
umapfs_vptofh,
umapfs_init,
+ umapfs_sysctl
};
diff --git a/sys/miscfs/umapfs/umap_vnops.c b/sys/miscfs/umapfs/umap_vnops.c
index 18995119006..14a23102aed 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.8 1997/10/06 20:20:42 deraadt Exp $ */
+/* $OpenBSD: umap_vnops.c,v 1.9 1997/11/06 05:58:49 csapuntz Exp $ */
/* $NetBSD: umap_vnops.c,v 1.5.4.1 1996/05/25 22:13:35 jtc Exp $ */
/*
@@ -52,6 +52,7 @@
#include <sys/namei.h>
#include <sys/malloc.h>
#include <sys/buf.h>
+#include <miscfs/nullfs/null.h>
#include <miscfs/umapfs/umap.h>
@@ -65,6 +66,8 @@ int umap_print __P((void *));
int umap_rename __P((void *));
int umap_strategy __P((void *));
int umap_bwrite __P((void *));
+int umap_unlock __P((void *));
+int umap_lock __P((void *));
/*
* Global vfs data structures
@@ -83,7 +86,8 @@ struct vnodeopv_entry_desc umap_vnodeop_entries[] = {
{ &vop_reclaim_desc, umap_reclaim },
{ &vop_print_desc, umap_print },
{ &vop_rename_desc, umap_rename },
-
+ { &vop_lock_desc, umap_lock },
+ { &vop_unlock_desc, umap_unlock },
{ &vop_strategy_desc, umap_strategy },
{ &vop_bwrite_desc, umap_bwrite },
@@ -378,10 +382,54 @@ umap_inactive(v)
* cache and reusable.
*
*/
- VOP_UNLOCK(ap->a_vp);
+ VOP_UNLOCK(ap->a_vp, 0, ap->a_p);
return (0);
}
+/*
+ * We need to process our own vnode lock and then clear the
+ * interlock flag as it applies only to our vnode, not the
+ * vnodes below us on the stack.
+ */
+int
+umap_lock(v)
+ void *v;
+{
+ struct vop_lock_args /* {
+ struct vnode *a_vp;
+ int a_flags;
+ struct proc *a_p;
+ } */ *ap = v;
+
+ vop_nolock(ap);
+ if ((ap->a_flags & LK_TYPE_MASK) == LK_DRAIN)
+ return (0);
+ ap->a_flags &= ~LK_INTERLOCK;
+ return (null_bypass(ap));
+}
+
+/*
+ * We need to process our own vnode unlock and then clear the
+ * interlock flag as it applies only to our vnode, not the
+ * vnodes below us on the stack.
+ */
+int
+umap_unlock(v)
+ void *v;
+{
+ struct vop_unlock_args /* {
+ struct vnode *a_vp;
+ int a_flags;
+ struct proc *a_p;
+ } */ *ap = v;
+
+ vop_nounlock(ap);
+ ap->a_flags &= ~LK_INTERLOCK;
+ return (null_bypass(ap));
+}
+
+
+
int
umap_reclaim(v)
void *v;