/*
* Copyright 2000, International Business Machines Corporation and others.
* All Rights Reserved.
- *
+ *
* This software has been released under the terms of the IBM Public
* License. For details, see the LICENSE file in the top-level source
* directory or online at http://www.openafs.org/dl/license10.html
#define osi_Time() (time)
/* This gets redefined from ucred to cred in osi_vfs.h, just do it right */
-#define AFS_UCRED cred
-
-#define osi_vnhold(avc, r) do { VN_HOLD(AFSTOV(avc)); } while(0)
+typedef struct cred afs_ucred_t;
+typedef struct proc afs_proc_t;
-#undef afs_osi_Alloc_NoSleep
-extern void *afs_osi_Alloc_NoSleep(size_t size);
+#undef gop_lookupname
+#define gop_lookupname(fnamep,segflg,followlink,compvpp) lookupname((fnamep),(segflg),(followlink),NULL,(compvpp), NULL)
+#undef gop_lookupname_user
+#define gop_lookupname_user(fnamep,segflg,followlink,compvpp) lookupname((fnamep),(segflg),(followlink),NULL,(compvpp), NULL)
#ifdef AFS_SGI64_ENV
#include <sys/flock.h>
#define vfs_data vfs_bh.bh_first->bd_pdata
#endif /* AFS_SGI64_ENV */
-
/*
* Global lock, semaphore, mutex and state vector support.
*/
#undef AFS_MUTEX_ENTER
#define AFS_MUTEX_ENTER(mp) \
MACRO_BEGIN \
- register struct kthread *_kthreadP; \
+ struct kthread *_kthreadP; \
while(mutex_tryenter(mp) == 0) { \
_kthreadP = (struct kthread*)mutex_owner(mp); \
if (_kthreadP != NULL && _kthreadP->k_sonproc == CPU_NONE) { \
#define AFS_MUTEX_ENTER(mp) \
MACRO_BEGIN \
- register struct proc *_procP; \
+ struct proc *_procP; \
while(mutex_tryenter(mp) == 0) { \
_procP = mutex_owner(mp); \
if (_procP != NULL && _procP->p_sonproc == CPU_NONE) { \
* CAUTION -- The ISAFS_(RX)?GLOCK macros are not safe to use when the lock is
* not held if the test may be made at interrupt level as the code may
* appear to be running as the process that is (or last was) running at
- * non-interrupt level. Worse yet, the interrupt may occur just as the
+ * non-interrupt level. Worse yet, the interrupt may occur just as the
* process is exiting, in which case, the pid may change from the start
* of the interrupt to the end, since the u area has been changed. So,
* at interrupt level, I'm using the base of the current interrupt stack.
- * Note that afs_osinet.c also modifies afs_global_owner for osi_Sleep and
+ * Note that afs_osinet.c also modifies afs_global_owner for osi_Sleep and
* afs_osi_Wakeup. Changes made here should be reflected there as well.
* NOTE - As of 6.2, we can no longer use mutexes in interrupts, so the above
* concern no longer exists.
#else
#define AFS_GLOCK() AFS_MUTEX_ENTER(&afs_global_lock)
#endif
-#define AFS_GUNLOCK() (AFS_ASSERT_GLOCK(), mutex_exit(&afs_global_lock))
+#define AFS_GUNLOCK() { AFS_ASSERT_GLOCK(); mutex_exit(&afs_global_lock); }
#define ISAFS_GLOCK() mutex_mine(&afs_global_lock)
#else
extern long afs_global_owner;
afs_global_owner = osi_ThreadUnique(); \
MACRO_END
#define AFS_GUNLOCK() \
- (AFS_ASSERT_GLOCK(), afs_global_owner = 0, mutex_exit(&afs_global_lock))
+ { AFS_ASSERT_GLOCK(); afs_global_owner = 0; mutex_exit(&afs_global_lock); }
#define ISAFS_GLOCK() (osi_ThreadUnique() == afs_global_owner)
#endif /* AFS_SGI64_ENV */
-
-#define AFS_RXGLOCK()
-#define AFS_RXGUNLOCK()
-#define ISAFS_RXGLOCK() 1
-
#else /* MP */
#define AFS_GLOCK()
#define AFS_GUNLOCK()
#define ISAFS_GLOCK() 1
-#define SPLVAR register int splvar
+#define SPLVAR int splvar
#define NETPRI splvar=splnet()
#define USERPRI splx(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) \
#define afs_hz HZ
-#ifdef PAGESIZE
-#undef PAGESIZE
-#endif
-#define PAGESIZE 4096
-
#ifdef AFS_SGI64_ENV
#undef setuerror
#undef getuerror
#undef OSI_VN_DECL
#define OSI_VN_DECL(V) bhv_desc_t *bhv_##V
#undef OSI_VN_CONVERT
-#define OSI_VN_CONVERT(V) struct vnode * V = (struct vnode*)BHV_TO_VNODE(bhv_##V);
+#define OSI_VN_CONVERT(V) struct vnode * V = (struct vnode*)BHV_TO_VNODE(bhv_##V)
#undef OSI_VC_ARG
#define OSI_VC_ARG(V) bhv_##V
#undef OSI_VC_DECL
#define OSI_VC_DECL(V) bhv_desc_t *bhv_##V
#undef OSI_VC_CONVERT
-#define OSI_VC_CONVERT(V) struct vcache * V = VTOAFS(BHV_TO_VNODE(bhv_##V));
+#define OSI_VC_CONVERT(V) struct vcache * V = VTOAFS(BHV_TO_VNODE(bhv_##V))
#undef OSI_VFS_ARG
#define OSI_VFS_ARG(V) bhv_##V
#undef OSI_VFS_DECL
#define OSI_VFS_DECL(V) bhv_desc_t *bhv_##V
#undef OSI_VFS_CONVERT
-#define OSI_VFS_CONVERT(V) struct vfs * V = (struct vfs*)bhvtovfs(bhv_##V);
+#define OSI_VFS_CONVERT(V) struct vfs * V = (struct vfs*)bhvtovfs(bhv_##V)
#endif /* AFS_SGI64_ENV */
+#define osi_procname(procname, size) strncpy(procname, proc_name(curproc()), size)
-
+static_inline void
+osi_GetTime(osi_timeval32_t *atv)
+{
+#ifdef _K64U64
+ struct __irix5_timeval now;
+ irix5_microtime(&now);
+#else
+ struct timeval now;
+ microtime(&now);
+#endif
+ atv->tv_sec = now.tv_sec;
+ atv->tv_usec = now.tv_usec;
+}
#endif /* _OSI_MACHDEP_H_ */