Make typedefs of AFS_UCRED and AFS_PROC with renaming
[openafs.git] / src / afs / NBSD / 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  *
12  * DUX OSI header file. Extends afs_osi.h.
13  *
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
16  * afs_osi.h.
17  */
18
19 #ifndef _OSI_MACHDEP_H_
20 #define _OSI_MACHDEP_H_
21
22 #include <sys/lock.h>
23 /* #include <kern/sched_prim.h> */
24 /* #include <sys/unix_defs.h> */
25
26 #define getpid()                curproc
27
28 /* 
29  * Time related macros
30  */
31 extern struct timeval time;
32 #define osi_Time() (time.tv_sec)
33 #define afs_hz      hz
34
35 typedef struct ucred afs_ucred_t;
36 typedef struct proc afs_proc_t;
37
38 #define afs_bufferpages bufpages
39
40 #undef gop_lookupname
41 #define gop_lookupname(fnamep,segflg,followlink,compvpp) lookupname((fnamep),(segflg),(followlink),NULL,(compvpp))
42 #undef gop_lookupname_user
43 #define gop_lookupname_user(fnamep,segflg,followlink,compvpp) lookupname((fnamep),(segflg),(followlink),NULL,(compvpp))
44
45 #define osi_vnhold(avc,r)  do { \
46        if ((avc)->vrefCount) { VN_HOLD((struct vnode *)(avc)); } \
47        else osi_Panic("refcnt==0");  } while(0)
48
49 #define gop_rdwr(rw,gp,base,len,offset,segflg,unit,cred,aresid) \
50   vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(unit),(cred),(aresid), curproc)
51
52 #undef afs_suser
53
54 #ifdef KERNEL
55 extern struct simplelock afs_global_lock;
56 #if 0
57 extern thread_t afs_global_owner;
58 #define AFS_GLOCK() \
59     do { \
60         usimple_lock(&afs_global_lock); \
61         osi_Assert(afs_global_owner == (thread_t)0); \
62         afs_global_owner = current_thread(); \
63     } while (0)
64 #define AFS_GUNLOCK() \
65     do { \
66         osi_Assert(afs_global_owner == current_thread()); \
67         afs_global_owner = (thread_t)0; \
68         usimple_unlock(&afs_global_lock); \
69     } while(0)
70 #define ISAFS_GLOCK() (afs_global_owner == current_thread())
71 #else
72 #define AFS_GLOCK() \
73     do { \
74         simple_lock(&afs_global_lock); \
75     } while (0)
76 #define AFS_GUNLOCK() \
77     do { \
78         simple_unlock(&afs_global_lock); \
79     } while(0)
80 #endif /* 0 */
81
82 #undef SPLVAR
83 #define SPLVAR
84 #undef NETPRI
85 #define NETPRI
86 #undef USERPRI
87 #define USERPRI
88 #endif /* KERNEL */
89
90 #endif /* _OSI_MACHDEP_H_ */