sl@0: // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // ROFS.INL sl@0: // sl@0: // sl@0: sl@0: sl@0: inline const TText* CDirectoryCache::NameAddress( const TRofsEntry* aEntry ) sl@0: { sl@0: return (const TText*)(((const TUint8*)aEntry) + aEntry->iNameOffset); sl@0: }; sl@0: sl@0: sl@0: inline TUint32 CDirectoryCache::AlignUp( TUint32 aValue ) sl@0: { sl@0: return aValue + ((4-aValue) & 3); // round up to next word boundary sl@0: }; sl@0: sl@0: inline const TRofsDir* CDirectoryCache::RootDirectory() const sl@0: { sl@0: return reinterpret_cast( iTreeBuffer->Ptr() ); sl@0: } sl@0: sl@0: inline const TRofsDir* CDirectoryCache::RofsDirFromMediaOffset( TUint aMediaOffset ) const sl@0: { sl@0: return reinterpret_cast(aMediaOffset - iTreeMediaOffset + iTreeBuffer->Ptr() ); sl@0: }; sl@0: sl@0: inline const TRofsDir* CDirectoryCache::RofsDirFromSubDirEntry( const TRofsEntry* aEntry ) const sl@0: { sl@0: return reinterpret_cast(aEntry->iFileAddress - iTreeMediaOffset + iTreeBuffer->Ptr() ); sl@0: }; sl@0: sl@0: inline const TRofsEntry* CDirectoryCache::FirstSubDirEntryFromDir( const TRofsDir* aDir ) sl@0: { sl@0: return reinterpret_cast(((const TUint8*)aDir) + aDir->iFirstEntryOffset ); sl@0: } sl@0: sl@0: inline const TRofsEntry* CDirectoryCache::FirstFileEntryFromDir( const TRofsDir* aDir ) const sl@0: { sl@0: __ASSERT_DEBUG( aDir->iFileBlockAddress != NULL, CRofs::Panic( CRofs::EPanicNullFileBlock )); sl@0: return reinterpret_cast(aDir->iFileBlockAddress - iFilesMediaOffset + iFilesBuffer->Ptr() ); sl@0: } sl@0: sl@0: inline const TAny* CDirectoryCache::EndOfFileBlockPlusOne( const TRofsDir* aDir ) const sl@0: { sl@0: __ASSERT_DEBUG( aDir->iFileBlockAddress != NULL, CRofs::Panic( CRofs::EPanicNullFileBlock2 )); sl@0: return reinterpret_cast( ((TUint8*)FirstFileEntryFromDir(aDir)) + aDir->iFileBlockSize ); sl@0: } sl@0: sl@0: sl@0: inline const TAny* CDirectoryCache::EndOfDirPlusOne( const TRofsDir* aDir ) const sl@0: { sl@0: return reinterpret_cast( ((TUint8*)aDir) + aDir->iStructSize ); sl@0: } sl@0: sl@0: inline const TRofsEntry* CDirectoryCache::NextEntry( const TRofsEntry* aEntry ) sl@0: { sl@0: return (const TRofsEntry*)((const TUint8*)aEntry + AlignUp( aEntry->iStructSize )); sl@0: } sl@0: sl@0: sl@0: inline CRofsMountCB& CRofsFileCB::RofsMount() sl@0: { return reinterpret_cast(Mount()); }; sl@0: sl@0: inline void CRofsFileCB::SetMediaBase(const TUint aBase) sl@0: {iMediaBase=aBase;} sl@0: sl@0: inline void CRofsFileCB::SetAttExtra( TUint8 aAttExtra ) sl@0: {iAttExtra = aAttExtra;} sl@0: sl@0: sl@0: inline void CRofsDirCB::SetCache( CDirectoryCache* aCache ) sl@0: {iCache = aCache;} sl@0: sl@0: sl@0: inline CRofs& CRofsMountCB::FileSystem() const sl@0: {return((CRofs&)Drive().FSys());} sl@0: sl@0: sl@0: inline TInt CRofs::TotalSupportedDrives() const sl@0: {return iTotalSupportedDrives;} sl@0: sl@0: