2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
11 * Solaris OSI header file. Extends afs_osi.h.
13 * afs_osi.h includes this file, which is the only way this file should
14 * be included in a source file. This file can redefine macros declared in
18 #ifndef _OSI_MACHDEP_H_
19 #define _OSI_MACHDEP_H_
21 #ifdef AFS_SUN57_64BIT_ENV
22 #include <sys/model.h> /* for get_udatamodel() */
25 #define getpid() curproc->p_pid
28 * The location of the NFSSRV module
29 * Used in osi_vfsops.c when checking to see if the nfssrv module is
32 #define NFSSRV "/kernel/misc/nfssrv"
33 #define NFSSRV_V9 "/kernel/misc/sparcv9/nfssrv"
34 #define NFSSRV_AMD64 "/kernel/misc/amd64/nfssrv"
36 typedef struct cred afs_ucred_t;
37 typedef struct proc afs_proc_t;
44 #define osi_Time() local_osi_Time()
45 extern void gethrestime(timespec_t *);
54 #define osi_Time() (hrestime.tv_sec)
58 # define osi_vnhold(avc, r) do { \
59 struct vnode *vp = AFSTOV(avc); \
62 mutex_enter(&vp->v_lock); \
63 prevcount = vp->v_count++; \
64 mutex_exit(&vp->v_lock); \
66 if (prevcount == 0) { \
67 VFS_HOLD(afs_globalVFS); \
70 #else /* !AFS_SUN58_ENV */
71 # define osi_vnhold(avc, r) do { VN_HOLD(AFSTOV(avc)); } while(0)
72 #endif /* !AFS_SUN58_ENV */
74 #define gop_rdwr(rw,gp,base,len,offset,segflg,ioflag,ulimit,cr,aresid) \
75 vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(ioflag),(ulimit),(cr),(aresid))
76 #define gop_lookupname(fnamep,segflg,followlink,compvpp) \
77 lookupname((fnamep),(segflg),(followlink),NULL,(compvpp))
78 #define gop_lookupname_user(fnamep,segflg,followlink,compvpp) \
79 lookupname((fnamep),(segflg),(followlink),NULL,(compvpp))
82 #if defined(AFS_SUN510_ENV)
83 #define afs_suser(x) afs_osi_suser(x)
85 #define afs_suser(x) suser(x)
89 * Global lock support.
91 #include <sys/mutex.h>
92 extern kmutex_t afs_global_lock;
94 #define AFS_GLOCK() mutex_enter(&afs_global_lock);
95 #define AFS_GUNLOCK() mutex_exit(&afs_global_lock);
96 #define ISAFS_GLOCK() mutex_owned(&afs_global_lock)
97 #define osi_InitGlock() \
98 mutex_init(&afs_global_lock, "afs_global_lock", MUTEX_DEFAULT, NULL);
102 /* Associate the Berkley signal equivalent lock types to System V's */
103 #define LOCK_SH 1 /* F_RDLCK */
104 #define LOCK_EX 2 /* F_WRLCK */
105 #define LOCK_NB 4 /* XXX */
106 #define LOCK_UN 8 /* F_UNLCK */
109 #define IO_APPEND FAPPEND
113 #define IO_SYNC FSYNC
116 #if defined(AFS_SUN56_ENV)
118 ** Macro returns 1 if file is larger than 2GB; else returns 0
120 #undef AfsLargeFileUio
121 #define AfsLargeFileUio(uio) ( (uio)->_uio_offset._p._u ? 1 : 0 )
122 #undef AfsLargeFileSize
123 #define AfsLargeFileSize(pos, off) ( ((offset_t)(pos)+(offset_t)(off) > (offset_t)0x7fffffff)?1:0)
126 #if defined(AFS_SUN510_ENV)
127 #include "h/sunddi.h"
128 extern ddi_taskq_t *afs_taskq;
129 extern krwlock_t afsifinfo_lock;
131 /* this should be in rx/SOLARIS/rx_knet.c accessed via accessor functions,
134 /* Global interface info struct */
136 char ifname[LIFNAMSIZ];
145 #define osi_procname(procname, size) strncpy(procname, PTOU(ttoproc(curthread))->u_comm, size)
147 #endif /* _OSI_MACHDEP_H_ */