cb347934c499df3c87b06ad35c20bf2c73fa68e7
[openafs.git] / src / afs / DUX / osi_machdep.h
1 /* Copyright (C) 1995 Transarc Corporation - All rights reserved. */
2 /*
3  *
4  * DUX OSI header file. Extends afs_osi.h.
5  *
6  * afs_osi.h includes this file, which is the only way this file should
7  * be included in a source file. This file can redefine macros declared in
8  * afs_osi.h.
9  */
10
11 #ifndef _OSI_MACHDEP_H_
12 #define _OSI_MACHDEP_H_
13
14 #include <kern/lock.h>
15 #include <kern/sched_prim.h>
16 #include <sys/unix_defs.h>
17
18 #define getpid()                u.u_procp->p_pid
19
20 /* 
21  * Time related macros
22  */
23 extern struct timeval time;
24 #define osi_Time() (time.tv_sec)
25 #define afs_hz      hz
26
27 #define PAGESIZE 8192
28
29 #define AFS_UCRED       ucred
30 #define AFS_PROC        struct proc
31
32 #define afs_bufferpages bufpages
33
34 #define osi_vnhold(avc,r)  do { \
35        if ((avc)->vrefCount) { VN_HOLD((struct vnode *)(avc)); } \
36        else osi_Panic("refcnt==0");  } while(0)
37
38 #define gop_rdwr(rw,gp,base,len,offset,segflg,unit,cred,aresid) \
39   vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(unit),(cred),(aresid))
40
41 #undef afs_suser
42
43 #ifdef KERNEL
44 extern simple_lock_data_t afs_global_lock;
45 extern thread_t afs_global_owner;
46 #define AFS_GLOCK() \
47     do { \
48         usimple_lock(&afs_global_lock); \
49         osi_Assert(afs_global_owner == (thread_t)0); \
50         afs_global_owner = current_thread(); \
51     } while (0)
52 #define AFS_GUNLOCK() \
53     do { \
54         osi_Assert(afs_global_owner == current_thread()); \
55         afs_global_owner = (thread_t)0; \
56         usimple_unlock(&afs_global_lock); \
57     } while(0)
58 #define ISAFS_GLOCK() (afs_global_owner == current_thread())
59 #define AFS_RXGLOCK()
60 #define AFS_RXGUNLOCK()
61 #define ISAFS_RXGLOCK() 1
62
63 #undef SPLVAR
64 #define SPLVAR
65 #undef NETPRI
66 #define NETPRI
67 #undef USERPRI
68 #define USERPRI
69 #endif /* KERNEL */
70
71 #endif /* _OSI_MACHDEP_H_ */