| sl@0 |      1 | // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
 | 
| sl@0 |      2 | // All rights reserved.
 | 
| sl@0 |      3 | // This component and the accompanying materials are made available
 | 
| sl@0 |      4 | // under the terms of the License "Eclipse Public License v1.0"
 | 
| sl@0 |      5 | // which accompanies this distribution, and is available
 | 
| sl@0 |      6 | // at the URL "http://www.eclipse.org/legal/epl-v10.html".
 | 
| sl@0 |      7 | //
 | 
| sl@0 |      8 | // Initial Contributors:
 | 
| sl@0 |      9 | // Nokia Corporation - initial contribution.
 | 
| sl@0 |     10 | //
 | 
| sl@0 |     11 | // Contributors:
 | 
| sl@0 |     12 | //
 | 
| sl@0 |     13 | // Description:
 | 
| sl@0 |     14 | // f32\srom\sr_rom.cpp
 | 
| sl@0 |     15 | // 
 | 
| sl@0 |     16 | //
 | 
| sl@0 |     17 | 
 | 
| sl@0 |     18 | #include "sr_std.h"
 | 
| sl@0 |     19 | 
 | 
| sl@0 |     20 | #if defined(_UNICODE)
 | 
| sl@0 |     21 | #define __SIZE(len) ((len)<<1)
 | 
| sl@0 |     22 | #else
 | 
| sl@0 |     23 | #define __SIZE(len) (len)
 | 
| sl@0 |     24 | #endif
 | 
| sl@0 |     25 | 
 | 
| sl@0 |     26 | const TRomHeader* CRom::iRomHeaderAddress=(TRomHeader*)UserSvr::RomHeaderAddress();
 | 
| sl@0 |     27 | 
 | 
| sl@0 |     28 | TInt TRomDir::BinarySearch(const TDesC& aName, TInt aLengthLimit, TInt aMode, TBool aDir) const
 | 
| sl@0 |     29 | 	{
 | 
| sl@0 |     30 | //	RDebug::Print(_L("BinarySearch %S ll=%d m=%d dir=%d"), &aName, aLengthLimit, aMode, aDir);
 | 
| sl@0 |     31 | 	const TRomDirSortInfo* s = SortInfo();
 | 
| sl@0 |     32 | 	TInt l = aDir ? 0 : s->iSubDirCount;
 | 
| sl@0 |     33 | 	TInt r = aDir ? s->iSubDirCount : s->iSubDirCount + s->iFileCount;
 | 
| sl@0 |     34 | 	TBool found = EFalse;
 | 
| sl@0 |     35 | 	while (r>l)
 | 
| sl@0 |     36 | 		{
 | 
| sl@0 |     37 | 		TInt m=(l+r)>>1;
 | 
| sl@0 |     38 | 		const TRomEntry* e = SortedEntry(m);
 | 
| sl@0 |     39 | 		TInt nl = Min(e->iNameLength, aLengthLimit);
 | 
| sl@0 |     40 | 		TPtrC en((const TText*)&e->iName[0], nl);
 | 
| sl@0 |     41 | 		TInt k = CRomMountCB::Compare(aName, en);
 | 
| sl@0 |     42 | 		if (k==0)
 | 
| sl@0 |     43 | 			{
 | 
| sl@0 |     44 | 			if (aMode == EArrayFindMode_Any)
 | 
| sl@0 |     45 | 				{
 | 
| sl@0 |     46 | //				RDebug::Printf("Found %d", m);
 | 
| sl@0 |     47 | 				return m;
 | 
| sl@0 |     48 | 				}
 | 
| sl@0 |     49 | 			found = ETrue;
 | 
| sl@0 |     50 | 			if (aMode == EArrayFindMode_First)
 | 
| sl@0 |     51 | 				r=m;
 | 
| sl@0 |     52 | 			else
 | 
| sl@0 |     53 | 				l=m+1;
 | 
| sl@0 |     54 | 			}
 | 
| sl@0 |     55 | 		else if (k>0)
 | 
| sl@0 |     56 | 			l=m+1;
 | 
| sl@0 |     57 | 		else
 | 
| sl@0 |     58 | 			r=m;
 | 
| sl@0 |     59 | 		}
 | 
| sl@0 |     60 | //	RDebug::Printf("Found=%d r=%d", found, r);
 | 
| sl@0 |     61 | 	return found ? r : KErrNotFound;
 | 
| sl@0 |     62 | 	}
 | 
| sl@0 |     63 | 
 | 
| sl@0 |     64 | // Navigate the path to find the leaf directory, starting at this.
 | 
| sl@0 |     65 | const TRomDir* TRomDir::FindLeafDir(const TDesC& aPath) const
 | 
| sl@0 |     66 | 	{
 | 
| sl@0 |     67 | 	TLex lex(aPath);
 | 
| sl@0 |     68 | 	TInt r;
 | 
| sl@0 |     69 | 	const TRomDir* d = this;
 | 
| sl@0 |     70 | 	FOREVER
 | 
| sl@0 |     71 | 		{
 | 
| sl@0 |     72 | 		lex.Inc(); // Skip the file separator
 | 
| sl@0 |     73 | 		lex.Mark();
 | 
| sl@0 |     74 | 		r=lex.Remainder().Locate(KPathDelimiter);
 | 
| sl@0 |     75 | 		if (r==KErrNotFound)
 | 
| sl@0 |     76 | 			r=lex.Remainder().Length();
 | 
| sl@0 |     77 | 		if (r==0) // End of the path
 | 
| sl@0 |     78 | 			break;
 | 
| sl@0 |     79 | 		lex.Inc(r); // Set the token length
 | 
| sl@0 |     80 | 		TInt ix = d->BinarySearch(lex.MarkedToken(), KMaxTInt, EArrayFindMode_Any, ETrue);
 | 
| sl@0 |     81 | 		if (ix<0)
 | 
| sl@0 |     82 | 			return NULL;
 | 
| sl@0 |     83 | 		const TRomEntry* e = d->SortedEntry(ix);
 | 
| sl@0 |     84 | //		if (!(e->iAtt & KEntryAttDir))
 | 
| sl@0 |     85 | //			return NULL;
 | 
| sl@0 |     86 | 		d = (const TRomDir*)e->iAddressLin;
 | 
| sl@0 |     87 | 		}
 | 
| sl@0 |     88 | 	return d;
 | 
| sl@0 |     89 | 	}
 | 
| sl@0 |     90 | 
 | 
| sl@0 |     91 | LOCAL_C void Fault(TFault aFault)
 | 
| sl@0 |     92 | //
 | 
| sl@0 |     93 | // Report a fault in the rom file system.
 | 
| sl@0 |     94 | //
 | 
| sl@0 |     95 | 	{
 | 
| sl@0 |     96 | 
 | 
| sl@0 |     97 | 	User::Panic(_L("ROMFILESYS"),aFault);
 | 
| sl@0 |     98 | 	}
 | 
