Whamcloud - gitweb
bdb16dc710f6baabc6d659bf3d064156aefae430
[fs/lustre-release.git] / libcfs / include / libcfs / winnt / kp30.h
1 /*
2  * GPL HEADER START
3  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 only,
8  * as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License version 2 for more details (a copy is included
14  * in the LICENSE file that accompanied this code).
15  *
16  * You should have received a copy of the GNU General Public License
17  * version 2 along with this program; If not, see
18  * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
19  *
20  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
21  * CA 95054 USA or visit www.sun.com if you need additional information or
22  * have any questions.
23  *
24  * GPL HEADER END
25  */
26 /*
27  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
28  * Use is subject to license terms.
29  */
30 /*
31  * This file is part of Lustre, http://www.lustre.org/
32  * Lustre is a trademark of Sun Microsystems, Inc.
33  */
34
35 #ifndef __LIBCFS_WINNT_KP30_H__
36 #define __LIBCFS_WINNT_KP30_H__
37
38 #ifdef __KERNEL__
39
40 /* Module parameter support */
41 #define CFS_MODULE_PARM(name, t, type, perm, desc)
42
43 #define CFS_SYSFS_MODULE_PARM    0 /* no sysfs access to module parameters */
44
45 #define CAP_CHOWN                   0
46 #define CAP_DAC_OVERRIDE            1
47 #define CAP_DAC_READ_SEARCH         2
48 #define CAP_FOWNER                  3
49 #define CAP_FSETID                  4
50 #define CAP_LINUX_IMMUTABLE         9
51 #define CAP_SYS_ADMIN              21
52 #define CAP_SYS_BOOT               23
53 #define CAP_SYS_RESOURCE           24
54
55 /* winnt panic */
56 void libcfs_panic(char *msg);
57 #define panic(msg) libcfs_panic(msg)
58 void libcfs_register_panic_notifier();
59 void libcfs_unregister_panic_notifier();
60
61
62 #define cfs_work_struct_t WORK_QUEUE_ITEM
63 #define cfs_schedule_work(tq)
64 #define cfs_get_work_data(type,field,data)   (data)
65
66 /* ------------------------------------------------------------------- */
67
68 #define PORTAL_SYMBOL_REGISTER(x)               cfs_symbol_register(#x, &x)
69 #define PORTAL_SYMBOL_UNREGISTER(x)             cfs_symbol_unregister(#x)
70
71 #define symbol_get(x)                    (cfs_symbol_get(#x))
72 #define symbol_put(x)                    cfs_symbol_put(#x)
73
74 #define try_module_get(THIS_MODULE)                       do{}while(0)
75 #define module_put(THIS_MODULE)                     do{}while(0)
76
77 #define printk                                  DbgPrint
78 #define ptintf                                  DbgPrint
79 #define printk_ratelimit()                      (FALSE)
80 #define vprintk(f, a)                           vDbgPrintEx(DPFLTR_IHVDRIVER_ID, DPFLTR_ERROR_LEVEL, f, a)
81                                                 /* vDbgPrintEx only available on xp and later OS */
82 #define cfs_assert                              ASSERT
83
84 #else  /* !__KERNEL__ */
85
86 # include <stdio.h>
87 # include <stdlib.h>
88 #ifdef __CYGWIN__
89 # include <cygwin-ioctl.h>
90 #endif
91 # include <time.h>
92 #include <crtdbg.h>
93
94 #define cfs_assert     _ASSERT
95
96 #ifndef get_cpu
97 #define get_cpu() smp_processor_id()
98 #define put_cpu() do { } while (0)
99 #else
100 #endif
101
102 #endif /* End of !__KERNEL__ */
103
104 /******************************************************************************/
105 /* Light-weight trace
106  * Support for temporary event tracing with minimal Heisenberg effect. */
107 #define LWT_SUPPORT  0
108
109 /* kernel hasn't defined this? */
110 typedef struct {
111         __s64      lwte_when;
112         char       *lwte_where;
113         void       *lwte_task;
114         long_ptr_t        lwte_p1;
115         long_ptr_t        lwte_p2;
116         long_ptr_t        lwte_p3;
117         long_ptr_t        lwte_p4;
118 # if BITS_PER_LONG > 32
119         long_ptr_t        lwte_pad;
120 # endif
121 } lwt_event_t;
122
123
124 # define LWT_EVENT(p1,p2,p3,p4)
125
126
127 /* ------------------------------------------------------------------ */
128
129 #define IOCTL_LIBCFS_TYPE long_ptr_t
130
131 #ifdef __CYGWIN__
132 # ifndef BITS_PER_LONG
133 #  if (~0UL) == 0xffffffffUL
134 #   define BITS_PER_LONG 32
135 #  else
136 #   define BITS_PER_LONG 64
137 #  endif
138 # endif
139 #endif
140
141 #if BITS_PER_LONG > 32
142 # define LI_POISON ((int)0x5a5a5a5a5a5a5a5a)
143 # define LL_POISON ((long_ptr_t)0x5a5a5a5a5a5a5a5a)
144 # define LP_POISON ((char *)(long_ptr_t)0x5a5a5a5a5a5a5a5a)
145 #else
146 # define LI_POISON ((int)0x5a5a5a5a)
147 # define LL_POISON ((long_ptr_t)0x5a5a5a5a)
148 # define LP_POISON ((char *)(long_ptr_t)0x5a5a5a5a)
149 #endif
150
151 #define LPF64 "%I64d"
152 #define LPU64 "%I64u"
153 #define LPD64 "%I64d"
154 #define LPX64 "%#I64x"
155 #define LPO64 "%#I64o"
156
157 /*
158  * long_ptr_t & ulong_ptr_t, same to "long" for linux
159  */
160 #if _x86_
161 # define LPLU "%u"
162 # define LPLD "%d"
163 # define LPLX "%#x"
164 # define LPPID "%d"
165 #else
166 # define LPLU "%Ii64u"
167 # define LPLD "%I64d"
168 # define LPLX "%#I64x"
169 # define LPPID "%d"
170 #endif
171
172 #endif