Whamcloud - gitweb
57d450c3e367a7f5953090e67c344068077d75d3
[fs/lustre-release.git] / libcfs / include / libcfs / winnt / kp30.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  * GPL HEADER START
5  *
6  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 only,
10  * as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License version 2 for more details (a copy is included
16  * in the LICENSE file that accompanied this code).
17  *
18  * You should have received a copy of the GNU General Public License
19  * version 2 along with this program; If not, see [sun.com URL with a
20  * copy of GPLv2].
21  *
22  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23  * CA 95054 USA or visit www.sun.com if you need additional information or
24  * have any questions.
25  *
26  * GPL HEADER END
27  */
28 /*
29  * Copyright  2008 Sun Microsystems, Inc. All rights reserved
30  * Use is subject to license terms.
31  */
32 /*
33  * This file is part of Lustre, http://www.lustre.org/
34  * Lustre is a trademark of Sun Microsystems, Inc.
35  */
36
37 #ifndef __LIBCFS_WINNT_KP30_H__
38 #define __LIBCFS_WINNT_KP30_H__
39
40 #ifndef __LIBCFS_KP30_H__
41 #error Do not #include this file directly. #include <libcfs/libcfs.h> instead
42 #endif
43
44 #include <libcfs/winnt/portals_compat25.h>
45 #include <lnet/types.h>
46
47 #ifdef __KERNEL__
48
49 /* Module parameter support */
50 #define CFS_MODULE_PARM(name, t, type, perm, desc)
51
52 #define CFS_SYSFS_MODULE_PARM    0 /* no sysfs access to module parameters */
53
54
55 static inline void our_cond_resched()
56 {
57     schedule_timeout(1i64);
58 }
59
60 #ifdef CONFIG_SMP
61 #define LASSERT_SPIN_LOCKED(lock) do {} while(0) /* XXX */
62 #else
63 #define LASSERT_SPIN_LOCKED(lock) do {} while(0)
64 #endif
65
66 #error Need a winnt version of panic()
67 #define LIBCFS_PANIC(msg) KeBugCheckEx(msg, (ULONG_PTR)NULL, (ULONG_PTR)NULL, (ULONG_PTR)NULL, (ULONG_PTR)NULL)
68 #error libcfs_register_panic_notifier() missing
69 #error libcfs_unregister_panic_notifier() missing
70
71 #define cfs_work_struct_t WORK_QUEUE_ITEM
72 #define cfs_prepare_work(tq, routine, contex)
73 #define cfs_schedule_work(tq)
74 #define cfs_get_work_data(type,field,data)   (data)
75
76 /* ------------------------------------------------------------------- */
77
78 #define PORTAL_SYMBOL_REGISTER(x)               cfs_symbol_register(#x, &x)
79 #define PORTAL_SYMBOL_UNREGISTER(x)             cfs_symbol_unregister(#x)
80
81 #define PORTAL_SYMBOL_GET(x)                    (cfs_symbol_get(#x))
82 #define PORTAL_SYMBOL_PUT(x)                    cfs_symbol_put(#x)
83
84 #define PORTAL_MODULE_USE                       do{}while(0)
85 #define PORTAL_MODULE_UNUSE                     do{}while(0)
86
87 #define printk                                  DbgPrint
88 #define ptintf                                  DbgPrint
89
90 #else  /* !__KERNEL__ */
91
92 # include <stdio.h>
93 # include <stdlib.h>
94 #ifdef __CYGWIN__
95 # include <cygwin-ioctl.h>
96 #endif
97 # include <time.h>
98
99 #endif /* End of !__KERNEL__ */
100
101 /******************************************************************************/
102 /* Light-weight trace
103  * Support for temporary event tracing with minimal Heisenberg effect. */
104 #define LWT_SUPPORT  0
105
106 /* kernel hasn't defined this? */
107 typedef struct {
108         __s64      lwte_when;
109         char       *lwte_where;
110         void       *lwte_task;
111         long_ptr        lwte_p1;
112         long_ptr        lwte_p2;
113         long_ptr        lwte_p3;
114         long_ptr        lwte_p4;
115 # if BITS_PER_LONG > 32
116         long_ptr        lwte_pad;
117 # endif
118 } lwt_event_t;
119
120
121 # define LWT_EVENT(p1,p2,p3,p4)
122
123
124 /* ------------------------------------------------------------------ */
125
126 #define IOCTL_LIBCFS_TYPE long_ptr
127
128 #ifdef __CYGWIN__
129 # ifndef BITS_PER_LONG
130 #  if (~0UL) == 0xffffffffUL
131 #   define BITS_PER_LONG 32
132 #  else
133 #   define BITS_PER_LONG 64
134 #  endif
135 # endif
136 #endif
137
138 #if BITS_PER_LONG > 32
139 # define LI_POISON ((int)0x5a5a5a5a5a5a5a5a)
140 # define LL_POISON ((long_ptr)0x5a5a5a5a5a5a5a5a)
141 # define LP_POISON ((char *)(long_ptr)0x5a5a5a5a5a5a5a5a)
142 #else
143 # define LI_POISON ((int)0x5a5a5a5a)
144 # define LL_POISON ((long_ptr)0x5a5a5a5a)
145 # define LP_POISON ((char *)(long_ptr)0x5a5a5a5a)
146 #endif
147
148 #if defined(__x86_64__)
149 # define LPU64 "%I64u"
150 # define LPD64 "%I64d"
151 # define LPX64 "%I64x"
152 # define LPSZ  "%lu"
153 # define LPSSZ "%ld"
154 #elif (BITS_PER_LONG == 32 || __WORDSIZE == 32)
155 # define LPU64 "%I64u"
156 # define LPD64 "%I64d"
157 # define LPX64 "%I64x"
158 # define LPSZ  "%u"
159 # define LPSSZ "%d"
160 #elif (BITS_PER_LONG == 64 || __WORDSIZE == 64)
161 # define LPU64 "%I64u"
162 # define LPD64 "%I64d"
163 # define LPX64 "%I64x"
164 # define LPSZ  "%u"
165 # define LPSSZ "%d"
166 #endif
167 #ifndef LPU64
168 # error "No word size defined"
169 #endif
170
171 #endif