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 /* #include <kern/sched_prim.h> */
25 /* #include <sys/unix_defs.h> */
27 #ifndef AFS_FBSD50_ENV
28 #define getpid() curproc
30 extern struct simplelock afs_rxglobal_lock;
35 #define osi_Time() time_second
40 #define AFS_UCRED ucred
41 #define AFS_PROC struct proc
43 #define osi_curcred() (curthread->td_ucred)
45 #define osi_curcred() (curproc->p_cred->pc_ucred)
48 #define afs_bufferpages bufpages
50 #define osi_vnhold(avc,r) do { VN_HOLD((struct vnode *)(avc)); } while (0)
53 #define gop_lookupname osi_lookupname
58 extern struct lock afs_global_lock;
60 #if defined(AFS_FBSD50_ENV)
63 #define v_flag v_vflag
64 #define afs_suser() (!suser(curthread))
65 #define simple_lock(x) mtx_lock(x)
66 #define simple_unlock(x) mtx_unlock(x)
67 #define gop_rdwr(rw,gp,base,len,offset,segflg,unit,cred,aresid) \
68 vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(unit),(cred),(cred),(aresid), curthread)
69 extern struct thread * afs_global_owner;
72 osi_Assert(curthread); \
73 lockmgr(&afs_global_lock, LK_EXCLUSIVE, 0, curthread); \
74 osi_Assert(afs_global_owner == 0); \
75 afs_global_owner = curthread; \
77 #define AFS_GUNLOCK() \
79 osi_Assert(curthread); \
80 osi_Assert(afs_global_owner == curthread); \
81 afs_global_owner = 0; \
82 lockmgr(&afs_global_lock, LK_RELEASE, 0, curthread); \
84 #define ISAFS_GLOCK() (afs_global_owner == curthread && curthread)
88 #define gop_rdwr(rw,gp,base,len,offset,segflg,unit,cred,aresid) \
89 vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(unit),(cred),(aresid), curproc)
90 extern struct proc * afs_global_owner;
93 osi_Assert(curproc); \
94 lockmgr(&afs_global_lock, LK_EXCLUSIVE, 0, curproc); \
95 osi_Assert(afs_global_owner == 0); \
96 afs_global_owner = curproc; \
98 #define AFS_GUNLOCK() \
100 osi_Assert(curproc); \
101 osi_Assert(afs_global_owner == curproc); \
102 afs_global_owner = 0; \
103 lockmgr(&afs_global_lock, LK_RELEASE, 0, curproc); \
105 #define ISAFS_GLOCK() (afs_global_owner == curproc && curproc)
108 #define AFS_RXGLOCK()
109 #define AFS_RXGUNLOCK()
110 #define ISAFS_RXGLOCK() 1
113 #define SPLVAR int splvar
115 #define NETPRI splvar=splnet()
117 #define USERPRI splx(splvar)
120 #endif /* _OSI_MACHDEP_H_ */