Whamcloud - gitweb
LU-1347 build: remove the vim/emacs modelines
[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 LASSERT_SPIN_LOCKED(lock) do {} while(0)
46 #define LASSERT_SEM_LOCKED(sem) LASSERT(down_trylock(sem) != 0)
47
48 /* winnt panic */
49 void libcfs_panic(char *msg);
50 #define LIBCFS_PANIC(msg) libcfs_panic(msg)
51 void libcfs_register_panic_notifier();
52 void libcfs_unregister_panic_notifier();
53
54
55 #define cfs_work_struct_t WORK_QUEUE_ITEM
56 #define cfs_prepare_work(tq, routine, contex)
57 #define cfs_schedule_work(tq)
58 #define cfs_get_work_data(type,field,data)   (data)
59
60 /* ------------------------------------------------------------------- */
61
62 #define PORTAL_SYMBOL_REGISTER(x)               cfs_symbol_register(#x, &x)
63 #define PORTAL_SYMBOL_UNREGISTER(x)             cfs_symbol_unregister(#x)
64
65 #define PORTAL_SYMBOL_GET(x)                    (cfs_symbol_get(#x))
66 #define PORTAL_SYMBOL_PUT(x)                    cfs_symbol_put(#x)
67
68 #define PORTAL_MODULE_USE                       do{}while(0)
69 #define PORTAL_MODULE_UNUSE                     do{}while(0)
70
71 #define printk                                  DbgPrint
72 #define ptintf                                  DbgPrint
73 #define printk_ratelimit()                      (FALSE)
74 #define vprintk(f, a)                           vDbgPrintEx(DPFLTR_IHVDRIVER_ID, DPFLTR_ERROR_LEVEL, f, a)
75                                                 /* vDbgPrintEx only available on xp and later OS */
76 #define cfs_assert                              ASSERT
77
78 #else  /* !__KERNEL__ */
79
80 # include <stdio.h>
81 # include <stdlib.h>
82 #ifdef __CYGWIN__
83 # include <cygwin-ioctl.h>
84 #endif
85 # include <time.h>
86 #include <crtdbg.h>
87
88 #define cfs_assert     _ASSERT
89
90 #ifndef get_cpu
91 #define cfs_get_cpu() cfs_smp_processor_id()
92 #define cfs_put_cpu() do { } while (0)
93 #else
94 #define cfs_get_cpu() get_cpu()
95 #define cfs_put_cpu() put_cpu()
96 #endif
97
98 #endif /* End of !__KERNEL__ */
99
100 /******************************************************************************/
101 /* Light-weight trace
102  * Support for temporary event tracing with minimal Heisenberg effect. */
103 #define LWT_SUPPORT  0
104
105 /* kernel hasn't defined this? */
106 typedef struct {
107         __s64      lwte_when;
108         char       *lwte_where;
109         void       *lwte_task;
110         long_ptr_t        lwte_p1;
111         long_ptr_t        lwte_p2;
112         long_ptr_t        lwte_p3;
113         long_ptr_t        lwte_p4;
114 # if BITS_PER_LONG > 32
115         long_ptr_t        lwte_pad;
116 # endif
117 } lwt_event_t;
118
119
120 # define LWT_EVENT(p1,p2,p3,p4)
121
122
123 /* ------------------------------------------------------------------ */
124
125 #define IOCTL_LIBCFS_TYPE long_ptr_t
126
127 #ifdef __CYGWIN__
128 # ifndef BITS_PER_LONG
129 #  if (~0UL) == 0xffffffffUL
130 #   define BITS_PER_LONG 32
131 #  else
132 #   define BITS_PER_LONG 64
133 #  endif
134 # endif
135 #endif
136
137 #if BITS_PER_LONG > 32
138 # define LI_POISON ((int)0x5a5a5a5a5a5a5a5a)
139 # define LL_POISON ((long_ptr_t)0x5a5a5a5a5a5a5a5a)
140 # define LP_POISON ((char *)(long_ptr_t)0x5a5a5a5a5a5a5a5a)
141 #else
142 # define LI_POISON ((int)0x5a5a5a5a)
143 # define LL_POISON ((long_ptr_t)0x5a5a5a5a)
144 # define LP_POISON ((char *)(long_ptr_t)0x5a5a5a5a)
145 #endif
146
147 #define LPF64 "%I64d"
148 #define LPU64 "%I64u"
149 #define LPD64 "%I64d"
150 #define LPX64 "%#I64x"
151 #define LPO64 "%#I64o"
152
153 /*
154  * long_ptr_t & ulong_ptr_t, same to "long" for linux
155  */
156 #if _x86_
157 # define LPLU "%u"
158 # define LPLD "%d"
159 # define LPLX "%#x"
160 # define LPPID "%d"
161 #else
162 # define LPLU "%Ii64u"
163 # define LPLD "%I64d"
164 # define LPLX "%#I64x"
165 # define LPPID "%d"
166 #endif
167
168 #endif