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>
31 #define osi_Time() time_second
36 #define AFS_UCRED ucred
37 #define AFS_PROC struct proc
39 #define afs_bufferpages bufpages
41 #define iodone biodone
44 #define osi_vnhold(avc,r) vref(AFSTOV(avc))
46 #define vSetVfsp(vc, vfsp) AFSTOV(vc)->v_mount = (vfsp)
48 #define vSetType(vc, type) AFSTOV(vc)->v_type = (type)
50 #define vType(vc) AFSTOV(vc)->v_type
53 #define gop_lookupname osi_lookupname
57 #define afs_strcat(s1, s2) strcat((s1), (s2))
61 #undef afs_osi_Alloc_NoSleep
62 #define afs_osi_Alloc_NoSleep(size) osi_fbsd_alloc((size), 0)
64 #define VN_RELE(vp) vrele(vp)
65 #define VN_HOLD(vp) VREF(vp)
69 #define IsAfsVnode(v) ((v)->v_op == &afs_vnodeops)
70 extern struct vop_vector afs_vnodeops;
74 #if defined(AFS_FBSD50_ENV)
77 #define v_flag v_vflag
78 #define osi_curcred() (curthread->td_ucred)
79 #define afs_suser(x) (!suser(curthread))
80 #define osi_getpid() (curthread->td_proc->p_pid)
81 #define simple_lock(x) mtx_lock(x)
82 #define simple_unlock(x) mtx_unlock(x)
83 #define gop_rdwr(rw,gp,base,len,offset,segflg,unit,cred,aresid) \
84 vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(unit),(cred),(cred),(aresid), curthread)
85 extern struct mtx afs_global_mtx;
86 #define AFS_GLOCK() mtx_lock(&afs_global_mtx)
87 #define AFS_GUNLOCK() mtx_unlock(&afs_global_mtx)
88 #define ISAFS_GLOCK() (mtx_owned(&afs_global_mtx))
91 extern struct lock afs_global_lock;
93 #define osi_curcred() (curproc->p_cred->pc_ucred)
94 #define afs_suser(x) (!suser(curproc))
95 #define osi_getpid() (curproc->p_pid)
96 #define gop_rdwr(rw,gp,base,len,offset,segflg,unit,cred,aresid) \
97 vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(unit),(cred),(aresid), curproc)
98 extern struct proc *afs_global_owner;
101 osi_Assert(curproc); \
102 lockmgr(&afs_global_lock, LK_EXCLUSIVE, 0, curproc); \
103 osi_Assert(afs_global_owner == 0); \
104 afs_global_owner = curproc; \
106 #define AFS_GUNLOCK() \
108 osi_Assert(curproc); \
109 osi_Assert(afs_global_owner == curproc); \
110 afs_global_owner = 0; \
111 lockmgr(&afs_global_lock, LK_RELEASE, 0, curproc); \
113 #define ISAFS_GLOCK() (afs_global_owner == curproc && curproc)
117 #define SPLVAR int splvar
119 #define NETPRI splvar=splnet()
121 #define USERPRI splx(splvar)
124 #define ifnet_flags(x) (x?(x)->if_flags:0)
126 #endif /* _OSI_MACHDEP_H_ */