/* other */
#define afs_bufferpages bufpages
+#ifndef iodone
+#define iodone biodone
+#endif
#define PAGESIZE 8192
#define printk printf /* for RX version of xdr_* */
#define setgroups sys_setgroups
#ifdef KERNEL
extern int (**afs_vnodeop_p)();
-extern struct simplelock afs_global_lock;
-#ifndef AFS_GLOBAL_SUNLOCK
-#define AFS_ASSERT_GLOCK()
-#endif
+#ifdef AFS_GLOBAL_SUNLOCK
+extern struct proc * afs_global_owner;
+extern struct lock afs_global_lock;
+#define AFS_GLOCK() \
+ do { \
+ osi_Assert(curproc); \
+ lockmgr(&afs_global_lock, LK_EXCLUSIVE, 0, curproc); \
+ osi_Assert(afs_global_owner == NULL); \
+ afs_global_owner = curproc; \
+ } while (0)
+#define AFS_GUNLOCK() \
+ do { \
+ osi_Assert(curproc); \
+ osi_Assert(afs_global_owner == curproc); \
+ afs_global_owner = NULL; \
+ lockmgr(&afs_global_lock, LK_RELEASE, 0, curproc); \
+ } while(0)
+#define ISAFS_GLOCK() (afs_global_owner == curproc && curproc)
+#else
+extern struct simplelock afs_global_lock;
#define AFS_GLOCK()
#define AFS_GUNLOCK()
+#define AFS_ASSERT_GLOCK()
+#define ISAFS_GLOCK() 1
+#endif
#define AFS_RXGLOCK()
#define AFS_RXGUNLOCK()
#define ISAFS_RXGLOCK() 1
-#define ISAFS_GLOCK() 1
#undef SPLVAR
-#define SPLVAR
+#define SPLVAR int splvar
#undef NETPRI
-#define NETPRI
+#define NETPRI splvar=splnet()
#undef USERPRI
-#define USERPRI
+#define USERPRI splx(splvar)
#endif /* KERNEL */
#endif /* _OSI_MACHDEP_H_ */