} while(0)
#define ISAFS_GLOCK() lock_mine((void *)&afs_global_lock)
+#if defined(AFS_AIX41_ENV)
+#define osi_InitGlock() \
+ do { \
+ lock_alloc((void *)&afs_global_lock, LOCK_ALLOC_PIN, 1, 1); \
+ simple_lock_init((void *)&afs_global_lock); \
+ } while(0)
+#else
+#define osi_InitGlock() \
+ mutex_init(&afs_global_lock, "afs_global_lock", MUTEX_DEFAULT, NULL)
+#endif
+
#define ifnet_flags(x) (x?(x)->if_flags:0)
#endif
afs_global_owner = 0; \
lck_mtx_unlock(afs_global_lock); \
} while(0)
+#define osi_InitGlock() \
+ do { \
+ afs_global_owner = 0; \
+ } while (0)
#else
/* Should probably use mach locks rather than bsd locks, since we use the
mach thread control api's elsewhere (mach locks not used for consistency
afs_global_owner = 0; \
lockmgr(&afs_global_lock, LK_RELEASE, 0, current_proc()); \
} while(0)
+#define osi_InitGlock() \
+ do { \
+ lockinit(&afs_global_lock, PLOCK, "afs global lock", 0, 0); \
+ afs_global_owner = 0; \
+ } while (0)
#endif
#define ISAFS_GLOCK() (afs_global_owner == current_thread())
#define AFS_GLOCK() mtx_lock(&afs_global_mtx)
#define AFS_GUNLOCK() mtx_unlock(&afs_global_mtx)
#define ISAFS_GLOCK() (mtx_owned(&afs_global_mtx))
+#if defined(AFS_FBSD80_ENV) && defined(WITNESS)
+# define osi_InitGlock() \
+ do { \
+ memset(&afs_global_mtx, 0, sizeof(struct mtx)); \
+ mtx_init(&afs_global_mtx, "AFS global lock", NULL, MTX_DEF); \
+ afs_global_owner = 0; \
+ } while(0)
+#else
+# define osi_InitGlock() \
+ do { \
+ mtx_init(&afs_global_mtx, "AFS global lock", NULL, MTX_DEF); \
+ afs_global_owner = 0; \
+ } while (0)
#else /* FBSD50 */
extern struct lock afs_global_lock;
#define osi_curcred() (curproc->p_cred->pc_ucred)
lockmgr(&afs_global_lock, LK_RELEASE, 0, curproc); \
} while(0)
#define ISAFS_GLOCK() (afs_global_owner == curproc && curproc)
+#define osi_InitGlock() \
+ do { \
+ lockinit(&afs_global_lock, PLOCK, "afs global lock", 0, 0); \
+ afs_global_owner = 0; \
+ } while (0)
#endif /* FBSD50 */
#undef SPLVAR
#endif /* KERNEL */
-
+#if defined(AFS_SGI62_ENV)
+# define osi_InitGlock() \
+ mutex_init(&afs_global_lock, MUTEX_DEFAULT, "afs_global_lock");
+#else
+# define osi_InitGlock() \
+ mutex_init(&afs_global_lock, "afs_global_lock", MUTEX_DEFAULT, NULL);
+#endif
#ifdef AFS_SGI64_ENV
#define gop_rdwr(rw,gp,base,len,offset,segflg,ioflag,ulimit,cr,aresid) \
afs_global_owner = 0; \
mutex_unlock(&afs_global_lock); \
} while (0)
+
+#define osi_InitGlock()
+
#else
#define AFS_GLOCK()
#define AFS_GUNLOCK()
afs_global_owner = 0; \
mutex_unlock(&afs_global_lock); \
} while (0)
+
+#define osi_InitGlock()
+
#else
#define AFS_GLOCK()
#define AFS_GUNLOCK()
do { \
simple_unlock(&afs_global_lock); \
} while(0)
+#define osi_InitGlock() \
+ do { \
+ lockinit(&afs_global_lock, PLOCK, "afs global lock", 0, 0); \
+ afs_global_owner = 0; \
+ } while (0)
#endif /* 0 */
#undef SPLVAR
#define USERPRI splx(splvar)
#endif /* KERNEL */
+#define osi_InitGlock() \
+ do { \
+ lockinit(&afs_global_lock, PLOCK, "afs global lock", 0, 0); \
+ afs_global_owner = 0; \
+ } while (0)
+
/* vnodes */
extern int (**afs_vnodeop_p) ();
#define vType(vc) AFSTOV(vc)->v_type
#define AFS_GLOCK() mutex_enter(&afs_global_lock);
#define AFS_GUNLOCK() mutex_exit(&afs_global_lock);
#define ISAFS_GLOCK() mutex_owned(&afs_global_lock)
+#define osi_InitGlock() \
+ mutex_init(&afs_global_lock, "afs_global_lock", MUTEX_DEFAULT, NULL);
#endif
} while(0)
#define AFS_ASSERT_GLOCK() \
do { if (!ISAFS_GLOCK()) { osi_Panic("afs global lock not held"); } } while(0)
+#define osi_GlockInit() \
+ usr_mutex_init(&afs_global_lock, "afs_global_lock", MUTEX_DEFAULT, NULL)
extern int afs_bufferpages;
static int once = 0;
if (once++ > 0) /* just in case */
return;
-#if defined(AFS_HPUX_ENV)
+
osi_InitGlock();
-#else /* AFS_HPUX_ENV */
-#if defined(AFS_GLOBAL_SUNLOCK)
-#if defined(AFS_SGI62_ENV)
- mutex_init(&afs_global_lock, MUTEX_DEFAULT, "afs_global_lock");
-#elif defined(AFS_FBSD50_ENV)
-#if defined(AFS_FBSD80_ENV) && defined(WITNESS)
- /* "lock_initalized" (sic) can panic, checks a flag bit
- * is unset _before_ init */
- memset(&afs_global_mtx, 0, sizeof(struct mtx));
-#endif
- mtx_init(&afs_global_mtx, "AFS global lock", NULL, MTX_DEF);
-#elif defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
-#if !defined(AFS_DARWIN80_ENV)
- lockinit(&afs_global_lock, PLOCK, "afs global lock", 0, 0);
-#endif
- afs_global_owner = 0;
-#elif defined(AFS_AIX41_ENV)
- lock_alloc((void *)&afs_global_lock, LOCK_ALLOC_PIN, 1, 1);
- simple_lock_init((void *)&afs_global_lock);
-#elif !defined(AFS_LINUX22_ENV)
- /* Linux initialization in osi directory. Should move the others. */
- mutex_init(&afs_global_lock, "afs_global_lock", MUTEX_DEFAULT, NULL);
-#endif
-#endif /* AFS_GLOBAL_SUNLOCK */
-#endif /* AFS_HPUX_ENV */
if (!afs_osicred_initialized) {
#if defined(AFS_DARWIN80_ENV)