summaryrefslogtreecommitdiff
path: root/sys/miscfs/nullfs
diff options
context:
space:
mode:
Diffstat (limited to 'sys/miscfs/nullfs')
-rw-r--r--sys/miscfs/nullfs/null.h6
-rw-r--r--sys/miscfs/nullfs/null_subr.c22
-rw-r--r--sys/miscfs/nullfs/null_vfsops.c21
-rw-r--r--sys/miscfs/nullfs/null_vnops.c44
4 files changed, 37 insertions, 56 deletions
diff --git a/sys/miscfs/nullfs/null.h b/sys/miscfs/nullfs/null.h
index bdba4065075..a986184915b 100644
--- a/sys/miscfs/nullfs/null.h
+++ b/sys/miscfs/nullfs/null.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: null.h,v 1.5 1997/10/06 15:19:06 csapuntz Exp $ */
+/* $OpenBSD: null.h,v 1.6 1997/10/06 20:20:28 deraadt Exp $ */
/* $NetBSD: null.h,v 1.7 1996/05/17 20:53:11 gwr Exp $ */
/*
@@ -92,8 +92,6 @@ extern struct vnode *null_checkvp __P((struct vnode *vp, char *fil, int lno));
extern int (**null_vnodeop_p) __P((void *));
extern struct vfsops null_vfsops;
-int nullfs_init __P((struct vfsconf *));
-int null_bypass __P((void *));
-
+void nullfs_init __P((void));
#endif /* _KERNEL */
diff --git a/sys/miscfs/nullfs/null_subr.c b/sys/miscfs/nullfs/null_subr.c
index 930b1c632a9..f115d70e449 100644
--- a/sys/miscfs/nullfs/null_subr.c
+++ b/sys/miscfs/nullfs/null_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: null_subr.c,v 1.5 1997/10/06 15:19:06 csapuntz Exp $ */
+/* $OpenBSD: null_subr.c,v 1.6 1997/10/06 20:20:29 deraadt Exp $ */
/* $NetBSD: null_subr.c,v 1.6 1996/05/10 22:50:52 jtk Exp $ */
/*
@@ -42,7 +42,6 @@
#include <sys/param.h>
#include <sys/systm.h>
-#include <sys/proc.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/vnode.h>
@@ -68,6 +67,7 @@
LIST_HEAD(null_node_hashhead, null_node) *null_node_hashtbl;
u_long null_node_hash;
+void nullfs_init __P((void));
static struct vnode *
null_node_find __P((struct mount *, struct vnode *));
static int
@@ -75,17 +75,14 @@ static int
/*
* Initialise cache headers
*/
-/*ARGSUSED*/
-int
-nullfs_init(vfsp)
- struct vfsconf *vfsp;
+void
+nullfs_init()
{
#ifdef NULLFS_DIAGNOSTIC
printf("nullfs_init\n"); /* printed during system boot */
#endif
null_node_hashtbl = hashinit(NNULLNODECACHE, M_CACHE, &null_node_hash);
- return (0);
}
/*
@@ -99,7 +96,6 @@ null_node_find(mp, lowervp)
struct null_node_hashhead *hd;
struct null_node *a;
struct vnode *vp;
- struct proc *p = curproc;
/*
* Find hash base, and then search the (two-way) linked
@@ -117,7 +113,7 @@ loop:
* stuff, but we don't want to lock
* the lower node.
*/
- if (vget(vp, 0, p)) {
+ if (vget(vp, 0)) {
printf ("null_node_find: vget failed.\n");
goto loop;
};
@@ -145,7 +141,6 @@ null_node_alloc(mp, lowervp, vpp)
struct vnode *vp, *nvp;
int error;
extern int (**dead_vnodeop_p) __P((void *));
- struct proc *p = curproc;
if ((error = getnewvnode(VT_NULL, mp, null_vnodeop_p, &vp)) != 0)
return (error);
@@ -211,14 +206,14 @@ loop:
vgone(cvp);
goto loop;
}
- if (vget(cvp, 0, p)) /* can't lock; will die! */
+ if (vget(cvp, 0)) /* can't lock; will die! */
goto loop;
break;
}
vp->v_hashchain = cvpp;
vp->v_specnext = *cvpp;
- vp->v_specmountpoint = NULL;
+ vp->v_specflags = 0;
*cvpp = vp;
#ifdef DIAGNOSTIC
if (cvp == NULLVP)
@@ -254,7 +249,6 @@ null_node_create(mp, lowervp, newvpp, takelock)
int takelock;
{
struct vnode *aliasvp;
- struct proc *p = curproc; /* XXX */
if ((aliasvp = null_node_find(mp, lowervp)) != NULL) {
/*
@@ -303,7 +297,7 @@ null_node_create(mp, lowervp, newvpp, takelock)
upper layer lock */
VTONULL(aliasvp)->null_flags |= NULL_LLOCK;
if (takelock)
- vn_lock(aliasvp, LK_EXCLUSIVE | LK_RETRY, p);
+ VOP_LOCK(aliasvp);
*newvpp = aliasvp;
return (0);
diff --git a/sys/miscfs/nullfs/null_vfsops.c b/sys/miscfs/nullfs/null_vfsops.c
index 26dcb22db51..5e59d14d7c7 100644
--- a/sys/miscfs/nullfs/null_vfsops.c
+++ b/sys/miscfs/nullfs/null_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: null_vfsops.c,v 1.5 1997/10/06 15:19:07 csapuntz Exp $ */
+/* $OpenBSD: null_vfsops.c,v 1.6 1997/10/06 20:20:30 deraadt Exp $ */
/* $NetBSD: null_vfsops.c,v 1.11 1996/05/10 22:50:56 jtk Exp $ */
/*
@@ -48,7 +48,6 @@
#include <sys/param.h>
#include <sys/systm.h>
-#include <sys/proc.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/vnode.h>
@@ -139,7 +138,7 @@ nullfs_mount(mp, path, data, ndp, p)
/*
* Unlock the node (either the lower or the alias)
*/
- VOP_UNLOCK(vp, 0, p);
+ VOP_UNLOCK(vp);
/*
* Make sure the node alias worked
*/
@@ -159,7 +158,7 @@ nullfs_mount(mp, path, data, ndp, p)
if (NULLVPTOLOWERVP(nullm_rootvp)->v_mount->mnt_flag & MNT_LOCAL)
mp->mnt_flag |= MNT_LOCAL;
mp->mnt_data = (qaddr_t) xmp;
- vfs_getnewfsid(mp);
+ getnewfsid(mp, makefstype(MOUNT_LOFS));
(void) copyinstr(path, mp->mnt_stat.f_mntonname, MNAMELEN - 1, &size);
bzero(mp->mnt_stat.f_mntonname + size, MNAMELEN - size);
@@ -201,12 +200,16 @@ nullfs_unmount(mp, mntflags, p)
struct vnode *nullm_rootvp = MOUNTTONULLMOUNT(mp)->nullm_rootvp;
int error;
int flags = 0;
+ extern int doforce;
#ifdef NULLFS_DIAGNOSTIC
printf("nullfs_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;
}
@@ -250,7 +253,6 @@ nullfs_root(mp, vpp)
struct vnode **vpp;
{
struct vnode *vp;
- struct proc *p = curproc;
#ifdef NULLFS_DIAGNOSTIC
printf("nullfs_root(mp = %p, vp = %p->%p)\n", mp,
@@ -264,7 +266,7 @@ nullfs_root(mp, vpp)
*/
vp = MOUNTTONULLMOUNT(mp)->nullm_rootvp;
VREF(vp);
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
+ VOP_LOCK(vp);
*vpp = vp;
return 0;
}
@@ -318,7 +320,7 @@ nullfs_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_vfc->vfc_name, MFSNAMELEN);
+ strncpy(sbp->f_fstypename, mp->mnt_op->vfs_name, MFSNAMELEN);
return (0);
}
@@ -368,10 +370,8 @@ nullfs_vptofh(vp, fhp)
return (EOPNOTSUPP);
}
-#define nullfs_sysctl ((int (*) __P((int *, u_int, void *, size_t *, void *, \
- size_t, struct proc *)))eopnotsupp)
-
struct vfsops null_vfsops = {
+ MOUNT_NULL,
nullfs_mount,
nullfs_start,
nullfs_unmount,
@@ -383,5 +383,4 @@ struct vfsops null_vfsops = {
nullfs_fhtovp,
nullfs_vptofh,
nullfs_init,
- nullfs_sysctl
};
diff --git a/sys/miscfs/nullfs/null_vnops.c b/sys/miscfs/nullfs/null_vnops.c
index b4068bee664..b5d2775bba1 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.6 1997/10/06 15:19:07 csapuntz Exp $ */
+/* $OpenBSD: null_vnops.c,v 1.7 1997/10/06 20:20:31 deraadt Exp $ */
/* $NetBSD: null_vnops.c,v 1.7 1996/05/10 22:51:01 jtk Exp $ */
/*
@@ -98,18 +98,10 @@
* Although bypass handles most operations,
* vop_getattr, _inactive, _reclaim, and _print are not bypassed.
* Vop_getattr must change the fsid being returned.
- * Vop_lock and vop_unlock must handle any locking for the
- * current vnode as well as pass the lock request down.
* Vop_inactive and vop_reclaim are not bypassed so that
- * the can handle freeing null-layer specific data. Vop_print
- * is not bypassed to avoid excessive debugging information.
- * Also, certain vnod eoperations change the locking state within
- * the operation (create, mknod, remove, link, rename, mkdir, rmdir,
- * and symlink). Ideally, these operations should not change the
- * lock state, but should be changed to let the caller of the
- * function unlock them.Otherwise all intermediate vnode layers
- * (such as union, umapfs, etc) must catch these functions
- * to the necessary locking at their layer
+ * they can handle freeing null-layer specific data.
+ * Vop_print is not bypassed to avoid excessive debugging
+ * information.
*
*
* INSTANTIATING VNODE STACKS
@@ -190,6 +182,7 @@
int null_bug_bypass = 0; /* for debugging: enables bypass printf'ing */
+int null_bypass __P((void *));
int null_getattr __P((void *));
int null_inactive __P((void *));
int null_reclaim __P((void *));
@@ -517,7 +510,6 @@ null_lock(v)
struct vop_lock_args *ap = v;
struct vnode *vp = ap->a_vp;
struct null_node *nn;
- struct proc *p = ap->a_p;
#ifdef NULLFS_DIAGNOSTIC
vprint("null_lock_e", ap->a_vp);
@@ -541,7 +533,7 @@ start:
* is zero, we are probably being reclaimed so we need to
* keep our hands off the lower node.
*/
- vn_lock(nn->null_lowervp, LK_EXCLUSIVE | LK_RETRY, p);
+ VOP_LOCK(nn->null_lowervp);
nn->null_flags |= NULL_LLOCK;
}
@@ -576,7 +568,6 @@ null_unlock(v)
void *v;
{
struct vop_lock_args *ap = v;
- struct proc *p = ap->a_p;
struct null_node *nn = VTONULL(ap->a_vp);
#ifdef NULLFS_DIAGNOSTIC
@@ -596,7 +587,7 @@ null_unlock(v)
nn->null_flags &= ~NULL_LOCKED;
if ((nn->null_flags & NULL_LLOCK) != 0)
- VOP_UNLOCK(nn->null_lowervp, 0, p);
+ VOP_UNLOCK(nn->null_lowervp);
nn->null_flags &= ~NULL_LLOCK;
@@ -632,21 +623,20 @@ null_lookup(v)
register int error;
register struct vnode *dvp;
int flags = ap->a_cnp->cn_flags;
- struct componentname *cnp = ap->a_cnp;
- struct proc *p = cnp->cn_proc;
+
#ifdef NULLFS_DIAGNOSTIC
- printf("null_lookup: dvp=%lx, name='%s'\n",
- ap->a_dvp, cnp->cn_nameptr);
+ printf("null_lookup: dvp=%p, name='%s'\n",
+ ap->a_dvp, ap->a_cnp->cn_nameptr);
#endif
/*
* the starting dir (ap->a_dvp) comes in locked.
*/
/* set LOCKPARENT to hold on to it until done below */
- cnp->cn_flags |= LOCKPARENT;
+ ap->a_cnp->cn_flags |= LOCKPARENT;
error = null_bypass(ap);
if (!(flags & LOCKPARENT))
- cnp->cn_flags &= ~LOCKPARENT;
+ ap->a_cnp->cn_flags &= ~LOCKPARENT;
if (error)
/*
@@ -707,20 +697,20 @@ null_lookup(v)
* lock. No need for vget() since we hold a
* refcount to the starting directory
*/
- VOP_UNLOCK(dvp, 0, p);
- vn_lock(*ap->a_vpp, LK_EXCLUSIVE | LK_RETRY, p);
+ VOP_UNLOCK(dvp);
+ VOP_LOCK(*ap->a_vpp);
/*
* we should return our directory locked if
* (flags & LOCKPARENT) and (flags & ISLASTCN)
*/
if ((flags & LOCKPARENT) && (flags & ISLASTCN))
- vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, p);
+ VOP_LOCK(dvp);
} else {
/*
* Normal directory locking order: we hold the starting
* directory locked; now lock our layer of the target.
*/
- vn_lock(*ap->a_vpp, LK_RETRY | LK_EXCLUSIVE, p);
+ VOP_LOCK(*ap->a_vpp);
/*
* underlying starting dir comes back locked
* if lockparent (we set it) and no error
@@ -750,7 +740,7 @@ null_lookup(v)
* end yet, !(flags & ISLASTCN)
*/
if (!(flags & LOCKPARENT) || !(flags & ISLASTCN))
- VOP_UNLOCK(dvp, 0, p);
+ VOP_UNLOCK(dvp);
}
}
return error;