From c221b6562caccbb23e593e88c480bb3534dd150d Mon Sep 17 00:00:00 2001 From: Sean Hefty Date: Wed, 3 Feb 2010 16:57:05 -0800 Subject: [PATCH] winverbs: add debug output Signed-off-by: Sean Hefty --- trunk/core/winverbs/user/SOURCES | 78 ++++++------- trunk/core/winverbs/user/wv_base.h | 173 +++++++++++++++-------------- 2 files changed, 126 insertions(+), 125 deletions(-) diff --git a/trunk/core/winverbs/user/SOURCES b/trunk/core/winverbs/user/SOURCES index 6939d1e7..61e30e74 100644 --- a/trunk/core/winverbs/user/SOURCES +++ b/trunk/core/winverbs/user/SOURCES @@ -1,39 +1,39 @@ -!if $(FREEBUILD) -TARGETNAME = winverbs -!else -TARGETNAME = winverbsd -!endif - -TARGETPATH = ..\..\..\bin\user\obj$(BUILD_ALT_DIR) -TARGETTYPE = DYNLINK - -!if $(_NT_TOOLS_VERSION) == 0x700 -DLLDEF = $O\wv_exports.def -!else -DLLDEF = $(OBJ_PATH)\$O\wv_exports.def -!endif - -DLLENTRY = DllMain -USE_NTDLL = 1 - -SOURCES = \ - winverbs.rc \ - wv_main.cpp \ - wv_base.cpp \ - wv_cq.cpp \ - wv_device.cpp \ - wv_ep.cpp \ - wv_pd.cpp \ - wv_provider.cpp \ - wv_qp.cpp \ - wv_srq.cpp \ - wv_uverbs.cpp - -INCLUDES = ..;..\..\..\inc;..\..\..\inc\user; - -USER_C_FLAGS = $(USER_C_FLAGS) -DEXPORT_WV_SYMBOLS - -TARGETLIBS = \ - $(SDK_LIB_PATH)\kernel32.lib \ - $(SDK_LIB_PATH)\uuid.lib \ - $(SDK_LIB_PATH)\ws2_32.lib +!if $(FREEBUILD) +TARGETNAME = winverbs +!else +TARGETNAME = winverbsd +!endif + +TARGETPATH = ..\..\..\bin\user\obj$(BUILD_ALT_DIR) +TARGETTYPE = DYNLINK + +!if $(_NT_TOOLS_VERSION) == 0x700 +DLLDEF = $O\wv_exports.def +!else +DLLDEF = $(OBJ_PATH)\$O\wv_exports.def +!endif + +DLLENTRY = DllMain +USE_MSVCRT = 1 + +SOURCES = \ + winverbs.rc \ + wv_main.cpp \ + wv_base.cpp \ + wv_cq.cpp \ + wv_device.cpp \ + wv_ep.cpp \ + wv_pd.cpp \ + wv_provider.cpp \ + wv_qp.cpp \ + wv_srq.cpp \ + wv_uverbs.cpp + +INCLUDES = ..;..\..\..\inc;..\..\..\inc\user; + +USER_C_FLAGS = $(USER_C_FLAGS) -DEXPORT_WV_SYMBOLS + +TARGETLIBS = \ + $(SDK_LIB_PATH)\kernel32.lib \ + $(SDK_LIB_PATH)\uuid.lib \ + $(SDK_LIB_PATH)\ws2_32.lib diff --git a/trunk/core/winverbs/user/wv_base.h b/trunk/core/winverbs/user/wv_base.h index f37cf96b..c789371d 100644 --- a/trunk/core/winverbs/user/wv_base.h +++ b/trunk/core/winverbs/user/wv_base.h @@ -1,86 +1,87 @@ -/* - * Copyright (c) 2008 Intel Corporation. All rights reserved. - * - * This software is available to you under the OpenIB.org BSD license - * below: - * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: - * - * - Redistributions of source code must retain the above - * copyright notice, this list of conditions and the following - * disclaimer. - * - * - Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AWV - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#pragma once - -#ifndef _WV_BASE_H_ -#define _WV_BASE_H_ - -#include -#include -#include - -#include -#include - -HRESULT WvConvertIbStatus(ib_api_status_t status); -HRESULT WvConvertWSAStatus(int status); -HRESULT WvGetUserVerbs(HMODULE hLib, uvp_interface_t *pVerbs); - - -class CWVBase -{ -public: - CWVBase(); - ~CWVBase(); - STDMETHODIMP_(ULONG) AddRef(); - STDMETHODIMP_(ULONG) Release(); - - STDMETHODIMP Init(); - virtual void Delete() {}; - BOOL WvDeviceIoControl(HANDLE hDevice, DWORD dwIoControlCode, - LPVOID lpInBuffer, DWORD nInBufferSize, - LPVOID lpOutBuffer, DWORD nOutBufferSize, - LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped); - - HANDLE m_hFile; - volatile LONG m_nRef; - UINT64 m_Id; - -protected: - OVERLAPPED m_Overlap; - CRITICAL_SECTION m_CritSec; -}; - - -#if defined(_WIN64) - #define WvConvertSgl(pSgl, nSge) ((ib_local_ds_t *) pSgl) -#else - static inline ib_local_ds_t *WvConvertSgl(WV_SGE* pSgl, SIZE_T nSge) - { - SIZE_T n; - - for (n = 0; n < nSge; n++) { - pSgl[n].Reserved = 0; - } - return (ib_local_ds_t *) pSgl; - } -#endif (_WIN64) - -#endif // _WV_BASE_H_ +/* + * Copyright (c) 2008 Intel Corporation. All rights reserved. + * + * This software is available to you under the OpenIB.org BSD license + * below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AWV + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#pragma once + +#ifndef _WV_BASE_H_ +#define _WV_BASE_H_ + +#include +#include +#include +#include + +#include +#include + +HRESULT WvConvertIbStatus(ib_api_status_t status); +HRESULT WvConvertWSAStatus(int status); +HRESULT WvGetUserVerbs(HMODULE hLib, uvp_interface_t *pVerbs); + + +class CWVBase +{ +public: + CWVBase(); + ~CWVBase(); + STDMETHODIMP_(ULONG) AddRef(); + STDMETHODIMP_(ULONG) Release(); + + STDMETHODIMP Init(); + virtual void Delete() {}; + BOOL WvDeviceIoControl(HANDLE hDevice, DWORD dwIoControlCode, + LPVOID lpInBuffer, DWORD nInBufferSize, + LPVOID lpOutBuffer, DWORD nOutBufferSize, + LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped); + + HANDLE m_hFile; + volatile LONG m_nRef; + UINT64 m_Id; + +protected: + OVERLAPPED m_Overlap; + CRITICAL_SECTION m_CritSec; +}; + + +#if defined(_WIN64) + #define WvConvertSgl(pSgl, nSge) ((ib_local_ds_t *) pSgl) +#else + static inline ib_local_ds_t *WvConvertSgl(WV_SGE* pSgl, SIZE_T nSge) + { + SIZE_T n; + + for (n = 0; n < nSge; n++) { + pSgl[n].Reserved = 0; + } + return (ib_local_ds_t *) pSgl; + } +#endif (_WIN64) + +#endif // _WV_BASE_H_ -- 2.46.0