First public contribution.
2 * Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * File Name: f32test/server/t_file64bit.h
16 * Include file for t_file64bit.cpp (PREQ 1725).
25 #if !defined(__T_FILE64BIT_H__)
26 #define __T_FILE64BIT_H__
28 const TInt64 KKB = 1 << 10;
29 const TInt64 K2KB = 2 * KKB;
30 const TInt64 K4KB = 4 * KKB;
31 const TInt64 K32KB = 8 * K4KB;
32 const TInt64 KGB = 1 << 30;
33 const TInt64 K2GB = 2 * KGB;
34 const TInt64 K3GB = 3 * KGB;
35 const TInt64 K4GB = 4 * KGB;
36 const TInt64 K9GB = 9 * KGB;
37 const TInt64 K12GB = 12 * KGB;
38 const TInt64 K1GBMinusOne = KGB - 1;
39 const TInt64 KSize1GMinus4K = KGB - K4KB;
40 const TInt64 K2GBMinusOne = K2GB - 1;
41 const TInt64 K2GBMinusTen = K2GB - 10;
42 const TInt64 K2GBMinus100 = K2GB - 100;
43 const TInt64 KSize2GMinus4K = K2GB - K4KB;
44 const TInt64 K2GBPlusTen = K2GB + 10;
45 const TInt64 K2GBPlus16 = K2GB + 16;
46 const TInt64 K2GBPlus80 = K2GB + 80;
47 const TInt64 K2GBPlus98 = K2GB + 98;
48 const TInt64 K2GBPlus100 = K2GB + 100;
49 const TInt64 K2GBPlus200 = K2GB + 100;
50 const TInt64 K2GBPlus600 = K2GB + 600;
51 const TInt64 K2GBPlus300 = K2GB + 300;
52 const TInt64 K2GBPlus500 = K2GB + 500;
53 const TInt64 K3GBMinusOne = K3GB - 1;
54 const TInt64 KSize3GMinus4K = K3GB - K4KB;
55 const TInt64 K4GBMinusOne = K4GB - 1;
56 const TInt64 K4GBMinusTwo = K4GB - 2;
57 const TInt64 K4GBMinusTen = K4GB - 10;
58 const TInt64 K4GBMinus100 = K4GB - 100;
59 const TInt64 KSize3GMinus1Minus4K = K3GB -1 - K4KB;
60 const TInt64 KSize4GMinus1Minus4K = K4GB - 1 - K4KB;
61 const TInt64 KSize2GMinus1Minus4K = K2GB - 2 - K4KB;
62 const TInt64 K4GBPlusOne = K4GB + 1;
63 const TInt64 K4GBPlusTen = K4GB + 10;
66 const TInt KBUFSIZE = 10;
67 const TInt KMAXBUFSIZE = 2*KKB;
68 const TInt KWRITEBUFSIZE = KKB;
69 LOCAL_D TBuf8<0x63> pattern;
71 // Maximum bytes per cluster recommended in FAT32
72 const TInt KMaxClusterSize = K32KB;
74 //-------------------------------------------------------------------------------------------------------------------
76 _LIT(KFsName_FAT32, "Fat32");
77 _LIT(KFsName_NGFS, "NGFS");
78 _LIT(KFile2GBMinusOne, "File2GBMinusOne.txt");
79 _LIT(KFile2GB, "File2GB.txt");
80 _LIT(KFile3GB, "File3GB.txt");
81 _LIT(KFile4GBMinusOne, "File4GBMinusOne.txt");
82 _LIT( KClientFileName, "File4GBMinusOne.txt");
83 _LIT(KServerName, "FHServer64bit");
84 TInt gFilesInDirectory = 4;
86 TVolumeInfo gDriveVolumeInfo;
88 // Static function prototypes.
89 LOCAL_C void TestOpenFiles();
90 LOCAL_C void TestAdoptFiles();
92 LOCAL_C void TestReadFile();
93 LOCAL_C void TestWriteFile();
94 LOCAL_C void TestFileAccess();
95 LOCAL_C void TestLockUnLock();
96 LOCAL_C void TestCopyMoveDirectory();
99 class CFileManObserver : public CBase, public MFileManObserver
102 CFileManObserver(CFileMan* aFileMan);
104 TControl NotifyFileManStarted();
105 TControl NotifyFileManOperation();
106 TControl NotifyFileManEnded();
110 TInt iNotifyEndedSuccesses;
111 TInt iNotifyEndedFailures;
115 class RFsTest : public RFs
118 RFsTest& Replace(const TDesC &anOldName, const TDesC &aNewName);
119 RFsTest& ReadFileSection(const TDesC& aName, TInt64 aPos, TDes8& aBuffer, TInt aLen);
120 RFsTest& GetDir(const TDesC &aName, TUint anEntryAttMask, TUint anEntrySortKey, CDir *&anEntryList);
121 RFsTest& GetDir(const TDesC& aName,TUint anEntryAttMask,TUint anEntrySortKey,CDir*& anEntryList,CDir*& aDirList);
122 RFsTest& GetDir(const TDesC& aName,const TUidType& anEntryUid,TUint anEntrySortKey,CDir*& aFileList);
124 LOCAL_D RFsTest TestRFs;
126 class RFileTest : public RFile64
129 RFileTest(const TDesC& aName);
130 RFileTest& Create(const TDesC& aName,TUint aFileMode);
131 RFileTest& Replace(const TDesC& aName);
132 RFileTest& Replace(const TDesC& aName, TUint aFileMode);
133 RFileTest& Open(const TDesC& aName);
134 RFileTest& Open(const TDesC& aName, TUint aFileMode);
135 RFileTest& Temp(const TDesC& aPath,TFileName& aName,TUint aFileMode);
137 RFileTest& Lock(TInt64 aPos,TInt64 aLen=1);
138 RFileTest& LockE(TInt64 aPos,TInt64 aLen=1);
139 RFileTest& UnLock(TInt64 aPos,TInt64 aLen=1);
140 RFileTest& UnLockE(TInt64 aPos,TInt64 aLen=1);
142 RFileTest& Write(const TDesC8& aDes);
143 RFileTest& Write(const TDesC8& aDes, TRequestStatus& aStatus);
144 RFileTest& Write(const TDesC8& aDes, TInt aLength);
145 RFileTest& Write(const TDesC8& aDes, TInt aLength, TRequestStatus &aStatus);
146 RFileTest& Write(TInt64 aPos,const TDesC8& aDes,TInt aLen=1);
147 RFileTest& WriteE(TInt64 aPos,const TDesC8& aDes,TInt aLen=1);
148 RFileTest& Write(TInt64 aPos,const TDesC8& aDes,TInt aLen,TRequestStatus &aStatus);
149 RFileTest& WriteP(TInt64 aPos,const TDesC8& aDes);
150 RFileTest& Write(TInt64 aPos,const TDesC8& aDes,TRequestStatus& aStatus);
151 RFileTest& WriteU(TUint aPos,const TDesC8& aDes);
152 RFileTest& WriteU(TUint aPos,const TDesC8& aDes,TRequestStatus& aStatus);
153 RFileTest& WriteU(TUint aPos,const TDesC8& aDes, TInt aLength);
154 RFileTest& WriteU(TUint aPos,const TDesC8& aDes, TInt aLength,TRequestStatus& aStatus);
157 RFileTest& Read(TDes8& aDes);
158 RFileTest& Read(TDes8& aDes, TRequestStatus& aStatus);
159 RFileTest& Read(TDes8 &aDes, TInt aLen);
160 RFileTest& Read(TDes8 &aDes, TInt aLength, TRequestStatus &aStatus);
161 RFileTest& Read(TInt64 aPos,TDes8& aDes,TInt aLen=1);
162 RFileTest& ReadE(TInt64 aPos,TDes8& aDes,TInt aLen=1);
163 RFileTest& Read(TInt64 aPos,TDes8& aDes);
164 RFileTest& Read(TInt64 aPos,TDes8& aDes,TInt aLen, TRequestStatus& aStatus);
165 RFileTest& ReadP(TInt64 aPos,TDes8& aDes);
166 RFileTest& Read(TInt64 aPos,TDes8& aDes,TRequestStatus& aStatus);
167 RFileTest& ReadU(TUint aPos,TDes8& aDes,TRequestStatus& aStatus);
168 RFileTest& ReadU(TUint aPos,TDes8& aDes);
169 RFileTest& ReadU(TUint aPos,TDes8& aDes, TInt aLength);
170 RFileTest& ReadU(TUint aPos,TDes8& aDes, TInt aLength,TRequestStatus& aStatus);
172 RFileTest& SetSize(TInt64 aSize);
173 RFileTest& SetSizeE(TInt64 aSize);
174 RFileTest& Size(TInt64& aSize);
175 RFileTest& Seek(TSeek aMode,TInt64& aPos);
179 LOCAL_D RFileTest TestRFile1(_L("File 1"));
180 LOCAL_D RFileTest TestRFile2(_L("File 2"));