userlibandfileserver/fileserver/sfile/sf_std.h
changeset 9 96e5fb8b040d
equal deleted inserted replaced
-1:000000000000 9:96e5fb8b040d
       
     1 // Copyright (c) 1995-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".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // f32\sfile\sf_std.h
       
    15 // 
       
    16 //
       
    17  
       
    18 
       
    19 #ifndef SF_STD_H
       
    20 #define SF_STD_H
       
    21 
       
    22 #include "common.h"
       
    23 #include "message.h"
       
    24 #include <f32fsys.h>
       
    25 #include <f32ver.h>
       
    26 #include <f32dbg.h>
       
    27 #include <e32svr.h>
       
    28 #include <e32hal.h>
       
    29 #include <e32uid.h>
       
    30 #include <e32std_private.h>
       
    31 #include <e32def_private.h>
       
    32 #include <e32const_private.h>
       
    33 #include "sf_plugin.h"
       
    34 #include "sf_func.h"
       
    35 #include <F32plugin.h>
       
    36 #include "f32trace.h"
       
    37 #include <utraceefile.h>
       
    38 
       
    39 #define __PRINT1TEMP_ALWAYS(t,a) {{TBuf<KMaxFileName>temp(a);RDebug::Print(t,&temp);}}
       
    40 #define __PRINT2TEMP_ALWAYS(t,a,b) {{TBuf<KMaxFileName>temp(b);RDebug::Print(t,a,&temp);}}
       
    41 #define __PRINT3TEMP_ALWAYS(t,a,b,c) {{TBuf<KMaxFileName>temp(c);RDebug::Print(t,a,b,&temp);}}
       
    42 #define __PRINT4TEMP_ALWAYS(t,a,b,c,d) {{TBuf<KMaxFileName>temp(d);RDebug::Print(t,a,b,c,&temp);}}
       
    43 
       
    44 #define _THRD_BUF() (_L("thread id 0x"));buf.AppendNum(RThread().Id(),EHex);buf.Append(_L(" "))
       
    45 #define __THRD_PRINT_ALWAYS(t) {{TBuf<KMaxFileName> buf=_THRD_BUF();buf.Append(t);RDebug::Print(buf);}}
       
    46 #define __THRD_PRINT1_ALWAYS(t,a) {{TBuf<KMaxFileName> buf=_THRD_BUF();buf.Append(t);RDebug::Print(buf,a);}}
       
    47 #define __THRD_PRINT2_ALWAYS(t,a,b) {{TBuf<KMaxFileName> buf=_THRD_BUF();buf.Append(t);RDebug::Print(buf,a,b);}}
       
    48 #define __THRD_PRINT3_ALWAYS(t,a,b,c) {{TBuf<KMaxFileName> buf=_THRD_BUF();buf.Append(t);RDebug::Print(buf,a,b,c);}}
       
    49 #define __THRD_PRINT4_ALWAYS(t,a,b,c,d) {{TBuf<KMaxFileName> buf=_THRD_BUF();buf.Append(t);RDebug::Print(buf,a,b,c,d);}}
       
    50 
       
    51 
       
    52 #if defined(_DEBUG) || defined(_DEBUG_RELEASE)
       
    53 #define __PRINT(t) {if (DebugReg&KFSERV) RDebug::Print(t);}
       
    54 #define __PRINT1(t,a) {if (DebugReg&KFSERV) RDebug::Print(t,a);}
       
    55 #define __PRINT2(t,a,b) {if (DebugReg&KFSERV) RDebug::Print(t,a,b);}
       
    56 #define __PRINT3(t,a,b,c) {if (DebugReg&KFSERV) RDebug::Print(t,a,b,c);}
       
    57 #define __PRINT4(t,a,b,c,d) {if (DebugReg&KFSERV) RDebug::Print(t,a,b,c,d);}
       
    58 #define __IF_DEBUG(t) {if (DebugReg&KFLDR) RDebug::t;}
       
    59 #define __LDRTRACE(t) {if (DebugReg&KFLDR) t;}
       
    60 #define __PRINTALLOC(t,a,b,c) {if (DebugReg&KALLOC) RDebug::Print(t,a,b,c);}
       
    61 #define __PRINT1TEMP(t,a) {if (DebugReg&KFSERV) {TBuf<KMaxFileName>temp(a);RDebug::Print(t,&temp);}}
       
    62 #define __PRINT2TEMP(t,a,b) {if (DebugReg&KFSERV) {TBuf<KMaxFileName>temp(b);RDebug::Print(t,a,&temp);}}
       
    63 #define __PRINT3TEMP(t,a,b,c) {if (DebugReg&KFSERV) {TBuf<KMaxFileName>temp(c);RDebug::Print(t,a,b,&temp);}}
       
    64 #define __PRINT4TEMP(t,a,b,c,d) {if (DebugReg&KFSERV) {TBuf<KMaxFileName>temp(d);RDebug::Print(t,a,b,c,&temp);}}
       
    65 #define __CALL(t) {t;}
       
    66 
       
    67 #define __THRD_PRINT(t) {if (DebugReg&KTHRD) {TBuf<KMaxFileName> buf=_THRD_BUF();buf.Append(t);RDebug::Print(buf);}}
       
    68 #define __THRD_PRINT1(t,a) {if (DebugReg&KTHRD) {TBuf<KMaxFileName> buf=_THRD_BUF();buf.Append(t);RDebug::Print(buf,a);}}
       
    69 #define __THRD_PRINT2(t,a,b) {if (DebugReg&KTHRD) {TBuf<KMaxFileName> buf=_THRD_BUF();buf.Append(t);RDebug::Print(buf,a,b);}}
       
    70 #define __THRD_PRINT3(t,a,b,c) {if (DebugReg&KTHRD) {TBuf<KMaxFileName> buf=_THRD_BUF();buf.Append(t);RDebug::Print(buf,a,b,c);}}
       
    71 #define __THRD_PRINT4(t,a,b,c,d) {if (DebugReg&KTHRD) {TBuf<KMaxFileName> buf=_THRD_BUF();buf.Append(t);RDebug::Print(buf,a,b,c,d);}}
       
    72 
       
    73 #define __CACHE_PRINT(t) {if (DebugReg&KCACHE) RDebug::Print(t);}
       
    74 #define __CACHE_PRINT1(t,a) {if (DebugReg&KCACHE) RDebug::Print(t,a);}
       
    75 #define __CACHE_PRINT2(t,a,b) {if (DebugReg&KCACHE) RDebug::Print(t,a,b);}
       
    76 #define __CACHE_PRINT3(t,a,b,c) {if (DebugReg&KCACHE) RDebug::Print(t,a,b,c);}
       
    77 #define __CACHE_PRINT4(t,a,b,c,d) {if (DebugReg&KCACHE) RDebug::Print(t,a,b,c,d);}
       
    78 #define __CACHE_PRINT5(t,a,b,c,d,e) {if (DebugReg&KCACHE) RDebug::Print(t,a,b,c,d,e);}
       
    79 #define __CACHE_PRINT6(t,a,b,c,d,e,f) {if (DebugReg&KCACHE) RDebug::Print(t,a,b,c,d,e,f);}
       
    80 #define __CACHE_PRINT7(t,a,b,c,d,e,f,g) {if (DebugReg&KCACHE) RDebug::Print(t,a,b,c,d,e,f,g);}
       
    81 #define __PLUGIN_PRINT(t) {if (DebugReg&KPLUGIN) RDebug::Print(t);}
       
    82 #define __PLUGIN_PRINT1(t,a) {if (DebugReg&KPLUGIN) RDebug::Print(t,a);}
       
    83 #define __PLUGIN_PRINT2(t,a,b) {if (DebugReg&KPLUGIN) RDebug::Print(t,a,b);}
       
    84 #define __PLUGIN_PRINT3(t,a,b,c) {if (DebugReg&KPLUGIN) RDebug::Print(t,a,b,c);}
       
    85 #else
       
    86 #define __PRINT(t)
       
    87 #define __PRINT1(t,a)
       
    88 #define __PRINT2(t,a,b)
       
    89 #define __PRINT3(t,a,b,c)
       
    90 #define __PRINT4(t,a,b,c,d)
       
    91 #define __IF_DEBUG(t)
       
    92 #define __LDRTRACE(t)
       
    93 #define __PRINTALLOC(t,a,b,c) {if (DebugReg&KALLOC) RDebug::Print(t,a,b,c);}
       
    94 #define __PRINT1TEMP(t,a)
       
    95 #define __PRINT2TEMP(t,a,b)
       
    96 #define __PRINT3TEMP(t,a,b,c)
       
    97 #define __PRINT4TEMP(t,a,b,c,d)
       
    98 #define __CALL(t)
       
    99 #define __THRD_PRINT(t)
       
   100 #define __THRD_PRINT1(t,a)
       
   101 #define __THRD_PRINT2(t,a,b)
       
   102 #define __THRD_PRINT3(t,a,b,c)
       
   103 #define __THRD_PRINT4(t,a,b,c,d)
       
   104 #define __CACHE_PRINT(t)
       
   105 #define __CACHE_PRINT1(t,a)
       
   106 #define __CACHE_PRINT2(t,a,b)
       
   107 #define __CACHE_PRINT3(t,a,b,c)
       
   108 #define __CACHE_PRINT4(t,a,b,c,d)
       
   109 #define __CACHE_PRINT5(t,a,b,c,d,e)
       
   110 #define __CACHE_PRINT6(t,a,b,c,d,e,f)
       
   111 #define __CACHE_PRINT7(t,a,b,c,d,e,f,g)
       
   112 #define __PLUGIN_PRINT(t)
       
   113 #define __PLUGIN_PRINT1(t,a)
       
   114 #define __PLUGIN_PRINT2(t,a,b)
       
   115 #define __PLUGIN_PRINT3(t,a,b,c)
       
   116 #endif
       
   117 
       
   118 const TInt KMaxTotalDriveReserved	=0x100000;
       
   119 const TInt KMaxSessionDriveReserved	=0x10000;
       
   120 
       
   121 // If TFsFileDuplciate::DoRequestL() is called a new sub-session is created and 
       
   122 // the new sub-session handle is returned, mangled by KSubSessionMangleBit - 
       
   123 // this is to discourage use of the duplicated handle.
       
   124 // If TFsFileAdopt::DoRequestL() is called then the passed sub-session handle is 
       
   125 // assumed to be already mangled by KSubSessionMangleBit and the same sub-session 
       
   126 // handle is returned de-mangled.
       
   127 const TInt KSubSessionMangleBit = 0x4000;
       
   128 
       
   129 
       
   130 #define __CHECK_DRIVETHREAD(d) {__ASSERT_DEBUG(FsThreadManager::IsDriveThread(d,ETrue),Fault(EFsDriveThreadError));}
       
   131 #define __CHECK_MAINTHREAD() {__ASSERT_DEBUG(FsThreadManager::IsMainThread(),Fault(EFsMainThreadError));}
       
   132 
       
   133 #define __LAZY_DLL_UNLOAD
       
   134 
       
   135 const TInt KMaxTempNameAttempts=50;
       
   136 const TInt KHeapMinSize=0x1000;
       
   137 const TInt KHeapMaxSize=0x400000;
       
   138 const TInt KLoaderStackSize=0x8000;
       
   139 
       
   140 //-- maximum file size that was supported before introducing File Server 64-bit addressing support.
       
   141 //-- It is 2G-1. Used in legacy code that does not understand RFile64
       
   142 const TUint64 KMaxLegacyFileSize    = 0x7fffffff;
       
   143 
       
   144 //-- absolute maximum file size that file server supports
       
   145 const TUint64 KMaxSupportedFileSize = KMaxTUint64;
       
   146 
       
   147 //__DATA_CAGING__
       
   148 const TUint SHA1_LBLOCK=16;
       
   149 const TUint SHA1_HASH=20;
       
   150 #if defined(_DEBUG) || defined(_DEBUG_RELEASE)
       
   151 
       
   152 class TCorruptNameRec;
       
   153 class TCorruptLogRec
       
   154 	{
       
   155 public:
       
   156 	TCorruptLogRec();
       
   157 	~TCorruptLogRec();
       
   158 	TInt Construct(TCorruptNameRec* aNameRec, TPtrC* aProcessName, TCorruptLogRec* aChain);
       
   159 	inline TPtrC ProcessName(){return iProcessName->Des();};
       
   160 	static TInt GetLogRecord(TFsDebugCorruptLogRecordBuf& aLogRecord,TInt aLogRecNum);
       
   161 	static void DestroyList();
       
   162 private:
       
   163 	HBufC* iProcessName;
       
   164 	TCorruptNameRec* iNameRec;
       
   165 	TCorruptLogRec* iNext;
       
   166 	};
       
   167 
       
   168 TInt OutputTraceInfo(TCorruptNameRec* aNameRec, CFsRequest* aRequest);
       
   169 
       
   170 class TText8FileReader
       
   171 	{
       
   172 	enum {EMaxLine=1024};
       
   173 public:
       
   174 	TText8FileReader();
       
   175 	~TText8FileReader();
       
   176 	TInt Set(RFile& aFile);
       
   177 	TInt Read(TPtr& aPtr);	
       
   178 public:
       
   179 	RFile iFile;
       
   180 	TBuf8<EMaxLine> iBuf;
       
   181 	TInt iBufPos;
       
   182 	TText* iFileDataBuf;
       
   183 	TInt iFileSize;	
       
   184 	};	
       
   185 
       
   186 class TCorruptNameRec
       
   187 	{
       
   188 public:
       
   189 	TCorruptNameRec();
       
   190 	TInt Construct(TPtr* aName,TInt aReturnCode, TBool aUseOnce, TCorruptNameRec* aChain);
       
   191 	static void ResetListConsumed();
       
   192 	inline TPtrC Name(){return iName->Des();};
       
   193 	inline TInt ReturnCode(){return iReturnCode;};
       
   194 	inline TBool Consumed(){return iConsumed;};
       
   195 	inline void SetConsumed(){iConsumed=iUseOnce;};
       
   196 	inline TCorruptNameRec* Next(){return iNext;};
       
   197 private:
       
   198 	HBufC*	iName;
       
   199 	TInt	iReturnCode;
       
   200 	TBool	iUseOnce;
       
   201 	TBool	iConsumed;
       
   202 	TCorruptNameRec* iNext;
       
   203 	};
       
   204 #endif
       
   205 //
       
   206 
       
   207 //
       
   208 _LIT(KFsClient,"FSCLIENT");
       
   209 
       
   210 NONSHARABLE_CLASS(CSHA1) : public CBase
       
   211 	{
       
   212 public:
       
   213 	static CSHA1* NewL(void);
       
   214 	void Update(const TDesC8& aMessage);
       
   215 	TPtrC8 Final(void);
       
   216 	~CSHA1(void);
       
   217 	void Reset(void);
       
   218 private:
       
   219 	CSHA1(void);
       
   220 	TUint iA;
       
   221 	TUint iB;
       
   222 	TUint iC;
       
   223 	TUint iD;
       
   224 	TUint iE;
       
   225 	TBuf8<SHA1_HASH> iHash;
       
   226 	TUint iNl;
       
   227 	TUint iNh;
       
   228 	TUint iData[SHA1_LBLOCK*5];
       
   229 	void DoUpdate(const TUint8* aData,TUint aLength);
       
   230 	void DoFinal(void);
       
   231 	void Block();
       
   232 	void ConstructL(void);
       
   233 	TUint8* iTempData;
       
   234 	};
       
   235 
       
   236 enum TFsPanic
       
   237 	{
       
   238 	ELdrImportedOrdinalDoesNotExist
       
   239 	};
       
   240 //
       
   241 enum TFsFault
       
   242 	{
       
   243 	EDrvIllegalShareValue,			//0
       
   244 	EMainCreateScheduler,
       
   245 	EMainCreateServer,
       
   246 	EMainStartServer,
       
   247 	EMainCreateResources1,
       
   248 	EMainGetLocalFileSystem,
       
   249 	EMainGetLocalDefaultPath,
       
   250 	EInitConnectLocalDrive,
       
   251 	EMainCreateStartupThread1,
       
   252 	EInitDriveMappingDriveInfo,
       
   253 	EInitCreateDriveName,			//10
       
   254 	EMainStartupNoEStart,
       
   255 	ESesPathBadDrive,
       
   256 	EFileDuplicateLock,
       
   257 	ESysDefaultPathNotSupported,
       
   258 	ESysAddLocalFileSystem,
       
   259 	ESvrBadSessionIndex,
       
   260 	EGetLocalDrive1,
       
   261 	EGetLocalDrive2,
       
   262 	ELdrRestartInit,
       
   263 	ELdrRestartSemaphore,			//20
       
   264 	EStripBackSlashBadName,
       
   265 	EIsSubDirBadDes,
       
   266 	ERawDiskBadAccessCount2,
       
   267 	ERawDiskBadAccessCount1,
       
   268 	ERawDiskBadAccessCount,
       
   269 	EDriveNoDiskMounted,
       
   270 	ESvrNotifierIsNULL,
       
   271 	EMainCreateResources5,
       
   272 	EMainCreateStartupThread2,
       
   273 	EMainCreateStartupThread3,		//30
       
   274 	EMainCreateStartupThread4,
       
   275 	EMainStartupWriteToDiskSemaphore,	
       
   276 	EMainCreateResources6,
       
   277 	EMainScanMediaDriversMem1,
       
   278 	EMainScanMediaDriversLocation,
       
   279 	EMainScanMediaDriversMem2,
       
   280 	EMainScanMediaDriverConnect,
       
   281 	EMainScanMediaDriverDirOpen,
       
   282 	EMainScanMediaDriverDirRead,
       
   283 	EMainLoadMediaDriver,			//40
       
   284 	EInitCreateMediaChangeNotifier,
       
   285 	ELdrCleanupCreate,
       
   286 	ELdrSchedulerCreate,
       
   287 	ELdrServerCreate,
       
   288 	ELdrFsConnect,
       
   289 	ELdrFsSetPath,
       
   290 	ELdrCacheInit,
       
   291 	ELdrSchedulerStopped,
       
   292 	ESvrFormatOpenFailed,
       
   293 	ESvrRawDiskOpenFailed,			//50
       
   294 	EProxyDriveConstruction,
       
   295 	ELocDrvInitLocalDrive,
       
   296 	ELocDrvDismountedLocalDrive,
       
   297 	EBaseExtConstruction,
       
   298 	ECreateProxyDriveL,
       
   299 	EExtensionInfoCount0,
       
   300 	EExtensionInfoCount1,
       
   301 	EExtensionInfoCount2,
       
   302 	EStdChangeRequestType,
       
   303 	EExtChangeNameLength,			//60
       
   304 	EDiskSpaceThreshold,
       
   305 	EDebugChangeType,
       
   306 	EBaseQueConstruction,
       
   307 	EChangeQueType,
       
   308 	EDiskSpaceQueType1,
       
   309 	EDiskSpaceQueType2,
       
   310 	EBaseQueCancel,
       
   311 	EDebugQueType,
       
   312 	EBaseRequestSrc,
       
   313 	EBaseRequestDest,			//70
       
   314 	EBaseRequestDrive,
       
   315 	EBaseRequestSubstedDrive,
       
   316 	EBaseRequestSetDrive,
       
   317 	EBaseRequestSetSubstedDrive,
       
   318 	EBaseRequestMessage,
       
   319 	EBaseRequestSet1,
       
   320 	EBaseRequestSet2,
       
   321 	EDiskSpaceQueDrive,
       
   322 	ENotifyInfoDestructor,
       
   323 	EChangeBadIndex,			//80
       
   324 	EBadDiskNotifyType,
       
   325 	EBadDebugNotifyType,
       
   326 	EDiskChangeDrive,
       
   327 	EBadChangeNotifyType,
       
   328 	EDiskBadIndex1,
       
   329 	EDiskBadIndex2,
       
   330 	EDiskBadIndex3,
       
   331 	ESvrFreeDiskSpace,
       
   332 	EFsThreadBadDrvNum,
       
   333 	EFsThreadConstructor,			//90
       
   334 	EFsThreadDriveClose1,
       
   335 	EFsThreadDriveClose2,
       
   336 	EFsThreadGetThread,
       
   337 	EMainInitialiseRomFs,
       
   338 	EFsDriveThreadError,
       
   339 	EFsMainThreadError,
       
   340 	ETFsSetSubstNotNull,
       
   341 	EMountFileSystemFSys,
       
   342 	EDisMountFileSystemFSys,
       
   343 	EIsValidDriveMapping,			//100
       
   344 	EInitDriveMappingSocketNo,
       
   345 	ECompleteNotifSocketNo,
       
   346 	EObjRemoveContainerNotFound,
       
   347 	EObjDestructorAccessCount,
       
   348 	EObjDestructorContainer,
       
   349 	EObjRemoveBadHandle,
       
   350 	EArrayIndexOutOfRange,
       
   351 	EObjFindBadHandle,
       
   352 	EObjRemoveObjectNotFound,
       
   353 	EObjFindIndexOutOfRange,			//110
       
   354 	ESubOpenBadHandle,
       
   355 	EMainDisconnectThread,
       
   356 	EInternalRequestProcess,
       
   357 	EInternalRequestComplete1,
       
   358 	EInternalRequestComplete2,
       
   359 	EInternalRequestComplete3,
       
   360 	ERequestThreadDestructor,
       
   361 	EThreadManagerInitDrive,
       
   362 	EDriveCurrentWriteFunction,
       
   363 	EDriveGetNotifyUser,				//120
       
   364 	EDriveThreadWriteable,
       
   365 	EDriveThreadNotifyUser1,
       
   366 	EDriveThreadNotifyUser2,
       
   367 	ERequestDestructorFree,
       
   368 	ESessionDisconnectThread1,
       
   369 	ESessionDisconnectThread2,
       
   370 	EDismountFsDriveThread,
       
   371 	EDisconnectRequestDispatch1,
       
   372 	EDisconnectRequestDispatch2,
       
   373 	EDisonncectRequestProcess,			//130
       
   374 	EDispatchObjectDispatch,
       
   375 	EDispatchObjectThread,
       
   376 	EInternalRequestDispatch1,
       
   377 	EInternalRequestDispatch2,
       
   378 	EInternalRequestDispatch3,
       
   379 	EFsObjectIxDestructor,
       
   380 	EDisconnectRequestComplete,
       
   381 	EMountExtensionFSys,
       
   382 	EObjectConDestructor,
       
   383 	EParseSubstSession,					//140
       
   384 	ELdrGetKernelInfoFailed,
       
   385 	EObjectIxMainThread,
       
   386 	ESwapFileSystemNull,
       
   387 	ESwapFileSystemMount,
       
   388 	ESwapFileSystemRom,
       
   389 	EReserveSpaceArithmetic,
       
   390 	ECloseSubBadMessage,
       
   391 	EFsCacheLockFailure,
       
   392 	EFsPluginThreadError,				
       
   393 	EBadDismountNotifyType,				//150
       
   394 	ENotifyDismount,
       
   395 	EAllowDismount,
       
   396 	ENotifyDismountCancel,
       
   397 	EFileDuplicateAsyncReadRequest,
       
   398 	EFileFailedToServiceAsyncReadRequest,
       
   399 	ELdrCsIdWrap,
       
   400 	EFileShareBadPromoteCount,
       
   401 	EInternalRequestDispatchCancelPlugin,
       
   402 	EMainCreateStartupThread0,
       
   403 	ERequestAllocatorOpenSubFailed,		//160
       
   404 	ETParsePoolGet,
       
   405 	EInvalidDrive,
       
   406 	ELocDrvInvalidLocalDrive,
       
   407 	ELdrReaperCreate,
       
   408 	ELdrReaperCleanupTimerCreate,
       
   409 	EFsParsePoolLockFailure,
       
   410 	ELdrReaperCantGetDriveList,
       
   411 	EFileCacheCreateFailed,
       
   412 	EBadOperationIndex,
       
   413 	EBadOperationCompletionCode,		//170
       
   414 	EReadOffsetNonZero,
       
   415 	ETooManyOperations,
       
   416 	EInvalidOperationIndex,
       
   417 	EInvalidReadLength,
       
   418 	EInvalidWriteLength,
       
   419 	ERequestThreadNotInitialised,
       
   420 	EMemoryInfoFailed,
       
   421 	EMsgRestartBadFunction,
       
   422 	EPushOpNoCallback,
       
   423 	EFreeingMsgWithMsgOp,				//180
       
   424 	ENotUnused,
       
   425 	ELdrFileDataAllocInit,
       
   426 	ELdrFileDataAllocError,
       
   427 	EDismountLocked,
       
   428 	EInvalidMsgState,
       
   429 	EGetProxyDriveMapping1,
       
   430 	EGetProxyDriveMapping2,
       
   431 	EExtProxyDriveCaps,
       
   432 	EIsProxyDrive,
       
   433 	EClearProxyDriveMapping1,			//190
       
   434 	EClearProxyDriveMapping2,
       
   435 	ERequestQueueNotEmpty,
       
   436 	ESetupMediaChange,
       
   437 	ECancelNotifyChange,
       
   438 	EPluginOpError,
       
   439 	EBadMessageSlotIndex,
       
   440 	EInvalidCompletionFlags,
       
   441 	ECacheMemoryManagerCreateFailed,
       
   442 	EFileBodyIsNull,
       
   443 	ETraceLddLoadFailure,				//200
       
   444 	ETooManyDrivesPerSocket,
       
   445 	ENotificationFault,
       
   446 	EFsObjectOpen
       
   447 	};
       
   448 
       
   449 
       
   450 NONSHARABLE_CLASS(CFsObjectConIx) : public CBase
       
   451 	{
       
   452 public:
       
   453 	static CFsObjectConIx* NewL();
       
   454 	~CFsObjectConIx();
       
   455 	CFsObjectCon* CreateL();
       
   456 	void Remove(CFsObjectCon* aCon);
       
   457 protected:
       
   458 	CFsObjectConIx();
       
   459 	void CreateContainerL(CFsObjectCon*& anObject);
       
   460 private:
       
   461 	TInt iCount;
       
   462 	TInt iAllocated;
       
   463 	TInt iNextUniqueID;
       
   464 	CFsObjectCon** iContainers;
       
   465 	};
       
   466 
       
   467 struct SFsObjectIxRec
       
   468 	{
       
   469 	TInt16 instance;
       
   470 	TInt16 uniqueID;
       
   471 	CFsObject* obj;
       
   472 	};
       
   473 
       
   474 NONSHARABLE_CLASS(CFsObjectIx) : public CBase
       
   475 	{
       
   476 public:
       
   477 	static CFsObjectIx* NewL();
       
   478 	~CFsObjectIx();
       
   479 	TInt AddL(CFsObject* anObj,TBool aLock);
       
   480 	void Remove(TInt aHandle,TBool aLock);
       
   481 	CFsObject* At(TInt aHandle,TInt aUniqueID,TBool aLock);	
       
   482 	CFsObject* At(TInt aHandle,TBool aLock);
       
   483 	TInt At(const CFsObject* anObj,TBool aLock);
       
   484 	CFsObject* operator[](TInt anIndex);
       
   485 	void CloseMainThreadObjects();
       
   486 	inline TInt Count() const;
       
   487 	inline TInt ActiveCount() const;
       
   488 	inline void Lock();
       
   489 	inline void Unlock();
       
   490 protected:
       
   491 	CFsObjectIx();
       
   492 private:
       
   493 	TInt iNumEntries;		// number of actual entries in the index
       
   494 	TInt iHighWaterMark;	// 1+highest active index
       
   495 	TInt iAllocated;		// max entries before realloc needed
       
   496 	TInt iNextInstance;
       
   497 	SFsObjectIxRec *iObjects;
       
   498 	RFastLock iLock;
       
   499 	};
       
   500 
       
   501 NONSHARABLE_CLASS(CFsObjectCon) : public CBase
       
   502 	{
       
   503 protected:
       
   504 	enum {ENotOwnerID};
       
   505 public:
       
   506 	static CFsObjectCon* NewL();
       
   507 	~CFsObjectCon();
       
   508 	void AddL(CFsObject* anObj,TBool aLock);
       
   509 	void Remove(CFsObject* anObj,TBool aLock);
       
   510 	CFsObject* operator[](TInt anIndex);
       
   511 	CFsObject* At(TInt aFindHandle) const;
       
   512 	CFsObject* AtL(TInt aFindHandle) const;	
       
   513 	TInt FindByName(TInt& aFindHandle,const TDesC& aMatch) const;
       
   514 	inline void Lock();
       
   515 	inline void Unlock();
       
   516 	inline TInt UniqueID() const;
       
   517 	inline TInt Count() const;
       
   518 protected:
       
   519 	CFsObjectCon(TInt aUniqueID);
       
   520 	TInt CheckUniqueName(const CFsObject* anObject) const;
       
   521 	TBool NamesMatch(const TName& anObjectName, const CFsObject* aCurrentObject) const;
       
   522 public:
       
   523 	TInt iUniqueID;
       
   524 	TInt iCount;
       
   525 	TInt iAllocated;
       
   526 	CFsObject** iObjects;
       
   527 	RFastLock iLock;
       
   528 friend class CFsObjectConIx;
       
   529 friend class CFsObject;
       
   530 	};
       
   531 
       
   532 
       
   533 NONSHARABLE_CLASS(CFsSyncMessageScheduler) : public CActive
       
   534 	{
       
   535 public:
       
   536 	static CFsSyncMessageScheduler* NewL();
       
   537 	void DoCancel();
       
   538 	void RunL();
       
   539 	void Dispatch(CFsRequest* aRequest);
       
   540 	void CompleteSessionRequests(CSessionFs* aSession, TInt aValue);
       
   541 private:
       
   542 	CFsSyncMessageScheduler();
       
   543 	void ConstructL();
       
   544 private:
       
   545 	RThread iThread;
       
   546 	RFastLock iLock;
       
   547 	TDblQue<CFsRequest> iList;
       
   548 	TBool iSignalled;
       
   549 	};
       
   550 
       
   551 
       
   552 NONSHARABLE_CLASS(CNotifyMediaChange) : public CActive
       
   553 	{
       
   554 public:
       
   555 	CNotifyMediaChange(RLocalDrive* aDrive,TInt aSocketNo);
       
   556 	void DoCancel() {};
       
   557 	void RunL();
       
   558 private:
       
   559 	RLocalDrive* iDrive;
       
   560 	TInt iSocket;
       
   561 	};
       
   562 
       
   563 
       
   564 const TInt KMaxDrivesPerSocket=16;
       
   565 
       
   566 class LocalDrives
       
   567 	{
       
   568 public:
       
   569 	static void Initialise();
       
   570 	static TBusLocalDrive& GetLocalDrive(TInt aDriveNumber);
       
   571 	static CExtProxyDrive* GetProxyDrive(TInt aDrive);
       
   572 	static TInt InitProxyDrive(CFsRequest* aRequest);
       
   573 	static TInt MountProxyDrive(CFsRequest* aRequest);
       
   574 	static TInt DismountProxyDrive(TInt iDriveNumber);
       
   575 	static TBool IsValidDriveMapping(TInt aDrvNumber);
       
   576 	static TInt DriveNumberToLocalDriveNumber(TInt aDrvNumber);
       
   577 	static TInt SetDriveMappingL(CFsRequest* aRequest);
       
   578 	static void CompleteNotifications(TInt aSocket);
       
   579 	static void CompleteDriveNotifications(TInt aDriveNumber);
       
   580 	static TInt GetLocalSocket(TInt aControllerRelativeSocket, TMediaDevice aMediaType);
       
   581 	static TInt GetDriveFromLocalDrive(TInt aLocDrv);
       
   582 	static TInt GetLocalDriveNumber(TBusLocalDrive* aLocDrv);
       
   583 	static TBool IsProxyDrive(TInt aDrive);
       
   584 	static void ClearProxyDriveMapping(TInt aDrive);
       
   585 	static TBool IsProxyDriveInUse(CExtProxyDriveFactory* aDevice);
       
   586 	static TInt SetupMediaChange(TInt aDrive);
       
   587 	static void NotifyChangeCancel(TInt aDrive);
       
   588 private:
       
   589 	static void InitDriveMapping();
       
   590 	static TInt SwapDriveMapping(TInt aFirstDrive,TInt aSecondDrive);
       
   591 private:
       
   592 	class TSocketDesc
       
   593 		{
       
   594 	public:
       
   595 		TInt iDriveNumbers[KMaxDrivesPerSocket];	// drive numbers assigned to this socket
       
   596 		CNotifyMediaChange* iMediaChanges;
       
   597 		TMediaDevice iMediaType;
       
   598 		TInt iControllerRelativeSocket;
       
   599 		};
       
   600 	static TSocketDesc iSocketDescs[KMaxPBusSockets];
       
   601 	static TBusLocalDrive iLocalDrives[KMaxLocalDrives];			
       
   602 	static TInt iMapping[KMaxDrives];		// maps drive to local drive
       
   603 	static TBool iMappingSet;
       
   604 	static TInt iReverseMapping[KMaxLocalDrives];// opposite mapping of iMapping. local drive to drive (1 to [potentially] many)
       
   605 	// i.e. LocalDrive1 -> DriveX
       
   606 	//		LocalDrive2 -> DriveX
       
   607 	static TBool iIsMultiSlotDrive[KMaxDrives]; // index is drive number
       
   608 	static CExtProxyDrive* iProxyDriveMapping[KMaxProxyDrives];
       
   609 	
       
   610 	friend void TFsAddCompositeMount::AddFsToCompositeMountL(TInt aDriveNumber, CFileSystem& aFileSystem, TInt aLocalDriveNumber);
       
   611 	friend void TDrive::MultiSlotDriveCheck(); // for dual/multi slot drive map swapping. (iMapping/iReverseMapping)
       
   612 	};
       
   613 
       
   614 NONSHARABLE_CLASS(CLogon) : public CActive
       
   615 	{
       
   616 public:
       
   617 	enum {EPriority=3000};
       
   618 public:
       
   619 	static CLogon* NewL();
       
   620 	TInt Logon(RThread aThread);
       
   621 	virtual void DoCancel();
       
   622 	virtual void RunL();
       
   623 protected:
       
   624 	CLogon(TInt aPriority);
       
   625 private:
       
   626 	RThread iThread;
       
   627 	};
       
   628 
       
   629 #ifdef __LAZY_DLL_UNLOAD
       
   630 NONSHARABLE_CLASS(CLazyUnloadTimer): public CTimer
       
   631 	{
       
   632 public:
       
   633 	CLazyUnloadTimer();
       
   634 	~CLazyUnloadTimer();
       
   635 	static void New();
       
   636 	static void Finish();
       
   637 private:
       
   638 	void RunL();
       
   639 	void Start();
       
   640 	};
       
   641 #endif
       
   642 
       
   643 NONSHARABLE_CLASS(CSessionLoader) : public CSession2
       
   644 	{
       
   645 private:
       
   646 	virtual void ServiceL(const RMessage2& aMessage);
       
   647 	TInt DeleteExecutable(const TDesC& aName);
       
   648 	};
       
   649 
       
   650 NONSHARABLE_CLASS(CServerLoader) : public CServer2
       
   651 	{
       
   652 public:
       
   653 	enum {EPriority=2000};
       
   654 public:
       
   655 	static CServerLoader* New();
       
   656 	virtual CSession2* NewSessionL(const TVersion& aVersion,const RMessage2& aMessage) const;
       
   657 	virtual TInt RunError(TInt aError);
       
   658 private:
       
   659 	CServerLoader(TInt aPriority);
       
   660 	};
       
   661 
       
   662 class RLoaderMsg : public RMessage2
       
   663 	{
       
   664 public:
       
   665 	TInt GetString(HBufC8*& aBuf, TInt aParam, TInt aMaxLen, TInt aHeadroom, TBool aReduce) const;
       
   666 	TInt GetLdrInfo(TLdrInfo& aInfo) const;
       
   667 	TInt UpdateLdrInfo(const TLdrInfo& aInfo) const;
       
   668 	};
       
   669 
       
   670  void Fault(TFsFault aFault);
       
   671 
       
   672 class CSessionFs;
       
   673 class TOperation;
       
   674 class CRequestThread;
       
   675 
       
   676 typedef TInt (*TFsRequestFunc)(CFsRequest*);
       
   677 
       
   678 class TThreadTimer
       
   679 	{
       
   680 public:
       
   681 	TThreadTimer(TInt (*aCallBackFunction)(TAny* aPtr),TAny* aPtr);
       
   682 
       
   683 	void Start(CRequestThread* aRequestThread, TTimeIntervalMicroSeconds32 aTime);
       
   684 	void Stop();
       
   685 
       
   686 private:
       
   687 	TTickCountQueLink iLink;
       
   688 	TCallBack iCallBack;
       
   689 	CRequestThread* iRequestThread;	// the thread the timer is running on, NULL if timer not running
       
   690 
       
   691 	friend class CFsDeltaTimer;
       
   692 	};
       
   693 
       
   694 // Class adapted from CDeltaTimer (but unlike CDeltaTimer, not derived from CActive).
       
   695 // Used to support multiple timer events in drive threads.
       
   696 NONSHARABLE_CLASS(CFsDeltaTimer) : public CBase
       
   697 	{
       
   698 public:
       
   699 	static CFsDeltaTimer* New(CRequestThread& aRequestThread, TInt aPriority);
       
   700 	~CFsDeltaTimer();
       
   701 
       
   702 	void Start(TThreadTimer& aEntry, TTimeIntervalMicroSeconds32 aTime);
       
   703 	void Stop(TThreadTimer& aEntry);
       
   704 
       
   705 	void RunL();
       
   706 private:
       
   707 	CFsDeltaTimer(CRequestThread& aRequestThread, TInt aPriority, TInt aTickPeriod);
       
   708 	void Cancel();
       
   709 	void Activate();
       
   710 	TInt QueueLong(TTimeIntervalMicroSeconds aTimeInMicroSeconds, TThreadTimer& aEntry);
       
   711 private:	
       
   712 	CRequestThread& iRequestThread;
       
   713 	TThreadId iThreadId;
       
   714 	RTimer iTimer;
       
   715 	TTickCountQue iQueue;
       
   716 	const TInt iTickPeriod;
       
   717 	TBool iQueueBusy;
       
   718 	RFastLock iLock;
       
   719 	TBool iRestartNeeded;	// timer needs to be restarted as it was scheduled from a different thread
       
   720 public:
       
   721 	TRequestStatus iStatus;
       
   722 	};
       
   723 
       
   724 
       
   725 NONSHARABLE_CLASS(CRequestThread) : public CBase
       
   726 	{
       
   727 public:
       
   728 	TInt ThreadFunction();
       
   729 	void DeliverBack(CFsRequest* aRequest, TBool aLowPriority = EFalse);
       
   730 	void DeliverFront(CFsRequest* aRequests);
       
   731 
       
   732 	~CRequestThread();
       
   733 
       
   734 	CFsDeltaTimer* Timer();
       
   735 
       
   736 	void CompleteAllRequests(TInt aValue);
       
   737 protected:
       
   738 	CRequestThread();
       
   739 	TInt DoStart(RThread& aThread);
       
   740 	inline TInt Initialise();
       
   741 	void Deliver(CFsRequest* aRequest,TBool aIsFront, TBool aLowPriority = EFalse);
       
   742 	void Receive();
       
   743 	virtual TInt DoThreadInitialise();
       
   744 protected:
       
   745 	CFsRequest* iRequest;
       
   746 	TDblQue<CFsRequest> iList;
       
   747 	RFastLock iListLock;
       
   748 	TBool iIsWaiting;
       
   749 	TBool iExit;
       
   750 	RThread iThread;
       
   751 	CFsDeltaTimer* iTimer;
       
   752 	TBool iLowPriority;		// if true, drive thread's priority has been (temporarily) reduced
       
   753 	friend class CFsDeltaTimer;
       
   754 	};
       
   755 
       
   756 
       
   757 
       
   758 
       
   759 NONSHARABLE_CLASS(CDriveThread) : public CRequestThread
       
   760 	{
       
   761 public:
       
   762 	void CompleteReadWriteRequests();
       
   763 	void CompleteSessionRequests(CSessionFs* aSession, TInt aValue);
       
   764 	void CompleteClientRequests(TInt aValue);
       
   765 	TBool IsRequestWriteable();
       
   766 	TBool IsSessionNotifyUser();
       
   767 private:
       
   768 	CDriveThread();
       
   769 	static CDriveThread* NewL();
       
   770 	TUint StartL(TInt aDrvNumber);
       
   771 	TInt DoThreadInitialise();
       
   772 
       
   773 	void StartFinalisationTimer();
       
   774 	void StopFinalisationTimer();
       
   775 
       
   776 	static TInt FinaliseTimerEvent(TAny* aFileCache);
       
   777 private:
       
   778 	TInt iDriveNumber;
       
   779 	TThreadTimer iFinaliseTimer;
       
   780 
       
   781 friend class FsThreadManager;
       
   782 	};
       
   783 
       
   784 class CFsInternalRequest;
       
   785 
       
   786 NONSHARABLE_CLASS(CDisconnectThread) : public CRequestThread
       
   787 	{
       
   788 public:
       
   789 	inline CFsInternalRequest* GetRequest();
       
   790 private:
       
   791 	static CDisconnectThread* NewL();
       
   792 	TUint StartL();
       
   793 	~CDisconnectThread();	
       
   794 private:
       
   795 	CFsInternalRequest* iRequest;
       
   796 friend class FsThreadManager;
       
   797 	};
       
   798 
       
   799 class CFsPlugin;
       
   800 NONSHARABLE_CLASS(CPluginThread) : public CRequestThread
       
   801 	{
       
   802 public:
       
   803 	CPluginThread(CFsPlugin& aPlugin);
       
   804 	~CPluginThread();
       
   805 	
       
   806 	void CompleteSessionRequests(CSessionFs* aSession, TInt aValue);
       
   807 
       
   808 	/** @prototype */
       
   809 	void OperationLockWait();
       
   810 
       
   811 	/** @prototype */
       
   812 	void OperationLockSignal();
       
   813 
       
   814 private:
       
   815 	static CPluginThread* NewL(CFsPlugin& aPlugin);
       
   816 	TUint StartL();
       
   817 	virtual TInt DoThreadInitialise();
       
   818 private:
       
   819 	CFsPlugin& iPlugin;
       
   820 
       
   821 	/** @prototype */
       
   822 	RSemaphore iOperationLock;
       
   823 
       
   824 friend class FsPluginManager;
       
   825 	};
       
   826 
       
   827 class TFsDriveThread
       
   828 	{
       
   829 public:
       
   830 	TFsDriveThread();
       
   831 public:
       
   832 	RMutex iFSLock;
       
   833 	TBool iIsAvailable;
       
   834 	TBool iIsSync;
       
   835 	CDriveThread* iThread;
       
   836 	TUint iId;
       
   837 	TBool iIsHung;				// drive is hung waiting for a critical notifier
       
   838 	TBool iMediaChangePending;	// media change is pending while hung
       
   839 	};
       
   840 
       
   841 
       
   842 class FsThreadManager
       
   843 	{
       
   844 public:
       
   845 	static TInt CreateDisconnectThread();
       
   846 	static inline CDisconnectThread* GetDisconnectThread() {return(iDisconnectThread);}
       
   847 	static TBool IsDisconnectThread();
       
   848 //
       
   849 	static void SetMainThreadId();
       
   850 	static TBool IsMainThread();
       
   851 //
       
   852 	static TInt InitDrive(TInt aDrvNumber,TBool aIsSync);
       
   853 	static TInt ChangeSync(TInt aDrvNumber,TBool aIsSync);
       
   854 
       
   855 	static TInt GetDriveThread(TInt aDrvNumber, CDriveThread** aDrvThread);
       
   856 	static void CloseDrive(TInt aDrvNumber);
       
   857 	static TBool IsDriveThread(TInt aDrvNumber,TBool aLock);
       
   858 	static TBool IsDriveSync(TInt aDrvNumber,TBool aLock);
       
   859 	static TBool IsDriveAvailable(TInt aDrvNumber,TBool aLock);
       
   860 	static void LockDrive(TInt aDrvNumber);
       
   861 	static void UnlockDrive(TInt aDrvNumber);			
       
   862 	static void SetDriveHung(TInt aDrvNumber, TBool aIsHung);
       
   863 	static TBool IsDriveHung(TInt aDrvNumber);
       
   864 	static void SetMediaChangePending(TInt aDrvNumber);
       
   865 	static void StartFinalisationTimer(TInt aDriveNumber);
       
   866 	static void StopFinalisationTimer(TInt aDriveNumber);
       
   867 private:
       
   868 	inline static TFsDriveThread& GetFsDriveThread(TInt aDrvNumber) {return(iFsThreads[aDrvNumber]);}
       
   869 private:
       
   870 	static TFsDriveThread iFsThreads[KMaxDrives];
       
   871 	static TUint iMainId;
       
   872 	static CDisconnectThread* iDisconnectThread;
       
   873 	static TUint iDisconnectThreadId;
       
   874 	};
       
   875 
       
   876 
       
   877 const TInt KReservedDriveAccessArrayGranularity = 2;
       
   878 
       
   879 class TReservedDriveAccess
       
   880 	{
       
   881 public:
       
   882 	inline TReservedDriveAccess(TInt aDriveNumber);
       
   883 	inline TReservedDriveAccess(TInt aDriveNumber, TInt aReservedSpace);
       
   884 private:
       
   885 	TReservedDriveAccess();
       
   886 public:
       
   887 	TInt iDriveNumber;
       
   888 	TInt iReservedSpace;
       
   889 	TInt iReservedAccess;
       
   890 	};
       
   891 
       
   892 
       
   893 class CFsMessageRequest;
       
   894 NONSHARABLE_CLASS(CSessionFs) : public CSession2
       
   895 	{
       
   896 public:
       
   897 	static CSessionFs* NewL();
       
   898 	~CSessionFs();
       
   899 	virtual void CreateL();
       
   900 	TInt CurrentDrive();
       
   901 	void ServiceL(const RMessage2& aMessage);
       
   902 	TInt CountResources();
       
   903 	void ResourceCountMarkStart();
       
   904 	void ResourceCountMarkEnd(const RMessage2& aMessage);
       
   905 	TBool GetNotifyUser();
       
   906 	void SetNotifyUser(TBool aNotification);
       
   907 	TBool IsChangeNotify();
       
   908 	void SetSessionFlags(TUint32 aBitsToSet, TUint32 aBitsToClear);
       
   909 	TBool TestSessionFlags(TUint32 aFlags);
       
   910 	void CloseRequestCountInc();
       
   911 	void CloseRequestCountDec();
       
   912 	
       
   913 	//
       
   914 	virtual void Disconnect(const RMessage2& aMessage);
       
   915 	//
       
   916 	inline void IncResourceCount();
       
   917 	inline void DecResourceCount();
       
   918 	inline CFsObjectIx& Handles();
       
   919 	inline HBufC& Path();
       
   920 	inline void SetPath(HBufC* aPath);
       
   921 	inline TThreadId& ThreadId();
       
   922 	inline void SetThreadId(const TThreadId& aId);
       
   923 	//
       
   924 	TUint Reserved(TInt aDriveNumber) const;
       
   925 	TInt SetReserved(const TInt aDriveNumber, const TInt aReservedValue);
       
   926 	TBool ReservedAccess(TInt aDriveNumber) const;
       
   927 	void SetReservedAccess(const TInt aDriveNumber, const TBool aReservedAccess);
       
   928 private:
       
   929 	CSessionFs();
       
   930 
       
   931 private:
       
   932 	TInt iResourceCountMark;
       
   933 	TInt iResourceCount;
       
   934 	TInt iSessionFlags;
       
   935 	RFastLock iSessionFlagsLock;
       
   936 	CFsObjectIx* iHandles;
       
   937 	HBufC* iPath;
       
   938 	CFsMessageRequest* iDisconnectRequest;
       
   939 	RArray<TReservedDriveAccess> iReservedDriveAccess;
       
   940 	TThreadId iId;
       
   941 	TInt iCloseRequestCount;	// number of close requests owned by this sessions on the RequestAllocator close queue
       
   942 friend class CFsDisconnectRequest;
       
   943 	};
       
   944 
       
   945 NONSHARABLE_CLASS(CServerFs) : public CServer2
       
   946 	{
       
   947 public:
       
   948 	enum {EPriority=1000};
       
   949 public:
       
   950 	virtual ~CServerFs();
       
   951 	static void New();
       
   952 	virtual CSession2* NewSessionL(const TVersion& aVersion,const RMessage2& aMessage) const;
       
   953 	CSessionFs* operator[](TInt anIndex);
       
   954 	inline void SessionQueueLockWait();
       
   955 	inline void SessionQueueLockSignal();
       
   956 protected:
       
   957 	// from CServerFs
       
   958 	void RunL();
       
   959 
       
   960 private:
       
   961 	CServerFs(TInt aPriority);
       
   962 	// lock to protect iSessionQ
       
   963 	RFastLock iSessionQueueLock;
       
   964 	};
       
   965 
       
   966 NONSHARABLE_CLASS(CActiveSchedulerFs) : public CActiveScheduler
       
   967 	{
       
   968 public:
       
   969 	static void New();
       
   970 	virtual void Error(TInt anError) const;
       
   971 	};
       
   972 
       
   973 NONSHARABLE_CLASS(CActiveSchedulerLoader) : public CActiveScheduler
       
   974 	{
       
   975 public:
       
   976 	static CActiveSchedulerLoader* New();
       
   977 	virtual void Error(TInt anError) const;
       
   978 	};
       
   979 
       
   980 
       
   981 class TNameChecker
       
   982 	{
       
   983 public:
       
   984 	TNameChecker(const TDesC& aPathName): iName(aPathName){};
       
   985 	TBool IsIllegalChar(TText& aChar);
       
   986 	TBool IsIllegalName();
       
   987 	TBool IsIllegalName(TText& aChar);
       
   988 	TBool IsIllegalPath();
       
   989 	TBool IsIllegalPath(TText& aChar);
       
   990 	void SetName(const TDesC& aName){iName=aName;};
       
   991 private:
       
   992 	TBool IsIllegal(TText& aChar) const;
       
   993 private:
       
   994 	TFileName iName;
       
   995 	TParse iParse;
       
   996 	};
       
   997 
       
   998 enum TOperationFlags
       
   999 		{
       
  1000 		ESync = 0x01, 
       
  1001 		EInternalRequest = 0x02,	// NB Not really used!
       
  1002 		EParseSrc = 0x04, 
       
  1003 		EParseDst = 0x08,
       
  1004 		EFileShare = 0x10,			// Operates on an open file share
       
  1005 		};
       
  1006 
       
  1007 class TOperation
       
  1008 	{
       
  1009 public:
       
  1010 	TBool IsChangeNotify() const;
       
  1011 	TBool IsDiskSpaceNotify() const;
       
  1012 	TBool IsWrite() const;
       
  1013 	TUint NotifyType() const;
       
  1014 	TBool IsCompleted() const;
       
  1015 	TBool IsOpenSubSess() const; //used to allocate for close as well as open task for subsessions
       
  1016 	TBool IsCloseSubSess() const;
       
  1017 
       
  1018 	inline TBool IsSync() const;
       
  1019 	inline TInt Function();
       
  1020 	inline TInt Initialise(CFsRequest* aRequest);
       
  1021 	inline TInt PostInitialise(CFsRequest* aRequest);
       
  1022 	inline TInt DoRequestL(CFsRequest* aRequest);
       
  1023 	inline TFsPluginRequest::TF32ArgType Arg(TUint aIndex);
       
  1024 	
       
  1025 public:
       
  1026 	TInt iFunction;
       
  1027 	TUint iFlags;
       
  1028 	TFsRequestFunc iInitialise;
       
  1029 	// optional processing step. Runs initially in context of main file server thread
       
  1030 	// but may be executed again in drive thread context if request is postponed
       
  1031 	TFsRequestFunc iPostInitialise;
       
  1032 	TFsRequestFunc iDoRequestL;
       
  1033 	TUint32 iArgs;
       
  1034 	};
       
  1035 
       
  1036 class TMsgOperation
       
  1037 	{
       
  1038 public:
       
  1039 	inline void Set(TInt64 aPos, TInt aLength, TUint8* aData, TInt aOffset = 0, TInt aNextState = 0);
       
  1040 	inline void Set(TInt64 aPos, TInt aLength, TDesC8* aData, TInt aOffset = 0, TInt aNextState = 0);
       
  1041 public:
       
  1042 	
       
  1043 	typedef struct
       
  1044 		{
       
  1045 		TAny* iData;	// pointer to local buffer (TUint8*) or remote client decriptor (TDesC8*)
       
  1046 		TInt iTotalLength;
       
  1047 		TInt64 iPos;
       
  1048 		TInt iLength;	// length of current fair-scheduled read/write 
       
  1049 		TInt iOffset;	// offset into iData
       
  1050 		} SReadWriteArgs;
       
  1051 
       
  1052 	union
       
  1053 		{
       
  1054 		TInt iArgs[KMaxMessageArguments];
       
  1055 		SReadWriteArgs iReadWriteArgs;
       
  1056 		};
       
  1057 
       
  1058 	TInt iFunction;				// the current function (usually, but not always the same as TOperation.iFunction
       
  1059 	TFsRequestFunc iComplete;	// function to call when CFsMessageRequest::Complete() is called
       
  1060 	CFsPlugin* iCurrentPlugin;	// The current plugin at the stage this Operation was pushed
       
  1061 
       
  1062 	TBool iClientRequest;		// The current request originated through RFile/RFilePlugin, so uses a descriptor buffer: 
       
  1063 								// An EFSRV client request 		non-local handle	non-local buffer	descriptor
       
  1064 								// A plugin request				local handle		local buffer		descriptor
       
  1065 								// An internal (cache) request	local handle		local buffer		raw pointer
       
  1066 	TInt iState;
       
  1067 	TMsgOperation* iNext;
       
  1068 	TMsgOperation* iPrev;
       
  1069 	TBool iIsAllocated;
       
  1070 	TAny* iScratchValue0;
       
  1071 	TAny* iScratchValue1;
       
  1072 	TInt64 iClientPosition;
       
  1073 	};
       
  1074 
       
  1075 
       
  1076 
       
  1077 NONSHARABLE_CLASS(CFsRequest) : public CBase
       
  1078 	{
       
  1079 public:
       
  1080 	/** Request states - these indicate a message's current stage of processing 
       
  1081 	*/
       
  1082 	enum TReqStates
       
  1083 		{
       
  1084 		/** Need to call iOperation.iInitialise() */
       
  1085 		EReqStateInitialise,
       
  1086 		/** Need to call PostInitialise() */
       
  1087 		EReqStatePostInitialise,
       
  1088 		/** Need to call iOperation.iDoRequestL */
       
  1089 		EReqStateDoRequest,
       
  1090 		};
       
  1091 
       
  1092 
       
  1093 	/** 
       
  1094 	Request actions - these indicate what further processing is required 
       
  1095 	and may be returned by any of:	
       
  1096 
       
  1097 		CFsRequest::iOperation->Initialise()
       
  1098 		CFsPlugin::DoRequestL()
       
  1099 		CFsMessageRequest::iOperation->iPostInitialise()
       
  1100 		CFsRequest::iOperation->DoRequestL()
       
  1101 		CFsMessageRequest::iCurrentOperation->iComplete()
       
  1102 
       
  1103 	The last 3 bits of each return code are used in CFsMessageRequest::Complete() 
       
  1104 	as an array look up to determine what action to take
       
  1105 	 */
       
  1106 	enum TReqActions 
       
  1107 		{
       
  1108 		/** 
       
  1109 		Continue with processing, dispatching to drive thread if necessary
       
  1110 		NB same value as KErrNone to maintain compatibility with existing code
       
  1111 		*/
       
  1112 		EReqActionContinue = KErrNone,			// 0x00000000, last 3 bits = 0
       
  1113 
       
  1114 		/** 
       
  1115 		Complete and free the message 
       
  1116 		*/
       
  1117 		EReqActionComplete = KErrCompletion,		// 0xFFFFFFEF, last 3 bits = 7
       
  1118 		
       
  1119 		/** 
       
  1120 		A resource is in use, so dispatch message again to back of drive thread's request queue
       
  1121 		If returned by Initialise(), then Initialse() will be called again
       
  1122 		If returned by Complete(), then iPostInitialise() will be called again
       
  1123 		*/
       
  1124 		EReqActionBusy = -0x1002,				// 0xFFFFEFFE, last 3 bits = 6
       
  1125 		
       
  1126 		/** 
       
  1127 		Neither dispatch nor complete the message - 
       
  1128 		a plugin thread has taken ownership of the message
       
  1129 		*/
       
  1130 		EReqActionOwnedByPlugin = -0x1003,		// 0xFFFFEFFD, last 3 bits = 5
       
  1131 
       
  1132 		/**
       
  1133 		The request cannot be processed because there is already an active read/write request 
       
  1134 		for the associated file share. This request has been linked to the currently active
       
  1135 		request and will be dispatched to the the drive thread when the current request has completed.
       
  1136 		@see CFileShare::RequestStart() & CFileShare::RequestEnd()
       
  1137 		*/
       
  1138 		EReqActionPending = EReqActionOwnedByPlugin,
       
  1139 		};
       
  1140 public:
       
  1141 	~CFsRequest();
       
  1142 
       
  1143 	void ReadL(const TInt aMsgNum,TDes8& aDes);
       
  1144 	void ReadL(const TInt aMsgNum,TDes8& aDes,TInt anOffset);
       
  1145 	void ReadL(const TInt aMsgNum,TDes16& aDes);
       
  1146 	void ReadL(const TInt aMsgNum,TDes16& aDes,TInt anOffset);
       
  1147 
       
  1148 	void WriteL(const TInt aMsgNum,const TDesC8& aDes);
       
  1149 	void WriteL(const TInt aMsgNum,const TDesC8& aDes,TInt anOffset);
       
  1150 	void WriteL(const TInt aMsgNum,const TDesC16& aDes);
       
  1151 	void WriteL(const TInt aMsgNum,const TDesC16& aDes,TInt anOffset);
       
  1152 
       
  1153 	TInt Read(const TInt aMsgNum,TDes8& aDes);
       
  1154 	TInt Read(const TInt aMsgNum,TDes8& aDes,TInt anOffset);
       
  1155 	TInt Read(const TInt aMsgNum,TDes16& aDes);
       
  1156 	TInt Read(const TInt aMsgNum,TDes16& aDes,TInt anOffset);
       
  1157 
       
  1158 	TInt Write(const TInt aMsgNum,const TDesC8& aDes);
       
  1159 	TInt Write(const TInt aMsgNum,const TDesC8& aDes,TInt anOffset);
       
  1160 	TInt Write(const TInt aMsgNum,const TDesC16& aDes);
       
  1161 	TInt Write(const TInt aMsgNum,const TDesC16& aDes,TInt anOffset);
       
  1162 
       
  1163 	TInt GetDesLength(const TInt aMsgNum);
       
  1164 
       
  1165 	inline void Kill(TInt aReason);
       
  1166 	inline void Terminate(TInt aReason);
       
  1167 	inline void Panic(const TDesC &aCategory,TInt aReason);
       
  1168 	inline TBool ErrorPlugin(TInt aReason);
       
  1169 
       
  1170 	TInt Read(TFsPluginRequest::TF32ArgType aType, TInt& aVal);
       
  1171 	TInt Read(TFsPluginRequest::TF32ArgType aType, TUint& aVal);
       
  1172 	TInt Read(TFsPluginRequest::TF32ArgType aType, TInt64& aVal);
       
  1173 	//
       
  1174 	TInt Read(TFsPluginRequest::TF32ArgType aType, TDes8& aDes,  TInt aOffset = 0);
       
  1175 	TInt Read(TFsPluginRequest::TF32ArgType aType, TDes16& aDes, TInt aOffset = 0);
       
  1176 	//
       
  1177 	TInt Write(TFsPluginRequest::TF32ArgType aType, const TDesC8& aDes,  TInt aOffset = 0);
       
  1178 	TInt Write(TFsPluginRequest::TF32ArgType aType, const TDesC16& aDes, TInt aOffset = 0);
       
  1179 
       
  1180 	inline TInt Initialise(){return iOperation->Initialise(this);};
       
  1181 	virtual void Process()=0;
       
  1182 	virtual void Complete(TInt aError)=0;
       
  1183 	virtual void Dispatch()=0;
       
  1184 	virtual void Free()=0;
       
  1185 	//
       
  1186 	virtual TParse& Src();
       
  1187 	virtual TParse& Dest();
       
  1188 	virtual TDrive* Drive();
       
  1189 	virtual TDrive* SubstedDrive();
       
  1190 	virtual void SetDrive(TDrive* aDrive);
       
  1191 	virtual void SetSubstedDrive(TDrive* aDrive);
       
  1192 	virtual const RMessage2& Message();
       
  1193 	//
       
  1194 	inline TOperation* Operation();
       
  1195 	inline CSessionFs* Session();
       
  1196 	inline void SetSession(CSessionFs* aSession);
       
  1197 	inline TInt DriveNumber();
       
  1198 	inline void SetDriveNumber(TInt aDriveNumber);
       
  1199 	inline TBool IsCompleted();
       
  1200 	inline void SetCompleted(TBool aIsCompleted);
       
  1201 	inline TUint ScratchValue();
       
  1202 	inline void SetScratchValue(const TUint aValue);
       
  1203 	inline TInt64 ScratchValue64();
       
  1204 	inline void SetScratchValue64(const TInt64& aValue);
       
  1205 	inline TBool IsSeparateThread();
       
  1206 	inline TBool IsPostOperation() const;
       
  1207 	inline TBool IsPluginSpecific() const;
       
  1208 	inline TBool IsExpectedResult(TInt err) const;
       
  1209 	inline TBool IsChangeNotify() const;
       
  1210 	inline void SetState(TReqStates aReqState);
       
  1211 	inline TBool DirectToDrive();
       
  1212 	inline TBool IsDescData(TInt aMsgNum);
       
  1213 	inline TInt FsFunction();
       
  1214 
       
  1215 public:
       
  1216 	CFsRequest();
       
  1217 protected:
       
  1218 	inline void Set(const TOperation& aOperation,CSessionFs* aSession);
       
  1219 	inline void Set(CSessionFs* aSession);
       
  1220 	inline void SetError(TInt aError);
       
  1221 	inline TInt GetError() const;
       
  1222 	inline void SetPostOperation(TBool aSet);
       
  1223 
       
  1224 	inline TBool IsFsObjectOpen();
       
  1225 	inline void SetFsObjectOpen(TBool aSet);
       
  1226 	void SetAndOpenScratchValue(const TInt64& aValue);
       
  1227 
       
  1228 private:
       
  1229 	TInt GetSlot(TFsPluginRequest::TF32ArgType aType);
       
  1230 public:
       
  1231 	TDblQueLink iLink;
       
  1232 	CFsPlugin* iCurrentPlugin;
       
  1233 	CFsPlugin* iOwnerPlugin;	// the plugin which originated this request
       
  1234 	TThreadId iClientThreadId;
       
  1235 	TBool iDirectToDrive;
       
  1236 protected:
       
  1237 	CSessionFs* iSession;
       
  1238 	TOperation* iOperation;
       
  1239 	TInt iDriveNumber;
       
  1240 	TBool iIsCompleted;
       
  1241 	TInt64 iScratchValue;
       
  1242 	
       
  1243 	TReqStates iReqState;
       
  1244 
       
  1245 	/** defines for iFlags
       
  1246 	*/
       
  1247 	enum TFsRequestFlags
       
  1248 		{
       
  1249 		EIsAllocated			= 0x01,
       
  1250 		EFreeChanged			= 0x02,		// valid only for EFsFileWrite
       
  1251 		EPostInterceptEnabled	= 0x04,
       
  1252 		EPostOperation			= 0x08,
       
  1253 		EFsObjectOpen			= 0x10,
       
  1254 		};
       
  1255 	TUint iFlags;
       
  1256 
       
  1257 	TInt iError;
       
  1258 	};
       
  1259 
       
  1260 const TInt KOperationFunctionUnaltered = -1;
       
  1261 
       
  1262 NONSHARABLE_CLASS(CFsMessageRequest) : public CFsRequest
       
  1263 	{
       
  1264 public:
       
  1265 	void Set(const RMessage2& aMessage,CSessionFs* aSession);
       
  1266 	void Set(const RMessage2& aMessage,const TOperation& aOperation,CSessionFs* aSession);
       
  1267 	void Set(const TOperation& aOperation);
       
  1268 	inline void SetPostInitialise(TFsRequestFunc aCacheFunction);
       
  1269 	//
       
  1270 	inline void SetMessage(RMessage2& aMessage);
       
  1271 	//
       
  1272 	virtual void Process();
       
  1273 	virtual void Complete(TInt aError);
       
  1274 
       
  1275 	virtual void Dispatch();
       
  1276 	virtual void Free();
       
  1277 	virtual TDrive* Drive();
       
  1278 	virtual TDrive* SubstedDrive();
       
  1279 	virtual void SetDrive(TDrive* aDrive);
       
  1280 	virtual void SetSubstedDrive(TDrive* aDrive);
       
  1281 	virtual const RMessage2& Message();
       
  1282 
       
  1283 	inline TBool IsFreeChanged();
       
  1284 	inline void SetFreeChanged(TBool aChanged);
       
  1285 
       
  1286 	inline TBool PostInterceptEnabled();
       
  1287 	inline void EnablePostIntercept(TBool aEnable);
       
  1288 
       
  1289 	inline TBool IsAllocated();
       
  1290 	inline void SetAllocated();
       
  1291 	inline CFsMessageRequest();
       
  1292 	
       
  1293 	TInt PushOperation(TInt64 aPos, TInt aLength, TUint8* aData, TInt aOffset = 0, TFsRequestFunc aCallback = NULL, TInt aNextState = 0, TInt aFunction = KOperationFunctionUnaltered);
       
  1294 	TInt PushOperation(TInt64 aPos, TInt aLength, TDesC8* aData, TInt aOffset = 0, TFsRequestFunc aCallback = NULL, TInt aNextState = 0, TInt aFunction = KOperationFunctionUnaltered);
       
  1295 	TInt PushOperation(TFsRequestFunc aCallback = NULL, TInt aNextState = 0, TInt aFunction = KOperationFunctionUnaltered);
       
  1296 	void PopOperation();
       
  1297 	void SetOperationFunc(TInt aFunction);
       
  1298 	TMsgOperation& CurrentOperation();
       
  1299 	inline TMsgOperation* CurrentOperationPtr();
       
  1300 	void Dispatch(TBool aInitialise, TBool aLowPriority = EFalse, TBool aDispatchToFront = EFalse);
       
  1301 
       
  1302 	inline TInt& LastError();
       
  1303 	inline void SetLastError(TInt aLastError);
       
  1304 	inline void Init();
       
  1305 	void ReStart();
       
  1306 	TBool IsPluginRequest();
       
  1307 	
       
  1308    // UID of the process to touching the file. (To be used in notification framework).
       
  1309    // TUid iUID;
       
  1310 private:
       
  1311 	void DoNotify(TInt aError);
       
  1312 	TInt DoInitialise();
       
  1313 	TInt PostInitialise();
       
  1314 	TBool DispatchToPlugin();
       
  1315 	void ProcessPostOperation();
       
  1316 	void ProcessPreOperation();
       
  1317 	void ProcessDriveOperation();
       
  1318 	TBool CurrentPluginWaiting();
       
  1319 	inline TInt DispatchToDrive(TBool aLowPriority, TBool aDispatchToFront);
       
  1320 	TBool IsNotifierSpecific() const;
       
  1321 	TBool IsNotifierSupported() const;
       
  1322 protected:
       
  1323 	RMessage2 iMessage;
       
  1324 	TDrive* iDrive;
       
  1325 	TDrive* iSubstedDrive;
       
  1326 private:
       
  1327 	TMsgOperation* iCurrentOperation;
       
  1328 	TInt iLastError;
       
  1329 	};
       
  1330 
       
  1331 
       
  1332 NONSHARABLE_CLASS(TParsePool)
       
  1333 	{
       
  1334 private:
       
  1335 	enum {KEBlockSize = 4};
       
  1336 
       
  1337 public:
       
  1338 	static TInt			Init();
       
  1339 	static TParsePool*	Get();
       
  1340 	static void			Release(TParsePool* aObject);
       
  1341 	TParsePool ();
       
  1342 	TParse& GetObject() {return   iObject;};
       
  1343 
       
  1344 private:
       
  1345 	TParsePool*        iNext;
       
  1346 	TParsePool*        iPrev;
       
  1347 
       
  1348 	TBool              iFree;
       
  1349 	TParse             iObject;
       
  1350 	static TParsePool* iFreeHead;
       
  1351 	static TParsePool* iClosedHead;
       
  1352 	static TInt        iCountFree;
       
  1353 	static RFastLock   iLock;
       
  1354 	};
       
  1355 
       
  1356 	
       
  1357 NONSHARABLE_CLASS(CFsClientMessageRequest) : public CFsMessageRequest
       
  1358 	{
       
  1359 public:
       
  1360     CFsClientMessageRequest();
       
  1361 	virtual TParse& Src();
       
  1362 	virtual TParse& Dest();
       
  1363 	virtual void Free();
       
  1364 	TInt AllocParseObjects(const TOperation& aOperation);
       
  1365 public:
       
  1366 	CFsClientMessageRequest* iNext;
       
  1367 protected:
       
  1368 	TParsePool* iPoolSrc;
       
  1369 	TParsePool* iPoolDest;
       
  1370 	};
       
  1371 
       
  1372 NONSHARABLE_CLASS(CFsDisconnectRequest) : public CFsMessageRequest
       
  1373 	{
       
  1374 public:
       
  1375 	virtual void Process();
       
  1376 	virtual void Dispatch();
       
  1377 	virtual void Complete(TInt aError);
       
  1378 	};
       
  1379 
       
  1380 NONSHARABLE_CLASS(CFsInternalRequest) : public CFsRequest
       
  1381 	{
       
  1382 public:
       
  1383 	CFsInternalRequest();
       
  1384 	void Set(const TOperation& aOperation,CSessionFs* aSession);
       
  1385 	//
       
  1386 	inline void SetThreadHandle(TInt aThreadHandle);
       
  1387 	inline TInt ThreadHandle();
       
  1388 	inline TRequestStatus& Status();
       
  1389 	inline TBool IsAllocated();
       
  1390 	inline void SetAllocated();
       
  1391 	//
       
  1392 	virtual void Process();
       
  1393 	virtual void Complete(TInt aError);
       
  1394 	virtual void Dispatch();
       
  1395 	virtual void Free();
       
  1396 private:
       
  1397 	TUint iThreadHandle;
       
  1398 	TRequestStatus iStatus;
       
  1399 	TBool iIsAllocated;
       
  1400 	};
       
  1401 const TInt KMaxRequestAllocated		= 45;
       
  1402 const TInt KMaxOperationAllocated	= KMaxRequestAllocated * 2;
       
  1403 const TInt KAllocReqBlock=15;
       
  1404 
       
  1405 class TParseCon
       
  1406 	{
       
  1407 public:
       
  1408 	TParse iParse;
       
  1409 	TParseCon* iNext;
       
  1410 	};
       
  1411 
       
  1412 
       
  1413 class RequestAllocator
       
  1414 	{
       
  1415 public:
       
  1416 	static TInt GetMessageRequest(const TOperation& aOperation,const RMessage2& aMessage,CFsClientMessageRequest* &aRequest);
       
  1417 	static void FreeRequest(CFsClientMessageRequest* aRequest); // Use the one from cache
       
  1418 	static void OpenSubFailed(CSessionFs* aSession); 
       
  1419 	static TInt AllocRequest(TInt aNum);
       
  1420 
       
  1421 	static TInt AllocOperation();
       
  1422 	static TInt GetOperation(TMsgOperation* &aOperation);
       
  1423 	static void FreeOperation(TMsgOperation* aOperation);
       
  1424 
       
  1425 
       
  1426 	static void Initialise();
       
  1427 #if defined(_USE_CONTROLIO) || defined(_DEBUG) || defined(_DEBUG_RELEASE)
       
  1428 	inline static TInt TotalCount();
       
  1429 	static TInt CloseCount();
       
  1430 	static TInt FreeCount();
       
  1431 	inline static TInt AllocatedCount();
       
  1432 private:
       
  1433 	static TInt iAllocated;
       
  1434 #endif
       
  1435 public:
       
  1436 	static RFastLock iCacheLock;
       
  1437 private:
       
  1438 	static TInt iAllocNum;
       
  1439 	static CFsClientMessageRequest* iFreeHead;				
       
  1440 	static CFsClientMessageRequest* iCloseHead;
       
  1441 
       
  1442 	static TInt iAllocNumOperation;
       
  1443 	static TMsgOperation* iFreeHeadSupOp;
       
  1444 	};
       
  1445 
       
  1446 
       
  1447 NONSHARABLE_CLASS(CNotifyInfo) : public CBase
       
  1448 	{
       
  1449 public:
       
  1450 	
       
  1451     enum TInfoType {EDiskSpace,EStdChange,EExtChange,EDebugChange,EDismount};
       
  1452 
       
  1453 public:
       
  1454 	~CNotifyInfo();
       
  1455 	void Initialise(TInfoType aType,TRequestStatus* aStatus,const RMessagePtr2& aMessage,CSessionFs* aSession);
       
  1456 	void Complete(TInt aError);
       
  1457 	//
       
  1458 	inline CSessionFs* Session();
       
  1459 	inline TRequestStatus* Status();
       
  1460 	inline TInfoType Type() const {return(iType);}
       
  1461 public:
       
  1462 	TDblQueLink iLink;
       
  1463 protected:
       
  1464 	TInfoType iType;
       
  1465 	TRequestStatus* iStatus;
       
  1466 	RMessagePtr2 iMessage;
       
  1467 	CSessionFs* iSession;
       
  1468 	};
       
  1469 
       
  1470 
       
  1471 NONSHARABLE_CLASS(CStdChangeInfo) : public CNotifyInfo
       
  1472 	{
       
  1473 public:
       
  1474 	void Initialise(TNotifyType aChangeType,TRequestStatus* aStatus,const RMessagePtr2& aMessage,CSessionFs* aSession);
       
  1475 	TUint RequestNotifyType(CFsRequest* aRequest);
       
  1476 	TBool IsMatching(CFsRequest* aRequest);
       
  1477 protected:
       
  1478 	TNotifyType iChangeType;
       
  1479 	};
       
  1480 
       
  1481 NONSHARABLE_CLASS(CExtChangeInfo) : public CStdChangeInfo
       
  1482 	{
       
  1483 public:
       
  1484 	void Initialise(TNotifyType aChangeType,TRequestStatus* aStatus,const RMessagePtr2& aMessage,CSessionFs* aSession,const TDesC& aName);
       
  1485 	TBool IsMatching(CFsRequest* aRequest);
       
  1486 private:
       
  1487 	TFileName iName;
       
  1488 	};
       
  1489 
       
  1490 NONSHARABLE_CLASS(CDiskSpaceInfo) : public CNotifyInfo
       
  1491 	{
       
  1492 public:
       
  1493 	void Initialise(TRequestStatus* aStatus,const RMessagePtr2& aMessage,CSessionFs* aSession,TInt64 aThreshold);
       
  1494 	TBool IsMatching(TInt64& aBefore,TInt64& aAfter);
       
  1495 private:
       
  1496 	TInt64 iThreshold;
       
  1497 	};
       
  1498 
       
  1499 NONSHARABLE_CLASS(CDebugChangeInfo) : public CNotifyInfo
       
  1500 	{
       
  1501 public:
       
  1502 	void Initialise(TUint aDebugType,TRequestStatus* iStatus,const RMessagePtr2& aMessage,CSessionFs* aSession);
       
  1503 	TBool IsMatching(TUint aChange);
       
  1504 private:
       
  1505 	TUint iDebugType;
       
  1506 	};
       
  1507 
       
  1508 NONSHARABLE_CLASS(CDismountNotifyInfo) : public CNotifyInfo
       
  1509 	{
       
  1510 public:
       
  1511 	~CDismountNotifyInfo();
       
  1512 	void Initialise(TNotifyDismountMode aMode, TInt aDriveNumber,TRequestStatus* iStatus,const RMessagePtr2& aMessage,CSessionFs* aSession);
       
  1513 	TBool IsMatching(TNotifyDismountMode aMode, TInt aDriveNumber, CSessionFs* aSession);
       
  1514 private:
       
  1515 	TNotifyDismountMode iMode;
       
  1516 	TInt iDriveNumber;
       
  1517 	};
       
  1518 
       
  1519 const TInt KMaxNotifyQues=KMaxDrives+1;
       
  1520 const TInt KMaxDiskQues=KMaxDrives;	
       
  1521 
       
  1522 class TBaseQue
       
  1523 	{
       
  1524 protected:
       
  1525 	TBaseQue();
       
  1526 	~TBaseQue();
       
  1527 	void DoAddNotify(CNotifyInfo* aInfo);
       
  1528 	TBool DoCancelSession(CSessionFs* aSession,TInt aCompletionCode,TRequestStatus* aStatus=NULL);
       
  1529 	void DoCancelAll(TInt aCompletionCode);
       
  1530 	TBool IsEmpty();
       
  1531 protected:
       
  1532 	TDblQue<CNotifyInfo> iHeader;
       
  1533 	RFastLock iQLock;
       
  1534 	};
       
  1535 
       
  1536 class TChangeQue :public TBaseQue
       
  1537 	{
       
  1538 public:
       
  1539 	TInt AddNotify(CNotifyInfo* aInfo);
       
  1540 	TBool CancelSession(CSessionFs* aSession,TInt aCompletionCode,TRequestStatus* aStatus=NULL);
       
  1541 	void CancelAll(TInt aCompletionCode);
       
  1542 	void CheckChange(CFsRequest* aRequest);
       
  1543 	TBool IsEmpty();
       
  1544 	};
       
  1545 
       
  1546 class TDiskSpaceQue : public TBaseQue
       
  1547 	{
       
  1548 public:
       
  1549 	inline void SetDriveNumber(TInt aDriveNumber) {iDriveNumber=aDriveNumber;}
       
  1550 	TInt AddNotify(CNotifyInfo* aInfo);
       
  1551 	TInt CancelSession(CSessionFs* aSession,TInt aCompletionCode,TRequestStatus* aStatus=NULL);
       
  1552 	void CancelAll(TInt aCompletionCode);
       
  1553 	void CheckDiskSpace();
       
  1554 	void CheckDiskSpace(TInt64& aFreeDiskSpace);
       
  1555 	TBool IsEmpty();
       
  1556 private:
       
  1557 	TInt GetFreeDiskSpace(TInt64& aFreeDiskSpace);
       
  1558 private:
       
  1559 	TInt64 iFreeDiskSpace;
       
  1560 	TInt iDriveNumber;
       
  1561 	TInt64 iReservedDiskSpace;
       
  1562 	};
       
  1563 
       
  1564 class TDebugQue : public TBaseQue
       
  1565 	{
       
  1566 public:
       
  1567 	TInt AddNotify(CNotifyInfo* aInfo);
       
  1568 	TInt CancelSession(CSessionFs* aSession,TInt aCompletionCode,TRequestStatus* aStatus=NULL);
       
  1569 	void CancelAll(TInt aCompletionCode);
       
  1570 	void CheckDebug(TUint aDebugChange);
       
  1571 	};
       
  1572 
       
  1573 class TDismountNotifyQue : public TBaseQue
       
  1574 	{
       
  1575 public:
       
  1576 	TInt AddNotify(CNotifyInfo* aInfo);
       
  1577 	TInt CancelSession(CSessionFs* aSession,TInt aCompletionCode,TRequestStatus* aStatus=NULL);
       
  1578 	void CancelAll(TInt aCompletionCode);
       
  1579 	void CheckDismount(TNotifyDismountMode aMode, TInt aDrive, TBool aRemove, TInt aError);
       
  1580 	TBool HandlePendingDismount(CSessionFs* aSession, TInt aDrive);
       
  1581 	};
       
  1582 
       
  1583 class FsNotify
       
  1584 	{
       
  1585 public:
       
  1586 	static void Initialise();
       
  1587 	static TInt AddChange(CNotifyInfo* aInfo,TInt aDrive);
       
  1588 	static TInt AddDiskSpace(CNotifyInfo* aDiskInfo,TInt aDrive);
       
  1589 	static TInt AddDebug(CNotifyInfo* aDebugInfo);
       
  1590 	static TInt AddDismountNotify(CNotifyInfo* aDismountNotifyInfo);
       
  1591 	static void DiskChange(TInt aDrive);
       
  1592 	static void HandleChange(CFsRequest* aRequest,TInt aDrive);
       
  1593 	static void HandleDiskSpace(CFsRequest* aRequest,TInt aDrive);
       
  1594 	static void HandleDiskSpace(TInt aDrive, TInt64& aFreeSpace);
       
  1595 	static void HandleDebug(TUint aFunction);
       
  1596 	static void HandleDismount(TNotifyDismountMode aMode, TInt aDrive, TBool aRemove, TInt err);
       
  1597 	static void CancelChangeSession(CSessionFs* aSession,TRequestStatus* aStatus=NULL);
       
  1598 	static void CancelDiskSpaceSession(CSessionFs* aSession,TRequestStatus* aStatus=NULL);
       
  1599 	static void CancelDebugSession(CSessionFs* aSession, TRequestStatus* aStatus=NULL);
       
  1600 	static void CancelDismountNotifySession(CSessionFs* aSession, TRequestStatus* aStatus=NULL);
       
  1601 	static void CancelSession(CSessionFs* aSession);
       
  1602 	static TBool HandlePendingDismount(CSessionFs* aSession, TInt aDriveNumber);
       
  1603 	static TBool IsChangeQueEmpty(TInt aDrive);
       
  1604 	static TBool IsDiskSpaceQueEmpty(TInt aDrive);
       
  1605 private:
       
  1606 	static TInt ChangeIndex(TInt aDrive);
       
  1607 private:
       
  1608 	static TChangeQue iChangeQues[KMaxNotifyQues];
       
  1609 	static TDiskSpaceQue iDiskSpaceQues[KMaxDiskQues];
       
  1610 	static TDebugQue iDebugQue;
       
  1611 	static TDismountNotifyQue iDismountNotifyQue;
       
  1612 	};
       
  1613 
       
  1614 class CObjPromotion : public CFsObject
       
  1615 	{
       
  1616 public:
       
  1617 	TInt UniqueID() const {return(CFsObject::UniqueID());}
       
  1618 	};	
       
  1619 
       
  1620 NONSHARABLE_CLASS(CKernEventNotifier) : public CActive
       
  1621      {
       
  1622 public:
       
  1623      static CKernEventNotifier* New(TInt aPriority=EPriorityStandard);
       
  1624      ~CKernEventNotifier();
       
  1625      void Start();
       
  1626      inline TInt Change() const {return iChange;}
       
  1627 private:
       
  1628      CKernEventNotifier(TInt aPriority) : CActive(aPriority) {}
       
  1629      void RunL();
       
  1630      void DoCancel();
       
  1631 private:
       
  1632      static TInt LocaleChangeCallback(TAny* aPtr=NULL);
       
  1633      TInt FreeMemoryChangeCallback();
       
  1634 private:
       
  1635      TInt iChange;
       
  1636      RChangeNotifier iChangeNotifier;
       
  1637      };
       
  1638 
       
  1639 #if defined(_LOCKABLE_MEDIA)
       
  1640 
       
  1641 class TDelayedWriterInit
       
  1642 	{
       
  1643 public:
       
  1644 	const TDesC *iFileName;
       
  1645 	const TDesC8 *iData;
       
  1646 	const TDesC *iSemName;
       
  1647 	};
       
  1648 
       
  1649 
       
  1650 class TDelayedWriter
       
  1651 	{
       
  1652 public:
       
  1653 	TDelayedWriter();
       
  1654 	~TDelayedWriter();
       
  1655 
       
  1656 	static TDelayedWriter *NewL(const TDelayedWriterInit *dwi);
       
  1657 	void ConstructL(const TDelayedWriterInit *dwi);
       
  1658 
       
  1659 	HBufC *iFileName;
       
  1660 	HBufC8 *iData;
       
  1661 	};
       
  1662 
       
  1663 #endif
       
  1664 
       
  1665 extern CFsObjectConIx* TheContainer;
       
  1666 extern CFsObjectCon* FileSystems;
       
  1667 extern CFsObjectCon* Files;
       
  1668 extern CFsObjectCon* FileShares;
       
  1669 extern CFsObjectCon* Dirs;
       
  1670 extern CFsObjectCon* Formats;
       
  1671 extern CFsObjectCon* RawDisks;
       
  1672 extern CFsObjectCon* Extensions;
       
  1673 extern CFsObjectCon* ProxyDrives;
       
  1674 
       
  1675 extern CKernEventNotifier* TheKernEventNotifier;
       
  1676 
       
  1677 extern RThread TheServerThread;
       
  1678 extern RAllocator* ServerThreadAllocator;
       
  1679 
       
  1680 extern CServerFs* TheFileServer;
       
  1681 
       
  1682 extern HBufC* TheDriveNames[];
       
  1683 extern TDrive TheDrives[KMaxDrives];
       
  1684 extern TFileName TheDefaultPath;
       
  1685 extern RFTrace TheFtrace;
       
  1686 
       
  1687 extern SCapabilitySet AllCapabilities;
       
  1688 extern SCapabilitySet DisabledCapabilities;
       
  1689 
       
  1690 const TInt KDispatchObjectClose=KMaxTInt-1;
       
  1691 const TInt KSessionDisconnect=KMaxTInt-2;
       
  1692 const TInt KCancelSession=KMaxTInt-3;
       
  1693 const TInt KCancelPlugin=KMaxTInt-4;
       
  1694 const TInt KFileShareClose=KMaxTInt-5;
       
  1695 const TInt KFlushDirtyData=KMaxTInt-6;
       
  1696 
       
  1697 const TOperation DispatchObjectCloseOp=	{KDispatchObjectClose,	EInternalRequest,	&TFsCloseObject::Initialise,		NULL,	&TFsCloseObject::DoRequestL			};
       
  1698 const TOperation SessionDisconnectOp=	{KSessionDisconnect,	EInternalRequest,	&TFsSessionDisconnect::Initialise,	NULL,	&TFsSessionDisconnect::DoRequestL	};
       
  1699 const TOperation CancelSessionOp=		{KCancelSession,		EInternalRequest,	&TFsCancelSession::Initialise,		NULL,	&TFsCancelSession::DoRequestL		};
       
  1700 const TOperation CancelPluginOp=		{KCancelPlugin,			EInternalRequest,	&TFsCancelPlugin::Initialise,		NULL,	&TFsCancelPlugin::DoRequestL		};
       
  1701 const TOperation FileShareCloseOp=		{KFileShareClose,		EInternalRequest,	&TFsCloseFileShare::Initialise,		NULL,	&TFsCloseFileShare::DoRequestL		};
       
  1702 const TOperation FlushDirtyDataOp=		{KFlushDirtyData,		EInternalRequest,	&TFsFlushDirtyData::Initialise,		NULL,	&TFsFlushDirtyData::DoRequestL		};
       
  1703 
       
  1704 extern TBool OpenOnDriveZOnly;
       
  1705 extern TBool LocalFileSystemInitialized;
       
  1706 extern TBool StartupInitCompleted;
       
  1707 extern TBool RefreshZDriveCache;
       
  1708 extern TBool CompFsMounted;
       
  1709 extern TBool CompFsSync;
       
  1710 
       
  1711  TInt InitializeLocalFileSystem(const TDesC& aName);
       
  1712  void InstallRomFileSystemL();
       
  1713  void InstallFatFileSystemL();
       
  1714  TInt InstallFileSystem(CFileSystem* aSys,RLibrary aLib);
       
  1715 
       
  1716  TInt LoadFileSystem(const TDesC& aName);
       
  1717 
       
  1718  CFsObject* SessionObjectFromHandle(TInt aHandle,TInt aUniqueID, CSessionFs* aSession);
       
  1719  CFileShare* GetShareFromHandle(CSessionFs* aSession, TInt aHandle);
       
  1720 
       
  1721  TInt  ValidateDrive(TInt aDriveNumber,CFsRequest* aRequest);
       
  1722  TInt  ValidateDriveDoSubst(TInt aDriveNumber,CFsRequest* aRequest);
       
  1723  void  ValidateAtts(TUint anEntryAtt,TUint& aSetAttMask,TUint& aClearAttMask);
       
  1724  TInt  ParseSubstPtr0(CFsRequest* aRequest,TParse& aParse, TBool aUseSessionPath = ETrue);
       
  1725  TInt  ParseNoWildSubstPtr0(CFsRequest* aRequest,TParse& aParse, TBool aUseSessionPath = ETrue);
       
  1726  TInt  ParseNoWildSubstPtr1(CFsRequest* aRequest,TParse& aParse);
       
  1727  TInt  ParseNoWildSubstCheckPtr0(CFsRequest* aRequest,TParse& aParse, TBool aUseSessionPath = ETrue);
       
  1728  TInt  ParseNoWildSubstCheckPtr1(CFsRequest* aRequest,TParse& aParse);
       
  1729  TInt  ParseNoWildSubstFileCheckPtr1(CFsRequest* aRequest,TParse& aParse);
       
  1730  TInt  ParseNoWildSubstCheckPathPtr0(CFsRequest* aRequest,TParse& aParse);
       
  1731  TInt  ParseNoWildSubstCheckPathPtr1(CFsRequest* aRequest,TParse& aParse);
       
  1732  TInt  ParsePathPtr0(CFsRequest* aRequest,TParse& aParse);
       
  1733  TInt  ParseNotificationPath(CFsRequest* aRequest, TParse& aParse, TDes& aNotifyPath);
       
  1734  TBool IsIllegalFullName(const TDesC& aName);
       
  1735  TBool IsIllegalFullName(const TParse& aParse);
       
  1736  void  AddResource(CMountCB& aMount);
       
  1737  void  RemoveResource(CMountCB& aMount);
       
  1738  void  AddDiskAccess(CMountCB& aMount);
       
  1739  void  RemoveDiskAccess(CMountCB& aMount);
       
  1740  void  NextInPath(const TDesC& aPath,TPtrC& anEntry,TInt& aPos);
       
  1741  TBool PowerOk();
       
  1742  void  Get16BitDllName(TDes& aFileName, const TDesC8& aDllName);
       
  1743  void  Get8BitDllName(TDes8& aDllName, const TDesC& aFileName);
       
  1744  TInt  MatchUidType(const TUidType &aMatch, const TUidType &aType);
       
  1745  TBool IsWriteFunction(TInt aFunction);
       
  1746  TInt  InitLoader();
       
  1747  TInt  CheckDiskSpace(TInt64 aThreshold, CFsRequest* aRequest);
       
  1748  void  CheckForLeaveAfterOpenL(TInt leaveError, CFsRequest* aRequest, TInt aHandle);
       
  1749  TInt  ParseSubst(const TInt aP, CFsRequest* aRequest,TParse& aParse, TBool aUseSessionPath = ETrue);
       
  1750 
       
  1751 //#ifdef __DATA_CAGING__
       
  1752 
       
  1753  TBool CompareResource(const TDesC & aThePath);
       
  1754 
       
  1755 #ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
       
  1756  TInt PathCheck(CFsRequest* aRequest, const TDesC& aThePath, const TSecurityPolicy* aSysCap, const TSecurityPolicy* aPriCap, const char* aDiag);
       
  1757  TInt PathCheck(CFsRequest* aRequest, const TDesC& aThePath, const TSecurityPolicy* aSysCap, const TSecurityPolicy* aPriCap, const TSecurityPolicy* aROCap, const char* aDiag);
       
  1758  TInt PathCheck(CFsRequest* aRequest, const TDesC& aThePath,const TSecurityPolicy* aCap, const char* aDiag, TBool aExactMatchAllowed = EFalse);
       
  1759 #else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
       
  1760  TInt PathCheck(CFsRequest* aRequest, const TDesC& aThePath, const TSecurityPolicy* aSysCap, const TSecurityPolicy* aPriCap, OnlyCreateWithNull aDiag);
       
  1761  TInt PathCheck(CFsRequest* aRequest, const TDesC& aThePath, const TSecurityPolicy* aSysCap, const TSecurityPolicy* aPriCap, const TSecurityPolicy* aROCap, OnlyCreateWithNull aDiag); 
       
  1762  TInt PathCheck(CFsRequest* aRequest, const TDesC& aThePath,const TSecurityPolicy* aCap, OnlyCreateWithNull aDiag, TBool aExactMatchAllowed = EFalse);
       
  1763 #endif //!__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
       
  1764 
       
  1765  TBool ComparePrivate(const TDesC & aThePath);
       
  1766  TBool CompareSystem(const TDesC & aThePath);
       
  1767  TBool SIDCheck(CFsRequest* aRequest, const TDesC& aThePath);
       
  1768  TBool ComparePaths(const TDesC& aPath1,const TDesC& aPath2);
       
  1769  TUint32 CalcNameHash(const TDesC& aName);
       
  1770 
       
  1771 const TInt KResourceLength			=	9;
       
  1772 const TInt KSystemLength			=	4;
       
  1773 const TInt KPrivateLength			=	8;
       
  1774 const TInt KPrivateLengthCheck		=	17;
       
  1775 const TInt KSIDLength				=	8;
       
  1776 const TInt KSIDPathOffset			=	9;
       
  1777 
       
  1778 _LIT(KSlash, "\\");
       
  1779 _LIT(KPrivate,"\\Private");
       
  1780 _LIT(KPrivateSlash,"\\Private\\");
       
  1781 _LIT(KSysHash,"?:\\Sys\\Hash\\");
       
  1782 const TInt KBSlash='\\';
       
  1783 const TInt KHashFileReadSize = 1024*8;
       
  1784 
       
  1785 
       
  1786 const TInt KMsgPtr0	= 0;
       
  1787 const TInt KMsgPtr1	= 1;
       
  1788 const TInt KMsgPtr2	= 2;
       
  1789 const TInt KMsgPtr3	= 3;
       
  1790 
       
  1791 const TInt KIpcFunctionMask = 0x0000ffff;
       
  1792 const TInt KIpcFlagMask     = 0xffff0000;
       
  1793 const TInt KIpcFlagOffset   = 16;
       
  1794 
       
  1795 #if defined(_DEBUG) || defined(_DEBUG_RELEASE)
       
  1796  void  PrintStartUpReason(TMachineStartupType aReason);
       
  1797  TPtrC GetFunctionName(TInt aFunction);
       
  1798  void  SimulateAllocFailure(TInt aFunctionReturnValue,TInt aFunction);
       
  1799 
       
  1800 extern TInt ErrorCondition;
       
  1801 extern TInt ErrorCount;
       
  1802 extern TUint32 DebugReg;
       
  1803 extern TInt UserHeapAllocFailCount;
       
  1804 extern TInt KernHeapAllocFailCount;
       
  1805 extern TInt MessageCount;
       
  1806 
       
  1807 void PrintHeapSize(const TDesC& aMessage);
       
  1808 
       
  1809 extern TCorruptNameRec* gCorruptFileNameList;
       
  1810 extern TCorruptLogRec* gCorruptLogRecordList;
       
  1811 extern TInt gNumberOfCorruptHits;
       
  1812 extern HBufC* gCorruptFileNamesListFile;
       
  1813 #endif
       
  1814 
       
  1815 typedef TPckgBuf<TMediaPswdReplyNotifyInfoV1> TMediaPswdReplyNotifyInfoV1Buf;
       
  1816 
       
  1817 #if defined(__WINS__)
       
  1818  TInt MapWindowsFileName(TDes& aBuffer,const TDesC& aFileName);
       
  1819 #endif
       
  1820 
       
  1821 enum TDllFindMethod {EFindInPath, EFindInSystemLibs, EFindInSystemBin, EFindExhausted};
       
  1822 
       
  1823 //---------------------------------------------------------------------------------------------------------------------
       
  1824 
       
  1825 NONSHARABLE_CLASS(CFileBody) : public CBase, public CFileCB::MExtendedFileInterface
       
  1826 	{
       
  1827 protected:
       
  1828 	~CFileBody();
       
  1829 	CFileBody(CFileCB* aFileCB, CFileCB::MExtendedFileInterface* aExtendedFileInterface);
       
  1830 	void InitL();
       
  1831 
       
  1832 	TBool ExtendedFileInterfaceSupported();
       
  1833 
       
  1834 	// from MExtendedFileInterface	
       
  1835 	virtual void ReadL(TInt64 aPos,TInt& aLength,TDes8* aDes,const RMessagePtr2& aMessage, TInt aOffset = 0);
       
  1836 	virtual void WriteL(TInt64 aPos,TInt& aLength,const TDesC8* aDes,const RMessagePtr2& aMessage, TInt aOffset = 0);
       
  1837 	virtual void SetSizeL(TInt64 aSize);
       
  1838 
       
  1839 
       
  1840 private:
       
  1841 	CFileCB* iFileCB;
       
  1842 	CFileCB::MExtendedFileInterface* iExtendedFileInterface;
       
  1843 	TInt iFairSchedulingLen;
       
  1844 	TBool iNotifyAsyncReadersPending;
       
  1845 	TBool iDeleteOnClose;
       
  1846 
       
  1847 protected:
       
  1848 	TInt iPromotedShares;
       
  1849 	RArray<TAsyncReadRequest>* iAsyncReadRequests;
       
  1850 	CFileCache* iFileCache;	// pointer to owner CFileCache 
       
  1851 	TBool iLocalBufferSupport;
       
  1852 
       
  1853     /** 
       
  1854     maximum file size supported by the filesystem that instantiates the CFileCB, associated with this object.
       
  1855     For example, FAT32 supports files not larger than 4GB-1. Other file systems can support larger files. 
       
  1856     This member allows file server to know maximum allowed position in the file.
       
  1857     The default value is KMaxTUint64
       
  1858     */
       
  1859     TUint64 iMaxSupportedFileSize; 
       
  1860 
       
  1861 public:
       
  1862 	// Provides support for large file size ( file size > 4GB - 1)
       
  1863 	// Upper / High 32 bit word of the file size is saved here.
       
  1864 	// This can be non-zero only if the CFileShare::iMode is ORed with EFileBigFile
       
  1865 	// and the file size is > 4GB - 1.
       
  1866 	// This shall be queried by CFileCB::Size64() from file systems or by direct access from file server
       
  1867 	// This shall be updated by CFileCB::SetSize64() from file systems or by direct access from file server. 
       
  1868 	TUint iSizeHigh;
       
  1869 	
       
  1870 protected:
       
  1871 friend class CFileCB;
       
  1872 friend class CFileCache;
       
  1873 	};
       
  1874 
       
  1875 //---------------------------------------------------------------------------------------------------------------------
       
  1876 
       
  1877 NONSHARABLE_CLASS(CMountBody) : public CBase, public CMountCB::MFileAccessor, public CMountCB::MFileExtendedInterface
       
  1878 	{
       
  1879 protected:
       
  1880 	CMountBody(CMountCB* aMountCB, CMountCB::MFileAccessor* aFileAccessor = NULL, CMountCB::MFileExtendedInterface* aFileInterface = NULL);
       
  1881 	~CMountBody();
       
  1882 
       
  1883 	// Clamping support
       
  1884 	TInt ClampFile(const TInt aDriveNo,const TDesC& aName,TAny* aHandle);
       
  1885 	TInt UnclampFile(RFileClamp* aHandle);
       
  1886 	TInt IsFileClamped(const TInt64 aUniqueId);
       
  1887 	TInt NoOfClamps();
       
  1888 
       
  1889 	// Internal support clamping
       
  1890 	static TInt CompareClampsByIdAndCount(const RFileClamp& aClampA, const RFileClamp& aClampB);
       
  1891 	static TInt CompareClampsById(const RFileClamp& aClampA, const RFileClamp& aClampB);
       
  1892 	static TInt FindClampByIdAndCount(const RFileClamp& aClampA, const RFileClamp& aClampB);
       
  1893 	static TInt FindClampById(const RFileClamp& aClampA, const RFileClamp& aClampB);
       
  1894 
       
  1895 	// from MFileAccessor
       
  1896 	virtual TInt GetFileUniqueId(const TDesC& aName, TInt64& aUniqueId);
       
  1897 	virtual TInt Spare3(TInt aVal, TAny* aPtr1, TAny* aPtr2);
       
  1898 	virtual TInt Spare2(TInt aVal, TAny* aPtr1, TAny* aPtr2);
       
  1899 	virtual TInt Spare1(TInt aVal, TAny* aPtr1, TAny* aPtr2);
       
  1900 	
       
  1901 	// From MFileExtendedInterface
       
  1902 	virtual void ReadSection64L(const TDesC& aName, TInt64 aPos, TAny* aTrg, TInt aLength, const RMessagePtr2& aMessage);
       
  1903 
       
  1904 	void SetProxyDriveDismounted();
       
  1905 	TBool ProxyDriveDismounted();
       
  1906 	
       
  1907 
       
  1908     inline CFileSystem* GetFileSystem() const;
       
  1909     inline void SetFileSystem(CFileSystem* aFsys);
       
  1910 
       
  1911 private:
       
  1912 	CMountCB* iMountCB;
       
  1913 	RArray<RFileClamp> iClampIdentifiers;
       
  1914 	TInt32 iClampCount;
       
  1915 	CMountCB::MFileAccessor* iFileAccessor;
       
  1916 	CMountCB::MFileExtendedInterface* iFileExtendedInterface;
       
  1917 	TBool iProxyDriveDismounted;
       
  1918 	CFileSystem* iFSys;  ///< link to the FileSystem object that has produced the mount (iMountCB)
       
  1919 friend class CMountCB;
       
  1920 	};
       
  1921 
       
  1922 
       
  1923 #include "sf_ops.h"
       
  1924 #include "sf_std.inl"
       
  1925 
       
  1926 
       
  1927 #endif //SF_STD_H