Update contrib.
1 // Copyright (c) 1998-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32test\lffs\loadlffs.cpp
22 LOCAL_C void FormatLFFS(TDes &drive)
29 RDebug::Print(_L("Format LFFS drive %S\r\n"), &drive);
30 r = format.Open(TheFs, drive, EHighDensity, count);
41 //LOCAL_C void ForceMediaRemount( TMediaDevice aMedia )
43 // // Force a remount on next access
46 // UserSvr::ForceRemountMedia( aMedia );
53 RDebug::Print(_L("Read machine information"));
56 TBuf<4> LFFSdriveLetter;
58 LFFSdriveLetter.Zero();
59 LFFSdriveLetter.Append(_L("K:\\"));
60 LFFSdriveNumber = EDriveK;
62 RDebug::Print(_L("Load device driver: MEDLFS"));
63 TInt r=User::LoadPhysicalDevice(_L("MEDLFS"));
64 if(r != KErrNone && r != KErrAlreadyExists)
66 RDebug::Print(_L("Loading device driver failed"));
70 RDebug::Print(_L("Add file system: ELFFS"));
71 r=TheFs.AddFileSystem(_L("ELFFS"));
72 if(r != KErrNone && r != KErrAlreadyExists)
73 RDebug::Print(_L("Failed to add ELFFS"));
77 r = TheFs.FileSystemName(name, LFFSdriveNumber);
79 if (name.Length() != 0)
81 RDebug::Print(_L("Dismounting %S on drive %S\r\n"), &name, &LFFSdriveLetter);
82 r=TheFs.DismountFileSystem(name, LFFSdriveNumber);
83 RDebug::Print(_L("Dismount ret=%d"), r);
86 // ForceMediaRemount( EFixedMedia1 );
88 RDebug::Print(_L("Mount LFFS on drive %S\r\n"), &LFFSdriveLetter);
89 r=TheFs.MountFileSystem(_L("Lffs"), LFFSdriveNumber);
90 RDebug::Print(_L("Mount r=%d"),r);
92 if (r == KErrCorrupt || r == KErrNotReady)
94 RDebug::Print(_L("FS Corrupt, formatting"));
95 FormatLFFS(LFFSdriveLetter);
98 TheFs.SetSessionPath(LFFSdriveLetter);
99 return(LFFSdriveNumber);
102 GLDEF_C TInt E32Main()
104 // Load the LFFS on C:
108 CTrapCleanup* cleanup;
109 cleanup=CTrapCleanup::New();
111 TInt r=TheFs.Connect();
112 RDebug::Print(_L("Connect ret %d"),r);
115 RDebug::Print(_L("Mount LFFS ret %d"),r);