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
12 * FBSD OSI header file. Extends afs_osi.h.
14 * afs_osi.h includes this file, which is the only way this file should
15 * be included in a source file. This file can redefine macros declared in
19 #ifndef _OSI_MACHDEP_H_
20 #define _OSI_MACHDEP_H_
24 #if defined(AFS_FBSD50_ENV)
25 #include <sys/mutex.h>
28 extern struct simplelock afs_rxglobal_lock;
33 #define osi_Time() time_second
38 #define AFS_UCRED ucred
39 #define AFS_PROC struct proc
41 #define afs_bufferpages bufpages
43 #define iodone biodone
46 #define osi_vnhold(avc,r) vref(AFSTOV(avc))
48 #define vSetVfsp(vc, vfsp) AFSTOV(vc)->v_mount = (vfsp)
50 #define vSetType(vc, type) AFSTOV(vc)->v_type = (type)
52 #define vType(vc) AFSTOV(vc)->v_type
55 #define gop_lookupname osi_lookupname
59 #define afs_strcat(s1, s2) strcat((s1), (s2))
63 #undef afs_osi_Alloc_NoSleep
64 #define afs_osi_Alloc_NoSleep(size) osi_fbsd_alloc((size), 0)
66 #define VN_RELE(vp) vrele(vp)
67 #define VN_HOLD(vp) VREF(vp)
69 #if defined(AFS_FBSD50_ENV)
72 #define v_flag v_vflag
73 #define osi_curcred() (curthread->td_ucred)
74 #define afs_suser(x) (!suser(curthread))
75 #define simple_lock(x) mtx_lock(x)
76 #define simple_unlock(x) mtx_unlock(x)
77 #define gop_rdwr(rw,gp,base,len,offset,segflg,unit,cred,aresid) \
78 vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(unit),(cred),(cred),(aresid), curthread)
79 extern struct mtx afs_global_mtx;
80 #define AFS_GLOCK() mtx_lock(&afs_global_mtx)
81 #define AFS_GUNLOCK() mtx_unlock(&afs_global_mtx)
82 #define ISAFS_GLOCK() (mtx_owned(&afs_global_mtx))
85 extern struct lock afs_global_lock;
87 #define osi_curcred() (curproc->p_cred->pc_ucred)
88 #define afs_suser(x) (!suser(curproc))
89 #define getpid() curproc
90 #define gop_rdwr(rw,gp,base,len,offset,segflg,unit,cred,aresid) \
91 vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(unit),(cred),(aresid), curproc)
92 extern struct proc *afs_global_owner;
95 osi_Assert(curproc); \
96 lockmgr(&afs_global_lock, LK_EXCLUSIVE, 0, curproc); \
97 osi_Assert(afs_global_owner == 0); \
98 afs_global_owner = curproc; \
100 #define AFS_GUNLOCK() \
102 osi_Assert(curproc); \
103 osi_Assert(afs_global_owner == curproc); \
104 afs_global_owner = 0; \
105 lockmgr(&afs_global_lock, LK_RELEASE, 0, curproc); \
107 #define ISAFS_GLOCK() (afs_global_owner == curproc && curproc)
110 #define AFS_RXGLOCK()
111 #define AFS_RXGUNLOCK()
112 #define ISAFS_RXGLOCK() 1
115 #define SPLVAR int splvar
117 #define NETPRI splvar=splnet()
119 #define USERPRI splx(splvar)
122 #endif /* _OSI_MACHDEP_H_ */