X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=libcfs%2Finclude%2Flibcfs%2Fwinnt%2Fkp30.h;h=940bf482716035f769ad5f2a40248e5cef15a59a;hp=779d8be68d7c00d298fd1b73e5b58c514852aabc;hb=c8616363809a73b3d4b6c736e6b55a84d7f137b4;hpb=e1b3d71a27c166bebd26ab33f7299c41bd75dab5 diff --git a/libcfs/include/libcfs/winnt/kp30.h b/libcfs/include/libcfs/winnt/kp30.h index 779d8be..940bf48 100644 --- a/libcfs/include/libcfs/winnt/kp30.h +++ b/libcfs/include/libcfs/winnt/kp30.h @@ -1,35 +1,42 @@ -/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil; -*- - * vim:expandtab:shiftwidth=4:tabstop=4: +/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- + * vim:expandtab:shiftwidth=8:tabstop=8: * - * Copyright (C) 2004 Cluster File Systems, Inc. + * GPL HEADER START * - * This file is part of Lustre, http://www.lustre.org. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Lustre is free software; you can redistribute it and/or modify it under the - * terms of version 2 of the GNU General Public License as published by the - * Free Software Foundation. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 only, + * as published by the Free Software Foundation. * - * Lustre is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License version 2 for more details (a copy is included + * in the LICENSE file that accompanied this code). * - * You should have received a copy of the GNU General Public License along - * with Lustre; if not, write to the Free Software Foundation, Inc., 675 Mass - * Ave, Cambridge, MA 02139, USA. + * You should have received a copy of the GNU General Public License + * 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 + * have any questions. + * + * GPL HEADER END + */ +/* + * Copyright 2008 Sun Microsystems, Inc. All rights reserved + * Use is subject to license terms. + */ +/* + * This file is part of Lustre, http://www.lustre.org/ + * Lustre is a trademark of Sun Microsystems, Inc. */ #ifndef __LIBCFS_WINNT_KP30_H__ #define __LIBCFS_WINNT_KP30_H__ -#ifndef __LIBCFS_KP30_H__ -#error Do not #include this file directly. #include instead -#endif - -#include -#include - #ifdef __KERNEL__ /* Module parameter support */ @@ -37,22 +44,18 @@ #define CFS_SYSFS_MODULE_PARM 0 /* no sysfs access to module parameters */ +#define cond_resched our_cond_resched +void our_cond_resched(); -static inline void our_cond_resched() -{ - schedule_timeout(1i64); -} - -#ifdef CONFIG_SMP -#define LASSERT_SPIN_LOCKED(lock) do {} while(0) /* XXX */ -#else #define LASSERT_SPIN_LOCKED(lock) do {} while(0) -#endif +#define LASSERT_SEM_LOCKED(sem) LASSERT(down_trylock(sem) != 0) + +/* winnt panic */ +void libcfs_panic(char *msg); +#define LIBCFS_PANIC(msg) libcfs_panic(msg) +void libcfs_register_panic_notifier(); +void libcfs_unregister_panic_notifier(); -#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) @@ -72,6 +75,10 @@ static inline void our_cond_resched() #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__ */ @@ -81,6 +88,9 @@ static inline void our_cond_resched() # include #endif # include +#include + +#define cfs_assert _ASSERT #endif /* End of !__KERNEL__ */ @@ -94,12 +104,12 @@ 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; + long_ptr_t lwte_p1; + long_ptr_t lwte_p2; + long_ptr_t lwte_p3; + long_ptr_t lwte_p4; # if BITS_PER_LONG > 32 - long_ptr lwte_pad; + long_ptr_t lwte_pad; # endif } lwt_event_t; @@ -109,7 +119,7 @@ typedef struct { /* ------------------------------------------------------------------ */ -#define IOCTL_LIBCFS_TYPE long_ptr +#define IOCTL_LIBCFS_TYPE long_ptr_t #ifdef __CYGWIN__ # ifndef BITS_PER_LONG @@ -123,35 +133,34 @@ 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 LPSZ "%lu" +#define LPSSZ "%ld" + +/* + * 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