Update contrib.
1 // Copyright (c) 2006-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 // f32test\testfsys\t_tfsys2.cpp
21 const TInt KMajorVersionNumber=1;
22 const TInt KMinorVersionNumber=0;
24 //TInt gMountAttempts = 0;
26 CTestFileSystem::CTestFileSystem()
31 __DECLARE_NAME(_S("CTestFileSystem2"));
34 CTestFileSystem::~CTestFileSystem()
40 TInt CTestFileSystem::Install()
42 // Install the file system
45 iVersion=TVersion(KMajorVersionNumber,KMinorVersionNumber,KF32BuildVersionNumber);
46 TPtrC name=_L("Test2");
47 return(SetName(&name));
50 CMountCB* CTestFileSystem::NewMountL() const
52 // Create a new mount control block
55 CTestMountCB* mount = new(ELeave) CTestMountCB;
60 CFileCB* CTestFileSystem::NewFileL() const
65 return (new(ELeave) CTestFileCB);
68 CDirCB* CTestFileSystem::NewDirL() const
70 // create a new directory lister
73 return (new(ELeave) CTestDirCB);
76 CFormatCB* CTestFileSystem::NewFormatL() const
78 // Create a new media formatter
81 return (new(ELeave) CTestFormatCB);
84 TInt CTestFileSystem::DefaultPath(TDes& aPath) const
86 // Return the intial default path
93 void CTestFileSystem::DriveInfo(TDriveInfo& anInfo,TInt aDriveNumber) const
98 CFileSystem::DriveInfo(anInfo, aDriveNumber);
100 // hijack the iBattery member to report back the number of times MountL() has been called
101 anInfo.iBattery = (TBatteryState) iMountAttempts;
105 Reports whether the specified interface is supported - if it is,
106 the supplied interface object is modified to it
108 @param aInterfaceId The interface of interest
109 @param aInterface The interface object
110 @return KErrNone if the interface is supported, otherwise KErrNotFound
112 @see CFileSystem::GetInterface()
114 TInt CTestFileSystem::GetInterface(TInt aInterfaceId, TAny*& aInterface,TAny* aInput)
118 case CFileSystem::EProxyDriveSupport: // The FAT Filesystem supports proxy drives
122 return(CFileSystem::GetInterface(aInterfaceId, aInterface, aInput));
126 CFileSystem* CTestFileSystem::NewL()
131 CFileSystem* testFSys = new(ELeave) CTestFileSystem;
136 CTestMountCB::CTestMountCB() : iFileSystem(NULL)
140 CTestMountCB::~CTestMountCB(){};
141 CTestDirCB::CTestDirCB(){};
142 CTestDirCB::~CTestDirCB(){};
143 CTestFileCB::CTestFileCB(){};
144 CTestFileCB::~CTestFileCB(){};
145 CTestFormatCB::CTestFormatCB(){};
146 CTestFormatCB::~CTestFormatCB(){};
147 void CTestMountCB::MountL(TBool /*aForceMount*/)
150 iFileSystem->iMountAttempts++;
152 User::Leave(KErrCorrupt);
155 void CTestMountCB::EntryL(const TDesC& /*aName*/,TEntry& /*anEntry*/) const
157 User::Leave(KErrNotFound);
160 TInt CTestMountCB::ForceRemountDrive(const TDesC8* /*aMountInfo*/,TInt /*aMountInfoMessageHandle*/,TUint /*aFlags*/)
162 Drive().SetChanged(ETrue);
166 void CTestMountCB::SetFsy(const CTestFileSystem* aFileSystem)
168 iFileSystem = const_cast<CTestFileSystem*> (aFileSystem);
173 EXPORT_C CFileSystem* CreateFileSystem()
175 // Create a new file system
178 return(CTestFileSystem::NewL());