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