summaryrefslogtreecommitdiff
path: root/sys/miscfs/kernfs/kernfs_vnops.c
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/kernfs/kernfs_vnops.c
parentfec1be888534eb37405f6bf7a195f28670e1392b (diff)
Updates for VFS Lite 2 + soft update.
Diffstat (limited to 'sys/miscfs/kernfs/kernfs_vnops.c')
-rw-r--r--sys/miscfs/kernfs/kernfs_vnops.c77
1 files changed, 34 insertions, 43 deletions
diff --git a/sys/miscfs/kernfs/kernfs_vnops.c b/sys/miscfs/kernfs/kernfs_vnops.c
index 5606fa5ebdd..7f4a33eea58 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.12 1997/10/06 20:20:26 deraadt Exp $ */
+/* $OpenBSD: kernfs_vnops.c,v 1.13 1997/11/06 05:58:38 csapuntz Exp $ */
/* $NetBSD: kernfs_vnops.c,v 1.43 1996/03/16 23:52:47 christos Exp $ */
/*
@@ -118,11 +118,10 @@ struct kern_target kern_targets[] = {
static int nkern_targets = sizeof(kern_targets) / sizeof(kern_targets[0]);
int kernfs_badop __P((void *));
-int kernfs_enotsupp __P((void *));
int kernfs_lookup __P((void *));
-#define kernfs_create kernfs_enotsupp
-#define kernfs_mknod kernfs_enotsupp
+#define kernfs_create eopnotsupp
+#define kernfs_mknod eopnotsupp
int kernfs_open __P((void *));
#define kernfs_close nullop
int kernfs_access __P((void *));
@@ -130,36 +129,37 @@ int kernfs_getattr __P((void *));
int kernfs_setattr __P((void *));
int kernfs_read __P((void *));
int kernfs_write __P((void *));
-#define kernfs_ioctl kernfs_enotsupp
-#define kernfs_select kernfs_enotsupp
-#define kernfs_mmap kernfs_enotsupp
+#define kernfs_ioctl eopnotsupp
+#define kernfs_select eopnotsupp
+#define kernfs_mmap eopnotsupp
#define kernfs_fsync nullop
#define kernfs_seek nullop
-#define kernfs_remove kernfs_enotsupp
+#define kernfs_remove eopnotsupp
int kernfs_link __P((void *));
-#define kernfs_rename kernfs_enotsupp
-#define kernfs_mkdir kernfs_enotsupp
-#define kernfs_rmdir kernfs_enotsupp
+#define kernfs_rename eopnotsupp
+#define kernfs_revoke vop_revoke
+#define kernfs_mkdir eopnotsupp
+#define kernfs_rmdir eopnotsupp
int kernfs_symlink __P((void *));
int kernfs_readdir __P((void *));
-#define kernfs_readlink kernfs_enotsupp
+#define kernfs_readlink eopnotsupp
int kernfs_abortop __P((void *));
int kernfs_inactive __P((void *));
int kernfs_reclaim __P((void *));
-#define kernfs_lock nullop
-#define kernfs_unlock nullop
+#define kernfs_lock vop_nolock
+#define kernfs_unlock vop_nounlock
#define kernfs_bmap kernfs_badop
#define kernfs_strategy kernfs_badop
int kernfs_print __P((void *));
-#define kernfs_islocked nullop
+#define kernfs_islocked vop_noislocked
int kernfs_pathconf __P((void *));
-#define kernfs_advlock kernfs_enotsupp
-#define kernfs_blkatoff kernfs_enotsupp
-#define kernfs_valloc kernfs_enotsupp
+#define kernfs_advlock eopnotsupp
+#define kernfs_blkatoff eopnotsupp
+#define kernfs_valloc eopnotsupp
int kernfs_vfree __P((void *));
-#define kernfs_truncate kernfs_enotsupp
-#define kernfs_update kernfs_enotsupp
-#define kernfs_bwrite kernfs_enotsupp
+#define kernfs_truncate eopnotsupp
+#define kernfs_update eopnotsupp
+#define kernfs_bwrite eopnotsupp
int kernfs_xread __P((struct kern_target *, int, char **, int));
int kernfs_xwrite __P((struct kern_target *, char *, int));
@@ -179,6 +179,7 @@ struct vnodeopv_entry_desc kernfs_vnodeop_entries[] = {
{ &vop_write_desc, kernfs_write }, /* write */
{ &vop_ioctl_desc, kernfs_ioctl }, /* ioctl */
{ &vop_select_desc, kernfs_select }, /* select */
+ { &vop_revoke_desc, kernfs_revoke }, /* revoke */
{ &vop_mmap_desc, kernfs_mmap }, /* mmap */
{ &vop_fsync_desc, kernfs_fsync }, /* fsync */
{ &vop_seek_desc, kernfs_seek }, /* seek */
@@ -355,6 +356,7 @@ kernfs_lookup(v)
struct vnode **vpp = ap->a_vpp;
struct vnode *dvp = ap->a_dvp;
char *pname = cnp->cn_nameptr;
+ struct proc *p = cnp->cn_proc;
struct kern_target *kt;
struct vnode *fvp;
int error, i;
@@ -373,7 +375,7 @@ kernfs_lookup(v)
if (cnp->cn_namelen == 1 && *pname == '.') {
*vpp = dvp;
VREF(dvp);
- /*VOP_LOCK(dvp);*/
+ vn_lock(dvp, LK_SHARED | LK_RETRY, p);
return (0);
}
@@ -381,7 +383,7 @@ kernfs_lookup(v)
if (cnp->cn_namelen == 4 && bcmp(pname, "root", 4) == 0) {
*vpp = rootdir;
VREF(rootdir);
- VOP_LOCK(rootdir);
+ vn_lock(rootdir, LK_SHARED | LK_RETRY, p);
return (0);
}
#endif
@@ -396,6 +398,7 @@ kernfs_lookup(v)
printf("kernfs_lookup: i = %d, failed", i);
#endif
+ vn_lock(dvp, LK_SHARED | LK_RETRY, p);
return (cnp->cn_nameiop == LOOKUP ? ENOENT : EROFS);
found:
@@ -405,7 +408,7 @@ found:
if (*dp == NODEV || !vfinddev(*dp, kt->kt_vtype, &fvp))
return (ENOENT);
*vpp = fvp;
- if (vget(fvp, 1))
+ if (vget(fvp, LK_EXCLUSIVE, p))
goto loop;
return (0);
}
@@ -414,13 +417,16 @@ found:
printf("kernfs_lookup: allocate new vnode\n");
#endif
error = getnewvnode(VT_KERNFS, dvp->v_mount, kernfs_vnodeop_p, &fvp);
- if (error)
+ if (error) {
+ vn_lock(dvp, LK_SHARED | LK_RETRY, p);
return (error);
+ }
MALLOC(fvp->v_data, void *, sizeof(struct kernfs_node), M_TEMP,
M_WAITOK);
VTOKERN(fvp)->kf_kt = kt;
fvp->v_type = kt->kt_vtype;
+ vn_lock(fvp, LK_SHARED | LK_RETRY, p);
*vpp = fvp;
#ifdef KERNFS_DIAGNOSTIC
@@ -621,13 +627,10 @@ kernfs_readdir(v)
u_long *a_cookies;
int a_ncookies;
} */ *ap = v;
+ int error, i;
struct uio *uio = ap->a_uio;
struct dirent d;
struct kern_target *kt;
- int i;
- int error;
- u_long *cookies = ap->a_cookies;
- int ncookies = ap->a_ncookies;
if (ap->a_vp->v_type != VDIR)
return (ENOTDIR);
@@ -663,8 +666,6 @@ kernfs_readdir(v)
if ((error = uiomove((caddr_t)&d, UIO_MX, uio)) != 0)
break;
- if (ncookies-- > 0)
- *cookies++ = i + 1;
}
uio->uio_offset = i;
@@ -677,6 +678,7 @@ kernfs_inactive(v)
{
struct vop_inactive_args /* {
struct vnode *a_vp;
+ struct proc *a_p;
} */ *ap = v;
struct vnode *vp = ap->a_vp;
@@ -687,6 +689,7 @@ kernfs_inactive(v)
* Clear out the v_type field to avoid
* nasty things happening in vgone().
*/
+ VOP_UNLOCK(vp, 0, ap->a_p);
vp->v_type = VNON;
return (0);
}
@@ -817,18 +820,6 @@ kernfs_abortop(v)
}
/*
- * /dev/fd vnode unsupported operation
- */
-/*ARGSUSED*/
-int
-kernfs_enotsupp(v)
- void *v;
-{
-
- return (EOPNOTSUPP);
-}
-
-/*
* /dev/fd "should never get here" operation
*/
/*ARGSUSED*/