reindent-20030715
[openafs.git] / src / afs / UKERNEL / 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  * Solaris 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 "afs/sysincludes.h"
22
23 #define MAX_OSI_PATH            1024
24 #define MAX_OSI_FILES           1024
25 #define MAX_OSI_LINKS           25
26 #define OSI_WAITHASH_SIZE       128     /* must be power of two */
27 #define MAX_HOSTADDR            32
28
29 #define AFS_UCRED usr_ucred
30
31 #define AFS_KALLOC(A)           afs_osi_Alloc(A)
32
33 /* 
34  * Time related macros
35  */
36 #define afs_hz      HZ
37 #define osi_Time() (time(NULL))
38
39 #define osi_vnhold(avc, r)  do { VN_HOLD(AFSTOV(avc)); } while(0)
40 #define afs_suser           suser
41
42 /*
43  * Global lock support.
44  */
45
46 extern usr_thread_t afs_global_owner;
47 extern usr_mutex_t afs_global_lock;
48
49 #define ISAFS_GLOCK() (usr_thread_self() == afs_global_owner)
50
51 #define AFS_GLOCK() \
52     do { \
53         usr_mutex_lock(&afs_global_lock); \
54         afs_global_owner = usr_thread_self(); \
55     } while(0)
56 #define AFS_GUNLOCK() \
57     do { \
58         AFS_ASSERT_GLOCK(); \
59         memset(&afs_global_owner, 0, sizeof(usr_thread_t)); \
60         usr_mutex_unlock(&afs_global_lock); \
61     } while(0)
62 #define AFS_ASSERT_GLOCK() \
63     do { if (!ISAFS_GLOCK()) { osi_Panic("afs global lock not held"); } } while(0)
64
65 extern int afs_bufferpages;
66
67 #endif /* _OSI_MACHDEP_H_ */