userlibandfileserver/fileserver/srofs/sr_rofs.inl
author John Imhofe
Mon, 19 Oct 2009 15:55:17 +0100
changeset 0 a41df078684a
permissions -rw-r--r--
Convert Kernelhwsrv package from SFL to EPL kernel\eka\compsupp is subject to the ARM EABI LICENSE userlibandfileserver\fatfilenameconversionplugins\unicodeTables is subject to the Unicode license kernel\eka\kernel\zlib is subject to the zlib license

// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of the License "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
//
// Initial Contributors:
// Nokia Corporation - initial contribution.
//
// Contributors:
//
// Description:
// ROFS.INL
// 
//


inline const TText* CDirectoryCache::NameAddress( const TRofsEntry* aEntry )
	{
	return (const TText*)(((const TUint8*)aEntry) + aEntry->iNameOffset);
	};


inline TUint32 CDirectoryCache::AlignUp( TUint32 aValue )
	{
	return aValue + ((4-aValue) & 3); // round up to next word boundary
	};

inline const TRofsDir* CDirectoryCache::RootDirectory() const
	{
	return reinterpret_cast<const TRofsDir*>( iTreeBuffer->Ptr() );
	}

inline const TRofsDir* CDirectoryCache::RofsDirFromMediaOffset( TUint aMediaOffset ) const
	{
	return reinterpret_cast<const TRofsDir*>(aMediaOffset - iTreeMediaOffset + iTreeBuffer->Ptr() );
	};

inline const TRofsDir* CDirectoryCache::RofsDirFromSubDirEntry( const TRofsEntry* aEntry ) const
	{
	return reinterpret_cast<const TRofsDir*>(aEntry->iFileAddress - iTreeMediaOffset + iTreeBuffer->Ptr() );
	};

inline const TRofsEntry* CDirectoryCache::FirstSubDirEntryFromDir( const TRofsDir* aDir )
	{
	return reinterpret_cast<const TRofsEntry*>(((const TUint8*)aDir) + aDir->iFirstEntryOffset );
	}

inline const TRofsEntry* CDirectoryCache::FirstFileEntryFromDir( const TRofsDir* aDir ) const
	{
	__ASSERT_DEBUG( aDir->iFileBlockAddress != NULL, CRofs::Panic( CRofs::EPanicNullFileBlock ));
	return reinterpret_cast<const TRofsEntry*>(aDir->iFileBlockAddress - iFilesMediaOffset + iFilesBuffer->Ptr() );
	}

inline const TAny* CDirectoryCache::EndOfFileBlockPlusOne( const TRofsDir* aDir ) const
	{
	__ASSERT_DEBUG( aDir->iFileBlockAddress != NULL, CRofs::Panic( CRofs::EPanicNullFileBlock2 ));
	return reinterpret_cast<const TAny*>( ((TUint8*)FirstFileEntryFromDir(aDir)) + aDir->iFileBlockSize );
	}


inline const TAny* CDirectoryCache::EndOfDirPlusOne( const TRofsDir* aDir ) const
	{
	return reinterpret_cast<const TAny*>( ((TUint8*)aDir) + aDir->iStructSize );
	}

inline const TRofsEntry* CDirectoryCache::NextEntry( const TRofsEntry* aEntry )
	{
	return (const TRofsEntry*)((const TUint8*)aEntry + AlignUp( aEntry->iStructSize ));
	}


inline CRofsMountCB& CRofsFileCB::RofsMount()
	{ return reinterpret_cast<CRofsMountCB&>(Mount()); };

inline void CRofsFileCB::SetMediaBase(const TUint aBase)
	{iMediaBase=aBase;}

inline void CRofsFileCB::SetAttExtra( TUint8 aAttExtra )
	{iAttExtra = aAttExtra;}


inline void CRofsDirCB::SetCache( CDirectoryCache* aCache )
	{iCache = aCache;}


inline CRofs& CRofsMountCB::FileSystem() const
	{return((CRofs&)Drive().FSys());}


inline TInt CRofs::TotalSupportedDrives() const
	{return iTotalSupportedDrives;}