78b2630d066a9dff88dc1cfe8b437f2ea1d93ec8
[openafs.git] / src / afs / DUX / osi_machdep.h
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  * 
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
8  */
9
10 /*
11  * DUX OSI header file. Extends afs_osi.h.
12  *
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
15  * afs_osi.h.
16  */
17
18 #ifndef _OSI_MACHDEP_H_
19 #define _OSI_MACHDEP_H_
20
21 #include <kern/lock.h>
22 #include <kern/sched_prim.h>
23 #include <sys/unix_defs.h>
24
25 #define getpid()                u.u_procp->p_pid
26
27 /* 
28  * Time related macros
29  */
30 extern struct timeval time;
31 #define osi_Time() (time.tv_sec)
32 #define afs_hz      hz
33
34 #define PAGESIZE 8192
35
36 #define AFS_UCRED       ucred
37 #define AFS_PROC        struct proc
38
39 #define afs_bufferpages bufpages
40
41 #define osi_vnhold(avc,r)  do { \
42        if ((avc)->vrefCount) { VN_HOLD(AFSTOV(avc)); } \
43        else osi_Panic("refcnt==0");  } while(0)
44
45 #define gop_rdwr(rw,gp,base,len,offset,segflg,unit,cred,aresid) \
46   vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(unit),(cred),(aresid))
47
48 #undef afs_suser
49
50 #ifdef KERNEL
51 extern simple_lock_data_t afs_global_lock;
52 extern thread_t afs_global_owner;
53 #define AFS_GLOCK() \
54     do { \
55         usimple_lock(&afs_global_lock); \
56         osi_Assert(afs_global_owner == (thread_t)0); \
57         afs_global_owner = current_thread(); \
58     } while (0)
59 #define AFS_GUNLOCK() \
60     do { \
61         osi_Assert(afs_global_owner == current_thread()); \
62         afs_global_owner = (thread_t)0; \
63         usimple_unlock(&afs_global_lock); \
64     } while(0)
65 #define ISAFS_GLOCK() (afs_global_owner == current_thread())
66 #define AFS_RXGLOCK()
67 #define AFS_RXGUNLOCK()
68 #define ISAFS_RXGLOCK() 1
69
70 #undef SPLVAR
71 #define SPLVAR
72 #undef NETPRI
73 #define NETPRI
74 #undef USERPRI
75 #define USERPRI
76 #endif /* KERNEL */
77
78 #endif /* _OSI_MACHDEP_H_ */