| sl@0 |     99 | 
 | 
| sl@0 |    100 | CRomMountCB::CRomMountCB(const CRom* aRom)
 | 
| sl@0 |    101 | //
 | 
| sl@0 |    102 | // Constructor
 | 
| sl@0 |    103 | //
 | 
| sl@0 |    104 | 	: iRom(aRom)
 | 
| sl@0 |    105 | 	{
 | 
| sl@0 |    106 | 	}
 | 
| sl@0 |    107 | 
 | 
| sl@0 |    108 | void CRomMountCB::Dismounted()
 | 
| sl@0 |    109 | //
 | 
| sl@0 |    110 | // Dummy implementation of pure virtual function
 | 
| sl@0 |    111 | //
 | 
| sl@0 |    112 | 	{}
 | 
| sl@0 |    113 | 
 | 
| sl@0 |    114 | void CRomMountCB::IsFileInRom(const TDesC& aName,TUint8*& aFileStart)
 | 
| sl@0 |    115 | //
 | 
| sl@0 |    116 | // Return the address of the file if it is in rom
 | 
| sl@0 |    117 | //
 | 
| sl@0 |    118 | 	{
 | 
| sl@0 |    119 | 	
 | 
| sl@0 |    120 | 	TLinAddr dir;
 | 
| sl@0 |    121 | 	TLinAddr entry=0;
 | 
| sl@0 |    122 | 	aFileStart=NULL;
 | 
| sl@0 |    123 | 	TRAPD(r,FindEntryL(aName,KEntryAttNormal,ETrue,dir,entry));
 | 
| sl@0 |    124 | 	if (r!=KErrNone)
 | 
| sl@0 |    125 | 		return;
 | 
| sl@0 |    126 | 	aFileStart=(TUint8*)((const TRomEntry*)entry)->iAddressLin;
 | 
| sl@0 |    127 | 	}
 | 
| sl@0 |    128 | 
 | 
| sl@0 |    129 | TInt CRomMountCB::Compare(const TDesC& aLeft, const TDesC& aRight)
 | 
| sl@0 |    130 | //
 | 
| sl@0 |    131 | //Compares two filenames.  Folds ASCII characters to uppercase
 | 
| sl@0 |    132 | //
 | 
| sl@0 |    133 | 	{
 | 
| sl@0 |    134 | 
 | 
| sl@0 |    135 | 	TInt ll = aLeft.Length();
 | 
| sl@0 |    136 | 	TInt rl = aRight.Length();
 | 
| sl@0 |    137 | 	TInt len = Min(ll, rl);
 | 
| sl@0 |    138 | 	const TText* l = aLeft.Ptr();
 | 
| sl@0 |    139 | 	const TText* r = aRight.Ptr();
 | 
| sl@0 |    140 | 	while (len--)
 | 
| sl@0 |    141 | 		{
 | 
| sl@0 |    142 | 		TText lc = *l++;
 | 
| sl@0 |    143 | 		TText rc = *r++;
 | 
| sl@0 |    144 | 		if (lc >= 'A' && lc <= 'Z')
 | 
| sl@0 |    145 | 			lc += ('a' - 'A');
 | 
| sl@0 |    146 | 		if (rc >= 'A' && rc <= 'Z')
 | 
| sl@0 |    147 | 			rc += ('a' - 'A');
 | 
| sl@0 |    148 | 		TInt x = lc - rc;
 | 
| sl@0 |    149 | 		if (x)
 | 
| sl@0 |    150 | 			return x;
 | 
| sl@0 |    151 | 		}
 | 
| sl@0 |    152 | 	// match up to end of shorter string, now compare lengths
 | 
| sl@0 |    153 | 	return ll - rl;
 | 
| sl@0 |    154 | 	}
 | 
| sl@0 |    155 | 
 | 
| sl@0 |    156 | void CRomMountCB::FindBinaryL(const TDesC& aName, TUint aAtt, TBool aAttKnown, TLinAddr aDir, TLinAddr& aEntry, TInt aError) const
 | 
| sl@0 |    157 | //
 | 
| sl@0 |    158 | //Identical to FindL, but uses binary search for faster performance.
 | 
| sl@0 |    159 | //However, can't deal with wildcards, whereas FindL can.
 | 
| sl@0 |    160 | //
 | 
| sl@0 |    161 | 	{
 | 
| sl@0 |    162 | 
 | 
| sl@0 |    163 | 	//Although the value of aEntry is not used, we expect it to be zero,
 | 
| sl@0 |    164 | 	__ASSERT_DEBUG(aEntry==0,Fault(ERomInvalidArgument));
 | 
| sl@0 |    165 | 	const TRomDir* d = (const TRomDir*)aDir;
 | 
| sl@0 |    166 | 	TBool ix;
 | 
| sl@0 |    167 | 	if (aAttKnown)
 | 
| sl@0 |    168 | 		ix = d->BinarySearch(aName, KMaxTInt, EArrayFindMode_Any, aAtt & KEntryAttDir);
 | 
| sl@0 |    169 | 	else
 | 
| sl@0 |    170 | 		{
 | 
| sl@0 |    171 | 		//We don't know whether we're looking for a file or a directory, so
 | 
| sl@0 |    172 | 		//look through both
 | 
| sl@0 |    173 | 		ix = d->BinarySearch(aName, KMaxTInt, EArrayFindMode_Any, EFalse);
 | 
| sl@0 |    174 | 		if (ix<0 || !MatchEntryAtt(d->SortedEntry(ix)->iAtt, aAtt) )
 | 
| sl@0 |    175 | 			ix = d->BinarySearch(aName, KMaxTInt, EArrayFindMode_Any, ETrue);
 | 
| sl@0 |    176 | 		}
 | 
| sl@0 |    177 | 	if (ix>=0)
 | 
| sl@0 |    178 | 		{
 | 
| sl@0 |    179 | 		const TRomEntry* e = d->SortedEntry(ix);
 | 
| sl@0 |    180 | 		if (MatchEntryAtt(e->iAtt, aAtt))
 | 
| sl@0 |    181 | 			{
 | 
| sl@0 |    182 | 			aEntry = (TLinAddr)e;
 | 
| sl@0 |    183 | 			return;
 | 
| sl@0 |    184 | 			}
 | 
| sl@0 |    185 | 		}
 | 
| sl@0 |    186 | 	User::Leave(aError);
 | 
| sl@0 |    187 | 	}
 | 
| sl@0 |    188 | 
 | 
| sl@0 |    189 | void CRomMountCB::FindL(const TDesC& aName, TUint anAtt, TLinAddr aDir, TLinAddr& anEntry, TInt anError) const
 | 
| sl@0 |    190 | //
 | 
| sl@0 |    191 | // Scan from aDir looking for aName.
 | 
| sl@0 |    192 | // If found return the result in anEntry.
 | 
