afs: Always define our own osi_timeval32_t
[openafs.git] / src / afs / SOLARIS / osi_machdep.h
index 3e8c886..45ee8de 100644 (file)
@@ -18,7 +18,7 @@
 #ifndef _OSI_MACHDEP_H_
 #define _OSI_MACHDEP_H_
 
-#ifdef AFS_SUN57_64BIT_ENV
+#ifdef AFS_SUN5_64BIT_ENV
 #include <sys/model.h>         /* for get_udatamodel() */
 #endif
 
@@ -54,26 +54,6 @@ local_osi_Time()
 #define osi_Time() (hrestime.tv_sec)
 #endif
 
-#undef afs_osi_Alloc_NoSleep
-extern void *afs_osi_Alloc_NoSleep(size_t size);
-
-#ifdef AFS_SUN58_ENV
-# define osi_vnhold(avc, r)  do {    \
-    struct vnode *vp = AFSTOV(avc); \
-    uint_t prevcount;               \
-                                    \
-    mutex_enter(&vp->v_lock);       \
-    prevcount = vp->v_count++;      \
-    mutex_exit(&vp->v_lock);        \
-                                    \
-    if (prevcount == 0) {           \
-       VFS_HOLD(afs_globalVFS);    \
-    }                               \
-} while(0)
-#else /* !AFS_SUN58_ENV */
-# define osi_vnhold(avc, r)  do { VN_HOLD(AFSTOV(avc)); } while(0)
-#endif /* !AFS_SUN58_ENV */
-
 #define gop_rdwr(rw,gp,base,len,offset,segflg,ioflag,ulimit,cr,aresid) \
   vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(ioflag),(ulimit),(cr),(aresid))
 #define gop_lookupname(fnamep,segflg,followlink,compvpp) \
@@ -94,12 +74,11 @@ extern void *afs_osi_Alloc_NoSleep(size_t size);
 #include <sys/mutex.h>
 extern kmutex_t afs_global_lock;
 
-#define AFS_GLOCK()    mutex_enter(&afs_global_lock);
-#define AFS_GUNLOCK()  mutex_exit(&afs_global_lock);
+#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
 
 
 /* Associate the Berkley signal equivalent lock types to System V's */
@@ -116,7 +95,6 @@ extern kmutex_t afs_global_lock;
 #define        IO_SYNC         FSYNC
 #endif
 
-#if    defined(AFS_SUN56_ENV)
 /*
 ** Macro returns 1 if file is larger than 2GB; else returns 0
 */
@@ -124,7 +102,6 @@ extern kmutex_t afs_global_lock;
 #define AfsLargeFileUio(uio)       ( (uio)->_uio_offset._p._u ? 1 : 0 )
 #undef AfsLargeFileSize
 #define AfsLargeFileSize(pos, off) ( ((offset_t)(pos)+(offset_t)(off) > (offset_t)0x7fffffff)?1:0)
-#endif
 
 #if defined(AFS_SUN510_ENV)
 #include "h/sunddi.h"
@@ -144,7 +121,17 @@ struct afs_ifinfo {
   int         metric;
   ipaddr_t    dstaddr;
 };
+#endif /* AFS_SUN510_ENV */
 
 #define osi_procname(procname, size) strncpy(procname, PTOU(ttoproc(curthread))->u_comm, size)
 
+static_inline void
+osi_GetTime(osi_timeval32_t *atv)
+{
+    struct timeval32 now;
+    uniqtime32(&now);
+    atv->tv_sec = now.tv_sec;
+    atv->tv_usec = now.tv_usec;
+}
+
 #endif /* _OSI_MACHDEP_H_ */