1 /* Copyright (C) 1995 Transarc Corporation - All rights reserved. */
4 * Solaris OSI header file. Extends afs_osi.h.
6 * afs_osi.h includes this file, which is the only way this file should
7 * be included in a source file. This file can redefine macros declared in
11 #ifndef _OSI_MACHDEP_H_
12 #define _OSI_MACHDEP_H_
14 #ifdef AFS_SUN57_64BIT_ENV
15 #include <sys/model.h> /* for get_udatamodel() */
18 #define getpid() curproc->p_pid
21 * The location of the NFSSRV module
22 * Used in osi_vfsops.c when checking to see if the nfssrv module is
25 #define NFSSRV "/kernel/misc/nfssrv"
26 #define NFSSRV_V9 "/kernel/misc/sparcv9/nfssrv"
28 #define AFS_UCRED cred
29 #define AFS_PROC struct proc
35 #define osi_Time() (hrestime.tv_sec)
37 #undef afs_osi_Alloc_NoSleep
38 extern void *afs_osi_Alloc_NoSleep(size_t size);
40 #define osi_vnhold(avc, r) do { VN_HOLD((struct vnode *)(avc)); } while(0)
41 #define gop_rdwr(rw,gp,base,len,offset,segflg,ioflag,ulimit,cr,aresid) \
42 vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(ioflag),(ulimit),(cr),(aresid))
44 #define afs_suser suser
49 * Global lock support.
51 #include <sys/mutex.h>
52 extern kmutex_t afs_global_lock;
53 extern kmutex_t afs_rxglobal_lock;
55 #define AFS_GLOCK() mutex_enter(&afs_global_lock);
56 #define AFS_GUNLOCK() mutex_exit(&afs_global_lock);
57 #define ISAFS_GLOCK() mutex_owned(&afs_global_lock)
60 #define AFS_RXGUNLOCK()
61 #define ISAFS_RXGLOCK() 1
65 /* Associate the Berkley signal equivalent lock types to System V's */
66 #define LOCK_SH 1 /* F_RDLCK */
67 #define LOCK_EX 2 /* F_WRLCK */
68 #define LOCK_NB 4 /* XXX */
69 #define LOCK_UN 8 /* F_UNLCK */
72 #define IO_APPEND FAPPEND
79 #if defined(AFS_SUN56_ENV)
81 ** Macro returns 1 if file is larger than 2GB; else returns 0
83 #undef AfsLargeFileUio
84 #define AfsLargeFileUio(uio) ( (uio)->_uio_offset._p._u ? 1 : 0 )
85 #undef AfsLargeFileSize
86 #define AfsLargeFileSize(pos, off) ( ((offset_t)(pos)+(offset_t)(off) > (offset_t)MAXOFF_T)?1:0)
89 #endif /* _OSI_MACHDEP_H_ */