| sl@0 |    193 | //
 | 
| sl@0 |    194 | 	{
 | 
| sl@0 |    195 | 	const TRomDir* pD = (const TRomDir*)aDir;
 | 
| sl@0 |    196 | 	const TRomEntry* pE;
 | 
| sl@0 |    197 | 	if (anEntry==0)
 | 
| sl@0 |    198 | 		pE = &pD->iEntry;
 | 
| sl@0 |    199 | 	else
 | 
| sl@0 |    200 | 		{
 | 
| sl@0 |    201 | 		pE = (const TRomEntry*)anEntry;
 | 
| sl@0 |    202 | 		pE = PtrAdd(pE, Align4(__SIZE(pE->iNameLength) + KRomEntrySize));
 | 
| sl@0 |    203 | 		}
 | 
| sl@0 |    204 | 	const TRomEntry* pEnd = PtrAdd(&pD->iEntry, pD->iSize);
 | 
| sl@0 |    205 | 	while (pE<pEnd)
 | 
| sl@0 |    206 | 		{
 | 
| sl@0 |    207 | 		TPtrC name = TPtrC((const TText*)&pE->iName[0], pE->iNameLength);
 | 
| sl@0 |    208 | 		if (name.MatchF(aName)!=KErrNotFound && MatchEntryAtt(pE->iAtt, anAtt))
 | 
| sl@0 |    209 | 			{
 | 
| sl@0 |    210 | 			anEntry = (TLinAddr)pE;
 | 
| sl@0 |    211 | 			return;
 | 
| sl@0 |    212 | 			}
 | 
| sl@0 |    213 | 		pE = PtrAdd(pE, Align4(__SIZE(pE->iNameLength) + KRomEntrySize));
 | 
| sl@0 |    214 | 		}
 | 
| sl@0 |    215 | 	User::Leave(anError);
 | 
| sl@0 |    216 | 	}
 | 
| sl@0 |    217 | 
 | 
| sl@0 |    218 | void CRomMountCB::FindEntryL(const TDesC& aName, TUint anAtt, TBool aAttKnown, TLinAddr& aDir, TLinAddr& anEntry) const
 | 
| sl@0 |    219 | //
 | 
| sl@0 |    220 | // Locate an entry from its full path name.
 | 
| sl@0 |    221 | //
 | 
| sl@0 |    222 | 	{
 | 
| sl@0 |    223 | 
 | 
| sl@0 |    224 | 	TInt namePos=aName.LocateReverse(KPathDelimiter)+1; // There is always a path delimiter
 | 
| sl@0 |    225 | 	const TRomDir* d = ((const TRomDir*)RomRootDirectory())->FindLeafDir(aName.Left(namePos));
 | 
| sl@0 |    226 | 	if (!d)
 | 
| sl@0 |    227 | 		User::Leave(KErrPathNotFound);
 | 
| sl@0 |    228 | 	anEntry=0;
 | 
| sl@0 |    229 | 	aDir = (TLinAddr)d;
 | 
| sl@0 |    230 | 	FindBinaryL(aName.Mid(namePos),anAtt,aAttKnown,aDir,anEntry,KErrNotFound);
 | 
| sl@0 |    231 | 	}
 | 
| sl@0 |    232 | 
 | 
| sl@0 |    233 | void CRomMountCB::MountL(TBool /*aForceMount*/)
 | 
| sl@0 |    234 | //
 | 
| sl@0 |    235 | // Mount a media. Only allowed to leave with KErrNoMemory,KErrNotReady,KErrCorrupt,KErrUnknown.
 | 
| sl@0 |    236 | //
 | 
| sl@0 |    237 | 	{
 | 
| sl@0 |    238 | 
 | 
| sl@0 |    239 | 	iUniqueID=0;
 | 
| sl@0 |    240 | 	iSize=(TUint)RomHeader().iUncompressedSize;
 | 
| sl@0 |    241 | 	SetVolumeName(_L("RomDrive").AllocL());
 | 
| sl@0 |    242 | 	}
 | 
| sl@0 |    243 | 
 | 
| sl@0 |    244 | TInt CRomMountCB::ReMount()
 | 
| sl@0 |    245 | //
 | 
| sl@0 |    246 | // Try and remount this media.
 | 
| sl@0 |    247 | //
 | 
| sl@0 |    248 | 	{
 | 
| sl@0 |    249 | 
 | 
| sl@0 |    250 | 	Fault(ERomReMountNotSupported);
 | 
| sl@0 |    251 | 	return(0);
 | 
| sl@0 |    252 | 	}
 | 
| sl@0 |    253 | 
 | 
| sl@0 |    254 | void CRomMountCB::VolumeL(TVolumeInfo& aVolume) const
 | 
| sl@0 |    255 | //
 | 
| sl@0 |    256 | // Return the volume info.
 | 
| sl@0 |    257 | //
 | 
| sl@0 |    258 | 	{
 | 
| sl@0 |    259 | 
 | 
| sl@0 |    260 | 	aVolume.iFree=0;
 | 
| sl@0 |    261 | 	}
 | 
| sl@0 |    262 | 
 | 
| sl@0 |    263 | void CRomMountCB::SetVolumeL(TDes& /*aName*/)
 | 
| sl@0 |    264 | //
 | 
| sl@0 |    265 | // Set the volume label.
 | 
| sl@0 |    266 | //
 | 
| sl@0 |    267 | 	{
 | 
| sl@0 |    268 | 
 | 
| sl@0 |    269 | 	User::Leave(KErrAccessDenied);
 | 
| sl@0 |    270 | 	}
 | 
| sl@0 |    271 | 
 | 
| sl@0 |    272 | void CRomMountCB::MkDirL(const TDesC& /*aName*/)
 | 
| sl@0 |    273 | //
 | 
| sl@0 |    274 | // Make a directory.
 | 
| sl@0 |    275 | //
 | 
| sl@0 |    276 | 	{
 | 
| sl@0 |    277 | 
 | 
| sl@0 |    278 | 	User::Leave(KErrAccessDenied);
 | 
| sl@0 |    279 | 	}
 | 
| sl@0 |    280 | 
 | 
| sl@0 |    281 | void CRomMountCB::RmDirL(const TDesC& /*aName*/)
 | 
| sl@0 |    282 | //
 | 
| sl@0 |    283 | // Remove a directory.
 | 
| sl@0 |    284 | //
 | 
| sl@0 |    285 | 	{
 | 
| sl@0 |    286 | 
 | 
| sl@0 |    287 | 	User::Leave(KErrAccessDenied);
 | 
| sl@0 |    288 | 	}
 | 
| sl@0 |    289 | 
 | 
| sl@0 |    290 | void CRomMountCB::DeleteL(const TDesC& /*aName*/)
 | 
| sl@0 |    291 | //
 | 
| sl@0 |    292 | // Delete a file.
 | 
