Whamcloud - gitweb
LU-5427 lbuild: Fix compilation with MPSS 3.3
[fs/lustre-release.git] / libcfs / include / libcfs / winnt / kp30.h
index 57d450c..1f3095b 100644 (file)
@@ -1,6 +1,4 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
  * GPL HEADER START
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -16,8 +14,8 @@
  * in the LICENSE file that accompanied this code).
  *
  * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see [sun.com URL with a
- * copy of GPLv2].
+ * version 2 along with this program; If not, see
+ * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
  *
  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  * CA 95054 USA or visit www.sun.com if you need additional information or
@@ -26,7 +24,7 @@
  * GPL HEADER END
  */
 /*
- * Copyright  2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  */
 /*
 #ifndef __LIBCFS_WINNT_KP30_H__
 #define __LIBCFS_WINNT_KP30_H__
 
-#ifndef __LIBCFS_KP30_H__
-#error Do not #include this file directly. #include <libcfs/libcfs.h> instead
-#endif
-
-#include <libcfs/winnt/portals_compat25.h>
-#include <lnet/types.h>
-
 #ifdef __KERNEL__
 
 /* Module parameter support */
 #define CFS_SYSFS_MODULE_PARM    0 /* no sysfs access to module parameters */
 
 
-static inline void our_cond_resched()
-{
-    schedule_timeout(1i64);
-}
+/* winnt panic */
+void libcfs_panic(char *msg);
+#define panic(msg) libcfs_panic(msg)
+void libcfs_register_panic_notifier();
+void libcfs_unregister_panic_notifier();
 
-#ifdef CONFIG_SMP
-#define LASSERT_SPIN_LOCKED(lock) do {} while(0) /* XXX */
-#else
-#define LASSERT_SPIN_LOCKED(lock) do {} while(0)
-#endif
-
-#error Need a winnt version of panic()
-#define LIBCFS_PANIC(msg) KeBugCheckEx(msg, (ULONG_PTR)NULL, (ULONG_PTR)NULL, (ULONG_PTR)NULL, (ULONG_PTR)NULL)
-#error libcfs_register_panic_notifier() missing
-#error libcfs_unregister_panic_notifier() missing
 
 #define cfs_work_struct_t WORK_QUEUE_ITEM
-#define cfs_prepare_work(tq, routine, contex)
 #define cfs_schedule_work(tq)
 #define cfs_get_work_data(type,field,data)   (data)
 
@@ -78,14 +59,18 @@ static inline void our_cond_resched()
 #define PORTAL_SYMBOL_REGISTER(x)               cfs_symbol_register(#x, &x)
 #define PORTAL_SYMBOL_UNREGISTER(x)             cfs_symbol_unregister(#x)
 
-#define PORTAL_SYMBOL_GET(x)                    (cfs_symbol_get(#x))
-#define PORTAL_SYMBOL_PUT(x)                    cfs_symbol_put(#x)
+#define symbol_get(x)                    (cfs_symbol_get(#x))
+#define symbol_put(x)                    cfs_symbol_put(#x)
 
-#define PORTAL_MODULE_USE                       do{}while(0)
-#define PORTAL_MODULE_UNUSE                     do{}while(0)
+#define try_module_get(THIS_MODULE)                       do{}while(0)
+#define module_put(THIS_MODULE)                     do{}while(0)
 
 #define printk                                  DbgPrint
 #define ptintf                                  DbgPrint
+#define printk_ratelimit()                      (FALSE)
+#define vprintk(f, a)                           vDbgPrintEx(DPFLTR_IHVDRIVER_ID, DPFLTR_ERROR_LEVEL, f, a)
+                                                /* vDbgPrintEx only available on xp and later OS */
+#define cfs_assert                              ASSERT
 
 #else  /* !__KERNEL__ */
 
@@ -95,35 +80,19 @@ static inline void our_cond_resched()
 # include <cygwin-ioctl.h>
 #endif
 # include <time.h>
+#include <crtdbg.h>
 
-#endif /* End of !__KERNEL__ */
-
-/******************************************************************************/
-/* Light-weight trace
- * Support for temporary event tracing with minimal Heisenberg effect. */
-#define LWT_SUPPORT  0
-
-/* kernel hasn't defined this? */
-typedef struct {
-        __s64      lwte_when;
-        char       *lwte_where;
-        void       *lwte_task;
-        long_ptr        lwte_p1;
-        long_ptr        lwte_p2;
-        long_ptr        lwte_p3;
-        long_ptr        lwte_p4;
-# if BITS_PER_LONG > 32
-        long_ptr        lwte_pad;
-# endif
-} lwt_event_t;
-
-
-# define LWT_EVENT(p1,p2,p3,p4)
+#define cfs_assert     _ASSERT
 
+#ifndef get_cpu
+#define get_cpu() smp_processor_id()
+#define put_cpu() do { } while (0)
+#else
+#endif
 
-/* ------------------------------------------------------------------ */
+#endif /* End of !__KERNEL__ */
 
-#define IOCTL_LIBCFS_TYPE long_ptr
+#define IOCTL_LIBCFS_TYPE long_ptr_t
 
 #ifdef __CYGWIN__
 # ifndef BITS_PER_LONG
@@ -137,35 +106,33 @@ typedef struct {
 
 #if BITS_PER_LONG > 32
 # define LI_POISON ((int)0x5a5a5a5a5a5a5a5a)
-# define LL_POISON ((long_ptr)0x5a5a5a5a5a5a5a5a)
-# define LP_POISON ((char *)(long_ptr)0x5a5a5a5a5a5a5a5a)
+# define LL_POISON ((long_ptr_t)0x5a5a5a5a5a5a5a5a)
+# define LP_POISON ((char *)(long_ptr_t)0x5a5a5a5a5a5a5a5a)
 #else
 # define LI_POISON ((int)0x5a5a5a5a)
-# define LL_POISON ((long_ptr)0x5a5a5a5a)
-# define LP_POISON ((char *)(long_ptr)0x5a5a5a5a)
+# define LL_POISON ((long_ptr_t)0x5a5a5a5a)
+# define LP_POISON ((char *)(long_ptr_t)0x5a5a5a5a)
 #endif
 
-#if defined(__x86_64__)
-# define LPU64 "%I64u"
-# define LPD64 "%I64d"
-# define LPX64 "%I64x"
-# define LPSZ  "%lu"
-# define LPSSZ "%ld"
-#elif (BITS_PER_LONG == 32 || __WORDSIZE == 32)
-# define LPU64 "%I64u"
-# define LPD64 "%I64d"
-# define LPX64 "%I64x"
-# define LPSZ  "%u"
-# define LPSSZ "%d"
-#elif (BITS_PER_LONG == 64 || __WORDSIZE == 64)
-# define LPU64 "%I64u"
-# define LPD64 "%I64d"
-# define LPX64 "%I64x"
-# define LPSZ  "%u"
-# define LPSSZ "%d"
-#endif
-#ifndef LPU64
-# error "No word size defined"
+#define LPF64 "%I64d"
+#define LPU64 "%I64u"
+#define LPD64 "%I64d"
+#define LPX64 "%#I64x"
+#define LPO64 "%#I64o"
+
+/*
+ * long_ptr_t & ulong_ptr_t, same to "long" for linux
+ */
+#if _x86_
+# define LPLU "%u"
+# define LPLD "%d"
+# define LPLX "%#x"
+# define LPPID "%d"
+#else
+# define LPLU "%Ii64u"
+# define LPLD "%I64d"
+# define LPLX "%#I64x"
+# define LPPID "%d"
 #endif
 
 #endif