userlibandfileserver/fileserver/sfile/sf_std.h
changeset 0 a41df078684a
child 2 4122176ea935
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     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 	};
       
   447 
       
   448 
       
   449 NONSHARABLE_CLASS(CFsObjectConIx) : public CBase
       
   450 	{
       
   451 public:
       
   452 	static CFsObjectConIx* NewL();
       
   453 	~CFsObjectConIx();
       
   454 	CFsObjectCon* CreateL();
       
   455 	void Remove(CFsObjectCon* aCon);
       
   456 protected:
       
   457 	CFsObjectConIx();
       
   458 	void CreateContainerL(CFsObjectCon*& anObject);
       
   459 private:
       
   460 	TInt iCount;
       
   461 	TInt iAllocated;
       
   462 	TInt iNextUniqueID;
       
   463 	CFsObjectCon** iContainers;
       
   464 	};
       
   465 
       
   466 struct SFsObjectIxRec
       
   467 	{
       
   468 	TInt16 instance;
       
   469 	TInt16 uniqueID;
       
   470 	CFsObject* obj;
       
   471 	};
       
   472 
       
   473 NONSHARABLE_CLASS(CFsObjectIx) : public CBase
       
   474 	{
       
   475 public:
       
   476 	static CFsObjectIx* NewL();
       
   477 	~CFsObjectIx();
       
   478 	TInt AddL(CFsObject* anObj,TBool aLock);
       
   479 	void Remove(TInt aHandle,TBool aLock);
       
   480 	CFsObject* At(TInt aHandle,TInt aUniqueID,TBool aLock);	
       
   481 	CFsObject* At(TInt aHandle,TBool aLock);
       
   482 	TInt At(const CFsObject* anObj,TBool aLock);
       
   483 	CFsObject* operator[](TInt anIndex);
       
   484 	void CloseMainThreadObjects();
       
   485 	inline TInt Count() const;
       
   486 	inline TInt ActiveCount() const;
       
   487 	inline void Lock();
       
   488 	inline void Unlock();
       
   489 protected:
       
   490 	CFsObjectIx();
       
   491 private:
       
   492 	TInt iNumEntries;		// number of actual entries in the index
       
   493 	TInt iHighWaterMark;	// 1+highest active index
       
   494 	TInt iAllocated;		// max entries before realloc needed
       
   495 	TInt iNextInstance;
       
   496 	SFsObjectIxRec *iObjects;
       
   497 	RFastLock iLock;
       
   498 	};
       
   499 
       
   500 NONSHARABLE_CLASS(CFsObjectCon) : public CBase
       
   501 	{
       
   502 protected:
       
   503 	enum {ENotOwnerID};
       
   504 public:
       
   505 	static CFsObjectCon* NewL();
       
   506 	~CFsObjectCon();
       
   507 	void AddL(CFsObject* anObj,TBool aLock);
       
   508 	void Remove(CFsObject* anObj,TBool aLock);
       
   509 	CFsObject* operator[](TInt anIndex);
       
   510 	CFsObject* At(TInt aFindHandle) const;
       
   511 	CFsObject* AtL(TInt aFindHandle) const;	
       
   512 	TInt FindByName(TInt& aFindHandle,const TDesC& aMatch) const;
       
   513 	inline void Lock();
       
   514 	inline void Unlock();
       
   515 	inline TInt UniqueID() const;
       
   516 	inline TInt Count() const;
       
   517 protected:
       
   518 	CFsObjectCon(TInt aUniqueID);
       
   519 	TInt CheckUniqueName(const CFsObject* anObject) const;
       
   520 	TBool NamesMatch(const TName& anObjectName, const CFsObject* aCurrentObject) const;
       
   521 public:
       
   522 	TInt iUniqueID;
       
   523 	TInt iCount;
       
   524 	TInt iAllocated;
       
   525 	CFsObject** iObjects;
       
   526 	RFastLock iLock;
       
   527 friend class CFsObjectConIx;
       
   528 friend class CFsObject;
       
   529 	};
       
   530 
       
   531 
       
   532 NONSHARABLE_CLASS(CFsSyncMessageScheduler) : public CActive
       
   533 	{
       
   534 public:
       
   535 	static CFsSyncMessageScheduler* NewL();
       
   536 	void DoCancel();
       
   537 	void RunL();
       
   538 	void Dispatch(CFsRequest* aRequest);
       
   539 	void CompleteSessionRequests(CSessionFs* aSession, TInt aValue);
       
   540 private:
       
   541 	CFsSyncMessageScheduler();
       
   542 	void ConstructL();
       
   543 private:
       
   544 	RThread iThread;
       
   545 	RFastLock iLock;
       
   546 	TDblQue<CFsRequest> iList;
       
   547 	TBool iSignalled;
       
   548 	};
       
   549 
       
   550 
       
   551 NONSHARABLE_CLASS(CNotifyMediaChange) : public CActive
       
   552 	{
       
   553 public:
       
   554 	CNotifyMediaChange(RLocalDrive* aDrive,TInt aSocketNo);
       
   555 	void DoCancel() {};
       
   556 	void RunL();
       
   557 private:
       
   558 	RLocalDrive* iDrive;
       
   559 	TInt iSocket;
       
   560 	};
       
   561 
       
   562 
       
   563 const TInt KMaxDrivesPerSocket=16;
       
   564 
       
   565 class LocalDrives
       
   566 	{
       
   567 public:
       
   568 	static void Initialise();
       
   569 	static TBusLocalDrive& GetLocalDrive(TInt aDriveNumber);
       
   570 	static CExtProxyDrive* GetProxyDrive(TInt aDrive);
       
   571 	static TInt InitProxyDrive(CFsRequest* aRequest);
       
   572 	static TInt MountProxyDrive(CFsRequest* aRequest);
       
   573 	static TInt DismountProxyDrive(TInt iDriveNumber);
       
   574 	static TBool IsValidDriveMapping(TInt aDrvNumber);
       
   575 	static TInt DriveNumberToLocalDriveNumber(TInt aDrvNumber);
       
   576 	static TInt SetDriveMappingL(CFsRequest* aRequest);
       
   577 	static void CompleteNotifications(TInt aSocket);
       
   578 	static void CompleteDriveNotifications(TInt aDriveNumber);
       
   579 	static TInt GetLocalSocket(TInt aControllerRelativeSocket, TMediaDevice aMediaType);
       
   580 	static TInt GetDriveFromLocalDrive(TInt aLocDrv);
       
   581 	static TInt GetLocalDriveNumber(TBusLocalDrive* aLocDrv);
       
   582 	static TBool IsProxyDrive(TInt aDrive);
       
   583 	static void ClearProxyDriveMapping(TInt aDrive);
       
   584 	static TBool IsProxyDriveInUse(CExtProxyDriveFactory* aDevice);
       
   585 	static TInt SetupMediaChange(TInt aDrive);
       
   586 	static void NotifyChangeCancel(TInt aDrive);
       
   587 private:
       
   588 	static void InitDriveMapping();
       
   589 	static TInt SwapDriveMapping(TInt aFirstDrive,TInt aSecondDrive);
       
   590 private:
       
   591 	class TSocketDesc
       
   592 		{
       
   593 	public:
       
   594 		TInt iDriveNumbers[KMaxDrivesPerSocket];	// drive numbers assigned to this socket
       
   595 		CNotifyMediaChange* iMediaChanges;
       
   596 		TMediaDevice iMediaType;
       
   597 		TInt iControllerRelativeSocket;
       
   598 		};
       
   599 	static TSocketDesc iSocketDescs[KMaxPBusSockets];
       
   600 	static TBusLocalDrive iLocalDrives[KMaxLocalDrives];			
       
   601 	static TInt iMapping[KMaxDrives];		// maps drive to local drive
       
   602 	static TBool iMappingSet;
       
   603 	static TInt iReverseMapping[KMaxLocalDrives];// opposite mapping of iMapping. local drive to drive (1 to [potentially] many)
       
   604 	// i.e. LocalDrive1 -> DriveX
       
   605 	//		LocalDrive2 -> DriveX
       
   606 	static TBool iIsMultiSlotDrive[KMaxDrives]; // index is drive number
       
   607 	static CExtProxyDrive* iProxyDriveMapping[KMaxProxyDrives];
       
   608 	
       
   609 	friend void TFsAddCompositeMount::AddFsToCompositeMountL(TInt aDriveNumber, CFileSystem& aFileSystem, TInt aLocalDriveNumber);
       
   610 	friend void TDrive::MultiSlotDriveCheck(); // for dual/multi slot drive map swapping. (iMapping/iReverseMapping)
       
   611 	};
       
   612 
       
   613 NONSHARABLE_CLASS(CLogon) : public CActive
       
   614 	{
       
   615 public:
       
   616 	enum {EPriority=3000};
       
   617 public:
       
   618 	static CLogon* NewL();
       
   619 	TInt Logon(RThread aThread);
       
   620 	virtual void DoCancel();
       
   621 	virtual void RunL();
       
   622 protected:
       
   623 	CLogon(TInt aPriority);
       
   624 private:
       
   625 	RThread iThread;
       
   626 	};
       
   627 
       
   628 #ifdef __LAZY_DLL_UNLOAD
       
   629 NONSHARABLE_CLASS(CLazyUnloadTimer): public CTimer
       
   630 	{
       
   631 public:
       
   632 	CLazyUnloadTimer();
       
   633 	~CLazyUnloadTimer();
       
   634 	static void New();
       
   635 	static void Finish();
       
   636 private:
       
   637 	void RunL();
       
   638 	void Start();
       
   639 	};
       
   640 #endif
       
   641 
       
   642 NONSHARABLE_CLASS(CSessionLoader) : public CSession2
       
   643 	{
       
   644 private:
       
   645 	virtual void ServiceL(const RMessage2& aMessage);
       
   646 	TInt DeleteExecutable(const TDesC& aName);
       
   647 	};
       
   648 
       
   649 NONSHARABLE_CLASS(CServerLoader) : public CServer2
       
   650 	{
       
   651 public:
       
   652 	enum {EPriority=2000};
       
   653 public:
       
   654 	static CServerLoader* New();
       
   655 	virtual CSession2* NewSessionL(const TVersion& aVersion,const RMessage2& aMessage) const;
       
   656 	virtual TInt RunError(TInt aError);
       
   657 private:
       
   658 	CServerLoader(TInt aPriority);
       
   659 	};
       
   660 
       
   661 class RLoaderMsg : public RMessage2
       
   662 	{
       
   663 public:
       
   664 	TInt GetString(HBufC8*& aBuf, TInt aParam, TInt aMaxLen, TInt aHeadroom, TBool aReduce) const;
       
   665 	TInt GetLdrInfo(TLdrInfo& aInfo) const;
       
   666 	TInt UpdateLdrInfo(const TLdrInfo& aInfo) const;
       
   667 	};
       
   668 
       
   669  void Fault(TFsFault aFault);
       
   670 
       
   671 class CSessionFs;
       
   672 class TOperation;
       
   673 class CRequestThread;
       
   674 
       
   675 typedef TInt (*TFsRequestFunc)(CFsRequest*);
       
   676 
       
   677 class TThreadTimer
       
   678 	{
       
   679 public:
       
   680 	TThreadTimer(TInt (*aCallBackFunction)(TAny* aPtr),TAny* aPtr);
       
   681 
       
   682 	void Start(CRequestThread* aRequestThread, TTimeIntervalMicroSeconds32 aTime);
       
   683 	void Stop();
       
   684 
       
   685 private:
       
   686 	TTickCountQueLink iLink;
       
   687 	TCallBack iCallBack;
       
   688 	CRequestThread* iRequestThread;	// the thread the timer is running on, NULL if timer not running
       
   689 
       
   690 	friend class CFsDeltaTimer;
       
   691 	};
       
   692 
       
   693 // Class adapted from CDeltaTimer (but unlike CDeltaTimer, not derived from CActive).
       
   694 // Used to support multiple timer events in drive threads.
       
   695 NONSHARABLE_CLASS(CFsDeltaTimer) : public CBase
       
   696 	{
       
   697 public:
       
   698 	static CFsDeltaTimer* New(CRequestThread& aRequestThread, TInt aPriority);
       
   699 	~CFsDeltaTimer();
       
   700 
       
   701 	void Start(TThreadTimer& aEntry, TTimeIntervalMicroSeconds32 aTime);
       
   702 	void Stop(TThreadTimer& aEntry);
       
   703 
       
   704 	void RunL();
       
   705 private:
       
   706 	CFsDeltaTimer(CRequestThread& aRequestThread, TInt aPriority, TInt aTickPeriod);
       
   707 	void Cancel();
       
   708 	void Activate();
       
   709 	TInt QueueLong(TTimeIntervalMicroSeconds aTimeInMicroSeconds, TThreadTimer& aEntry);
       
   710 private:	
       
   711 	CRequestThread& iRequestThread;
       
   712 	TThreadId iThreadId;
       
   713 	RTimer iTimer;
       
   714 	TTickCountQue iQueue;
       
   715 	const TInt iTickPeriod;
       
   716 	TBool iQueueBusy;
       
   717 	RFastLock iLock;
       
   718 	TBool iRestartNeeded;	// timer needs to be restarted as it was scheduled from a different thread
       
   719 public:
       
   720 	TRequestStatus iStatus;
       
   721 	};
       
   722 
       
   723 
       
   724 NONSHARABLE_CLASS(CRequestThread) : public CBase
       
   725 	{
       
   726 public:
       
   727 	TInt ThreadFunction();
       
   728 	void DeliverBack(CFsRequest* aRequest, TBool aLowPriority = EFalse);
       
   729 	void DeliverFront(CFsRequest* aRequests);
       
   730 
       
   731 	~CRequestThread();
       
   732 
       
   733 	CFsDeltaTimer* Timer();
       
   734 
       
   735 	void CompleteAllRequests(TInt aValue);
       
   736 protected:
       
   737 	CRequestThread();
       
   738 	TInt DoStart(RThread& aThread);
       
   739 	inline TInt Initialise();
       
   740 	void Deliver(CFsRequest* aRequest,TBool aIsFront, TBool aLowPriority = EFalse);
       
   741 	void Receive();
       
   742 	virtual TInt DoThreadInitialise();
       
   743 protected:
       
   744 	CFsRequest* iRequest;
       
   745 	TDblQue<CFsRequest> iList;
       
   746 	RFastLock iListLock;
       
   747 	TBool iIsWaiting;
       
   748 	TBool iExit;
       
   749 	RThread iThread;
       
   750 	CFsDeltaTimer* iTimer;
       
   751 	TBool iLowPriority;		// if true, drive thread's priority has been (temporarily) reduced
       
   752 	friend class CFsDeltaTimer;
       
   753 	};
       
   754 
       
   755 
       
   756 
       
   757 
       
   758 NONSHARABLE_CLASS(CDriveThread) : public CRequestThread
       
   759 	{
       
   760 public:
       
   761 	void CompleteReadWriteRequests();
       
   762 	void CompleteSessionRequests(CSessionFs* aSession, TInt aValue);
       
   763 	void CompleteClientRequests(TInt aValue);
       
   764 	TBool IsRequestWriteable();
       
   765 	TBool IsSessionNotifyUser();
       
   766 private:
       
   767 	CDriveThread();
       
   768 	static CDriveThread* NewL();
       
   769 	TUint StartL(TInt aDrvNumber);
       
   770 	TInt DoThreadInitialise();
       
   771 
       
   772 	void StartFinalisationTimer();
       
   773 	void StopFinalisationTimer();
       
   774 
       
   775 	static TInt FinaliseTimerEvent(TAny* aFileCache);
       
   776 private:
       
   777 	TInt iDriveNumber;
       
   778 	TThreadTimer iFinaliseTimer;
       
   779 
       
   780 friend class FsThreadManager;
       
   781 	};
       
   782 
       
   783 class CFsInternalRequest;
       
   784 
       
   785 NONSHARABLE_CLASS(CDisconnectThread) : public CRequestThread
       
   786 	{
       
   787 public:
       
   788 	inline CFsInternalRequest* GetRequest();
       
   789 private:
       
   790 	static CDisconnectThread* NewL();
       
   791 	TUint StartL();
       
   792 	~CDisconnectThread();	
       
   793 private:
       
   794 	CFsInternalRequest* iRequest;
       
   795 friend class FsThreadManager;
       
   796 	};
       
   797 
       
   798 class CFsPlugin;
       
   799 NONSHARABLE_CLASS(CPluginThread) : public CRequestThread
       
   800 	{
       
   801 public:
       
   802 	CPluginThread(CFsPlugin& aPlugin);
       
   803 	void CompleteSessionRequests(CSessionFs* aSession, TInt aValue);
       
   804 
       
   805 	/** @prototype */
       
   806 	void OperationLockWait();
       
   807 
       
   808 	/** @prototype */
       
   809 	void OperationLockSignal();
       
   810 
       
   811 private:
       
   812 	static CPluginThread* NewL(CFsPlugin& aPlugin);
       
   813 	TUint StartL();
       
   814 	virtual TInt DoThreadInitialise();
       
   815 private:
       
   816 	CFsPlugin& iPlugin;
       
   817 
       
   818 	/** @prototype */
       
   819 	RSemaphore iOperationLock;
       
   820 
       
   821 friend class FsPluginManager;
       
   822 	};
       
   823 
       
   824 class TFsDriveThread
       
   825 	{
       
   826 public:
       
   827 	TFsDriveThread();
       
   828 public:
       
   829 	RMutex iFSLock;
       
   830 	TBool iIsAvailable;
       
   831 	TBool iIsSync;
       
   832 	CDriveThread* iThread;
       
   833 	TUint iId;
       
   834 	TBool iIsHung;				// drive is hung waiting for a critical notifier
       
   835 	TBool iMediaChangePending;	// media change is pending while hung
       
   836 	};
       
   837 
       
   838 
       
   839 class FsThreadManager
       
   840 	{
       
   841 public:
       
   842 	static TInt CreateDisconnectThread();
       
   843 	static inline CDisconnectThread* GetDisconnectThread() {return(iDisconnectThread);}
       
   844 	static TBool IsDisconnectThread();
       
   845 //
       
   846 	static void SetMainThreadId();
       
   847 	static TBool IsMainThread();
       
   848 //
       
   849 	static TInt InitDrive(TInt aDrvNumber,TBool aIsSync);
       
   850 	static TInt ChangeSync(TInt aDrvNumber,TBool aIsSync);
       
   851 
       
   852 	static TInt GetDriveThread(TInt aDrvNumber, CDriveThread** aDrvThread);
       
   853 	static void CloseDrive(TInt aDrvNumber);
       
   854 	static TBool IsDriveThread(TInt aDrvNumber,TBool aLock);
       
   855 	static TBool IsDriveSync(TInt aDrvNumber,TBool aLock);
       
   856 	static TBool IsDriveAvailable(TInt aDrvNumber,TBool aLock);
       
   857 	static void LockDrive(TInt aDrvNumber);
       
   858 	static void UnlockDrive(TInt aDrvNumber);			
       
   859 	static void SetDriveHung(TInt aDrvNumber, TBool aIsHung);
       
   860 	static TBool IsDriveHung(TInt aDrvNumber);
       
   861 	static void SetMediaChangePending(TInt aDrvNumber);
       
   862 	static void StartFinalisationTimer(TInt aDriveNumber);
       
   863 	static void StopFinalisationTimer(TInt aDriveNumber);
       
   864 private:
       
   865 	inline static TFsDriveThread& GetFsDriveThread(TInt aDrvNumber) {return(iFsThreads[aDrvNumber]);}
       
   866 private:
       
   867 	static TFsDriveThread iFsThreads[KMaxDrives];
       
   868 	static TUint iMainId;
       
   869 	static CDisconnectThread* iDisconnectThread;
       
   870 	static TUint iDisconnectThreadId;
       
   871 	};
       
   872 
       
   873 
       
   874 const TInt KReservedDriveAccessArrayGranularity = 2;
       
   875 
       
   876 class TReservedDriveAccess
       
   877 	{
       
   878 public:
       
   879 	inline TReservedDriveAccess(TInt aDriveNumber);
       
   880 	inline TReservedDriveAccess(TInt aDriveNumber, TInt aReservedSpace);
       
   881 private:
       
   882 	TReservedDriveAccess();
       
   883 public:
       
   884 	TInt iDriveNumber;
       
   885 	TInt iReservedSpace;
       
   886 	TInt iReservedAccess;
       
   887 	};
       
   888 
       
   889 
       
   890 class CFsMessageRequest;
       
   891 NONSHARABLE_CLASS(CSessionFs) : public CSession2
       
   892 	{
       
   893 public:
       
   894 	static CSessionFs* NewL();
       
   895 	~CSessionFs();
       
   896 	virtual void CreateL();
       
   897 	TInt CurrentDrive();
       
   898 	void ServiceL(const RMessage2& aMessage);
       
   899 	TInt CountResources();
       
   900 	void ResourceCountMarkStart();
       
   901 	void ResourceCountMarkEnd(const RMessage2& aMessage);
       
   902 	TBool GetNotifyUser();
       
   903 	void SetNotifyUser(TBool aNotification);
       
   904 	TBool IsChangeNotify();
       
   905 	void SetSessionFlags(TUint32 aBitsToSet, TUint32 aBitsToClear);
       
   906 	TBool TestSessionFlags(TUint32 aFlags);
       
   907 	void CloseRequestCountInc();
       
   908 	void CloseRequestCountDec();
       
   909 	
       
   910 	//
       
   911 	virtual void Disconnect(const RMessage2& aMessage);
       
   912 	//
       
   913 	inline void IncResourceCount();
       
   914 	inline void DecResourceCount();
       
   915 	inline CFsObjectIx& Handles();
       
   916 	inline HBufC& Path();
       
   917 	inline void SetPath(HBufC* aPath);
       
   918 	inline TThreadId& ThreadId();
       
   919 	inline void SetThreadId(const TThreadId& aId);
       
   920 	//
       
   921 	TUint Reserved(TInt aDriveNumber) const;
       
   922 	TInt SetReserved(const TInt aDriveNumber, const TInt aReservedValue);
       
   923 	TBool ReservedAccess(TInt aDriveNumber) const;
       
   924 	void SetReservedAccess(const TInt aDriveNumber, const TBool aReservedAccess);
       
   925 private:
       
   926 	CSessionFs();
       
   927 
       
   928 private:
       
   929 	TInt iResourceCountMark;
       
   930 	TInt iResourceCount;
       
   931 	TInt iSessionFlags;
       
   932 	RFastLock iSessionFlagsLock;
       
   933 	CFsObjectIx* iHandles;
       
   934 	HBufC* iPath;
       
   935 	CFsMessageRequest* iDisconnectRequest;
       
   936 	RArray<TReservedDriveAccess> iReservedDriveAccess;
       
   937 	TThreadId iId;
       
   938 	TInt iCloseRequestCount;	// number of close requests owned by this sessions on the RequestAllocator close queue
       
   939 friend class CFsDisconnectRequest;
       
   940 	};
       
   941 
       
   942 NONSHARABLE_CLASS(CServerFs) : public CServer2
       
   943 	{
       
   944 public:
       
   945 	enum {EPriority=1000};
       
   946 public:
       
   947 	virtual ~CServerFs();
       
   948 	static void New();
       
   949 	virtual CSession2* NewSessionL(const TVersion& aVersion,const RMessage2& aMessage) const;
       
   950 	CSessionFs* operator[](TInt anIndex);
       
   951 	inline void SessionQueueLockWait();
       
   952 	inline void SessionQueueLockSignal();
       
   953 protected:
       
   954 	// from CServerFs
       
   955 	void RunL();
       
   956 
       
   957 private:
       
   958 	CServerFs(TInt aPriority);
       
   959 	// lock to protect iSessionQ
       
   960 	RFastLock iSessionQueueLock;
       
   961 	};
       
   962 
       
   963 NONSHARABLE_CLASS(CActiveSchedulerFs) : public CActiveScheduler
       
   964 	{
       
   965 public:
       
   966 	static void New();
       
   967 	virtual void Error(TInt anError) const;
       
   968 	};
       
   969 
       
   970 NONSHARABLE_CLASS(CActiveSchedulerLoader) : public CActiveScheduler
       
   971 	{
       
   972 public:
       
   973 	static CActiveSchedulerLoader* New();
       
   974 	virtual void Error(TInt anError) const;
       
   975 	};
       
   976 
       
   977 
       
   978 class TNameChecker
       
   979 	{
       
   980 public:
       
   981 	TNameChecker(const TDesC& aPathName): iName(aPathName){};
       
   982 	TBool IsIllegalChar(TText& aChar);
       
   983 	TBool IsIllegalName();
       
   984 	TBool IsIllegalName(TText& aChar);
       
   985 	TBool IsIllegalPath();
       
   986 	TBool IsIllegalPath(TText& aChar);
       
   987 	void SetName(const TDesC& aName){iName=aName;};
       
   988 private:
       
   989 	TBool IsIllegal(TText& aChar) const;
       
   990 private:
       
   991 	TFileName iName;
       
   992 	TParse iParse;
       
   993 	};
       
   994 
       
   995 enum TOperationFlags
       
   996 		{
       
   997 		ESync = 0x01, 
       
   998 		EInternalRequest = 0x02,	// NB Not really used!
       
   999 		EParseSrc = 0x04, 
       
  1000 		EParseDst = 0x08,
       
  1001 		EFileShare = 0x10,			// Operates on an open file share
       
  1002 		};
       
  1003 
       
  1004 class TOperation
       
  1005 	{
       
  1006 public:
       
  1007 	TBool IsChangeNotify() const;
       
  1008 	TBool IsDiskSpaceNotify() const;
       
  1009 	TBool IsWrite() const;
       
  1010 	TUint NotifyType() const;
       
  1011 	TBool IsCompleted() const;
       
  1012 	TBool IsOpenSubSess() const; //used to allocate for close as well as open task for subsessions
       
  1013 	TBool IsCloseSubSess() const;
       
  1014 
       
  1015 	inline TBool IsSync() const;
       
  1016 	inline TInt Function();
       
  1017 	inline TInt Initialise(CFsRequest* aRequest);
       
  1018 	inline TInt PostInitialise(CFsRequest* aRequest);
       
  1019 	inline TInt DoRequestL(CFsRequest* aRequest);
       
  1020 	inline TFsPluginRequest::TF32ArgType Arg(TUint aIndex);
       
  1021 	
       
  1022 public:
       
  1023 	TInt iFunction;
       
  1024 	TUint iFlags;
       
  1025 	TFsRequestFunc iInitialise;
       
  1026 	// optional processing step. Runs initially in context of main file server thread
       
  1027 	// but may be executed again in drive thread context if request is postponed
       
  1028 	TFsRequestFunc iPostInitialise;
       
  1029 	TFsRequestFunc iDoRequestL;
       
  1030 	TUint32 iArgs;
       
  1031 	};
       
  1032 
       
  1033 class TMsgOperation
       
  1034 	{
       
  1035 public:
       
  1036 	inline void Set(TInt64 aPos, TInt aLength, TUint8* aData, TInt aOffset = 0, TInt aNextState = 0);
       
  1037 	inline void Set(TInt64 aPos, TInt aLength, TDesC8* aData, TInt aOffset = 0, TInt aNextState = 0);
       
  1038 public:
       
  1039 	
       
  1040 	typedef struct
       
  1041 		{
       
  1042 		TAny* iData;	// pointer to local buffer (TUint8*) or remote client decriptor (TDesC8*)
       
  1043 		TInt iTotalLength;
       
  1044 		TInt64 iPos;
       
  1045 		TInt iLength;	// length of current fair-scheduled read/write 
       
  1046 		TInt iOffset;	// offset into iData
       
  1047 		} SReadWriteArgs;
       
  1048 
       
  1049 	union
       
  1050 		{
       
  1051 		TInt iArgs[KMaxMessageArguments];
       
  1052 		SReadWriteArgs iReadWriteArgs;
       
  1053 		};
       
  1054 
       
  1055 	TInt iFunction;				// the current function (usually, but not always the same as TOperation.iFunction
       
  1056 	TFsRequestFunc iComplete;	// function to call when CFsMessageRequest::Complete() is called
       
  1057 	CFsPlugin* iCurrentPlugin;	// The current plugin at the stage this Operation was pushed
       
  1058 
       
  1059 	TBool iClientRequest;		// The current request originated through RFile/RFilePlugin, so uses a descriptor buffer: 
       
  1060 								// An EFSRV client request 		non-local handle	non-local buffer	descriptor
       
  1061 								// A plugin request				local handle		local buffer		descriptor
       
  1062 								// An internal (cache) request	local handle		local buffer		raw pointer
       
  1063 	TInt iState;
       
  1064 	TMsgOperation* iNext;
       
  1065 	TMsgOperation* iPrev;
       
  1066 	TBool iIsAllocated;
       
  1067 	TAny* iScratchValue0;
       
  1068 	TAny* iScratchValue1;
       
  1069 	TInt64 iClientPosition;
       
  1070 	};
       
  1071 
       
  1072 
       
  1073 
       
  1074 NONSHARABLE_CLASS(CFsRequest) : public CBase
       
  1075 	{
       
  1076 public:
       
  1077 	/** Request states - these indicate a message's current stage of processing 
       
  1078 	*/
       
  1079 	enum TReqStates
       
  1080 		{
       
  1081 		/** Need to call iOperation.iInitialise() */
       
  1082 		EReqStateInitialise,
       
  1083 		/** Need to call PostInitialise() */
       
  1084 		EReqStatePostInitialise,
       
  1085 		/** Need to call iOperation.iDoRequestL */
       
  1086 		EReqStateDoRequest,
       
  1087 		};
       
  1088 
       
  1089 
       
  1090 	/** 
       
  1091 	Request actions - these indicate what further processing is required 
       
  1092 	and may be returned by any of:	
       
  1093 
       
  1094 		CFsRequest::iOperation->Initialise()
       
  1095 		CFsPlugin::DoRequestL()
       
  1096 		CFsMessageRequest::iOperation->iPostInitialise()
       
  1097 		CFsRequest::iOperation->DoRequestL()
       
  1098 		CFsMessageRequest::iCurrentOperation->iComplete()
       
  1099 
       
  1100 	The last 3 bits of each return code are used in CFsMessageRequest::Complete() 
       
  1101 	as an array look up to determine what action to take
       
  1102 	 */
       
  1103 	enum TReqActions 
       
  1104 		{
       
  1105 		/** 
       
  1106 		Continue with processing, dispatching to drive thread if necessary
       
  1107 		NB same value as KErrNone to maintain compatibility with existing code
       
  1108 		*/
       
  1109 		EReqActionContinue = KErrNone,			// 0x00000000, last 3 bits = 0
       
  1110 
       
  1111 		/** 
       
  1112 		Complete and free the message 
       
  1113 		*/
       
  1114 		EReqActionComplete = KErrCompletion,		// 0xFFFFFFEF, last 3 bits = 7
       
  1115 		
       
  1116 		/** 
       
  1117 		A resource is in use, so dispatch message again to back of drive thread's request queue
       
  1118 		If returned by Initialise(), then Initialse() will be called again
       
  1119 		If returned by Complete(), then iPostInitialise() will be called again
       
  1120 		*/
       
  1121 		EReqActionBusy = -0x1002,				// 0xFFFFEFFE, last 3 bits = 6
       
  1122 		
       
  1123 		/** 
       
  1124 		Neither dispatch nor complete the message - 
       
  1125 		a plugin thread has taken ownership of the message
       
  1126 		*/
       
  1127 		EReqActionOwnedByPlugin = -0x1003,		// 0xFFFFEFFD, last 3 bits = 5
       
  1128 
       
  1129 		/**
       
  1130 		The request cannot be processed because there is already an active read/write request 
       
  1131 		for the associated file share. This request has been linked to the currently active
       
  1132 		request and will be dispatched to the the drive thread when the current request has completed.
       
  1133 		@see CFileShare::RequestStart() & CFileShare::RequestEnd()
       
  1134 		*/
       
  1135 		EReqActionPending = EReqActionOwnedByPlugin,
       
  1136 		};
       
  1137 public:
       
  1138 	~CFsRequest();
       
  1139 
       
  1140 	void ReadL(const TInt aMsgNum,TDes8& aDes);
       
  1141 	void ReadL(const TInt aMsgNum,TDes8& aDes,TInt anOffset);
       
  1142 	void ReadL(const TInt aMsgNum,TDes16& aDes);
       
  1143 	void ReadL(const TInt aMsgNum,TDes16& aDes,TInt anOffset);
       
  1144 
       
  1145 	void WriteL(const TInt aMsgNum,const TDesC8& aDes);
       
  1146 	void WriteL(const TInt aMsgNum,const TDesC8& aDes,TInt anOffset);
       
  1147 	void WriteL(const TInt aMsgNum,const TDesC16& aDes);
       
  1148 	void WriteL(const TInt aMsgNum,const TDesC16& aDes,TInt anOffset);
       
  1149 
       
  1150 	TInt Read(const TInt aMsgNum,TDes8& aDes);
       
  1151 	TInt Read(const TInt aMsgNum,TDes8& aDes,TInt anOffset);
       
  1152 	TInt Read(const TInt aMsgNum,TDes16& aDes);
       
  1153 	TInt Read(const TInt aMsgNum,TDes16& aDes,TInt anOffset);
       
  1154 
       
  1155 	TInt Write(const TInt aMsgNum,const TDesC8& aDes);
       
  1156 	TInt Write(const TInt aMsgNum,const TDesC8& aDes,TInt anOffset);
       
  1157 	TInt Write(const TInt aMsgNum,const TDesC16& aDes);
       
  1158 	TInt Write(const TInt aMsgNum,const TDesC16& aDes,TInt anOffset);
       
  1159 
       
  1160 	TInt GetDesLength(const TInt aMsgNum);
       
  1161 
       
  1162 	inline void Kill(TInt aReason);
       
  1163 	inline void Terminate(TInt aReason);
       
  1164 	inline void Panic(const TDesC &aCategory,TInt aReason);
       
  1165 	inline TBool ErrorPlugin(TInt aReason);
       
  1166 
       
  1167 	TInt Read(TFsPluginRequest::TF32ArgType aType, TInt& aVal);
       
  1168 	TInt Read(TFsPluginRequest::TF32ArgType aType, TUint& aVal);
       
  1169 	TInt Read(TFsPluginRequest::TF32ArgType aType, TInt64& aVal);
       
  1170 	//
       
  1171 	TInt Read(TFsPluginRequest::TF32ArgType aType, TDes8& aDes,  TInt aOffset = 0);
       
  1172 	TInt Read(TFsPluginRequest::TF32ArgType aType, TDes16& aDes, TInt aOffset = 0);
       
  1173 	//
       
  1174 	TInt Write(TFsPluginRequest::TF32ArgType aType, const TDesC8& aDes,  TInt aOffset = 0);
       
  1175 	TInt Write(TFsPluginRequest::TF32ArgType aType, const TDesC16& aDes, TInt aOffset = 0);
       
  1176 
       
  1177 	inline TInt Initialise(){return iOperation->Initialise(this);};
       
  1178 	virtual void Process()=0;
       
  1179 	virtual void Complete(TInt aError)=0;
       
  1180 	virtual void Dispatch()=0;
       
  1181 	virtual void Free()=0;
       
  1182 	//
       
  1183 	virtual TParse& Src();
       
  1184 	virtual TParse& Dest();
       
  1185 	virtual TDrive* Drive();
       
  1186 	virtual TDrive* SubstedDrive();
       
  1187 	virtual void SetDrive(TDrive* aDrive);
       
  1188 	virtual void SetSubstedDrive(TDrive* aDrive);
       
  1189 	virtual const RMessage2& Message();
       
  1190 	//
       
  1191 	inline TOperation* Operation();
       
  1192 	inline CSessionFs* Session();
       
  1193 	inline void SetSession(CSessionFs* aSession);
       
  1194 	inline TInt DriveNumber();
       
  1195 	inline void SetDriveNumber(TInt aDriveNumber);
       
  1196 	inline TBool IsCompleted();
       
  1197 	inline void SetCompleted(TBool aIsCompleted);
       
  1198 	inline TUint ScratchValue();
       
  1199 	inline void SetScratchValue(const TUint aValue);
       
  1200 	inline TInt64 ScratchValue64();
       
  1201 	inline void SetScratchValue64(const TInt64& aValue);
       
  1202 	inline TBool IsSeparateThread();
       
  1203 	inline TBool IsPostOperation() const;
       
  1204 	inline TBool IsPluginSpecific() const;
       
  1205 	inline TBool IsExpectedResult(TInt err) const;
       
  1206 	inline TBool IsChangeNotify() const;
       
  1207 	inline void SetState(TReqStates aReqState);
       
  1208 	inline TBool DirectToDrive();
       
  1209 	inline TBool IsDescData(TInt aMsgNum);
       
  1210 	inline TInt FsFunction();
       
  1211 
       
  1212 public:
       
  1213 	CFsRequest();
       
  1214 protected:
       
  1215 	inline void Set(const TOperation& aOperation,CSessionFs* aSession);
       
  1216 	inline void Set(CSessionFs* aSession);
       
  1217 	inline void SetError(TInt aError);
       
  1218 	inline TInt GetError() const;
       
  1219 	inline void SetPostOperation(TBool aSet);
       
  1220 
       
  1221 	inline TBool IsFsObjectOpen();
       
  1222 	inline void SetFsObjectOpen(TBool aSet);
       
  1223 	void SetAndOpenScratchValue(const TInt64& aValue);
       
  1224 
       
  1225 private:
       
  1226 	TInt GetSlot(TFsPluginRequest::TF32ArgType aType);
       
  1227 public:
       
  1228 	TDblQueLink iLink;
       
  1229 	CFsPlugin* iCurrentPlugin;
       
  1230 	CFsPlugin* iOwnerPlugin;	// the plugin which originated this request
       
  1231 	TThreadId iClientThreadId;
       
  1232 	TBool iDirectToDrive;
       
  1233 protected:
       
  1234 	CSessionFs* iSession;
       
  1235 	TOperation* iOperation;
       
  1236 	TInt iDriveNumber;
       
  1237 	TBool iIsCompleted;
       
  1238 	TInt64 iScratchValue;
       
  1239 	
       
  1240 	TReqStates iReqState;
       
  1241 
       
  1242 	/** defines for iFlags
       
  1243 	*/
       
  1244 	enum TFsRequestFlags
       
  1245 		{
       
  1246 		EIsAllocated			= 0x01,
       
  1247 		EFreeChanged			= 0x02,		// valid only for EFsFileWrite
       
  1248 		EPostInterceptEnabled	= 0x04,
       
  1249 		EPostOperation			= 0x08,
       
  1250 		EFsObjectOpen			= 0x10,
       
  1251 		};
       
  1252 	TUint iFlags;
       
  1253 
       
  1254 	TInt iError;
       
  1255 	};
       
  1256 
       
  1257 const TInt KOperationFunctionUnaltered = -1;
       
  1258 
       
  1259 NONSHARABLE_CLASS(CFsMessageRequest) : public CFsRequest
       
  1260 	{
       
  1261 public:
       
  1262 	void Set(const RMessage2& aMessage,CSessionFs* aSession);
       
  1263 	void Set(const RMessage2& aMessage,const TOperation& aOperation,CSessionFs* aSession);
       
  1264 	void Set(const TOperation& aOperation);
       
  1265 	inline void SetPostInitialise(TFsRequestFunc aCacheFunction);
       
  1266 	//
       
  1267 	inline void SetMessage(RMessage2& aMessage);
       
  1268 	//
       
  1269 	virtual void Process();
       
  1270 	virtual void Complete(TInt aError);
       
  1271 
       
  1272 	virtual void Dispatch();
       
  1273 	virtual void Free();
       
  1274 	virtual TDrive* Drive();
       
  1275 	virtual TDrive* SubstedDrive();
       
  1276 	virtual void SetDrive(TDrive* aDrive);
       
  1277 	virtual void SetSubstedDrive(TDrive* aDrive);
       
  1278 	virtual const RMessage2& Message();
       
  1279 
       
  1280 	inline TBool IsFreeChanged();
       
  1281 	inline void SetFreeChanged(TBool aChanged);
       
  1282 
       
  1283 	inline TBool PostInterceptEnabled();
       
  1284 	inline void EnablePostIntercept(TBool aEnable);
       
  1285 
       
  1286 	inline TBool IsAllocated();
       
  1287 	inline void SetAllocated();
       
  1288 	inline CFsMessageRequest();
       
  1289 	
       
  1290 	TInt PushOperation(TInt64 aPos, TInt aLength, TUint8* aData, TInt aOffset = 0, TFsRequestFunc aCallback = NULL, TInt aNextState = 0, TInt aFunction = KOperationFunctionUnaltered);
       
  1291 	TInt PushOperation(TInt64 aPos, TInt aLength, TDesC8* aData, TInt aOffset = 0, TFsRequestFunc aCallback = NULL, TInt aNextState = 0, TInt aFunction = KOperationFunctionUnaltered);
       
  1292 	TInt PushOperation(TFsRequestFunc aCallback = NULL, TInt aNextState = 0, TInt aFunction = KOperationFunctionUnaltered);
       
  1293 	void PopOperation();
       
  1294 	void SetOperationFunc(TInt aFunction);
       
  1295 	TMsgOperation& CurrentOperation();
       
  1296 	inline TMsgOperation* CurrentOperationPtr();
       
  1297 	void Dispatch(TBool aInitialise, TBool aLowPriority = EFalse, TBool aDispatchToFront = EFalse);
       
  1298 
       
  1299 	inline TInt& LastError();
       
  1300 	inline void SetLastError(TInt aLastError);
       
  1301 	inline void Init();
       
  1302 	void ReStart();
       
  1303 	TBool IsPluginRequest();
       
  1304 	
       
  1305    // UID of the process to touching the file. (To be used in notification framework).
       
  1306    // TUid iUID;
       
  1307 private:
       
  1308 	void DoNotify(TInt aError);
       
  1309 	TInt DoInitialise();
       
  1310 	TInt PostInitialise();
       
  1311 	TBool DispatchToPlugin();
       
  1312 	void ProcessPostOperation();
       
  1313 	void ProcessPreOperation();
       
  1314 	void ProcessDriveOperation();
       
  1315 	TBool CurrentPluginWaiting();
       
  1316 	inline TInt DispatchToDrive(TBool aLowPriority, TBool aDispatchToFront);
       
  1317 	TBool IsNotifierSpecific() const;
       
  1318 	TBool IsNotifierSupported() const;
       
  1319 protected:
       
  1320 	RMessage2 iMessage;
       
  1321 	TDrive* iDrive;
       
  1322 	TDrive* iSubstedDrive;
       
  1323 private:
       
  1324 	TMsgOperation* iCurrentOperation;
       
  1325 	TInt iLastError;
       
  1326 	};
       
  1327 
       
  1328 
       
  1329 NONSHARABLE_CLASS(TParsePool)
       
  1330 	{
       
  1331 private:
       
  1332 	enum {KEBlockSize = 4};
       
  1333 
       
  1334 public:
       
  1335 	static TInt			Init();
       
  1336 	static TParsePool*	Get();
       
  1337 	static void			Release(TParsePool* aObject);
       
  1338 	TParsePool ();
       
  1339 	TParse& GetObject() {return   iObject;};
       
  1340 
       
  1341 private:
       
  1342 	TParsePool*        iNext;
       
  1343 	TParsePool*        iPrev;
       
  1344 
       
  1345 	TBool              iFree;
       
  1346 	TParse             iObject;
       
  1347 	static TParsePool* iFreeHead;
       
  1348 	static TParsePool* iClosedHead;
       
  1349 	static TInt        iCountFree;
       
  1350 	static RFastLock   iLock;
       
  1351 	};
       
  1352 
       
  1353 	
       
  1354 NONSHARABLE_CLASS(CFsClientMessageRequest) : public CFsMessageRequest
       
  1355 	{
       
  1356 public:
       
  1357     CFsClientMessageRequest();
       
  1358 	virtual TParse& Src();
       
  1359 	virtual TParse& Dest();
       
  1360 	virtual void Free();
       
  1361 	TInt AllocParseObjects(const TOperation& aOperation);
       
  1362 public:
       
  1363 	CFsClientMessageRequest* iNext;
       
  1364 protected:
       
  1365 	TParsePool* iPoolSrc;
       
  1366 	TParsePool* iPoolDest;
       
  1367 	};
       
  1368 
       
  1369 NONSHARABLE_CLASS(CFsDisconnectRequest) : public CFsMessageRequest
       
  1370 	{
       
  1371 public:
       
  1372 	virtual void Process();
       
  1373 	virtual void Dispatch();
       
  1374 	virtual void Complete(TInt aError);
       
  1375 	};
       
  1376 
       
  1377 NONSHARABLE_CLASS(CFsInternalRequest) : public CFsRequest
       
  1378 	{
       
  1379 public:
       
  1380 	CFsInternalRequest();
       
  1381 	void Set(const TOperation& aOperation,CSessionFs* aSession);
       
  1382 	//
       
  1383 	inline void SetThreadHandle(TInt aThreadHandle);
       
  1384 	inline TInt ThreadHandle();
       
  1385 	inline TRequestStatus& Status();
       
  1386 	inline TBool IsAllocated();
       
  1387 	inline void SetAllocated();
       
  1388 	//
       
  1389 	virtual void Process();
       
  1390 	virtual void Complete(TInt aError);
       
  1391 	virtual void Dispatch();
       
  1392 	virtual void Free();
       
  1393 private:
       
  1394 	TUint iThreadHandle;
       
  1395 	TRequestStatus iStatus;
       
  1396 	TBool iIsAllocated;
       
  1397 	};
       
  1398 const TInt KMaxRequestAllocated		= 45;
       
  1399 const TInt KMaxOperationAllocated	= KMaxRequestAllocated * 2;
       
  1400 const TInt KAllocReqBlock=15;
       
  1401 
       
  1402 class TParseCon
       
  1403 	{
       
  1404 public:
       
  1405 	TParse iParse;
       
  1406 	TParseCon* iNext;
       
  1407 	};
       
  1408 
       
  1409 
       
  1410 class RequestAllocator
       
  1411 	{
       
  1412 public:
       
  1413 	static TInt GetMessageRequest(const TOperation& aOperation,const RMessage2& aMessage,CFsClientMessageRequest* &aRequest);
       
  1414 	static void FreeRequest(CFsClientMessageRequest* aRequest); // Use the one from cache
       
  1415 	static void OpenSubFailed(CSessionFs* aSession); 
       
  1416 	static TInt AllocRequest(TInt aNum);
       
  1417 
       
  1418 	static TInt AllocOperation();
       
  1419 	static TInt GetOperation(TMsgOperation* &aOperation);
       
  1420 	static void FreeOperation(TMsgOperation* aOperation);
       
  1421 
       
  1422 
       
  1423 	static void Initialise();
       
  1424 #if defined(_USE_CONTROLIO) || defined(_DEBUG) || defined(_DEBUG_RELEASE)
       
  1425 	inline static TInt TotalCount();
       
  1426 	static TInt CloseCount();
       
  1427 	static TInt FreeCount();
       
  1428 	inline static TInt AllocatedCount();
       
  1429 private:
       
  1430 	static TInt iAllocated;
       
  1431 #endif
       
  1432 public:
       
  1433 	static RFastLock iCacheLock;
       
  1434 private:
       
  1435 	static TInt iAllocNum;
       
  1436 	static CFsClientMessageRequest* iFreeHead;				
       
  1437 	static CFsClientMessageRequest* iCloseHead;
       
  1438 
       
  1439 	static TInt iAllocNumOperation;
       
  1440 	static TMsgOperation* iFreeHeadSupOp;
       
  1441 	};
       
  1442 
       
  1443 
       
  1444 NONSHARABLE_CLASS(CNotifyInfo) : public CBase
       
  1445 	{
       
  1446 public:
       
  1447 	
       
  1448     enum TInfoType {EDiskSpace,EStdChange,EExtChange,EDebugChange,EDismount};
       
  1449 
       
  1450 public:
       
  1451 	~CNotifyInfo();
       
  1452 	void Initialise(TInfoType aType,TRequestStatus* aStatus,const RMessagePtr2& aMessage,CSessionFs* aSession);
       
  1453 	void Complete(TInt aError);
       
  1454 	//
       
  1455 	inline CSessionFs* Session();
       
  1456 	inline TRequestStatus* Status();
       
  1457 	inline TInfoType Type() const {return(iType);}
       
  1458 public:
       
  1459 	TDblQueLink iLink;
       
  1460 protected:
       
  1461 	TInfoType iType;
       
  1462 	TRequestStatus* iStatus;
       
  1463 	RMessagePtr2 iMessage;
       
  1464 	CSessionFs* iSession;
       
  1465 	};
       
  1466 
       
  1467 
       
  1468 NONSHARABLE_CLASS(CStdChangeInfo) : public CNotifyInfo
       
  1469 	{
       
  1470 public:
       
  1471 	void Initialise(TNotifyType aChangeType,TRequestStatus* aStatus,const RMessagePtr2& aMessage,CSessionFs* aSession);
       
  1472 	TUint RequestNotifyType(CFsRequest* aRequest);
       
  1473 	TBool IsMatching(CFsRequest* aRequest);
       
  1474 protected:
       
  1475 	TNotifyType iChangeType;
       
  1476 	};
       
  1477 
       
  1478 NONSHARABLE_CLASS(CExtChangeInfo) : public CStdChangeInfo
       
  1479 	{
       
  1480 public:
       
  1481 	void Initialise(TNotifyType aChangeType,TRequestStatus* aStatus,const RMessagePtr2& aMessage,CSessionFs* aSession,const TDesC& aName);
       
  1482 	TBool IsMatching(CFsRequest* aRequest);
       
  1483 private:
       
  1484 	TFileName iName;
       
  1485 	};
       
  1486 
       
  1487 NONSHARABLE_CLASS(CDiskSpaceInfo) : public CNotifyInfo
       
  1488 	{
       
  1489 public:
       
  1490 	void Initialise(TRequestStatus* aStatus,const RMessagePtr2& aMessage,CSessionFs* aSession,TInt64 aThreshold);
       
  1491 	TBool IsMatching(TInt64& aBefore,TInt64& aAfter);
       
  1492 private:
       
  1493 	TInt64 iThreshold;
       
  1494 	};
       
  1495 
       
  1496 NONSHARABLE_CLASS(CDebugChangeInfo) : public CNotifyInfo
       
  1497 	{
       
  1498 public:
       
  1499 	void Initialise(TUint aDebugType,TRequestStatus* iStatus,const RMessagePtr2& aMessage,CSessionFs* aSession);
       
  1500 	TBool IsMatching(TUint aChange);
       
  1501 private:
       
  1502 	TUint iDebugType;
       
  1503 	};
       
  1504 
       
  1505 NONSHARABLE_CLASS(CDismountNotifyInfo) : public CNotifyInfo
       
  1506 	{
       
  1507 public:
       
  1508 	~CDismountNotifyInfo();
       
  1509 	void Initialise(TNotifyDismountMode aMode, TInt aDriveNumber,TRequestStatus* iStatus,const RMessagePtr2& aMessage,CSessionFs* aSession);
       
  1510 	TBool IsMatching(TNotifyDismountMode aMode, TInt aDriveNumber, CSessionFs* aSession);
       
  1511 private:
       
  1512 	TNotifyDismountMode iMode;
       
  1513 	TInt iDriveNumber;
       
  1514 	};
       
  1515 
       
  1516 const TInt KMaxNotifyQues=KMaxDrives+1;
       
  1517 const TInt KMaxDiskQues=KMaxDrives;	
       
  1518 
       
  1519 class TBaseQue
       
  1520 	{
       
  1521 protected:
       
  1522 	TBaseQue();
       
  1523 	~TBaseQue();
       
  1524 	void DoAddNotify(CNotifyInfo* aInfo);
       
  1525 	TBool DoCancelSession(CSessionFs* aSession,TInt aCompletionCode,TRequestStatus* aStatus=NULL);
       
  1526 	void DoCancelAll(TInt aCompletionCode);
       
  1527 	TBool IsEmpty();
       
  1528 protected:
       
  1529 	TDblQue<CNotifyInfo> iHeader;
       
  1530 	RFastLock iQLock;
       
  1531 	};
       
  1532 
       
  1533 class TChangeQue :public TBaseQue
       
  1534 	{
       
  1535 public:
       
  1536 	TInt AddNotify(CNotifyInfo* aInfo);
       
  1537 	TBool CancelSession(CSessionFs* aSession,TInt aCompletionCode,TRequestStatus* aStatus=NULL);
       
  1538 	void CancelAll(TInt aCompletionCode);
       
  1539 	void CheckChange(CFsRequest* aRequest);
       
  1540 	TBool IsEmpty();
       
  1541 	};
       
  1542 
       
  1543 class TDiskSpaceQue : public TBaseQue
       
  1544 	{
       
  1545 public:
       
  1546 	inline void SetDriveNumber(TInt aDriveNumber) {iDriveNumber=aDriveNumber;}
       
  1547 	TInt AddNotify(CNotifyInfo* aInfo);
       
  1548 	TInt CancelSession(CSessionFs* aSession,TInt aCompletionCode,TRequestStatus* aStatus=NULL);
       
  1549 	void CancelAll(TInt aCompletionCode);
       
  1550 	void CheckDiskSpace();
       
  1551 	void CheckDiskSpace(TInt64& aFreeDiskSpace);
       
  1552 	TBool IsEmpty();
       
  1553 private:
       
  1554 	TInt GetFreeDiskSpace(TInt64& aFreeDiskSpace);
       
  1555 private:
       
  1556 	TInt64 iFreeDiskSpace;
       
  1557 	TInt iDriveNumber;
       
  1558 	TInt64 iReservedDiskSpace;
       
  1559 	};
       
  1560 
       
  1561 class TDebugQue : public TBaseQue
       
  1562 	{
       
  1563 public:
       
  1564 	TInt AddNotify(CNotifyInfo* aInfo);
       
  1565 	TInt CancelSession(CSessionFs* aSession,TInt aCompletionCode,TRequestStatus* aStatus=NULL);
       
  1566 	void CancelAll(TInt aCompletionCode);
       
  1567 	void CheckDebug(TUint aDebugChange);
       
  1568 	};
       
  1569 
       
  1570 class TDismountNotifyQue : public TBaseQue
       
  1571 	{
       
  1572 public:
       
  1573 	TInt AddNotify(CNotifyInfo* aInfo);
       
  1574 	TInt CancelSession(CSessionFs* aSession,TInt aCompletionCode,TRequestStatus* aStatus=NULL);
       
  1575 	void CancelAll(TInt aCompletionCode);
       
  1576 	void CheckDismount(TNotifyDismountMode aMode, TInt aDrive, TBool aRemove, TInt aError);
       
  1577 	TBool HandlePendingDismount(CSessionFs* aSession, TInt aDrive);
       
  1578 	};
       
  1579 
       
  1580 class FsNotify
       
  1581 	{
       
  1582 public:
       
  1583 	static void Initialise();
       
  1584 	static TInt AddChange(CNotifyInfo* aInfo,TInt aDrive);
       
  1585 	static TInt AddDiskSpace(CNotifyInfo* aDiskInfo,TInt aDrive);
       
  1586 	static TInt AddDebug(CNotifyInfo* aDebugInfo);
       
  1587 	static TInt AddDismountNotify(CNotifyInfo* aDismountNotifyInfo);
       
  1588 	static void DiskChange(TInt aDrive);
       
  1589 	static void HandleChange(CFsRequest* aRequest,TInt aDrive);
       
  1590 	static void HandleDiskSpace(CFsRequest* aRequest,TInt aDrive);
       
  1591 	static void HandleDiskSpace(TInt aDrive, TInt64& aFreeSpace);
       
  1592 	static void HandleDebug(TUint aFunction);
       
  1593 	static void HandleDismount(TNotifyDismountMode aMode, TInt aDrive, TBool aRemove, TInt err);
       
  1594 	static void CancelChangeSession(CSessionFs* aSession,TRequestStatus* aStatus=NULL);
       
  1595 	static void CancelDiskSpaceSession(CSessionFs* aSession,TRequestStatus* aStatus=NULL);
       
  1596 	static void CancelDebugSession(CSessionFs* aSession, TRequestStatus* aStatus=NULL);
       
  1597 	static void CancelDismountNotifySession(CSessionFs* aSession, TRequestStatus* aStatus=NULL);
       
  1598 	static void CancelSession(CSessionFs* aSession);
       
  1599 	static TBool HandlePendingDismount(CSessionFs* aSession, TInt aDriveNumber);
       
  1600 	static TBool IsChangeQueEmpty(TInt aDrive);
       
  1601 	static TBool IsDiskSpaceQueEmpty(TInt aDrive);
       
  1602 private:
       
  1603 	static TInt ChangeIndex(TInt aDrive);
       
  1604 private:
       
  1605 	static TChangeQue iChangeQues[KMaxNotifyQues];
       
  1606 	static TDiskSpaceQue iDiskSpaceQues[KMaxDiskQues];
       
  1607 	static TDebugQue iDebugQue;
       
  1608 	static TDismountNotifyQue iDismountNotifyQue;
       
  1609 	};
       
  1610 
       
  1611 class CObjPromotion : public CFsObject
       
  1612 	{
       
  1613 public:
       
  1614 	TInt UniqueID() const {return(CFsObject::UniqueID());}
       
  1615 	};	
       
  1616 
       
  1617 NONSHARABLE_CLASS(CKernEventNotifier) : public CActive
       
  1618      {
       
  1619 public:
       
  1620      static CKernEventNotifier* New(TInt aPriority=EPriorityStandard);
       
  1621      ~CKernEventNotifier();
       
  1622      void Start();
       
  1623      inline TInt Change() const {return iChange;}
       
  1624 private:
       
  1625      CKernEventNotifier(TInt aPriority) : CActive(aPriority) {}
       
  1626      void RunL();
       
  1627      void DoCancel();
       
  1628 private:
       
  1629      static TInt LocaleChangeCallback(TAny* aPtr=NULL);
       
  1630      TInt FreeMemoryChangeCallback();
       
  1631 private:
       
  1632      TInt iChange;
       
  1633      RChangeNotifier iChangeNotifier;
       
  1634      };
       
  1635 
       
  1636 #if defined(_LOCKABLE_MEDIA)
       
  1637 
       
  1638 class TDelayedWriterInit
       
  1639 	{
       
  1640 public:
       
  1641 	const TDesC *iFileName;
       
  1642 	const TDesC8 *iData;
       
  1643 	const TDesC *iSemName;
       
  1644 	};
       
  1645 
       
  1646 
       
  1647 class TDelayedWriter
       
  1648 	{
       
  1649 public:
       
  1650 	TDelayedWriter();
       
  1651 	~TDelayedWriter();
       
  1652 
       
  1653 	static TDelayedWriter *NewL(const TDelayedWriterInit *dwi);
       
  1654 	void ConstructL(const TDelayedWriterInit *dwi);
       
  1655 
       
  1656 	HBufC *iFileName;
       
  1657 	HBufC8 *iData;
       
  1658 	};
       
  1659 
       
  1660 #endif
       
  1661 
       
  1662 extern CFsObjectConIx* TheContainer;
       
  1663 extern CFsObjectCon* FileSystems;
       
  1664 extern CFsObjectCon* Files;
       
  1665 extern CFsObjectCon* FileShares;
       
  1666 extern CFsObjectCon* Dirs;
       
  1667 extern CFsObjectCon* Formats;
       
  1668 extern CFsObjectCon* RawDisks;
       
  1669 extern CFsObjectCon* Extensions;
       
  1670 extern CFsObjectCon* ProxyDrives;
       
  1671 
       
  1672 extern CKernEventNotifier* TheKernEventNotifier;
       
  1673 
       
  1674 extern RThread TheServerThread;
       
  1675 extern RAllocator* ServerThreadAllocator;
       
  1676 
       
  1677 extern CServerFs* TheFileServer;
       
  1678 
       
  1679 extern HBufC* TheDriveNames[];
       
  1680 extern TDrive TheDrives[KMaxDrives];
       
  1681 extern TFileName TheDefaultPath;
       
  1682 extern RFTrace TheFtrace;
       
  1683 
       
  1684 extern SCapabilitySet AllCapabilities;
       
  1685 extern SCapabilitySet DisabledCapabilities;
       
  1686 
       
  1687 const TInt KDispatchObjectClose=KMaxTInt-1;
       
  1688 const TInt KSessionDisconnect=KMaxTInt-2;
       
  1689 const TInt KCancelSession=KMaxTInt-3;
       
  1690 const TInt KCancelPlugin=KMaxTInt-4;
       
  1691 const TInt KFileShareClose=KMaxTInt-5;
       
  1692 const TInt KFlushDirtyData=KMaxTInt-6;
       
  1693 
       
  1694 const TOperation DispatchObjectCloseOp=	{KDispatchObjectClose,	EInternalRequest,	&TFsCloseObject::Initialise,		NULL,	&TFsCloseObject::DoRequestL			};
       
  1695 const TOperation SessionDisconnectOp=	{KSessionDisconnect,	EInternalRequest,	&TFsSessionDisconnect::Initialise,	NULL,	&TFsSessionDisconnect::DoRequestL	};
       
  1696 const TOperation CancelSessionOp=		{KCancelSession,		EInternalRequest,	&TFsCancelSession::Initialise,		NULL,	&TFsCancelSession::DoRequestL		};
       
  1697 const TOperation CancelPluginOp=		{KCancelPlugin,			EInternalRequest,	&TFsCancelPlugin::Initialise,		NULL,	&TFsCancelPlugin::DoRequestL		};
       
  1698 const TOperation FileShareCloseOp=		{KFileShareClose,		EInternalRequest,	&TFsCloseFileShare::Initialise,		NULL,	&TFsCloseFileShare::DoRequestL		};
       
  1699 const TOperation FlushDirtyDataOp=		{KFlushDirtyData,		EInternalRequest,	&TFsFlushDirtyData::Initialise,		NULL,	&TFsFlushDirtyData::DoRequestL		};
       
  1700 
       
  1701 extern TBool OpenOnDriveZOnly;
       
  1702 extern TBool LocalFileSystemInitialized;
       
  1703 extern TBool StartupInitCompleted;
       
  1704 extern TBool RefreshZDriveCache;
       
  1705 extern TBool CompFsMounted;
       
  1706 extern TBool CompFsSync;
       
  1707 
       
  1708  TInt InitializeLocalFileSystem(const TDesC& aName);
       
  1709  void InstallRomFileSystemL();
       
  1710  void InstallFatFileSystemL();
       
  1711  TInt InstallFileSystem(CFileSystem* aSys,RLibrary aLib);
       
  1712 
       
  1713  TInt LoadFileSystem(const TDesC& aName);
       
  1714 
       
  1715  CFsObject* SessionObjectFromHandle(TInt aHandle,TInt aUniqueID, CSessionFs* aSession);
       
  1716  CFileShare* GetShareFromHandle(CSessionFs* aSession, TInt aHandle);
       
  1717 
       
  1718  TInt  ValidateDrive(TInt aDriveNumber,CFsRequest* aRequest);
       
  1719  TInt  ValidateDriveDoSubst(TInt aDriveNumber,CFsRequest* aRequest);
       
  1720  void  ValidateAtts(TUint anEntryAtt,TUint& aSetAttMask,TUint& aClearAttMask);
       
  1721  TInt  ParseSubstPtr0(CFsRequest* aRequest,TParse& aParse, TBool aUseSessionPath = ETrue);
       
  1722  TInt  ParseNoWildSubstPtr0(CFsRequest* aRequest,TParse& aParse, TBool aUseSessionPath = ETrue);
       
  1723  TInt  ParseNoWildSubstPtr1(CFsRequest* aRequest,TParse& aParse);
       
  1724  TInt  ParseNoWildSubstCheckPtr0(CFsRequest* aRequest,TParse& aParse, TBool aUseSessionPath = ETrue);
       
  1725  TInt  ParseNoWildSubstCheckPtr1(CFsRequest* aRequest,TParse& aParse);
       
  1726  TInt  ParseNoWildSubstFileCheckPtr1(CFsRequest* aRequest,TParse& aParse);
       
  1727  TInt  ParseNoWildSubstCheckPathPtr0(CFsRequest* aRequest,TParse& aParse);
       
  1728  TInt  ParseNoWildSubstCheckPathPtr1(CFsRequest* aRequest,TParse& aParse);
       
  1729  TInt  ParsePathPtr0(CFsRequest* aRequest,TParse& aParse);
       
  1730  TInt  ParseNotificationPath(CFsRequest* aRequest, TParse& aParse, TDes& aNotifyPath);
       
  1731  TBool IsIllegalFullName(const TDesC& aName);
       
  1732  TBool IsIllegalFullName(const TParse& aParse);
       
  1733  void  AddResource(CMountCB& aMount);
       
  1734  void  RemoveResource(CMountCB& aMount);
       
  1735  void  AddDiskAccess(CMountCB& aMount);
       
  1736  void  RemoveDiskAccess(CMountCB& aMount);
       
  1737  void  NextInPath(const TDesC& aPath,TPtrC& anEntry,TInt& aPos);
       
  1738  TBool PowerOk();
       
  1739  void  Get16BitDllName(TDes& aFileName, const TDesC8& aDllName);
       
  1740  void  Get8BitDllName(TDes8& aDllName, const TDesC& aFileName);
       
  1741  TInt  MatchUidType(const TUidType &aMatch, const TUidType &aType);
       
  1742  TBool IsWriteFunction(TInt aFunction);
       
  1743  TInt  InitLoader();
       
  1744  TInt  CheckDiskSpace(TInt64 aThreshold, CFsRequest* aRequest);
       
  1745  void  CheckForLeaveAfterOpenL(TInt leaveError, CFsRequest* aRequest, TInt aHandle);
       
  1746  TInt  ParseSubst(const TInt aP, CFsRequest* aRequest,TParse& aParse, TBool aUseSessionPath = ETrue);
       
  1747 
       
  1748 //#ifdef __DATA_CAGING__
       
  1749 
       
  1750  TBool CompareResource(const TDesC & aThePath);
       
  1751 
       
  1752 #ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
       
  1753  TInt PathCheck(CFsRequest* aRequest, const TDesC& aThePath, const TSecurityPolicy* aSysCap, const TSecurityPolicy* aPriCap, const char* aDiag);
       
  1754  TInt PathCheck(CFsRequest* aRequest, const TDesC& aThePath, const TSecurityPolicy* aSysCap, const TSecurityPolicy* aPriCap, const TSecurityPolicy* aROCap, const char* aDiag);
       
  1755  TInt PathCheck(CFsRequest* aRequest, const TDesC& aThePath,const TSecurityPolicy* aCap, const char* aDiag, TBool aExactMatchAllowed = EFalse);
       
  1756 #else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
       
  1757  TInt PathCheck(CFsRequest* aRequest, const TDesC& aThePath, const TSecurityPolicy* aSysCap, const TSecurityPolicy* aPriCap, OnlyCreateWithNull aDiag);
       
  1758  TInt PathCheck(CFsRequest* aRequest, const TDesC& aThePath, const TSecurityPolicy* aSysCap, const TSecurityPolicy* aPriCap, const TSecurityPolicy* aROCap, OnlyCreateWithNull aDiag); 
       
  1759  TInt PathCheck(CFsRequest* aRequest, const TDesC& aThePath,const TSecurityPolicy* aCap, OnlyCreateWithNull aDiag, TBool aExactMatchAllowed = EFalse);
       
  1760 #endif //!__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
       
  1761 
       
  1762  TBool ComparePrivate(const TDesC & aThePath);
       
  1763  TBool CompareSystem(const TDesC & aThePath);
       
  1764  TBool SIDCheck(CFsRequest* aRequest, const TDesC& aThePath);
       
  1765  TBool ComparePaths(const TDesC& aPath1,const TDesC& aPath2);
       
  1766  TUint32 CalcNameHash(const TDesC& aName);
       
  1767 
       
  1768 const TInt KResourceLength			=	9;
       
  1769 const TInt KSystemLength			=	4;
       
  1770 const TInt KPrivateLength			=	8;
       
  1771 const TInt KPrivateLengthCheck		=	17;
       
  1772 const TInt KSIDLength				=	8;
       
  1773 const TInt KSIDPathOffset			=	9;
       
  1774 
       
  1775 _LIT(KSlash, "\\");
       
  1776 _LIT(KPrivate,"\\Private");
       
  1777 _LIT(KPrivateSlash,"\\Private\\");
       
  1778 _LIT(KSysHash,"?:\\Sys\\Hash\\");
       
  1779 const TInt KBSlash='\\';
       
  1780 const TInt KHashFileReadSize = 1024*8;
       
  1781 
       
  1782 
       
  1783 const TInt KMsgPtr0	= 0;
       
  1784 const TInt KMsgPtr1	= 1;
       
  1785 const TInt KMsgPtr2	= 2;
       
  1786 const TInt KMsgPtr3	= 3;
       
  1787 
       
  1788 const TInt KIpcFunctionMask = 0x0000ffff;
       
  1789 const TInt KIpcFlagMask     = 0xffff0000;
       
  1790 const TInt KIpcFlagOffset   = 16;
       
  1791 
       
  1792 #if defined(_DEBUG) || defined(_DEBUG_RELEASE)
       
  1793  void  PrintStartUpReason(TMachineStartupType aReason);
       
  1794  TPtrC GetFunctionName(TInt aFunction);
       
  1795  void  SimulateAllocFailure(TInt aFunctionReturnValue,TInt aFunction);
       
  1796 
       
  1797 extern TInt ErrorCondition;
       
  1798 extern TInt ErrorCount;
       
  1799 extern TUint32 DebugReg;
       
  1800 extern TInt UserHeapAllocFailCount;
       
  1801 extern TInt KernHeapAllocFailCount;
       
  1802 extern TInt MessageCount;
       
  1803 
       
  1804 void PrintHeapSize(const TDesC& aMessage);
       
  1805 
       
  1806 extern TCorruptNameRec* gCorruptFileNameList;
       
  1807 extern TCorruptLogRec* gCorruptLogRecordList;
       
  1808 extern TInt gNumberOfCorruptHits;
       
  1809 extern HBufC* gCorruptFileNamesListFile;
       
  1810 #endif
       
  1811 
       
  1812 typedef TPckgBuf<TMediaPswdReplyNotifyInfoV1> TMediaPswdReplyNotifyInfoV1Buf;
       
  1813 
       
  1814 #if defined(__WINS__)
       
  1815  TInt MapWindowsFileName(TDes& aBuffer,const TDesC& aFileName);
       
  1816 #endif
       
  1817 
       
  1818 enum TDllFindMethod {EFindInPath, EFindInSystemLibs, EFindInSystemBin, EFindExhausted};
       
  1819 
       
  1820 //---------------------------------------------------------------------------------------------------------------------
       
  1821 
       
  1822 NONSHARABLE_CLASS(CFileBody) : public CBase, public CFileCB::MExtendedFileInterface
       
  1823 	{
       
  1824 protected:
       
  1825 	~CFileBody();
       
  1826 	CFileBody(CFileCB* aFileCB, CFileCB::MExtendedFileInterface* aExtendedFileInterface);
       
  1827 	void InitL();
       
  1828 
       
  1829 	TBool ExtendedFileInterfaceSupported();
       
  1830 
       
  1831 	// from MExtendedFileInterface	
       
  1832 	virtual void ReadL(TInt64 aPos,TInt& aLength,TDes8* aDes,const RMessagePtr2& aMessage, TInt aOffset = 0);
       
  1833 	virtual void WriteL(TInt64 aPos,TInt& aLength,const TDesC8* aDes,const RMessagePtr2& aMessage, TInt aOffset = 0);
       
  1834 	virtual void SetSizeL(TInt64 aSize);
       
  1835 
       
  1836 
       
  1837 private:
       
  1838 	CFileCB* iFileCB;
       
  1839 	CFileCB::MExtendedFileInterface* iExtendedFileInterface;
       
  1840 	TInt iFairSchedulingLen;
       
  1841 	TBool iNotifyAsyncReadersPending;
       
  1842 	TBool iDeleteOnClose;
       
  1843 
       
  1844 protected:
       
  1845 	TInt iPromotedShares;
       
  1846 	RArray<TAsyncReadRequest>* iAsyncReadRequests;
       
  1847 	CFileCache* iFileCache;	// pointer to owner CFileCache 
       
  1848 	TBool iLocalBufferSupport;
       
  1849 
       
  1850     /** 
       
  1851     maximum file size supported by the filesystem that instantiates the CFileCB, associated with this object.
       
  1852     For example, FAT32 supports files not larger than 4GB-1. Other file systems can support larger files. 
       
  1853     This member allows file server to know maximum allowed position in the file.
       
  1854     The default value is KMaxTUint64
       
  1855     */
       
  1856     TUint64 iMaxSupportedFileSize; 
       
  1857 
       
  1858 public:
       
  1859 	// Provides support for large file size ( file size > 4GB - 1)
       
  1860 	// Upper / High 32 bit word of the file size is saved here.
       
  1861 	// This can be non-zero only if the CFileShare::iMode is ORed with EFileBigFile
       
  1862 	// and the file size is > 4GB - 1.
       
  1863 	// This shall be queried by CFileCB::Size64() from file systems or by direct access from file server
       
  1864 	// This shall be updated by CFileCB::SetSize64() from file systems or by direct access from file server. 
       
  1865 	TUint iSizeHigh;
       
  1866 	
       
  1867 protected:
       
  1868 friend class CFileCB;
       
  1869 friend class CFileCache;
       
  1870 	};
       
  1871 
       
  1872 //---------------------------------------------------------------------------------------------------------------------
       
  1873 
       
  1874 NONSHARABLE_CLASS(CMountBody) : public CBase, public CMountCB::MFileAccessor, public CMountCB::MFileExtendedInterface
       
  1875 	{
       
  1876 protected:
       
  1877 	CMountBody(CMountCB* aMountCB, CMountCB::MFileAccessor* aFileAccessor = NULL, CMountCB::MFileExtendedInterface* aFileInterface = NULL);
       
  1878 	~CMountBody();
       
  1879 
       
  1880 	// Clamping support
       
  1881 	TInt ClampFile(const TInt aDriveNo,const TDesC& aName,TAny* aHandle);
       
  1882 	TInt UnclampFile(RFileClamp* aHandle);
       
  1883 	TInt IsFileClamped(const TInt64 aUniqueId);
       
  1884 	TInt NoOfClamps();
       
  1885 
       
  1886 	// Internal support clamping
       
  1887 	static TInt CompareClampsByIdAndCount(const RFileClamp& aClampA, const RFileClamp& aClampB);
       
  1888 	static TInt CompareClampsById(const RFileClamp& aClampA, const RFileClamp& aClampB);
       
  1889 	static TInt FindClampByIdAndCount(const RFileClamp& aClampA, const RFileClamp& aClampB);
       
  1890 	static TInt FindClampById(const RFileClamp& aClampA, const RFileClamp& aClampB);
       
  1891 
       
  1892 	// from MFileAccessor
       
  1893 	virtual TInt GetFileUniqueId(const TDesC& aName, TInt64& aUniqueId);
       
  1894 	virtual TInt Spare3(TInt aVal, TAny* aPtr1, TAny* aPtr2);
       
  1895 	virtual TInt Spare2(TInt aVal, TAny* aPtr1, TAny* aPtr2);
       
  1896 	virtual TInt Spare1(TInt aVal, TAny* aPtr1, TAny* aPtr2);
       
  1897 	
       
  1898 	// From MFileExtendedInterface
       
  1899 	virtual void ReadSection64L(const TDesC& aName, TInt64 aPos, TAny* aTrg, TInt aLength, const RMessagePtr2& aMessage);
       
  1900 
       
  1901 	void SetProxyDriveDismounted();
       
  1902 	TBool ProxyDriveDismounted();
       
  1903 	
       
  1904 
       
  1905     inline CFileSystem* GetFileSystem() const;
       
  1906     inline void SetFileSystem(CFileSystem* aFsys);
       
  1907 
       
  1908 private:
       
  1909 	CMountCB* iMountCB;
       
  1910 	RArray<RFileClamp> iClampIdentifiers;
       
  1911 	TInt32 iClampCount;
       
  1912 	CMountCB::MFileAccessor* iFileAccessor;
       
  1913 	CMountCB::MFileExtendedInterface* iFileExtendedInterface;
       
  1914 	TBool iProxyDriveDismounted;
       
  1915 	CFileSystem* iFSys;  ///< link to the FileSystem object that has produced the mount (iMountCB)
       
  1916 friend class CMountCB;
       
  1917 	};
       
  1918 
       
  1919 
       
  1920 #include "sf_ops.h"
       
  1921 #include "sf_std.inl"
       
  1922 
       
  1923 
       
  1924 #endif //SF_STD_H