ciop.cpp
来自「PGP8.0源码 请认真阅读您的文件包然后写出其具体功能」· C++ 代码 · 共 122 行
CPP
122 行
/*____________________________________________________________________________
Copyright (C) 2002 PGP Corporation
All rights reserved.
$Id: CIop.cpp,v 1.2 2002/08/06 20:09:30 dallen Exp $
____________________________________________________________________________*/
#include "pgpClassesConfig.h"
#include "CDriverSubsystemsDrv98.h"
#include "CIop.h"
#include "CIosInterface.h"
_USING_PGP
// Types
typedef void (__cdecl *IopCallbackFuncType)(PIOP);
// Class CIop member functions
CIop::CIop() : mWeCreated(FALSE), mIop(NULL)
{
}
CIop::CIop(PIOP pIop) : mWeCreated(FALSE), mIop(pIop)
{
pgpAssertAddrValid(pIop, IOP);
}
CIop::~CIop()
{
if (WeCreated())
Destroy();
}
PGPBoolean
CIop::DoIlbCriteria() const
{
return CDriverSubsystemsDrv98::IosInterface().IlbIoCriteria(&Ior());
}
PGPBoolean
CIop::DoInternalIlbCriteria() const
{
return CDriverSubsystemsDrv98::IosInterface().IlbIntIoCriteria(mIop);
}
CComboError
CIop::Create(PVRP pVrp, PGPUInt8 flags)
{
pgpAssert(!WeCreated());
CComboError error;
mSize = static_cast<PGPUInt16>(pVrp->VRP_max_req_size +
(pVrp->VRP_max_sgd * sizeof(SGD)));
mOffset = static_cast<PGPUInt16>(pVrp->VRP_delta_to_ior);
mIop = CDriverSubsystemsDrv98::IosInterface().IspCreateIop(mSize,
mOffset, ISP_M_FL_INTERRUPT_TIME);
if (IsNull(mIop))
error.pgpErr = kPGPError_VolumeOpFailed;
if (error.IsntError())
{
mWeCreated = TRUE;
Timer() = kDefaultIopTimeout;
TimerOrig() = kDefaultIopTimeout;
Next() = NULL;
Status() = 0;
Flags() = IORF_VERSION_002;
Callback() = NULL;
PrivatePort() = kPGPdiskIopMagic;
SgdLinPhys() = reinterpret_cast<PSGD>(&Ior() + 1);
NumSgds() = 0;
}
return error;
}
void
CIop::Destroy()
{
pgpAssert(WeCreated());
CDriverSubsystemsDrv98::IosInterface().IspDeallocMem((PGPUInt8 *) &Ior() -
mOffset);
mIop = NULL;
mWeCreated = FALSE;
}
void
CIop::SendCommand(const PDCB pDcb) const
{
pgpAssertAddrValid(pDcb, DCB);
__asm push edi
IOS_SendCommand(&Ior(), const_cast<PDCB>(pDcb));
__asm pop edi
}
void
CIop::Callback(PGPUInt16 status) const
{
Status() = status;
--CallbackPtr();
IopCallbackFuncType callbackFunc =
reinterpret_cast<IopCallbackFuncType>(
CallbackPtr()->IOP_CB_address);
callbackFunc(mIop);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?