| 0 |      1 | // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
 | 
|  |      2 | // All rights reserved.
 | 
|  |      3 | // This component and the accompanying materials are made available
 | 
|  |      4 | // under the terms of the License "Eclipse Public License v1.0"
 | 
|  |      5 | // which accompanies this distribution, and is available
 | 
|  |      6 | // at the URL "http://www.eclipse.org/legal/epl-v10.html".
 | 
|  |      7 | //
 | 
|  |      8 | // Initial Contributors:
 | 
|  |      9 | // Nokia Corporation - initial contribution.
 | 
|  |     10 | //
 | 
|  |     11 | // Contributors:
 | 
|  |     12 | //
 | 
|  |     13 | // Description:
 | 
|  |     14 | // ROFS.INL
 | 
|  |     15 | // 
 | 
|  |     16 | //
 | 
|  |     17 | 
 | 
|  |     18 | 
 | 
|  |     19 | inline const TText* CDirectoryCache::NameAddress( const TRofsEntry* aEntry )
 | 
|  |     20 | 	{
 | 
|  |     21 | 	return (const TText*)(((const TUint8*)aEntry) + aEntry->iNameOffset);
 | 
|  |     22 | 	};
 | 
|  |     23 | 
 | 
|  |     24 | 
 | 
|  |     25 | inline TUint32 CDirectoryCache::AlignUp( TUint32 aValue )
 | 
|  |     26 | 	{
 | 
|  |     27 | 	return aValue + ((4-aValue) & 3); // round up to next word boundary
 | 
|  |     28 | 	};
 | 
|  |     29 | 
 | 
|  |     30 | inline const TRofsDir* CDirectoryCache::RootDirectory() const
 | 
|  |     31 | 	{
 | 
|  |     32 | 	return reinterpret_cast<const TRofsDir*>( iTreeBuffer->Ptr() );
 | 
|  |     33 | 	}
 | 
|  |     34 | 
 | 
|  |     35 | inline const TRofsDir* CDirectoryCache::RofsDirFromMediaOffset( TUint aMediaOffset ) const
 | 
|  |     36 | 	{
 | 
|  |     37 | 	return reinterpret_cast<const TRofsDir*>(aMediaOffset - iTreeMediaOffset + iTreeBuffer->Ptr() );
 | 
|  |     38 | 	};
 | 
|  |     39 | 
 | 
|  |     40 | inline const TRofsDir* CDirectoryCache::RofsDirFromSubDirEntry( const TRofsEntry* aEntry ) const
 | 
|  |     41 | 	{
 | 
|  |     42 | 	return reinterpret_cast<const TRofsDir*>(aEntry->iFileAddress - iTreeMediaOffset + iTreeBuffer->Ptr() );
 | 
|  |     43 | 	};
 | 
|  |     44 | 
 | 
|  |     45 | inline const TRofsEntry* CDirectoryCache::FirstSubDirEntryFromDir( const TRofsDir* aDir )
 | 
|  |     46 | 	{
 | 
|  |     47 | 	return reinterpret_cast<const TRofsEntry*>(((const TUint8*)aDir) + aDir->iFirstEntryOffset );
 | 
|  |     48 | 	}
 | 
|  |     49 | 
 | 
|  |     50 | inline const TRofsEntry* CDirectoryCache::FirstFileEntryFromDir( const TRofsDir* aDir ) const
 | 
|  |     51 | 	{
 | 
|  |     52 | 	__ASSERT_DEBUG( aDir->iFileBlockAddress != NULL, CRofs::Panic( CRofs::EPanicNullFileBlock ));
 | 
|  |     53 | 	return reinterpret_cast<const TRofsEntry*>(aDir->iFileBlockAddress - iFilesMediaOffset + iFilesBuffer->Ptr() );
 | 
|  |     54 | 	}
 | 
|  |     55 | 
 | 
|  |     56 | inline const TAny* CDirectoryCache::EndOfFileBlockPlusOne( const TRofsDir* aDir ) const
 | 
|  |     57 | 	{
 | 
|  |     58 | 	__ASSERT_DEBUG( aDir->iFileBlockAddress != NULL, CRofs::Panic( CRofs::EPanicNullFileBlock2 ));
 | 
|  |     59 | 	return reinterpret_cast<const TAny*>( ((TUint8*)FirstFileEntryFromDir(aDir)) + aDir->iFileBlockSize );
 | 
|  |     60 | 	}
 | 
|  |     61 | 
 | 
|  |     62 | 
 | 
|  |     63 | inline const TAny* CDirectoryCache::EndOfDirPlusOne( const TRofsDir* aDir ) const
 | 
|  |     64 | 	{
 | 
|  |     65 | 	return reinterpret_cast<const TAny*>( ((TUint8*)aDir) + aDir->iStructSize );
 | 
|  |     66 | 	}
 | 
|  |     67 | 
 | 
|  |     68 | inline const TRofsEntry* CDirectoryCache::NextEntry( const TRofsEntry* aEntry )
 | 
|  |     69 | 	{
 | 
|  |     70 | 	return (const TRofsEntry*)((const TUint8*)aEntry + AlignUp( aEntry->iStructSize ));
 | 
|  |     71 | 	}
 | 
|  |     72 | 
 | 
|  |     73 | 
 | 
|  |     74 | inline CRofsMountCB& CRofsFileCB::RofsMount()
 | 
|  |     75 | 	{ return reinterpret_cast<CRofsMountCB&>(Mount()); };
 | 
|  |     76 | 
 | 
|  |     77 | inline void CRofsFileCB::SetMediaBase(const TUint aBase)
 | 
|  |     78 | 	{iMediaBase=aBase;}
 | 
|  |     79 | 
 | 
|  |     80 | inline void CRofsFileCB::SetAttExtra( TUint8 aAttExtra )
 | 
|  |     81 | 	{iAttExtra = aAttExtra;}
 | 
|  |     82 | 
 | 
|  |     83 | 
 | 
|  |     84 | inline void CRofsDirCB::SetCache( CDirectoryCache* aCache )
 | 
|  |     85 | 	{iCache = aCache;}
 | 
|  |     86 | 
 | 
|  |     87 | 
 | 
|  |     88 | inline CRofs& CRofsMountCB::FileSystem() const
 | 
|  |     89 | 	{return((CRofs&)Drive().FSys());}
 | 
|  |     90 | 
 | 
|  |     91 | 
 | 
|  |     92 | inline TInt CRofs::TotalSupportedDrives() const
 | 
|  |     93 | 	{return iTotalSupportedDrives;}
 | 
|  |     94 | 
 | 
|  |     95 | 
 |