[OpenAFS-devel] OpenBSD 4.2 and OpenAFS?

Jim Rees rees@umich.edu
Fri, 28 Dec 2007 20:15:46 -0500


Matthew Schlegel wrote:

  I'm working on getting OpenAFS to compile on OpenBSD 4.2 and I'm currently
  stumped by the following errors:

I'm afraid the OpenBSD vnode locking has changed in 4.2, probably for SMP.
The fix will require looking at the new code and figuring out what changed.
I usually do this by looking at what they changed in the nfs client, and
trying to apply the same changes to OpenBSD.  I may eventually get around to
doing this but it won't be any time soon.

If you are feeling adventurous, you could try something like this:

Index: osi_vnodeops.c
===================================================================
RCS file: /cvs/openafs/src/afs/OBSD/osi_vnodeops.c,v
retrieving revision 1.20
diff -u -r1.20 osi_vnodeops.c
--- osi_vnodeops.c	9 Mar 2006 15:27:17 -0000	1.20
+++ osi_vnodeops.c	29 Dec 2007 01:13:28 -0000
@@ -189,8 +189,8 @@
     {&vop_abortop_desc, vop_generic_abortop},	/* abortop */
     {&vop_inactive_desc, afs_nbsd_inactive},	/* inactive */
     {&vop_reclaim_desc, afs_nbsd_reclaim},	/* reclaim */
-    {&vop_lock_desc, afs_nbsd_lock},		/* lock */
-    {&vop_unlock_desc, afs_nbsd_unlock},	/* unlock */
+    {&vop_lock_desc, ((int (*)(void *))vop_generic_lock)},	/* lock */
+    {&vop_unlock_desc, ((int (*)(void *))vop_generic_unlock)},	/* unlock */
     {&vop_bmap_desc, afs_nbsd_bmap},		/* bmap */
     {&vop_strategy_desc, afs_nbsd_strategy},	/* strategy */
     {&vop_print_desc, afs_nbsd_print},		/* print */
@@ -921,40 +921,6 @@
 }
 
 int
-afs_nbsd_lock(void *v)
-{
-    struct vop_lock_args	/* {
-				 * struct vnode *a_vp;
-				 * int a_flags;
-				 * sturct proc *a_p;
-				 * } */ *ap = v;
-    struct vnode *vp = ap->a_vp;
-    struct vcache *vc = VTOAFS(vp);
-
-    if (!vc)
-	panic("afs_nbsd_lock: null vcache");
-    return afs_osi_lockmgr(&vc->rwlock, ap->a_flags | LK_CANRECURSE, &vp->v_interlock,
-		   ap->a_p);
-}
-
-int
-afs_nbsd_unlock(void *v)
-{
-    struct vop_unlock_args	/* {
-				 * struct vnode *a_vp;
-				 * int a_flags;
-				 * struct proc *a_p;
-				 * } */ *ap = v;
-    struct vnode *vp = ap->a_vp;
-    struct vcache *vc = VTOAFS(vp);
-
-    if (!vc)
-	panic("afs_nbsd_unlock: null vcache");
-    return afs_osi_lockmgr(&vc->rwlock, ap->a_flags | LK_RELEASE, &vp->v_interlock,
-		   ap->a_p);
-}
-
-int
 afs_nbsd_bmap(void *v)
 {
     struct vop_bmap_args	/* {