| sl@0 |    293 | //
 | 
| sl@0 |    294 | 	{
 | 
| sl@0 |    295 | 
 | 
| sl@0 |    296 | 	User::Leave(KErrAccessDenied);
 | 
| sl@0 |    297 | 	}
 | 
| sl@0 |    298 | 
 | 
| sl@0 |    299 | void CRomMountCB::RenameL(const TDesC& /*anOldName*/,const TDesC& /*aNewName*/)
 | 
| sl@0 |    300 | //
 | 
| sl@0 |    301 | // Rename a file or directory.
 | 
| sl@0 |    302 | //
 | 
| sl@0 |    303 | 	{
 | 
| sl@0 |    304 | 
 | 
| sl@0 |    305 | 	User::Leave(KErrAccessDenied);
 | 
| sl@0 |    306 | 	}
 | 
| sl@0 |    307 | 
 | 
| sl@0 |    308 | void CRomMountCB::ReplaceL(const TDesC& /*anOldName*/,const TDesC& /*aNewName*/)
 | 
| sl@0 |    309 | //
 | 
| sl@0 |    310 | // Atomic replace.
 | 
| sl@0 |    311 | //
 | 
| sl@0 |    312 | 	{
 | 
| sl@0 |    313 | 
 | 
| sl@0 |    314 | 	User::Leave(KErrAccessDenied);
 | 
| sl@0 |    315 | 	}
 | 
| sl@0 |    316 | 
 | 
| sl@0 |    317 | void CRomMountCB::EntryL(const TDesC& aName,TEntry& anEntry) const
 | 
| sl@0 |    318 | //
 | 
| sl@0 |    319 | // Get entry details.
 | 
| sl@0 |    320 | //
 | 
| sl@0 |    321 | 	{
 | 
| sl@0 |    322 | 
 | 
| sl@0 |    323 | 	TLinAddr dir;
 | 
| sl@0 |    324 | 	TLinAddr entry;
 | 
| sl@0 |    325 | 	FindEntryL(aName,KEntryAttMaskSupported,EFalse,dir,entry);
 | 
| sl@0 |    326 | 	const TRomEntry* pE = (const TRomEntry*)entry;
 | 
| sl@0 |    327 | 	anEntry.iAtt=pE->iAtt;
 | 
| sl@0 |    328 | 	anEntry.iSize=pE->iSize;
 | 
| sl@0 |    329 | 	anEntry.iModified=RomHeader().iTime;
 | 
| sl@0 |    330 | 	anEntry.iName.Des().Copy((TText*)&pE->iName[0],pE->iNameLength);
 | 
| sl@0 |    331 | 	ReadUidL(pE->iAddressLin,anEntry);
 | 
| sl@0 |    332 | 	}
 | 
| sl@0 |    333 | 
 | 
| sl@0 |    334 | void CRomMountCB::SetEntryL(const TDesC& /*aName*/,const TTime& /*aTime*/,TUint /*aMask*/,TUint /*aVal*/)
 | 
| sl@0 |    335 | //
 | 
| sl@0 |    336 | // Set entry details.
 | 
| sl@0 |    337 | //
 | 
| sl@0 |    338 | 	{
 | 
| sl@0 |    339 | 
 | 
| sl@0 |    340 | 	User::Leave(KErrAccessDenied);
 | 
| sl@0 |    341 | 	}
 | 
| sl@0 |    342 | 
 | 
| sl@0 |    343 | void CRomMountCB::FileOpenL(const TDesC& aName,TUint aMode,TFileOpen anOpen,CFileCB* aFile)
 | 
| sl@0 |    344 | //
 | 
| sl@0 |    345 | // Open a file on the current mount.
 | 
| sl@0 |    346 | //
 | 
| sl@0 |    347 | 	{
 | 
| sl@0 |    348 | 
 | 
| sl@0 |    349 | 	if (aMode&EFileWrite)
 | 
| sl@0 |    350 | 		User::Leave(KErrAccessDenied);
 | 
| sl@0 |    351 | 	switch (anOpen)
 | 
| sl@0 |    352 | 		{
 | 
| sl@0 |    353 | 	case EFileCreate:
 | 
| sl@0 |    354 | 	case EFileReplace:
 | 
| sl@0 |    355 | 		User::Leave(KErrAccessDenied);
 | 
| sl@0 |    356 | 	case EFileOpen:
 | 
| sl@0 |    357 | 		break;
 | 
| sl@0 |    358 | 	default:
 | 
| sl@0 |    359 | 		User::Leave(KErrAccessDenied);
 | 
| sl@0 |    360 | 		}
 | 
| sl@0 |    361 | 	TLinAddr dir;
 | 
| sl@0 |    362 | 	TLinAddr entry;
 | 
| sl@0 |    363 | 	FindEntryL(aName,KEntryAttMustBeFile,ETrue,dir,entry);
 | 
| sl@0 |    364 | 	const TRomEntry* pE = (const TRomEntry*)entry;
 | 
| sl@0 |    365 | 	CRomFileCB& file=(*((CRomFileCB*)aFile));
 | 
| sl@0 |    366 | 	file.SetSize(pE->iSize);
 | 
| sl@0 |    367 | 	file.SetAtt(pE->iAtt);
 | 
| sl@0 |    368 | 	file.SetModified(RomHeader().iTime);
 | 
| sl@0 |    369 | 	file.SetBase((const TUint8*)pE->iAddressLin);
 | 
| sl@0 |    370 | 	}
 | 
| sl@0 |    371 | 
 | 
| sl@0 |    372 | void CRomMountCB::DirOpenL(const TDesC& aName, CDirCB* aDir)
 | 
| sl@0 |    373 | //
 | 
| sl@0 |    374 | // Open a file on the current mount.
 | 
| sl@0 |    375 | //
 | 
| sl@0 |    376 | 	{
 | 
| sl@0 |    377 | 
 | 
| sl@0 |    378 |     TFileName fileName=aName;
 | 
| sl@0 |    379 |     TInt namePos=aName.LocateReverse(KPathDelimiter)+1; // Exclude path delimiter
 | 
| sl@0 |    380 |     if (namePos==aName.Length())
 | 
| sl@0 |    381 |         fileName+=_L("*");
 | 
| sl@0 |    382 | 	const TRomDir* d = ((const TRomDir*)RomRootDirectory())->FindLeafDir(aName.Left(namePos));
 | 
| sl@0 |    383 | 	if (!d)
 | 
| sl@0 |    384 | 		User::Leave(KErrPathNotFound);
 | 
| sl@0 |    385 | 	CRomDirCB& dirCB = *(CRomDirCB*)aDir;
 | 
| sl@0 |    386 | 	dirCB.SetDir((TLinAddr)d, NULL, fileName.Mid(namePos));
 | 
| sl@0 |    387 | 	}
 | 
| sl@0 |    388 | 
 | 
