Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / libcfs / 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 #define cfs_get_work_data(type,field,data)   (data)
61
62 /* ------------------------------------------------------------------- */
63
64 #define PORTAL_SYMBOL_REGISTER(x)               cfs_symbol_register(#x, &x)
65 #define PORTAL_SYMBOL_UNREGISTER(x)             cfs_symbol_unregister(#x)
66
67 #define PORTAL_SYMBOL_GET(x)                    (cfs_symbol_get(#x))
68 #define PORTAL_SYMBOL_PUT(x)                    cfs_symbol_put(#x)
69
70 #define PORTAL_MODULE_USE                       do{}while(0)
71 #define PORTAL_MODULE_UNUSE                     do{}while(0)
72
73 #define printk                                  DbgPrint
74 #define ptintf                                  DbgPrint
75
76 #else  /* !__KERNEL__ */
77
78 # include <stdio.h>
79 # include <stdlib.h>
80 #ifdef __CYGWIN__
81 # include <cygwin-ioctl.h>
82 #endif
83 # include <time.h>
84
85 #endif /* End of !__KERNEL__ */
86
87 /******************************************************************************/
88 /* Light-weight trace
89  * Support for temporary event tracing with minimal Heisenberg effect. */
90 #define LWT_SUPPORT  0
91
92 /* kernel hasn't defined this? */
93 typedef struct {
94         __s64      lwte_when;
95         char       *lwte_where;
96         void       *lwte_task;
97         long_ptr        lwte_p1;
98         long_ptr        lwte_p2;
99         long_ptr        lwte_p3;
100         long_ptr        lwte_p4;
101 # if BITS_PER_LONG > 32
102         long_ptr        lwte_pad;
103 # endif
104 } lwt_event_t;
105
106
107 # define LWT_EVENT(p1,p2,p3,p4)
108
109
110 /* ------------------------------------------------------------------ */
111
112 #define IOCTL_LIBCFS_TYPE long_ptr
113
114 #ifdef __CYGWIN__
115 # ifndef BITS_PER_LONG
116 #  if (~0UL) == 0xffffffffUL
117 #   define BITS_PER_LONG 32
118 #  else
119 #   define BITS_PER_LONG 64
120 #  endif
121 # endif
122 #endif
123
124 #if BITS_PER_LONG > 32
125 # define LI_POISON ((int)0x5a5a5a5a5a5a5a5a)
126 # define LL_POISON ((long_ptr)0x5a5a5a5a5a5a5a5a)
127 # define LP_POISON ((char *)(long_ptr)0x5a5a5a5a5a5a5a5a)
128 #else
129 # define LI_POISON ((int)0x5a5a5a5a)
130 # define LL_POISON ((long_ptr)0x5a5a5a5a)
131 # define LP_POISON ((char *)(long_ptr)0x5a5a5a5a)
132 #endif
133
134 #if defined(__x86_64__)
135 # define LPU64 "%I64u"
136 # define LPD64 "%I64d"
137 # define LPX64 "%I64x"
138 # define LPSZ  "%lu"
139 # define LPSSZ "%ld"
140 #elif (BITS_PER_LONG == 32 || __WORDSIZE == 32)
141 # define LPU64 "%I64u"
142 # define LPD64 "%I64d"
143 # define LPX64 "%I64x"
144 # define LPSZ  "%u"
145 # define LPSSZ "%d"
146 #elif (BITS_PER_LONG == 64 || __WORDSIZE == 64)
147 # define LPU64 "%I64u"
148 # define LPD64 "%I64d"
149 # define LPX64 "%I64x"
150 # define LPSZ  "%u"
151 # define LPSSZ "%d"
152 #endif
153 #ifndef LPU64
154 # error "No word size defined"
155 #endif
156
157 #endif