コード例 #1
0
ファイル: ndasobject.cpp プロジェクト: yzx65/ndas4windows
UINT32
CMirDiskObject::GetNDASMediaType() const
{
	if(::IsEmptyDisk(FirstDisk()))
	{
		if(::IsEmptyDisk(SecondDisk()))
			return NMT_INVALID;
		else
		{
			CUnitDiskObjectPtr unitDisk = 
				boost::dynamic_pointer_cast<CUnitDiskObject>(SecondDisk());
			CUnitDiskInfoHandlerPtr unitHandler = unitDisk->GetInfoHandler();

			return unitHandler->GetNDASMediaType();
		}
	}
	else
	{
		CUnitDiskObjectPtr unitDisk = 
			boost::dynamic_pointer_cast<CUnitDiskObject>(FirstDisk());
		CUnitDiskInfoHandlerPtr unitHandler = unitDisk->GetInfoHandler();

		return unitHandler->GetNDASMediaType();
	}
}
コード例 #2
0
ファイル: ndasobject.cpp プロジェクト: yzx65/ndas4windows
void CMirDiskObject::MigrateV1()
{
	if(::IsEmptyDisk(FirstDisk()) || ::IsEmptyDisk(SecondDisk()))
		return;
	//
	// To migrate, all the disks in the bound must exist
	// In version 1, only 2 disks can be bound.
	//
	ATLASSERT( GetDiskCount() == 2 );
//	CUnitDiskObjectPtr firstDisk, secondDisk;
	CUnitDiskObjectVector vtDisks;
	
//	firstDisk = boost::dynamic_pointer_cast<CUnitDiskObject>( front() );
//	secondDisk = boost::dynamic_pointer_cast<CUnitDiskObject>( back() );
	vtDisks.push_back( FirstDisk() );
	vtDisks.push_back( SecondDisk() );

	//
	// Unbind disks & bind again with version 2 information
	// 
	FirstDisk()->UnBind( FirstDisk() );
	SecondDisk()->UnBind( SecondDisk() );

	FirstDisk()->Bind( vtDisks, 0, NMT_RAID1 );
	SecondDisk()->Bind( vtDisks, 1, NMT_RAID1 );

}
コード例 #3
0
ファイル: ndasobject.cpp プロジェクト: yzx65/ndas4windows
_int64 CMirDiskObject::GetUserSectorCount() const
{
	if(!::IsEmptyDisk(FirstDisk()))
	{
		return FirstDisk()->GetUserSectorCount();
	}

	if(!::IsEmptyDisk(SecondDisk()))
	{
		return SecondDisk()->GetUserSectorCount();
	}

	return 0;
}
コード例 #4
0
ファイル: ndasobject.cpp プロジェクト: yzx65/ndas4windows
BOOL CMirDiskObject::IsBroken() const
{
	if(!FirstDisk()->IsUsable() || !SecondDisk()->IsUsable())
		return TRUE;

	return FALSE;
}
コード例 #5
0
ファイル: ndasobject.cpp プロジェクト: yzx65/ndas4windows
BOOL CMirDiskObject::IsUsable() const
{
	// If at least one disk is usable, we can still use mirror.
	if(FirstDisk()->IsUsable() || SecondDisk()->IsUsable())
		return TRUE;
	
	return FALSE;
}
コード例 #6
0
BOOL CMirDiskObject::GetDirtyDiskStatus(BOOL *pbFirstDefected, BOOL *pbSecondDefected) const
{
	BOOL bResults;
	LAST_WRITTEN_SECTOR FirstLWS, SecondLWS;

	*pbFirstDefected = FALSE;
	*pbSecondDefected = FALSE;

	if(::IsEmptyDisk(FirstDisk()) || ::IsEmptyDisk(SecondDisk()))
		return 0;

	CUnitDiskInfoHandlerPtr Firsthandler = FirstDisk()->GetInfoHandler();
	CUnitDiskInfoHandlerPtr Secondhandler = SecondDisk()->GetInfoHandler();

	bResults = Firsthandler->GetLastWrittenSectorInfo(&FirstLWS);
	if(!bResults) return FALSE;
	bResults = Secondhandler->GetLastWrittenSectorInfo(&SecondLWS);
	if(!bResults) return FALSE;

	if ( Firsthandler->IsPeerDirty() || FirstLWS.timeStamp > SecondLWS.timeStamp)
	{
		*pbSecondDefected = TRUE;
	}
	else
	{
		*pbSecondDefected = FALSE;
	}

	if ( Secondhandler->IsPeerDirty() || SecondLWS.timeStamp > SecondLWS.timeStamp)
	{
		*pbFirstDefected = TRUE;
	}
	else
	{
		*pbFirstDefected = FALSE;
	}

	return TRUE;
}