| sl@0 |    389 | void CRomMountCB::RawReadL(TInt64 aPos,TInt aLength,const TAny* aDes,TInt anOffset,const RMessagePtr2& aMessage) const
 | 
| sl@0 |    390 | //
 | 
| sl@0 |    391 | // Read up to aLength data directly from the ROM
 | 
| sl@0 |    392 | //
 | 
| sl@0 |    393 | 	{
 | 
| sl@0 |    394 | 
 | 
| sl@0 |    395 | 	TUint romSize=RomHeader().iUncompressedSize;
 | 
| sl@0 |    396 | 	if (I64LOW(aPos)>=romSize)
 | 
| sl@0 |    397 | 		aMessage.WriteL(2,TPtrC8(NULL,0),anOffset);
 | 
| sl@0 |    398 | 	else
 | 
| sl@0 |    399 | 		{
 | 
| sl@0 |    400 | 		TInt len=Min((TInt)(romSize-I64LOW(aPos)),aLength);
 | 
| sl@0 |    401 | 		aMessage.WriteL(2,TPtrC8((TUint8*)RomHeader().iRomBase,len),anOffset);
 | 
| sl@0 |    402 | 		}
 | 
| sl@0 |    403 | 	}
 | 
| sl@0 |    404 | 
 | 
| sl@0 |    405 | void CRomMountCB::RawWriteL(TInt64 /*aPos*/,TInt /*aLength*/,const TAny* /*aDes*/,TInt /*anOffset*/,const RMessagePtr2& /*aMessage*/)
 | 
| sl@0 |    406 | //
 | 
| sl@0 |    407 | // Write aLength data to ROM (?)
 | 
| sl@0 |    408 | //
 | 
| sl@0 |    409 | 	{
 | 
| sl@0 |    410 | 
 | 
| sl@0 |    411 | 	User::Leave(KErrAccessDenied);
 | 
| sl@0 |    412 | 	}
 | 
| sl@0 |    413 | 
 | 
| sl@0 |    414 | void CRomMountCB::ReadUidL(TLinAddr anAddr,TEntry& anEntry) const
 | 
| sl@0 |    415 | //
 | 
| sl@0 |    416 | // Read a uid if present.
 | 
| sl@0 |    417 | //
 | 
| sl@0 |    418 | 	{
 | 
| sl@0 |    419 | 	// Need to consider zero-length files (for which anAddr is 0)
 | 
| sl@0 |    420 | 	// and files too small to have a UID
 | 
| sl@0 |    421 | 	if (anEntry.iSize >= (TInt) sizeof(TCheckedUid))
 | 
| sl@0 |    422 | 		{
 | 
| sl@0 |    423 | 		TCheckedUid entryUid(TPtrC8((TUint8*)anAddr, sizeof(TCheckedUid)));
 | 
| sl@0 |    424 | 		anEntry.iType=entryUid.UidType();
 | 
| sl@0 |    425 | 		}
 | 
| sl@0 |    426 | 	else
 | 
| sl@0 |    427 | 		{
 | 
| sl@0 |    428 | 		anEntry.iType=KNullUid;
 | 
| sl@0 |    429 | 		}
 | 
| sl@0 |    430 | 	}
 | 
| sl@0 |    431 | 
 | 
| sl@0 |    432 | 
 | 
| sl@0 |    433 | 
 | 
| sl@0 |    434 | void CRomMountCB::ReadSectionL(const TDesC& aName,TInt aPos,TAny* aTrg,TInt aLength,const RMessagePtr2& aMessage)
 | 
| sl@0 |    435 | 	{
 | 
| sl@0 |    436 | 
 | 
| sl@0 |    437 | 	__PRINT(Print(_L("CRomMountCB::ReadSectionL")));
 | 
| sl@0 |    438 | 			
 | 
| sl@0 |    439 | 	TLinAddr dir;
 | 
| sl@0 |    440 | 	TLinAddr entry;
 | 
| sl@0 |    441 | 	FindEntryL(aName,KEntryAttMustBeFile,ETrue,dir,entry);
 | 
| sl@0 |    442 | 	const TRomEntry* pE = (TRomEntry*)entry;
 | 
| sl@0 |    443 | 	TInt size=pE->iSize;
 | 
| sl@0 |    444 | 
 | 
| sl@0 |    445 | 	const TText8* baseAddress = (const TText8*)pE->iAddressLin;
 | 
| sl@0 |    446 | 	
 | 
| sl@0 |    447 | 	if (size>=(aPos+aLength)) //|| (size>aPos)
 | 
| sl@0 |    448 | 		{
 | 
| sl@0 |    449 | 		TPtrC8 section((baseAddress+aPos),aLength);
 | 
| sl@0 |    450 | 		aMessage.WriteL(0,section,0);
 | 
| sl@0 |    451 | 		}
 | 
| sl@0 |    452 | 	else if (size>aPos)
 | 
| sl@0 |    453 | 		{
 | 
| sl@0 |    454 | 		aLength=(size-aPos);
 | 
| sl@0 |    455 | 		TPtrC8 section((baseAddress+aPos),aLength);
 | 
| sl@0 |    456 | 		aMessage.WriteL(0,section,0);
 | 
| sl@0 |    457 | 		}	
 | 
| sl@0 |    458 | 	else
 | 
| sl@0 |    459 | 		User::Leave(KErrEof);
 | 
| sl@0 |    460 | 	
 | 
| sl@0 |    461 | 	}
 | 
| sl@0 |    462 | 
 | 
| sl@0 |    463 | 
 | 
| sl@0 |    464 | 
 | 
| sl@0 |    465 | void CRomMountCB::GetShortNameL(const TDesC& /*aLongName*/,TDes& /*aShortName*/)
 | 
| sl@0 |    466 | //
 | 
| sl@0 |    467 | // Return the short name associated with aLongName
 | 
| sl@0 |    468 | // Assumes all rom names are 8.3
 | 
| sl@0 |    469 | //
 | 
| sl@0 |    470 | 	{
 | 
| sl@0 |    471 | 
 | 
| sl@0 |    472 | 	User::Leave(KErrNotSupported);
 | 
| sl@0 |    473 | 	}
 | 
| sl@0 |    474 | 
 | 
| sl@0 |    475 | void CRomMountCB::GetLongNameL(const TDesC& /*aShortName*/,TDes& /*aLongName*/)
 | 
| sl@0 |    476 | //
 | 
| sl@0 |    477 | // Return the short name associated with aLongName
 | 
| sl@0 |    478 | // Assumes all rom names are 8.3
 | 
| sl@0 |    479 | //
 | 
| sl@0 |    480 | 	{
 | 
| sl@0 |    481 | 
 | 
| sl@0 |    482 | 	User::Leave(KErrNotSupported);
 | 
| sl@0 |    483 | 	}	
 | 
| sl@0 |    484 | 
 | 
