afs: Always define our own osi_timeval32_t
[openafs.git] / src / afs / IRIX / osi_machdep.h
index 032797c..56defec 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * 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
@@ -27,13 +27,14 @@ extern time_t time;
 #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>
@@ -43,8 +44,6 @@ extern flid_t osi_flid;
 #define vfs_data vfs_bh.bh_first->bd_pdata
 #endif /* AFS_SGI64_ENV */
 
-#define ifnet_flags(x) (x?(x)->if_flags:0)
-
 /*
  * Global lock, semaphore, mutex and state vector support.
  */
@@ -63,7 +62,7 @@ extern flid_t osi_flid;
 #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) { \
@@ -107,7 +106,7 @@ extern flid_t osi_flid;
 
 #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) { \
@@ -140,11 +139,11 @@ extern flid_t osi_flid;
  * 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.
@@ -178,7 +177,7 @@ extern long afs_global_owner;
 #define AFS_GUNLOCK()
 #define ISAFS_GLOCK() 1
 
-#define SPLVAR      register int splvar
+#define SPLVAR      int splvar
 #define NETPRI      splvar=splnet()
 #define USERPRI     splx(splvar)
 
@@ -187,7 +186,13 @@ extern long afs_global_owner;
 
 #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) \
@@ -207,11 +212,6 @@ extern long afs_global_owner;
 
 #define afs_hz HZ
 
-#ifdef PAGESIZE
-#undef PAGESIZE
-#endif
-#define PAGESIZE 4096
-
 #ifdef AFS_SGI64_ENV
 #undef setuerror
 #undef getuerror
@@ -385,7 +385,20 @@ extern long afs_global_owner;
 #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_ */