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_remfsy.h sl@0: // sl@0: // sl@0: sl@0: #include sl@0: #if !defined(__T_REMFSY_H__) sl@0: #define __T_REMFSY_H__ sl@0: #if defined(_UNICODE) sl@0: #define _WTEXT(c) L ## c sl@0: #define _STRC LPCWSTR sl@0: #define _STR LPWSTR sl@0: #else sl@0: #define _WTEXT(c) c sl@0: #define _STRC LPCSTR sl@0: #define _STR LPSTR sl@0: #endif sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #if defined (__DEBUG__)|| defined(_DEBUG_RELEASE) sl@0: #include sl@0: #endif sl@0: sl@0: sl@0: // sl@0: // Common constants used by both EFSRV and the filesystems sl@0: // sl@0: sl@0: const TUint KEntryAttIllegal=(KEntryAttVolume|KEntryAttDir); sl@0: const TUint KEntryAttModified=0x20000000; sl@0: const TUint KEntryAttMustBeFile=0x80000000; sl@0: const TInt KCurrentPosition=KMinTInt; sl@0: sl@0: sl@0: GLDEF_D const TInt KMaxParses=7; sl@0: GLDEF_D const TInt KHeapSize=0x2000; sl@0: GLREF_C void TurnAllocFailureOff(); sl@0: GLREF_C void TurnAllocFailureOn(); sl@0: GLREF_C void ReportCheckDiskFailure(TInt aRet); sl@0: GLREF_D RTest test; sl@0: GLREF_D TFileName gSessionPath; sl@0: GLREF_D TInt gAllocFailOff; sl@0: GLREF_D TInt gAllocFailOn; sl@0: sl@0: #if defined(_DEBUG) sl@0: #define SetAllocFailure(a) SetAllocFailure(a) sl@0: #else sl@0: #define SetAllocFailure(a) IsRomAddress(NULL) sl@0: #define KAllocFailureOn 0 sl@0: #define KAllocFailureOff 0 sl@0: #endif sl@0: sl@0: sl@0: enum TPanic sl@0: { sl@0: EFileTimeToSystemTime, sl@0: EFileClose, sl@0: EFileCloseSetAttributes, sl@0: EDirClose, sl@0: EMapCouldNotConnect sl@0: }; sl@0: sl@0: sl@0: class CSessionFs; sl@0: sl@0: class CRemoteMountCB : public CMountCB sl@0: { sl@0: public: sl@0: CRemoteMountCB(); sl@0: ~CRemoteMountCB(); sl@0: void MountL(TBool aForceMount); sl@0: TInt ReMount(); sl@0: void Dismounted(); sl@0: void VolumeL(TVolumeInfo& aVolume) const; sl@0: void SetVolumeL(TDes& aName); sl@0: void MkDirL(const TDesC& aName); sl@0: void RmDirL(const TDesC& aName); sl@0: void DeleteL(const TDesC& aName); sl@0: void RenameL(const TDesC& anOldName,const TDesC& anNewName); sl@0: void ReplaceL(const TDesC& anOldName,const TDesC& anNewName); sl@0: void EntryL(const TDesC& aName,TEntry& anEntry) const; sl@0: void SetEntryL(const TDesC& aName,const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask); sl@0: void FileOpenL(const TDesC& aName,TUint aMode,TFileOpen anOpen,CFileCB* aFile); sl@0: void DirOpenL(const TDesC& aName,CDirCB* aDir); sl@0: void RawReadL(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt anOffset,const RMessagePtr2& aMessage) const; sl@0: void RawWriteL(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt anOffset,const RMessagePtr2& aMessage); sl@0: void ReadUidL(const TDesC& aName,TEntry& anEntry) const; sl@0: void GetShortNameL(const TDesC& aLongName,TDes& aShortName); sl@0: void GetLongNameL(const TDesC& aShortName,TDes& aLongName); sl@0: void IsFileInRom(const TDesC& aFileName,TUint8*& aFileStart); sl@0: void ReadSectionL(const TDesC& aName,TInt aPos,TAny* aTrg,TInt aLength,const RMessagePtr2& aMessage); sl@0: private: sl@0: TBool IsRomDrive() const; sl@0: }; sl@0: sl@0: sl@0: class RConsole; sl@0: class CRemoteFileCB : public CFileCB sl@0: { sl@0: public: sl@0: CRemoteFileCB(); sl@0: ~CRemoteFileCB(); sl@0: void RenameL(const TDesC& aNewName); sl@0: void ReadL(TInt aPos,TInt& aLength,const TAny* aDes,const RMessagePtr2& aMessage); sl@0: void WriteL(TInt aPos,TInt& aLength,const TAny* aDes,const RMessagePtr2& aMessage); sl@0: TInt Address(TInt& aPos) const; sl@0: void SetSizeL(TInt aSize); sl@0: void SetEntryL(const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask); sl@0: void FlushDataL(); sl@0: void FlushAllL(); sl@0: // inline void SetHandle(HANDLE aHandle) {iWinHandle=aHandle;} sl@0: void CheckPos(TInt aPos); sl@0: private: sl@0: TBool IsRomDrive() const; sl@0: private: sl@0: TInt iCurrentPos; sl@0: TUint8* iFilePtr; sl@0: RConsole iConsole; sl@0: // HANDLE iWinHandle; sl@0: }; sl@0: sl@0: class CRemoteDirCB : public CDirCB sl@0: { sl@0: public: sl@0: CRemoteDirCB(/*CSessionFs* aSession*/); sl@0: ~CRemoteDirCB(); sl@0: void ReadL(TEntry& anEntry); sl@0: // inline void SetHandle(HANDLE aHandle) {iWinHandle=aHandle;} sl@0: inline void SetFullName(const TDesC& aName) {iFullName.Set(aName,NULL,NULL);} sl@0: private: sl@0: TBool MatchUid(); sl@0: public: sl@0: TEntry iEntry; sl@0: private: sl@0: // HANDLE iWinHandle; sl@0: TParse iFullName; sl@0: }; sl@0: sl@0: class CRemoteFormatCB : public CFormatCB sl@0: { sl@0: public: sl@0: CRemoteFormatCB(/*CSessionFs* aSession*/); sl@0: ~CRemoteFormatCB(); sl@0: public: sl@0: virtual void DoFormatStepL(); sl@0: }; sl@0: sl@0: class CRemote : public CFileSystem sl@0: { sl@0: public: sl@0: CRemote(); sl@0: TInt Install(); sl@0: TInt DefaultPath(TDes& aPath) const; sl@0: void DriveInfo(TDriveInfo& anInfo,TInt aDriveNumber) const; sl@0: private: sl@0: CMountCB* NewMountL() const; // These were not previously implemented sl@0: CFileCB* NewFileL() const; // They are essential for a CRemote sl@0: CDirCB* NewDirL() const; // object to be instantiated because they are sl@0: CFormatCB* NewFormatL() const; // pure virtual in CFileSystem sl@0: public: sl@0: static CFileSystem* NewL(); sl@0: }; sl@0: sl@0: struct SParse sl@0: { sl@0: const TText* src; sl@0: const TText* rel; sl@0: const TText* def; sl@0: const TText* fullName; sl@0: const TText* drive; sl@0: const TText* path; sl@0: const TText* name; sl@0: const TText* ext; sl@0: }; sl@0: sl@0: struct SParseServer sl@0: { sl@0: const TText* src; sl@0: const TText* rel; sl@0: const TText* fullName; sl@0: const TText* drive; sl@0: const TText* path; sl@0: const TText* name; sl@0: const TText* ext; sl@0: }; sl@0: sl@0: sl@0: class TMultipleSessionTest sl@0: { sl@0: public: sl@0: TMultipleSessionTest() {}; sl@0: TMultipleSessionTest(RFs& aFs): iFs(aFs){}; sl@0: void Initialise(RFs& aFs); sl@0: void RunTests(RTest& aTest); sl@0: void testDriveList(RTest& aTest); sl@0: void testDriveInfo(RTest& aTest); sl@0: void testVolumeInfo(RTest& aTest); sl@0: void testPath(RTest& aTest); sl@0: void testInitialisation(RTest& aTest); sl@0: void testSubst(RTest& aTest); sl@0: void CopyFileToTestDirectory(RTest& aTest); sl@0: void MakeAndDeleteFiles(RTest& aTest); sl@0: void FillUpDisk(RTest& aTest); sl@0: void testSetVolume(RTest& aTest); sl@0: // void testPowerDown(RTest& aTest); sl@0: // void testMediaChange(RTest& aTest); sl@0: void DeleteTestDirectory(RTest& aTest); sl@0: TInt CurrentDrive(RTest& aTest); sl@0: void SetSessionPath(TInt aDrive); sl@0: private: sl@0: RFs iFs; sl@0: TBuf<30> iSessionPath; sl@0: }; sl@0: sl@0: sl@0: // sl@0: // WINS - dependent functions sl@0: // sl@0: sl@0: GLREF_D const TFileName ZPath; sl@0: sl@0: GLREF_C TBool GetEnvValue(TInt aDrive,TDes& aDes); sl@0: GLREF_C TBool MapDrive(TDes& aFileName,TInt aDrive); sl@0: GLREF_C TBool MapDriveInfo(TDriveInfo& anInfo,TInt aDrive); sl@0: GLREF_C TBool MapDriveAttributes(TUint& aDriveAtt,TInt aDrive); sl@0: GLREF_C void CheckAppendL(TDes& aFileName,const TDesC& aName); sl@0: #endif sl@0: sl@0: