Whamcloud - gitweb
b=20339 Remove LPSZ definition.
[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
20  * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
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 #ifdef __KERNEL__
41
42 /* Module parameter support */
43 #define CFS_MODULE_PARM(name, t, type, perm, desc)
44
45 #define CFS_SYSFS_MODULE_PARM    0 /* no sysfs access to module parameters */
46
47 #define LASSERT_SPIN_LOCKED(lock) do {} while(0)
48 #define LASSERT_SEM_LOCKED(sem) LASSERT(down_trylock(sem) != 0)
49
50 /* winnt panic */
51 void libcfs_panic(char *msg);
52 #define LIBCFS_PANIC(msg) libcfs_panic(msg)
53 void libcfs_register_panic_notifier();
54 void libcfs_unregister_panic_notifier();
55
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 #define printk_ratelimit()                      (FALSE)
76 #define vprintk(f, a)                           vDbgPrintEx(DPFLTR_IHVDRIVER_ID, DPFLTR_ERROR_LEVEL, f, a)
77                                                 /* vDbgPrintEx only available on xp and later OS */
78 #define cfs_assert                              ASSERT
79
80 #else  /* !__KERNEL__ */
81
82 # include <stdio.h>
83 # include <stdlib.h>
84 #ifdef __CYGWIN__
85 # include <cygwin-ioctl.h>
86 #endif
87 # include <time.h>
88 #include <crtdbg.h>
89
90 #define cfs_assert     _ASSERT
91
92 #ifndef get_cpu
93 #define cfs_get_cpu() cfs_smp_processor_id()
94 #define cfs_put_cpu() do { } while (0)
95 #else
96 #define cfs_get_cpu() get_cpu()
97 #define cfs_put_cpu() put_cpu()
98 #endif
99
100 #endif /* End of !__KERNEL__ */
101
102 /******************************************************************************/
103 /* Light-weight trace
104  * Support for temporary event tracing with minimal Heisenberg effect. */
105 #define LWT_SUPPORT  0
106
107 /* kernel hasn't defined this? */
108 typedef struct {
109         __s64      lwte_when;
110         char       *lwte_where;
111         void       *lwte_task;
112         long_ptr_t        lwte_p1;
113         long_ptr_t        lwte_p2;
114         long_ptr_t        lwte_p3;
115         long_ptr_t        lwte_p4;
116 # if BITS_PER_LONG > 32
117         long_ptr_t        lwte_pad;
118 # endif
119 } lwt_event_t;
120
121
122 # define LWT_EVENT(p1,p2,p3,p4)
123
124
125 /* ------------------------------------------------------------------ */
126
127 #define IOCTL_LIBCFS_TYPE long_ptr_t
128
129 #ifdef __CYGWIN__
130 # ifndef BITS_PER_LONG
131 #  if (~0UL) == 0xffffffffUL
132 #   define BITS_PER_LONG 32
133 #  else
134 #   define BITS_PER_LONG 64
135 #  endif
136 # endif
137 #endif
138
139 #if BITS_PER_LONG > 32
140 # define LI_POISON ((int)0x5a5a5a5a5a5a5a5a)
141 # define LL_POISON ((long_ptr_t)0x5a5a5a5a5a5a5a5a)
142 # define LP_POISON ((char *)(long_ptr_t)0x5a5a5a5a5a5a5a5a)
143 #else
144 # define LI_POISON ((int)0x5a5a5a5a)
145 # define LL_POISON ((long_ptr_t)0x5a5a5a5a)
146 # define LP_POISON ((char *)(long_ptr_t)0x5a5a5a5a)
147 #endif
148
149 #define LPF64 "%I64d"
150 #define LPU64 "%I64u"
151 #define LPD64 "%I64d"
152 #define LPX64 "%#I64x"
153
154 /*
155  * long_ptr_t & ulong_ptr_t, same to "long" for linux
156  */
157 #if _x86_
158 # define LPLU "%u"
159 # define LPLD "%d"
160 # define LPLX "%#x"
161 # define LPPID "%d"
162 #else
163 # define LPLU "%Ii64u"
164 # define LPLD "%I64d"
165 # define LPLX "%#I64x"
166 # define LPPID "%d"
167 #endif
168
169 #endif