| sl@0 |    485 | TInt CRomMountCB::GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput) 
 | 
| sl@0 |    486 | //
 | 
| sl@0 |    487 | // Access the specified interface; behaviour is interface-specific
 | 
| sl@0 |    488 | //
 | 
| sl@0 |    489 | 	{
 | 
| sl@0 |    490 | 	switch(aInterfaceId)
 | 
| sl@0 |    491 | 		{
 | 
| sl@0 |    492 | 		case (CMountCB::EFileAccessor):
 | 
| sl@0 |    493 | 			{
 | 
| sl@0 |    494 | 			((CMountCB::MFileAccessor*&) aInterface) = this;
 | 
| sl@0 |    495 | 			return KErrNone;
 | 
| sl@0 |    496 | 			}
 | 
| sl@0 |    497 | 		default:
 | 
| sl@0 |    498 | 			return (CMountCB::GetInterface(aInterfaceId,aInterface,aInput));
 | 
| sl@0 |    499 | 		}
 | 
| sl@0 |    500 | 	}
 | 
| sl@0 |    501 | 
 | 
| sl@0 |    502 | TInt CRomMountCB::GetFileUniqueId(const TDesC& /* aName */, TInt64& aUniqueId)
 | 
| sl@0 |    503 | 	{
 | 
| sl@0 |    504 | 	// Get unique identifier for the file - for ROM File System will just return zero
 | 
| sl@0 |    505 | 	aUniqueId = MAKE_TINT64(0,0);
 | 
| sl@0 |    506 | 	return KErrNone;
 | 
| sl@0 |    507 | 	}
 | 
| sl@0 |    508 | 
 | 
| sl@0 |    509 | TInt CRomMountCB::Spare3(TInt /*aVal*/, TAny* /*aPtr1*/, TAny* /*aPtr2*/)
 | 
| sl@0 |    510 | 	{
 | 
| sl@0 |    511 | 	return KErrNotSupported;
 | 
| sl@0 |    512 | 	}
 | 
| sl@0 |    513 | 
 | 
| sl@0 |    514 | TInt CRomMountCB::Spare2(TInt /*aVal*/, TAny* /*aPtr1*/, TAny* /*aPtr2*/)
 | 
| sl@0 |    515 | 	{
 | 
| sl@0 |    516 | 	return KErrNotSupported;
 | 
| sl@0 |    517 | 	}
 | 
| sl@0 |    518 | 
 | 
| sl@0 |    519 | TInt CRomMountCB::Spare1(TInt /*aVal*/, TAny* /*aPtr1*/, TAny* /*aPtr2*/)
 | 
| sl@0 |    520 | 	{
 | 
| sl@0 |    521 | 	return KErrNotSupported;
 | 
| sl@0 |    522 | 	}
 | 
| sl@0 |    523 | 
 | 
| sl@0 |    524 | 
 | 
| sl@0 |    525 | CRomFileCB::CRomFileCB(const CRom* aRom)
 | 
| sl@0 |    526 | //
 | 
| sl@0 |    527 | // Constructor
 | 
| sl@0 |    528 | //
 | 
| sl@0 |    529 | 	: iRom(aRom)
 | 
| sl@0 |    530 | 	{
 | 
| sl@0 |    531 | 	}
 | 
| sl@0 |    532 | 
 | 
| sl@0 |    533 | void CRomFileCB::ReadL(TInt aPos,TInt& aLength,const TAny* aTrg,const RMessagePtr2& aMessage)
 | 
| sl@0 |    534 | //
 | 
| sl@0 |    535 | // Read from the file.
 | 
| sl@0 |    536 | //
 | 
| sl@0 |    537 | 	{
 | 
| sl@0 |    538 | 
 | 
| sl@0 |    539 | 	__PRINT(Print(_L("CRomFileCB::ReadL")));
 | 
| sl@0 |    540 | 
 | 
| sl@0 |    541 | 	if (aPos>=iSize)
 | 
| sl@0 |    542 | 		{
 | 
| sl@0 |    543 |         TPtrC8 nullBuf(NULL,0);
 | 
| sl@0 |    544 | 		aMessage.WriteL(0,nullBuf,0);
 | 
| sl@0 |    545 | 		aLength=0;
 | 
| sl@0 |    546 | 		}
 | 
| sl@0 |    547 | 	else
 | 
| sl@0 |    548 | 		{
 | 
| sl@0 |    549 | 		TInt len=Min((iSize-aPos),aLength);
 | 
| sl@0 |    550 |         TPtrC8 romBuf(iBase+aPos,len);
 | 
| sl@0 |    551 | //		thread->WriteL(aTrg,romBuf,0);
 | 
| sl@0 |    552 | 		aMessage.WriteL(0,romBuf,0);
 | 
| sl@0 |    553 | 		aLength=len;
 | 
| sl@0 |    554 | 		}
 | 
| sl@0 |    555 | 	}
 | 
| sl@0 |    556 | 
 | 
| sl@0 |    557 | void CRomFileCB::WriteL(TInt /*aPos*/,TInt& /*aLength*/,const TAny* /*aDes*/,const RMessagePtr2& /*aMessage*/)
 | 
| sl@0 |    558 | //
 | 
| sl@0 |    559 | // Write to the file.
 | 
| sl@0 |    560 | //
 | 
| sl@0 |    561 | 	{
 | 
| sl@0 |    562 | 
 | 
| sl@0 |    563 | 	User::Leave(KErrAccessDenied);
 | 
| sl@0 |    564 | 	}
 | 
| sl@0 |    565 | 
 | 
| sl@0 |    566 | void CRomFileCB::RenameL(const TDesC& /*aDes*/)
 | 
| sl@0 |    567 | //
 | 
| sl@0 |    568 | // Rename the file.
 | 
| sl@0 |    569 | //
 | 
| sl@0 |    570 | 	{
 | 
| sl@0 |    571 | 
 | 
| sl@0 |    572 | 	User::Leave(KErrAccessDenied);
 | 
| sl@0 |    573 | 	}
 | 
| sl@0 |    574 | 
 | 
| sl@0 |    575 | void CRomFileCB::SetSizeL(TInt /*aSize*/)
 | 
| sl@0 |    576 | //
 | 
| sl@0 |    577 | // Set the file size.
 | 
| sl@0 |    578 | //
 | 
| sl@0 |    579 | 	{
 | 
| sl@0 |    580 | 
 | 
| sl@0 |    581 | 	User::Leave(KErrAccessDenied);
 | 
| sl@0 |    582 | 	}
 | 
| sl@0 |    583 | 
 | 
| sl@0 |    584 | void CRomFileCB::SetEntryL(const TTime& /*aTime*/,TUint /*aMask*/,TUint /*aVal*/)
 | 
| sl@0 |    585 | //
 | 
| sl@0 |    586 | // Set the entry's attributes and modified time.
 | 
| sl@0 |    587 | //
 | 
