sl@0: // Copyright (c) 1997-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: // f32test\fsstress\t_remmnt.cpp sl@0: // sl@0: // sl@0: sl@0: #if defined(_UNICODE) sl@0: #if !defined(UNICODE) sl@0: #define UNICODE sl@0: #endif sl@0: #endif sl@0: sl@0: /* sl@0: #define WIN32_LEAN_AND_MEAN sl@0: #pragma warning( disable : 4201 ) // nonstandard extension used : nameless struct/union sl@0: #include sl@0: #pragma warning( default : 4201 ) // nonstandard extension used : nameless struct/union sl@0: #include sl@0: */ sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: #include "t_remfsy.h" sl@0: sl@0: sl@0: sl@0: LOCAL_C TInt GetMediaSize(TInt /*aDriveNumber*/,TInt64& /*aSize*/,TInt64& /*aFree*/) sl@0: // sl@0: // Return the size and free space on a drive. sl@0: // sl@0: { sl@0: return(KErrNone); sl@0: } sl@0: sl@0: LOCAL_C TInt GetVolume(TInt /*aDriveNumber*/,TDes& aName,TUint& aUniqueID) sl@0: // sl@0: // Return the volume name and uniqueID. sl@0: // sl@0: { sl@0: aUniqueID=1234; sl@0: aName=(_L("REMOTDRV")); sl@0: return(KErrNone); sl@0: } sl@0: sl@0: sl@0: ////////////////////////////////////////////////////////////////////////// sl@0: // CRemoteMountCB // sl@0: ////////////////////////////////////////////////////////////////////////// sl@0: sl@0: sl@0: CRemoteMountCB::CRemoteMountCB() sl@0: // sl@0: // Constructor sl@0: // sl@0: { sl@0: __DECLARE_NAME(_S("CRemoteMountCB")); sl@0: } sl@0: sl@0: CRemoteMountCB::~CRemoteMountCB() sl@0: // sl@0: // Destructor sl@0: // sl@0: {} sl@0: sl@0: void CRemoteMountCB::MountL(TBool /*aForceMount*/) sl@0: // sl@0: // Mount a media. Only allowed to leave with KErrNoMemory,KErrNotReady,KErrCorrupt,KErrUnknown. sl@0: // sl@0: { sl@0: // TInt64 s,f; sl@0: TFileName driveName; sl@0: TInt d=Drive().DriveNumber(); sl@0: // TInt driveNum=d; sl@0: if (MapDrive(driveName,d)) sl@0: RFs::CharToDrive(driveName[0],d); sl@0: //User::LeaveIfError(GetMediaSize(d,s,f)); sl@0: //if (driveNum==EDriveZ) sl@0: // iSize=4*1048576; sl@0: // else sl@0: //iSize=s; sl@0: iSize=4*1024*16; sl@0: User::LeaveIfError(GetVolume(d,driveName,iUniqueID)); sl@0: HBufC* pN=driveName.AllocL(); sl@0: SetVolumeName(pN); sl@0: } sl@0: sl@0: TInt CRemoteMountCB::ReMount() sl@0: // sl@0: // Try and remount this media. sl@0: // sl@0: { sl@0: sl@0: TFileName n; sl@0: TInt d=Drive().DriveNumber(); sl@0: if (MapDrive(n,d)) sl@0: RFs::CharToDrive(n[0],d); sl@0: TUint uniqueID; sl@0: TInt r=GetVolume(d,n,uniqueID); sl@0: if (r!=KErrNone) sl@0: return(r); sl@0: if (n==VolumeName() && uniqueID==iUniqueID) sl@0: return(KErrNone); sl@0: return(KErrGeneral); sl@0: } sl@0: sl@0: void CRemoteMountCB::Dismounted() sl@0: // sl@0: // Dummy implementation of a pure virtual function sl@0: // sl@0: {} sl@0: sl@0: void CRemoteMountCB::VolumeL(TVolumeInfo& aVolume) const sl@0: // sl@0: // Return the volume info. sl@0: // sl@0: { sl@0: TInt64 s,f(0); sl@0: TFileName n; sl@0: TInt d=Drive().DriveNumber(); sl@0: TInt driveNum=d; sl@0: if (MapDrive(n,d)) sl@0: RFs::CharToDrive(n[0],d); sl@0: User::LeaveIfError(GetMediaSize(d,s,f)); sl@0: if (driveNum==EDriveZ) sl@0: aVolume.iFree=0; sl@0: else sl@0: aVolume.iFree=f; sl@0: } sl@0: sl@0: sl@0: void CRemoteMountCB::SetVolumeL(TDes& /*aName*/) sl@0: // sl@0: // Set the volume label sl@0: // Dummy implementation of a pure virtual function sl@0: // sl@0: {} sl@0: sl@0: sl@0: void CRemoteMountCB::IsFileInRom(const TDesC& /*aName*/,TUint8*& /*aFileStart*/) sl@0: // sl@0: // Return the address of the file if it is in rom sl@0: // sl@0: {} sl@0: sl@0: sl@0: sl@0: sl@0: void CRemoteMountCB::MkDirL(const TDesC& /*aName*/) sl@0: // sl@0: // Make a directory sl@0: // Dummy implementation of a pure virtual function sl@0: // sl@0: { sl@0: User::After(200000); // Wait 0.2 seconds sl@0: } sl@0: sl@0: sl@0: void CRemoteMountCB::RmDirL(const TDesC& /*aName*/) sl@0: // sl@0: // Remove a directory sl@0: // Dummy implementation of a pure virtual function sl@0: // sl@0: { sl@0: User::After(200000); // Wait 0.2 seconds sl@0: } sl@0: sl@0: void CRemoteMountCB::DeleteL(const TDesC& /*aName*/) sl@0: // sl@0: // Delete a file sl@0: // Dummy implementation of a pure virtual function sl@0: // sl@0: { sl@0: User::After(200000); // Wait 0.2 seconds sl@0: } sl@0: sl@0: void CRemoteMountCB::RenameL(const TDesC& /*anOldName*/,const TDesC& /*aNewName*/) sl@0: // sl@0: // Rename a file or directory sl@0: // Dummy implementation of a pure virtual function sl@0: // sl@0: { sl@0: User::After(200000); // Wait 0.2 seconds sl@0: } sl@0: sl@0: void CRemoteMountCB::ReplaceL(const TDesC& /*anOldName*/,const TDesC& /*aNewName*/) sl@0: // sl@0: // Delete aNewName if it exists and rename anOldName sl@0: // Dummy implementation of a pure virtual function sl@0: // sl@0: { sl@0: User::After(200000); // Wait 0.2 seconds sl@0: } sl@0: sl@0: void CRemoteMountCB::ReadUidL(const TDesC& /*aName*/,TEntry& /*anEntry*/) const sl@0: // sl@0: // Read the entry uid if present sl@0: // sl@0: { sl@0: User::After(200000); // Wait 0.2 seconds sl@0: } sl@0: sl@0: sl@0: void CRemoteMountCB::EntryL(const TDesC& /*aName*/,TEntry& /*anEntry*/) const sl@0: // sl@0: // Get entry details sl@0: // Dummy implementation of a pure virtual function sl@0: // sl@0: { sl@0: User::After(200000); // Wait 0.2 seconds sl@0: } sl@0: sl@0: void CRemoteMountCB::SetEntryL(const TDesC& /*aName*/,const TTime& /*aTime*/,TUint /*aSetAttMask*/,TUint /*aClearAttMask*/) sl@0: // sl@0: // Set entry details sl@0: // Dummy implementation of a pure virtual function sl@0: // sl@0: { sl@0: User::After(200000); // Wait 0.2 seconds sl@0: } sl@0: sl@0: sl@0: void CRemoteMountCB::FileOpenL(const TDesC& /*aName*/,TUint /*aMode*/,TFileOpen /*anOpen*/,CFileCB* /*aFile*/) sl@0: // sl@0: // Open a File sl@0: // Dummy implementation of a pure virtual function sl@0: // sl@0: { sl@0: User::After(200000); // Wait 0.2 seconds sl@0: } sl@0: sl@0: void CRemoteMountCB::DirOpenL(const TDesC& /*aName*/,CDirCB* /*aDir*/) sl@0: // sl@0: // Open a directory on the current mount sl@0: // Dummy implementation of a pure virtual function sl@0: // sl@0: { sl@0: User::After(200000); // Wait 0.2 seconds sl@0: } sl@0: sl@0: sl@0: void CRemoteMountCB::RawReadL(TInt64 /*aPos*/,TInt /*aLength*/,const TAny* /*aTrg*/,TInt /*anOffset*/,const RMessagePtr2& /*aMessage*/) const sl@0: // sl@0: // Read directly from disk sl@0: // sl@0: { sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: void CRemoteMountCB::RawWriteL(TInt64 /*aPos*/,TInt /*aLength*/,const TAny* /*aSrc*/,TInt /*anOffset*/,const RMessagePtr2& /*aMessage*/) sl@0: // sl@0: // Write directly to disk sl@0: // sl@0: { sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: void CRemoteMountCB::GetShortNameL(const TDesC& /*aLongName*/,TDes& /*aShortName*/) sl@0: // sl@0: // Get the short name associated with aLongName sl@0: // Dummy implementation of a pure virtual function sl@0: // sl@0: {} sl@0: sl@0: sl@0: void CRemoteMountCB::GetLongNameL(const TDesC& /*aShortName*/,TDes& /*aLongName*/) sl@0: // sl@0: // Get the short name associated with aLongName sl@0: // Dummy implementation of a pure virtual function sl@0: // sl@0: {} sl@0: sl@0: sl@0: void CRemoteMountCB::ReadSectionL(const TDesC& /*aName*/,TInt /*aPos*/,TAny* /*aTrg*/,TInt /*aLength*/,const RMessagePtr2& /*aMessage*/) sl@0: // sl@0: // Get the short name associated with aLongName sl@0: // Dummy implementation of a pure virtual function sl@0: // sl@0: {} sl@0: sl@0: sl@0: sl@0: TBool CRemoteMountCB::IsRomDrive() const sl@0: // sl@0: // Returns ETrue if the drive == EDriveZ sl@0: // sl@0: { sl@0: return(Drive().DriveNumber()==EDriveZ); sl@0: } sl@0: sl@0: sl@0: