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 * MACOS 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 XAFS_DARWIN_ENV
24 typedef unsigned short etap_event_t;
29 #include <kern/thread.h>
32 #define getpid() current_proc()->p_pid
33 #define getppid() current_proc()->p_pptr->p_pid
35 #define gop_lookupname osi_lookupname
39 /* vcexcl - used only by afs_create */
40 enum vcexcl { EXCL, NONEXCL } ;
45 extern struct timeval time;
46 #define osi_Time() (time.tv_sec)
51 #define AFS_UCRED ucred
53 #define AFS_PROC struct proc
55 #define osi_vnhold(avc,r) do { \
56 if ((avc)->vrefCount) { VN_HOLD(&((avc)->v)); } \
57 else (avc)->vrefCount = 1; } while(0)
59 #define gop_rdwr(rw,gp,base,len,offset,segflg,unit,cred,aresid) \
60 vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(unit),(cred),(aresid),current_proc())
65 extern thread_t afs_global_owner;
66 /* simple locks cannot be used since sleep can happen at any time */
67 /* Should probably use mach locks rather than bsd locks, since we use the
68 mach thread control api's elsewhere (mach locks not used for consistency
69 with rx, since rx needs lock_write_try() in order to use mach locks
71 extern struct lock__bsd__ afs_global_lock;
74 lockmgr(&afs_global_lock, LK_EXCLUSIVE, 0, current_proc()); \
75 osi_Assert(afs_global_owner == 0); \
76 afs_global_owner = current_thread(); \
78 #define AFS_GUNLOCK() \
80 osi_Assert(afs_global_owner == current_thread()); \
81 afs_global_owner = 0; \
82 lockmgr(&afs_global_lock, LK_RELEASE, 0, current_proc()); \
84 #define ISAFS_GLOCK() (afs_global_owner == current_thread())
86 #define AFS_RXGUNLOCK()
87 #define ISAFS_RXGLOCK() 1
96 #define NETPRI x=splnet();
98 #define USERPRI splx(x);
101 #define AFS_APPL_UFS_CACHE 1
102 #define AFS_APPL_HFS_CACHE 2
104 extern ino_t VnodeToIno(vnode_t *vp);
105 extern dev_t VnodeToDev(vnode_t *vp);
109 #endif /* _OSI_MACHDEP_H_ */