Update contrib.
1 // Copyright (c) 1997-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\fsstress\t_remmnt.cpp
25 #define WIN32_LEAN_AND_MEAN
26 #pragma warning( disable : 4201 ) // nonstandard extension used : nameless struct/union
28 #pragma warning( default : 4201 ) // nonstandard extension used : nameless struct/union
41 LOCAL_C TInt GetMediaSize(TInt /*aDriveNumber*/,TInt64& /*aSize*/,TInt64& /*aFree*/)
43 // Return the size and free space on a drive.
49 LOCAL_C TInt GetVolume(TInt /*aDriveNumber*/,TDes& aName,TUint& aUniqueID)
51 // Return the volume name and uniqueID.
55 aName=(_L("REMOTDRV"));
60 //////////////////////////////////////////////////////////////////////////
62 //////////////////////////////////////////////////////////////////////////
65 CRemoteMountCB::CRemoteMountCB()
70 __DECLARE_NAME(_S("CRemoteMountCB"));
73 CRemoteMountCB::~CRemoteMountCB()
79 void CRemoteMountCB::MountL(TBool /*aForceMount*/)
81 // Mount a media. Only allowed to leave with KErrNoMemory,KErrNotReady,KErrCorrupt,KErrUnknown.
86 TInt d=Drive().DriveNumber();
88 if (MapDrive(driveName,d))
89 RFs::CharToDrive(driveName[0],d);
90 //User::LeaveIfError(GetMediaSize(d,s,f));
91 //if (driveNum==EDriveZ)
96 User::LeaveIfError(GetVolume(d,driveName,iUniqueID));
97 HBufC* pN=driveName.AllocL();
101 TInt CRemoteMountCB::ReMount()
103 // Try and remount this media.
108 TInt d=Drive().DriveNumber();
110 RFs::CharToDrive(n[0],d);
112 TInt r=GetVolume(d,n,uniqueID);
115 if (n==VolumeName() && uniqueID==iUniqueID)
120 void CRemoteMountCB::Dismounted()
122 // Dummy implementation of a pure virtual function
126 void CRemoteMountCB::VolumeL(TVolumeInfo& aVolume) const
128 // Return the volume info.
133 TInt d=Drive().DriveNumber();
136 RFs::CharToDrive(n[0],d);
137 User::LeaveIfError(GetMediaSize(d,s,f));
138 if (driveNum==EDriveZ)
145 void CRemoteMountCB::SetVolumeL(TDes& /*aName*/)
147 // Set the volume label
148 // Dummy implementation of a pure virtual function
153 void CRemoteMountCB::IsFileInRom(const TDesC& /*aName*/,TUint8*& /*aFileStart*/)
155 // Return the address of the file if it is in rom
162 void CRemoteMountCB::MkDirL(const TDesC& /*aName*/)
165 // Dummy implementation of a pure virtual function
168 User::After(200000); // Wait 0.2 seconds
172 void CRemoteMountCB::RmDirL(const TDesC& /*aName*/)
174 // Remove a directory
175 // Dummy implementation of a pure virtual function
178 User::After(200000); // Wait 0.2 seconds
181 void CRemoteMountCB::DeleteL(const TDesC& /*aName*/)
184 // Dummy implementation of a pure virtual function
187 User::After(200000); // Wait 0.2 seconds
190 void CRemoteMountCB::RenameL(const TDesC& /*anOldName*/,const TDesC& /*aNewName*/)
192 // Rename a file or directory
193 // Dummy implementation of a pure virtual function
196 User::After(200000); // Wait 0.2 seconds
199 void CRemoteMountCB::ReplaceL(const TDesC& /*anOldName*/,const TDesC& /*aNewName*/)
201 // Delete aNewName if it exists and rename anOldName
202 // Dummy implementation of a pure virtual function
205 User::After(200000); // Wait 0.2 seconds
208 void CRemoteMountCB::ReadUidL(const TDesC& /*aName*/,TEntry& /*anEntry*/) const
210 // Read the entry uid if present
213 User::After(200000); // Wait 0.2 seconds
217 void CRemoteMountCB::EntryL(const TDesC& /*aName*/,TEntry& /*anEntry*/) const
220 // Dummy implementation of a pure virtual function
223 User::After(200000); // Wait 0.2 seconds
226 void CRemoteMountCB::SetEntryL(const TDesC& /*aName*/,const TTime& /*aTime*/,TUint /*aSetAttMask*/,TUint /*aClearAttMask*/)
229 // Dummy implementation of a pure virtual function
232 User::After(200000); // Wait 0.2 seconds
236 void CRemoteMountCB::FileOpenL(const TDesC& /*aName*/,TUint /*aMode*/,TFileOpen /*anOpen*/,CFileCB* /*aFile*/)
239 // Dummy implementation of a pure virtual function
242 User::After(200000); // Wait 0.2 seconds
245 void CRemoteMountCB::DirOpenL(const TDesC& /*aName*/,CDirCB* /*aDir*/)
247 // Open a directory on the current mount
248 // Dummy implementation of a pure virtual function
251 User::After(200000); // Wait 0.2 seconds
255 void CRemoteMountCB::RawReadL(TInt64 /*aPos*/,TInt /*aLength*/,const TAny* /*aTrg*/,TInt /*anOffset*/,const RMessagePtr2& /*aMessage*/) const
257 // Read directly from disk
260 User::Leave(KErrNotSupported);
263 void CRemoteMountCB::RawWriteL(TInt64 /*aPos*/,TInt /*aLength*/,const TAny* /*aSrc*/,TInt /*anOffset*/,const RMessagePtr2& /*aMessage*/)
265 // Write directly to disk
268 User::Leave(KErrNotSupported);
271 void CRemoteMountCB::GetShortNameL(const TDesC& /*aLongName*/,TDes& /*aShortName*/)
273 // Get the short name associated with aLongName
274 // Dummy implementation of a pure virtual function
279 void CRemoteMountCB::GetLongNameL(const TDesC& /*aShortName*/,TDes& /*aLongName*/)
281 // Get the short name associated with aLongName
282 // Dummy implementation of a pure virtual function
287 void CRemoteMountCB::ReadSectionL(const TDesC& /*aName*/,TInt /*aPos*/,TAny* /*aTrg*/,TInt /*aLength*/,const RMessagePtr2& /*aMessage*/)
289 // Get the short name associated with aLongName
290 // Dummy implementation of a pure virtual function
296 TBool CRemoteMountCB::IsRomDrive() const
298 // Returns ETrue if the drive == EDriveZ
301 return(Drive().DriveNumber()==EDriveZ);