| sl@0 |    588 | 	{
 | 
| sl@0 |    589 | 
 | 
| sl@0 |    590 | 	User::Leave(KErrAccessDenied);
 | 
| sl@0 |    591 | 	}
 | 
| sl@0 |    592 | 
 | 
| sl@0 |    593 | void CRomFileCB::FlushAllL()
 | 
| sl@0 |    594 | //
 | 
| sl@0 |    595 | // Commit any buffered date to the media.
 | 
| sl@0 |    596 | //
 | 
| sl@0 |    597 | 	{
 | 
| sl@0 |    598 | 
 | 
| sl@0 |    599 | 	User::Leave(KErrAccessDenied);
 | 
| sl@0 |    600 | 	}
 | 
| sl@0 |    601 | 
 | 
| sl@0 |    602 | void CRomFileCB::FlushDataL()
 | 
| sl@0 |    603 | //
 | 
| sl@0 |    604 | // Commit any buffered date to the media.
 | 
| sl@0 |    605 | //
 | 
| sl@0 |    606 | 	{
 | 
| sl@0 |    607 | 
 | 
| sl@0 |    608 | 	User::Leave(KErrAccessDenied);
 | 
| sl@0 |    609 | 	}
 | 
| sl@0 |    610 | 
 | 
| sl@0 |    611 | TInt CRomFileCB::Address(TInt& aPos) const
 | 
| sl@0 |    612 | //
 | 
| sl@0 |    613 | // Return address of the file at aPos. Default implementation.
 | 
| sl@0 |    614 | //
 | 
| sl@0 |    615 | 	{
 | 
| sl@0 |    616 | 
 | 
| sl@0 |    617 | 	if (aPos>=iSize)
 | 
| sl@0 |    618 | 		return(KErrEof);
 | 
| sl@0 |    619 | 	aPos=(TInt)(iBase+aPos);
 | 
| sl@0 |    620 | 	return(KErrNone);
 | 
| sl@0 |    621 | 	}
 | 
| sl@0 |    622 | 
 | 
| sl@0 |    623 | CRomDirCB::CRomDirCB(const CRom* aRom)
 | 
| sl@0 |    624 | //
 | 
| sl@0 |    625 | // Constructor
 | 
| sl@0 |    626 | //
 | 
| sl@0 |    627 | 	: iRom(aRom)
 | 
| sl@0 |    628 | 	{
 | 
| sl@0 |    629 | 	}
 | 
| sl@0 |    630 | 
 | 
| sl@0 |    631 | CRomDirCB::~CRomDirCB()
 | 
| sl@0 |    632 | //
 | 
| sl@0 |    633 | // Destruct
 | 
| sl@0 |    634 | //
 | 
| sl@0 |    635 | 	{
 | 
| sl@0 |    636 | 
 | 
| sl@0 |    637 | 	delete iMatch;
 | 
| sl@0 |    638 | 	}
 | 
| sl@0 |    639 | 
 | 
| sl@0 |    640 | TBool CRomDirCB::MatchUid()
 | 
| sl@0 |    641 | //
 | 
| sl@0 |    642 | // Match the uid ?
 | 
| sl@0 |    643 | //
 | 
| sl@0 |    644 | 	{
 | 
| sl@0 |    645 | 
 | 
| sl@0 |    646 | 	if (iUidType[0]!=TUid::Null() || iUidType[1]!=TUid::Null() || iUidType[2]!=TUid::Null())
 | 
| sl@0 |    647 | 		return(ETrue);
 | 
| sl@0 |    648 | 	return(EFalse);
 | 
| sl@0 |    649 | 	}
 | 
| sl@0 |    650 | 
 | 
| sl@0 |    651 | LOCAL_C TBool CompareUid(const TUidType& aUidTrg, const TUidType& aUidSuitor)
 | 
| sl@0 |    652 | //
 | 
| sl@0 |    653 | // Compare the suitor to the target pattern
 | 
| sl@0 |    654 | //
 | 
| sl@0 |    655 | 	{
 | 
| sl@0 |    656 | 	
 | 
| sl@0 |    657 | 	if (aUidTrg[0]!=TUid::Null() && aUidTrg[0]!=aUidSuitor[0])
 | 
| sl@0 |    658 | 		return(EFalse);
 | 
| sl@0 |    659 | 	if (aUidTrg[1]!=TUid::Null() && aUidTrg[1]!=aUidSuitor[1])
 | 
| sl@0 |    660 | 		return(EFalse);
 | 
| sl@0 |    661 | 	if (aUidTrg[2]!=TUid::Null() && aUidTrg[2]!=aUidSuitor[2])
 | 
| sl@0 |    662 | 		return(EFalse);
 | 
| sl@0 |    663 | 	return(ETrue);
 | 
| sl@0 |    664 | 	}
 | 
| sl@0 |    665 | 
 | 
| sl@0 |    666 | void CRomDirCB::ReadL(TEntry& anEntry)
 | 
| sl@0 |    667 | //
 | 
| sl@0 |    668 | // Read the next entry from the directory.
 | 
| sl@0 |    669 | //
 | 
| sl@0 |    670 | 	{
 | 
| sl@0 |    671 | 
 | 
| sl@0 |    672 | 	CRomMountCB& mount=(CRomMountCB&)Mount();
 | 
| sl@0 |    673 | 	const TRomEntry* pE;
 | 
| sl@0 |    674 | 	FOREVER
 | 
| sl@0 |    675 | 		{
 | 
| sl@0 |    676 | 		//
 | 
| sl@0 |    677 | 		//May be called with wildcards in the path, so we need
 | 
| sl@0 |    678 | 		//to call the slow, sequential FindL
 | 
| sl@0 |    679 | 		//
 | 
| sl@0 |    680 | 		if (!iPending)
 | 
| sl@0 |    681 | 			mount.FindL(*iMatch,iAtt,iDir,iNext,KErrEof);
 | 
| sl@0 |    682 | 		iPending=EFalse;
 | 
| sl@0 |    683 | 		pE = (const TRomEntry*)iNext;
 | 
| sl@0 |    684 | 		iEntry.iName.Des().Copy((TText*)&pE->iName[0],pE->iNameLength);
 | 
| sl@0 |    685 | 		iEntry.iAtt=pE->iAtt;
 | 
| sl@0 |    686 | 		iEntry.iSize=pE->iSize;
 | 
| sl@0 |    687 | 		iEntry.iModified=RomHeader().iTime;
 | 
| sl@0 |    688 | 		anEntry=iEntry;
 | 
| sl@0 |    689 | 		if (MatchUid())
 | 
| sl@0 |    690 | 			{
 | 
| sl@0 |    691 | 			mount.ReadUidL(pE->iAddressLin,anEntry);
 | 
| sl@0 |    692 | 			if (CompareUid(iUidType,anEntry.iType))
 | 
| sl@0 |    693 | 				break;
 | 
| sl@0 |    694 | 			}
 | 
| sl@0 |    695 | 		else
 | 
| sl@0 |    696 | 			break;
 | 
| sl@0 |    697 | 		}
 | 
| sl@0 |    698 | 	if (iAtt&KEntryAttAllowUid && (anEntry.iAtt&KEntryAttDir)==0 && MatchUid()==EFalse)
 | 
| sl@0 |    699 | 		mount.ReadUidL(pE->iAddressLin,anEntry);
 | 
| sl@0 |    700 | 	}
 | 
| sl@0 |    701 | 
 | 
| sl@0 |    702 | void CRomDirCB::SetDir(TLinAddr aDir,TLinAddr anEntry,const TDesC& aName)
 | 
| sl@0 |    703 | //
 | 
| sl@0 |    704 | // Set the directory and entry that we are on after open.
 | 
| sl@0 |    705 | //
 | 
| sl@0 |    706 | 	{
 | 
| sl@0 |    707 | 
 | 
| sl@0 |    708 |     iDir=aDir;
 | 
| sl@0 |    709 | 	iNext=anEntry;
 | 
| sl@0 |    710 | 	iMatch=aName.AllocL();
 | 
| sl@0 |    711 | 	iPending=(anEntry!=NULL);
 | 
| sl@0 |    712 | 	}
 | 
| sl@0 |    713 | 
 | 
| sl@0 |    714 | CRom::CRom()
 | 
| sl@0 |    715 | //
 | 
| sl@0 |    716 | // Constructor
 | 
| sl@0 |    717 | //
 | 
| sl@0 |    718 | 	{
 | 
| sl@0 |    719 | 	}
 | 
| sl@0 |    720 | 
 | 
| sl@0 |    721 | CRom::~CRom()
 | 
| sl@0 |    722 | //
 | 
| sl@0 |    723 | // Destruct
 | 
| sl@0 |    724 | //
 | 
| sl@0 |    725 | 	{
 | 
| sl@0 |    726 | 	}
 | 
| sl@0 |    727 | 
 | 
| sl@0 |    728 | TInt CRom::Install()
 | 
| sl@0 |    729 | //
 | 
| sl@0 |    730 | // Install the file system.
 | 
| sl@0 |    731 | //
 | 
| sl@0 |    732 | 	{
 | 
| sl@0 |    733 | 
 | 
| sl@0 |    734 | 	iVersion=TVersion(KF32MajorVersionNumber,KF32MinorVersionNumber,KF32BuildVersionNumber);
 | 
| sl@0 |    735 |     TPtrC name=_L("Rom");
 | 
| sl@0 |    736 | 	return(SetName(&name));
 | 
| sl@0 |    737 | 	}
 | 
| sl@0 |    738 | 
 | 
| sl@0 |    739 | CMountCB* CRom::NewMountL() const
 | 
| sl@0 |    740 | //
 | 
| sl@0 |    741 | // Create a new mount control block.
 | 
| sl@0 |    742 | //
 | 
| sl@0 |    743 | 	{
 | 
| sl@0 |    744 | 
 | 
| sl@0 |    745 | 	return(new(ELeave) CRomMountCB(this));
 | 
| sl@0 |    746 | 	}
 | 
| sl@0 |    747 | 
 | 
| sl@0 |    748 | CFileCB* CRom::NewFileL() const
 | 
| sl@0 |    749 | //
 | 
| sl@0 |    750 | // Create a new file.
 | 
| sl@0 |    751 | //
 | 
| sl@0 |    752 | 	{
 | 
| sl@0 |    753 | 
 | 
| sl@0 |    754 | 	return(new(ELeave) CRomFileCB(this));
 | 
| sl@0 |    755 | 	}
 | 
| sl@0 |    756 | 
 | 
| sl@0 |    757 | CDirCB* CRom::NewDirL() const
 | 
| sl@0 |    758 | //
 | 
| sl@0 |    759 | // Create a new directory lister.
 | 
| sl@0 |    760 | //
 | 
| sl@0 |    761 | 	{
 | 
| sl@0 |    762 | 
 | 
| sl@0 |    763 | 	return(new(ELeave) CRomDirCB(this));
 | 
| sl@0 |    764 | 	}
 | 
| sl@0 |    765 | 
 | 
| sl@0 |    766 | CFormatCB* CRom::NewFormatL() const
 | 
| sl@0 |    767 | //
 | 
| sl@0 |    768 | // Create a new media formatter.
 | 
| sl@0 |    769 | //
 | 
| sl@0 |    770 | 	{
 | 
| sl@0 |    771 | 
 | 
| sl@0 |    772 | 	User::Leave(KErrAccessDenied);
 | 
| sl@0 |    773 | 	return(NULL);
 | 
| sl@0 |    774 | 	}
 | 
| sl@0 |    775 | 
 | 
| sl@0 |    776 | void CRom::DriveInfo(TDriveInfo& anInfo,TInt /*aDriveNumber*/) const
 | 
| sl@0 |    777 | //
 | 
| sl@0 |    778 | // Return the drive info.
 | 
| sl@0 |    779 | //
 | 
| sl@0 |    780 | 	{
 | 
| sl@0 |    781 | 	anInfo.iDriveAtt=KDriveAttRom|KDriveAttInternal;
 | 
| sl@0 |    782 | 	anInfo.iMediaAtt=KMediaAttWriteProtected;
 | 
| sl@0 |    783 | 	anInfo.iType=EMediaRom;
 | 
| sl@0 |    784 | 	}
 | 
| sl@0 |    785 | 
 | 
| sl@0 |    786 | GLDEF_C void InstallRomFileSystemL()
 | 
| sl@0 |    787 | //
 | 
| sl@0 |    788 | // Create the ROM file system.
 | 
| sl@0 |    789 | //
 | 
| sl@0 |    790 | 	{
 | 
| sl@0 |    791 | 
 | 
| sl@0 |    792 | 	CFileSystem* pS=new(ELeave) CRom;
 | 
| sl@0 |    793 | 	CleanupStack::PushL(pS);
 | 
| sl@0 |    794 | 	User::LeaveIfError(InstallFileSystem(pS,RLibrary()));
 | 
| sl@0 |    795 | 	CleanupStack::Pop(1, pS);
 | 
| sl@0 |    796 | 	}
 | 
| sl@0 |    797 | 
 | 
| sl@0 |    798 | GLDEF_C const TRomHeader *RomHeader(CFileSystem *aFsys)
 | 
| sl@0 |    799 | //
 | 
| sl@0 |    800 | // Return the ROM header
 | 
| sl@0 |    801 | //
 | 
| sl@0 |    802 | 	{
 | 
| sl@0 |    803 | 
 | 
| sl@0 |    804 | 	return &((CRom *)aFsys)->RomHeader();
 | 
| sl@0 |    805 | 	}
 | 
| sl@0 |    806 | 
 |