os/kernelhwsrv/userlibandfileserver/fileserver/inc/f32fsys.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     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\inc\f32fsys.h
    15 // 
    16 // WARNING: This file contains some APIs which are internal and are subject
    17 //          to change without notice. Such APIs should therefore not be used
    18 //          outside the Kernel and Hardware Services package.
    19 //
    20 
    21 /**
    22  @file
    23  @publishedPartner
    24  @released
    25 */
    26 
    27 #if !defined(__F32FSYS_H__)
    28 #define __F32FSYS_H__
    29 #if !defined(__F32FILE_H__)
    30 #include <f32file.h>
    31 #endif
    32 #include <e32atomics.h>
    33 #include <d32locd.h>
    34 
    35 //
    36 #if defined(_UNICODE)
    37 #define KFileSystemUidValue KFileSystemUidValue16
    38 #define KFileServerUidValue KFileServerUidValue16
    39 #define KFileServerDllUidValue KFileServerDllUidValue16
    40 #else
    41 #define KFileSystemUidValue KFileSystemUidValue8
    42 #define KFileServerUidValueKFileServerUidValue8
    43 #define KFileServerDllUidValueKFileServerDllUidValue8
    44 #endif
    45 
    46 
    47 /**
    48 Filesystem error code 1 : indicates an item cannot be found,
    49 because it has been hidden.
    50 */
    51 const TInt KErrHidden=(1);
    52 
    53 /**
    54 Filesystem error code 2 : in the context of file operations, a path
    55 was not found, because it has been hidden.
    56 */
    57 const TInt KErrPathHidden=(2);
    58 
    59 
    60 const TInt KFileShareLockGranularity=2;
    61 const TInt KAsyncRequestArrayGranularity=2;
    62 
    63 /**
    64 @publishedPartner
    65 @released
    66 
    67 File system UID value 16.
    68 */
    69 const TInt KFileSystemUidValue16=0x100039df;
    70 
    71 
    72 
    73 
    74 /**
    75 @publishedPartner
    76 @released
    77 
    78 File system UID value 8.
    79 */
    80 const TInt KFileSystemUidValue8=0x1000008f;
    81 
    82 
    83 
    84 
    85 /**
    86 @publishedPartner
    87 @released
    88 
    89 File server UID value 16.
    90 */
    91 const TInt KFileServerUidValue16=0x100039e3;
    92 
    93 
    94 
    95 
    96 /**
    97 @publishedPartner
    98 @released
    99 
   100 File server UID value 8.
   101 */
   102 const TInt KFileServerUidValue8=0x100000bb;
   103 
   104 
   105 
   106 
   107 /**
   108 @publishedPartner
   109 @released
   110 
   111 File server DLL UID value 16.
   112 */
   113 const TInt KFileServerDllUidValue16=0x100039e4;
   114 
   115 
   116 
   117 
   118 /**
   119 @publishedPartner
   120 @released
   121 
   122 File server DLL UID value 8.
   123 */
   124 const TInt KFileServerDllUidValue8=0x100000bd;
   125 
   126 
   127 
   128 
   129 /**
   130 @publishedPartner
   131 @released
   132 
   133 Local file system UID value.
   134 */
   135 const TInt KLocalFileSystemUidValue=0x100000d6;
   136 
   137 
   138 
   139 
   140 /**
   141 @publishedPartner
   142 @released
   143 
   144 Estart component UID value.
   145 */
   146 const TInt KEstartUidValue=0x10272C04;
   147 
   148 
   149 
   150 /**
   151 @publishedPartner
   152 @released
   153 Maximum length of a volume name.
   154 */
   155 const TInt KMaxVolumeNameLength=11;
   156 
   157 
   158 
   159 
   160 /**
   161 @publishedPartner
   162 @released
   163 
   164 First local drive indicator.
   165 */
   166 const TInt KFirstLocalDrive=EDriveC;
   167 
   168 
   169 const TInt KMaxExtensionCount=2;
   170 //
   171 const TInt KDriveInvalid=-1;
   172 //
   173 _LIT(KMediaPWrdFile, "?:\\sys\\data\\mmcstore");
   174 //
   175 
   176 /** 
   177 @internalTechnology
   178 */
   179 const TUint KSystemDriveKey = 0x10283049;
   180 
   181 
   182 /**
   183 @publishedPartner
   184 @released
   185 
   186 Enumeration that specifies whether, on opening a file:
   187 - an existing file is opened
   188 - a new file is created 
   189 - an existing file is replaced.
   190 */
   191 enum TFileOpen {EFileOpen,EFileCreate,EFileReplace};
   192 
   193 
   194 
   195 
   196 /**
   197 @publishedPartner
   198 @released
   199 
   200 The file share mode.
   201 */
   202 typedef TFileMode TShare;
   203 
   204 
   205 
   206 
   207 class CMountCB;
   208 class CFileSystem;
   209 class CFileCB;
   210 class CDirCB;
   211 class CFileShare;
   212 class CSessionFs;
   213 class CFsPlugin;
   214 class CFileBody;
   215 class CMountBody;
   216 class CFsMessageRequest;
   217 class CProxyDrive;
   218 class CFormatCB;
   219 
   220 //
   221 class CFsObjectCon;
   222 class CFileCache;
   223 //
   224 class CExtNotifyMediaChange;
   225 //
   226 
   227 /**
   228 @publishedPartner
   229 @released
   230 
   231 Implements reference counting to track concurrent references to itself.
   232  
   233 An object of this type arranges automatic destruction of itself when the final 
   234 reference is removed.
   235 
   236 A reference counting object is any object which has CFsObject as its base class. 
   237 Constructing a CFsObject derived type or calling its Open() member function 
   238 adds a reference to that object by adding one to the reference count; calling 
   239 its Close() member function removes a reference by subtracting one from the 
   240 reference count; when the last user of the object calls Close(), the reference 
   241 count becomes zero and the object is automatically destroyed.
   242 */
   243 class CFsObject : public CBase
   244 
   245 	{
   246 public:
   247 	IMPORT_C CFsObject();
   248 	IMPORT_C virtual TInt Open();
   249 	IMPORT_C virtual void Close();
   250 	IMPORT_C TInt SetName(const TDesC* aName);
   251 	IMPORT_C TName Name() const;
   252 	IMPORT_C virtual TBool IsCorrectThread();
   253 	inline CFsObjectCon* Container() const;
   254 protected:
   255 	void DoClose();
   256 	TInt UniqueID() const;
   257 	inline TInt Inc();
   258 	inline TInt Dec();
   259 	IMPORT_C ~CFsObject();
   260 private:
   261 	TInt iAccessCount;
   262 	CFsObjectCon* iContainer;
   263 	HBufC* iName;   
   264 friend class CFsObjectCon;
   265 friend class CFsObjectIx;
   266 	};
   267 
   268 
   269 
   270 
   271 class CFsRequest;
   272 class CFsInternalRequest;
   273 
   274 /**
   275 Implements a request dispatcher.
   276  
   277 Base class for file server resources.
   278 for example subsessions that are opened, such as RFile etc, that need closing are closed by 
   279 issuing a subsession close request, handled by this object.
   280 
   281 @publishedPartner
   282 @released
   283 */
   284 class CFsDispatchObject : public CFsObject
   285 	{
   286 public:
   287 	CFsDispatchObject();
   288 	/**
   289 	Returns the drive number.
   290 	@return Drive number.
   291 	*/
   292 	TInt DriveNumber() const {return(iDriveNumber);}
   293 	IMPORT_C void Close();
   294 	IMPORT_C virtual TBool IsCorrectThread();
   295 protected:
   296 	void DoInitL(TInt aDrvNumber);
   297 	void Dispatch();
   298 	~CFsDispatchObject();
   299 private:
   300 	CFsInternalRequest* iRequest;
   301 	TInt iDriveNumber;
   302 friend class TFsCloseObject;
   303 friend class CFileShare;	// needed to override the close operation so that the file cache can be flushed on a close
   304 	};
   305 
   306 
   307 
   308 
   309 /**
   310 Notifier class must be unique to each thread so one per drive or threaded plugin should be used
   311 allocated in the file system. No longer global
   312 
   313 @publishedPartner
   314 @released
   315 */
   316 NONSHARABLE_CLASS(CAsyncNotifier) : public CBase
   317 	{
   318 public:
   319 	IMPORT_C static CAsyncNotifier* New();
   320 	IMPORT_C ~CAsyncNotifier();
   321 	IMPORT_C TInt Notify(const TDesC& aLine1,const TDesC& aLine2,const TDesC& aButton1,const TDesC& aButton2,TInt& aButtonVal);
   322 	inline void SetMount(CMountCB* aMount) { iMount = aMount; };
   323 protected:
   324 	CAsyncNotifier();
   325 	TInt Connect(); 
   326 private:
   327 	RNotifier iNotifier;
   328 	CMountCB* iMount;
   329 	};
   330 
   331 
   332 
   333 
   334 class CProxyDriveFactory;
   335 
   336 /**
   337 @publishedPartner
   338 @released
   339 
   340 Structure containing information related to a single drive extension.
   341 */
   342 struct TExtensionInfo
   343 	{
   344 	TBool iIsPrimary;            	///< Is the primary drive extension for a given drive  
   345 	CProxyDriveFactory* iFactory;  	///< Pointer to the drive extension's object factory
   346 	};
   347 
   348 
   349 
   350 
   351 /**
   352 @publishedPartner
   353 @released
   354 
   355 Represents information related to the Drive extension(s) in use for a given drive.
   356 */
   357 struct TDriveExtInfo
   358 	{
   359 	TDriveExtInfo();
   360 	
   361 	TInt iCount; 								///< Number of drive extensions in use                               
   362 
   363 	TExtensionInfo iInfo[KMaxExtensionCount]; 	///< Drive extension related information    
   364 	};
   365 
   366 
   367 
   368 
   369 /**
   370 @publishedPartner
   371 @released
   372 
   373 Represents a drive in the file server.
   374 
   375 Note that drives may act as substitutes for paths on other drives,
   376 in which case any access to this drive letter will be translated into
   377 a reference to the assigned path. In this way drives can act as short
   378 cuts to paths on other drives.
   379 */
   380 class TDrive
   381 	{
   382 public:
   383 	TDrive();
   384 	void CreateL(TInt aDriveNumber);
   385 	TInt CheckMount();
   386 	TInt CheckMountAndEntryName(const TDesC& aName);
   387     TInt FinaliseMount();
   388     TInt FinaliseMount(TInt aOperation, TAny* aParam1=NULL, TAny* aParam2=NULL);
   389     TInt MountControl(TInt aLevel, TInt aOption, TAny* aParam);
   390     void MountFileSystem(TBool aForceMount, TUint32 aFsNameHash = 0);
   391     void FlushCachedFileInfoL();
   392 	TInt FlushCachedFileInfo(TBool aPurgeCache = EFalse);
   393 	void PurgeDirty(CMountCB& aMount);
   394 	void DriveInfo(TDriveInfo& anInfo);
   395 	TInt Volume(TVolumeInfo& aVolume);
   396 	TInt SetVolume(const TDesC& aName);
   397 	TInt MkDir(const TDesC& aName);
   398 	TInt RmDir(const TDesC& aName);
   399 	TInt Delete(const TDesC& aName);
   400 	TInt Rename(const TDesC& anOldName,const TDesC& aNewName);
   401 	TInt Replace(const TDesC& anOldName,const TDesC& aNewName);
   402 	TInt Entry(const TDesC& aName,TEntry& anEntry);
   403 	TInt SetEntry(const TDesC& aName,const TTime& aTime,TUint aMask,TUint aVal);
   404 	TInt FileTemp(CFsRequest* aRequest,TInt& aHandle,const TDesC& aPath,TDes& aName,TUint aMode);
   405 	TInt FileOpen(CFsRequest* aRequest,TInt& aHandle,const TDesC& aName,TUint aMode,TFileOpen anOpen);
   406 	TInt DirOpen(CSessionFs* aSession,TInt& aHandle,const TDesC& aName,TUint anAtt,const TUidType& aUidType);
   407     CFormatCB* FormatOpenL(CFsRequest* aRequest, TInt& aFmtHandle, TFormatMode aFmtMode, const TLDFormatInfo*  apLDFormatInfo, const TVolFormatParam*  apVolFormatParam);
   408 	
   409     TInt CheckDisk(); 
   410     TInt CheckDisk(TInt aOperation, TAny* aParam1=NULL, TAny* aParam2=NULL);
   411 	
   412     TInt ScanDrive(); 
   413 	TInt ScanDrive(TInt aOperation, TAny* aParam1=NULL, TAny* aParam2=NULL);
   414 
   415     TInt ReadFileSection(const TDesC& aName,TInt aPos,TAny* aTrg,TInt aLength,const RMessagePtr2& aMessage);
   416     TInt ReadFileSection64(const TDesC& aName,TInt64 aPos,TAny* aTrg,TInt aLength,const RMessagePtr2& aMessage);
   417 	TInt GetShortName(const TDesC& aLongName,TDes& aShortName);
   418 	TInt GetLongName(const TDesC& aShortName,TDes& aLongName);
   419 	TInt IsFileOpen(const TDesC& aFileName,CFileCB*& aFileCB);
   420 	TInt IsFileInRom(const TDesC& aFileName,TUint8*& aFileStart);
   421 	TInt LockDevice(TMediaPassword& aOld,TMediaPassword& aNew,TBool aStore);
   422 	TInt UnlockDevice(TMediaPassword& aPassword,TBool aStore);
   423 	TInt ClearDevicePassword(TMediaPassword& aPassword);
   424 	TInt EraseDevicePassword();
   425 	TInt FreeDiskSpace(TInt64& aFreeDiskSpace);
   426 	TInt ForceRemountDrive(const TDesC8* aMountInfo,TInt aMountInfoMessageHandle,TUint aFlags);
   427 	TBool IsWriteProtected();
   428 	TInt MountExtension(CProxyDriveFactory* aFactory,TBool aIsPrimary);
   429 	TInt DismountExtension(CProxyDriveFactory* aFactory,TBool aIsPrimary);
   430 	TInt ExtensionName(TDes& aExtensionName,TInt aPos);
   431 	TInt ControlIO(const RMessagePtr2& aMessage,TInt aCommand,TAny* aParam1,TAny* aParam2);	
   432 	void SetAtt(TUint aValue);
   433 	IMPORT_C TUint Att();
   434 	IMPORT_C TBool GetNotifyUser();		
   435 	IMPORT_C void Dismount();		
   436 	IMPORT_C TBool IsWriteableResource() const;	
   437 	IMPORT_C TBool IsCurrentWriteFunction() const; 
   438 	inline TInt GetReason() const;	
   439 	inline void SetChanged(TBool aValue);	
   440 	inline TBool IsChanged() const;
   441 	inline TInt DriveNumber() const;
   442 	inline TBool IsMounted() const;
   443 	inline TBool IsLocal()	const;			
   444 	inline TBool IsRom()	const;			
   445 	inline TBool IsRemovable()	const;		
   446 	inline TBool IsSubsted() 	const;		
   447 	inline CMountCB& CurrentMount() const;
   448 	inline  TBool IsCurrentMount(CMountCB& aMount) const;
   449 	inline TDrive& SubstedDrive() const;
   450 	inline void SetSubstedDrive(TDrive* aDrive);
   451 	inline HBufC& Subst() const;
   452 	inline void SetSubst(HBufC* aSubst);
   453 	inline CFsObjectCon& Mount() const;	
   454 	inline CFileSystem& FSys();			
   455 	inline CFileSystem*& GetFSys();
   456 	inline TDriveExtInfo& ExtInfo();	
   457 	inline void SetNotifyOn();			
   458 	inline void SetNotifyOff();	
   459 	inline TInt ReservedSpace() const;
   460 	inline void SetReservedSpace(const TInt aReservedSpace);
   461 	
   462     inline void SetRugged(TBool aIsRugged);
   463 	inline TBool IsRugged() const;
   464     
   465     inline TBool IsSynchronous() const;
   466     inline void SetSynchronous(TBool aIsSynch);
   467 
   468 	TInt DismountProxyDrive();
   469     TInt ForceUnmountFileSystemForFormatting();
   470 
   471 public:
   472 	void DismountLock();
   473 	TInt DismountUnlock();
   474 	TInt DismountLocked() const;
   475 	void SetDismountDeferred(TBool aPending);
   476 	void ForceDismount();
   477 	TInt ActiveMounts() const;
   478 	void ReactivateMounts();
   479 	TInt ClampFile(const TDesC& aName,TAny* aHandle);
   480 	TInt UnclampFile(CMountCB* aMount, RFileClamp* aHandle);
   481 	TInt ClampsOnDrive();
   482 	inline TBool DismountDeferred() const;
   483 	TInt DeferredDismount();
   484 #if defined(_DEBUG) || defined(_DEBUG_RELEASE)
   485 	TInt ClearDeferredDismount();
   486 #endif
   487 	void SetClampFlag(TBool aClamped);
   488 	TBool ClampFlag();
   489 	inline void Lock();
   490 	inline void UnLock();
   491     void MultiSlotDriveCheck();	
   492     
   493     TInt RequestFreeSpaceOnMount(TUint64 aFreeSpaceRequired);
   494     TInt MountedVolumeSize(TUint64& aSize);
   495 
   496 	TBool ReMount(CMountCB& aMount);
   497 
   498 private:
   499 
   500     void DoMountFileSystemL(CMountCB*& apMount, TBool aForceMount, TUint32 aFsNameHash);
   501 
   502     void SetVolumeL(const TDesC& aName,HBufC*& aBuf);
   503 	void DirOpenL(CSessionFs* aSession,TInt& aHandle,const TDesC& aName,TUint anAtt,const TUidType& aUidType,CDirCB*& aDir);
   504 	void FileOpenL(CFsRequest* aRequest,TInt& aHandle,const TDesC& aName,TUint aMode,TFileOpen anOpen,CFileCB*& aFileCB,CFileShare*& aFileShare);
   505 	TInt CheckMountAndEntryNames(const TDesC& anOldName,const TDesC& aNewName);
   506 	CFileCB* LocateFileByPath(const TDesC& aPath);
   507 	TInt CheckDirectories(const TDesC& anOldName,const TDesC& aNewName);
   508 	void DoEntryL(const TDesC& aName,TEntry& anEntry);
   509 	void ReadSectionL(const TDesC& aName,TInt64 aPos,TAny* aTrg,TInt aLength,const RMessagePtr2& aMessage);
   510 	TInt ValidateShare(CFileCB& aFile,TShare aReqShare);
   511 	TInt CheckAttributes(const TDesC& aName,TUint& aSetAttMask,TUint& aClearAttMask);
   512 	TBool IsExtensionMounted(CProxyDriveFactory* aFactory);
   513 	CFileCB* LocateFile(const TDesC& aName);
   514 	CFileCache* LocateClosedFile(const TDesC& aName, TBool aResurrect = ETrue);
   515 	TBool ReMount();
   516 	IMPORT_C TBool IsDriveThread() const;
   517 	IMPORT_C TBool IsMainThread() const;
   518 	IMPORT_C void DriveFault(TBool aDriveError) const;
   519     void DoDismount();
   520     void DoCompleteDismountNotify(TInt aCompletionCode);
   521 
   522 private:
   523 	
   524     //-- intrinsic TDrive flags. Used in iDriveFlags.
   525     enum 
   526 	    { 
   527         ENotifyOff       = 0x01, 
   528         EDismountDeferred= 0x02,
   529         ENotRugged       = 0x04, 
   530         EClampPresent    = 0x08,
   531         EDriveIsSynch    = 0x10, //-- is set on mount when the drive is synchronous (doesn't have its own thread)
   532 		};	
   533 
   534 private:
   535 	TInt            iDriveNumber;
   536 	TUint           iAtt;
   537 	TBool           iChanged;
   538 	TInt            iReason;
   539 	TInt            iMountNumber;
   540 	CFileSystem*    iFSys;
   541 	CMountCB*       iCurrentMount;
   542 	TDrive*         iSubstedDrive;
   543 	HBufC*          iSubst;
   544 	CFsObjectCon*   iMount;
   545 	RFastLock       iLock;
   546 	TDriveExtInfo   iExtInfo;	
   547 	TInt            iDriveFlags;   ///< intrinsic TDrive flags
   548 	TInt            iReservedSpace;
   549 	TInt            iDismountLock;
   550 	TInt            iMountFailures;		// number of times the mount has failed
   551 	TInt            iLastMountError;
   552 
   553 	TInt iSpare1;			
   554 	TInt iSpare2;
   555 
   556 	
   557 	friend class LocalDrives;			// for access to iChanged flag
   558 	friend class CExtNotifyMediaChange; // for access to iChanged flag
   559 	};
   560 
   561 class CFileCB;
   562 class CDirCB;
   563 
   564 __ASSERT_COMPILE(sizeof(TVolFormatParam) != sizeof(TLDFormatInfo));
   565 
   566 
   567 
   568 /**
   569 @publishedPartner
   570 @released
   571 
   572 A file server interface class representing a mount.
   573 
   574 An instance of this object is referred to as a mount control block.
   575 
   576 A mount control block needs to be created for a specific volume (partition) on
   577 a drive in order to be able to access that volume. Volumes may be permanent
   578 or represent removable media. Note that removable media may also be mounted directly onto
   579 a device with no drive. Volumes can be formatted, unlike drives.
   580 
   581 The volume represented is either a currently mounted volume in the system or,
   582 in the case of removable volumes, a volume that has been removed but still has
   583 subsession objects open.
   584 
   585 A plug-in file system implements this class.
   586 */
   587 class CMountCB : public CFsDispatchObject
   588 	{
   589 public:
   590 	IMPORT_C CMountCB();
   591 	IMPORT_C ~CMountCB();
   592 	IMPORT_C TBool operator!=(const CMountCB& aMount) const;
   593 	IMPORT_C TBool MatchEntryAtt(TUint anAtt,TUint aMatt) const;
   594 	IMPORT_C void SetDiskSpaceChange(TInt64 aFreeDiskSpace);
   595     IMPORT_C void InitL(TDrive& aDrive, CFileSystem* apFileSystem);
   596 
   597     inline TDrive& Drive() const;
   598 	inline void SetDrive(TDrive* aDrive);
   599 	inline HBufC& VolumeName() const; 
   600 	inline void SetVolumeName(HBufC* aName);
   601 	inline TBool GetNotifyUser() const;
   602 	inline void SetNotifyOn();
   603 	inline void SetNotifyOff();
   604 	inline void IncLock();
   605 	inline void DecLock();
   606 	inline TInt LockStatus() const; 
   607 	inline TBool IsCurrentMount() const; 
   608 	inline TBool Locked() const;
   609 	inline TInt64 Size() const; 
   610 	inline TInt LocalDrive(TBusLocalDrive*& aLocalDrive);
   611 	inline TInt ProxyDrive(CProxyDrive*& aProxyDrive);
   612 	inline TInt LocalBufferSupport(CFileCB* aFile = NULL);
   613 	inline TInt AddToCompositeMount(TInt aMountIndex);
   614 	
   615 // Pure virtual
   616 
   617     /**
   618     Attempts to set the mount control block properties using
   619     the current mount (i.e. volume) on the associated drive.
   620 
   621     The function should set the volume name (iVolumeName),
   622     the unique ID (iUniqueID) and the volume size (iSize)
   623     by reading and processing the current mount.
   624 
   625     When aForceMount is set to ETrue, the properties of a corrupt volume should
   626     be forcibly stored. The classic case of when this is desirable is when
   627     a corrupt volume needs to be formatted.
   628 
   629     The function should leave, on error detection, with an appropriate error code.
   630 
   631     @param aForceMount Indicates whether the properties of a corrupt
   632                        volume should be stored.
   633                        
   634     @leave KErrCorrupt The properties of the current mount on the drive were
   635            not successfully mounted due to corruption of volume information,
   636            assuming that aForceMount is not set.
   637     */
   638 	virtual void MountL(TBool aForceMount) =0;
   639 
   640 
   641     /**
   642     Checks whether the mount control block represents the current mount on
   643     the associated drive.
   644 
   645     The function should read mount information from the current volume,
   646     and check it against the mount information from this mount - typically
   647     iVolumeName and iUniqueID. If the mount information matches, the function
   648     should return KErrNone, otherwise it should return KErrGeneral.
   649 
   650     Called by the associated TDrive object when the drive has no current mounts,
   651     which is the case on first access to the drive and following a volume
   652     change on a drive associated with removable media. In this circumstance,
   653     this function is called systematically on every mount control block owned
   654     by the drive. If ReMount() calls for all existing mount
   655     control blocks fail, the drive creates a new mount control block and calls
   656     CMountCB::MountL() on that object; the new object is added to the list of
   657     mount control blocks owned by the drive.
   658 
   659     @return KErrNone if the mount represented by this object is found to be
   660             the current mount;
   661             KErrGeneral if this object is found not to represent
   662             the current mount;
   663             otherwise one of the other sytem wide error codes.
   664     */
   665 	virtual TInt ReMount() =0;
   666 
   667 
   668     /**
   669     Carries out any clean-up necessary for a volume dismount. 
   670 
   671     Dismounting a volume will always succeed, so the function does not need
   672     to return an error value. Any cached information should be discarded and no
   673     attempt should be made to access the volume. For removable media it may be
   674     that the media has already been removed. This function is called when
   675     a media change is detected.
   676     */
   677 	virtual void Dismounted() =0;
   678 
   679 
   680     /**
   681     Gets volume information.
   682 
   683     The only information that the function has to supply is the free space,
   684     TVolumeInfo::iFree, since the remaining members have already been set by
   685     the calling function.
   686 
   687     The function should leave, on error detection, with
   688     an appropriate error code.
   689 
   690     @param aVolume On return, a reference to the filled volume
   691                    information object.
   692     */
   693 	virtual void VolumeL(TVolumeInfo& aVolume) const =0;
   694 
   695 
   696     /**
   697     Sets the volume name for the mount, thus writing the new volume name
   698     to the corresponding volume.
   699 
   700     This function should leave on error detection.
   701 
   702     @param aName A reference to a descriptor containing the new volume name.
   703 
   704     @leave KErrBadName If the specified volume name is longer than the maximum
   705            allowed length for a volume name
   706     */
   707 	virtual void SetVolumeL(TDes& aName) =0;
   708 
   709 
   710     /**
   711     Creates a new directory on the mount.
   712 
   713     The directory to be created is identified through its full name in aName.
   714     The full name is in the form:
   715     @code
   716     \\dirA\\dirB\\dirC\\dirD
   717     @endcode
   718     where dirD is the new directory to be created in \\dirA\\dirB\\dirC\\.
   719     This means that dirC is the leaf directory in which dirD will be created.
   720 
   721     The function should leave, on error detection, with an appropriate
   722     error code.
   723 
   724     @param aName A reference to a descriptor containing the full name of
   725                  the directory to be created.
   726                  
   727     @leave  KErrPathNotFound Part of the path in aName does not exist.
   728     @leave  KErrAlreadyExists dirD already exists in \\dirA\\dirB\\dirC\\
   729     @leave  KErrAccessDenied dirD already exists but is not a directory.
   730     @leave  KErrDirFull There is no room in \\dirA\\dirB\\dirC\\ for the new entry,
   731             which is especially applicable to the root directory.
   732     */
   733 	virtual void MkDirL(const TDesC& aName) =0;
   734 
   735 
   736     /**
   737     Removes the directory specified by aName (its full name) from the volume.
   738 
   739     The directory specified by aName is in the form:
   740     @code
   741     \\dirA\\dirB\\dirC\\dirD
   742     @endcode
   743     where dirD is the directory to be removed from \\dirA\\dirB\\dirC\\.
   744     This means that dirC is the leaf directory from which dirD should be removed.
   745 
   746     The function can assume that the directory exists and is not read-only. 
   747 
   748     The function should leave with a suitable error code if it cannot complete
   749     successfully for any reason. 
   750     
   751     @param aName A reference to a descriptor containing the full name of
   752                  the directory to be removed.
   753     
   754     @leave KErrInUse dirD contains entries other than the parent (..)
   755            and current (.) entries.
   756     */
   757 	virtual void RmDirL(const TDesC& aName) =0;
   758 
   759 
   760     /**
   761     Deletes the specified file from the mount.
   762 
   763     The function can assume that the file is closed.
   764 
   765     The file name specified by aName is of the form:
   766     @code
   767     \\dirA\\dirB\\dirC\\file.ext
   768     @endcode
   769     
   770     The extension is optional.
   771 
   772     The function should leave on error detection, with
   773     an appropriate error code.
   774 
   775 	@param aName A reference to a descriptor containing the full path name
   776 	             of the file that will be removed.
   777 	
   778 	@leave KErrAccessDenied aName specifies a file whose attributes state that
   779 	       the file is read-only or aName specifies a directory.
   780     */
   781 	virtual void DeleteL(const TDesC& aName) =0;
   782 
   783 
   784     /**
   785     Renames or moves a single file or directory on the mount.
   786 
   787     It can be used to move a file or directory since both
   788     anOldName and anNewName specify the respective entries with full names;
   789     for example,
   790     @code
   791     \\dirA\\dirB\\dirC\\oldEntryName
   792     @endcode
   793     
   794     and
   795     
   796     @code
   797     \\dirE\\dirF\\dirG\\newEntryName
   798     @endcode
   799 
   800     If oldEntryName is a file, it can be assumed that it is closed.
   801     If oldEntryName is a directory, it can be assumed that there are no
   802     open files in this directory. Furthermore, if newEntryName specifies
   803     a directory, it can be assumed that it is not a subdirectory of oldEntryName.
   804 
   805     The function should leave with an appropriate error code if it cannot
   806     complete successfully for any reason. 
   807 
   808 	@param anOldName A reference to a descriptor containing the full entry
   809 	                 name of the entry to be renamed.
   810 
   811 	@param anNewName A reference to a descriptor containing the new full entry
   812 	                 name for the entry to be renamed.
   813  
   814     @leave KErrAlreadyExists The new entry already exists.
   815     */
   816 	virtual void RenameL(const TDesC& anOldName,const TDesC& anNewName) =0;
   817 
   818 
   819     /**
   820     Replaces one file on the mount with another.
   821 
   822     The function can assume that both anOldName and, if it exists, anNewName
   823     contain the full file names of files, and that these files are not open.
   824 
   825     If the file aNewName does not exist it should be created.
   826 
   827     The file anOldName should have its contents, attributes, and the universal
   828     date and time of its last modification, copied to the file aNewName,
   829     overwriting any existing contents and attribute details.
   830     Finally anOldName should be deleted.
   831 
   832     The function should leave with an appropriate error code if it cannot
   833     complete successfully for any reason.
   834 
   835     @param anOldName A reference to a descriptor containing the full file name
   836                      of the file to replace the file specified by anNewName
   837     @param anNewName A reference to a descriptor containing the new full file
   838                      name for the entry to be replaced.
   839     */
   840 	virtual void ReplaceL(const TDesC& anOldName,const TDesC& anNewName) =0;
   841 
   842 
   843     /**
   844     Gets the entry details for the specified file or directory.
   845 
   846     anEntry should be filled with details from the file or directory with the
   847     full name aName. aName is of the form
   848     @code
   849     \\dirA\\dirB\\dirC\\entry.
   850     @endcode
   851     
   852     Note that anEntry.iType (the entry UID) should only be set for a file whose
   853     size is greater than or equal to sizeof(TCheckedUid).
   854 
   855     The function should leave with an appropriate error code if it cannot
   856     complete successfully for any reason.
   857 
   858     @param aName   A reference to a descriptor containing the full name of
   859                    the entry whose details are required.
   860     @param anEntry On return, a reference to the filled entry object.
   861     
   862     @leave KErrPathNotFound The entry, aName, cannot be found.
   863     */
   864 	virtual void EntryL(const TDesC& aName,TEntry& anEntry) const =0;
   865 
   866 
   867     /**
   868     Sets entry details for a specified file or directory.
   869 
   870     The entry identfied by the full name descriptor aName should have
   871     its modification time and its attributes mask updated as required.
   872 
   873     The entry receives a new universal modified time from aTime.
   874     The entry attributes are set with aSetAttMask and cleared
   875     with aClearAttMask:
   876     the bits that are set in aSetAttMask should be set
   877     in the entry attribute mask;
   878     the bits that are set in aClearAttMask
   879     should be cleared from the entry attribute mask.
   880 
   881     The function can assume that aSetAttMask and aClearAttMask do not change
   882     the type of attribute (i.e. volume or directory). Furthermore, if aName
   883     specifies a file, it can be assumed that this file is closed.
   884 
   885     The function should leave with an appropriate error code on error detection.
   886     
   887     @param aName         A reference to a descriptor containing the full name of
   888                          the entry to be updated.
   889     @param aTime         A reference to the time object holding the new universal
   890                          modified time for aName.
   891     @param aSetAttMask   Attribute mask for setting the entry's attributes.
   892     @param aClearAttMask Attribute mask for clearing the entry's attributes.
   893     */
   894 	virtual void SetEntryL(const TDesC& aName,const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask) =0;
   895 
   896 
   897     /**
   898     Customises the opening of a new or existing file on the mount.
   899 
   900     The function is called internally (via TDrive::FileOpen()) as a result of
   901     a call by the client, and the file is created, if necessary, and opened by
   902     the calling function. However this function implements any replacement
   903     functionality, as well as any other behaviour particular to the file system.
   904 
   905     If anOpen specifies EFileReplace (rather than EFileCreate or EFileOpen) then,
   906     if replacement functionality is required, the data contained in the file
   907     should be discarded, the archive attribute should be set, and the size of
   908     the file should be set to zero. Note that it can be assumed that if anOpen
   909     specifies EFileReplace then the file already exists.
   910 
   911     After successful completion of the function, the file control block pointer
   912     will be added to the file server's global files container.
   913 
   914     The function should leave with a suitable error code if it cannot be completed
   915     successfully.
   916 
   917     @param aName  The full name of the file that will be opened.
   918     @param aMode  The file share mode. The following share modes are available:
   919                   EFileShareExclusive;
   920                   EFileShareReadersOnly;
   921                   EFileShareAny;
   922                   EFileShareReadersOrWriters;
   923                   EFileStream;
   924                   EFileStreamText;
   925                   EFileRead;
   926                   EFileWrite.
   927     @param anOpen IndicatES how the file will be opened. It can be one of
   928                   the following:
   929                   EFileOpen;
   930                   EFileCreate;
   931                   EFileReplace.
   932     @param aFile  Pointer to the file control block which will, on success,
   933                   represent the open file.
   934                   
   935     @leave KErrAccessDenied aName may specify a directory, or the function may
   936            be attempting to open a file on a ROM drive.
   937     */
   938 	virtual void FileOpenL(const TDesC& aName,TUint aMode,TFileOpen anOpen,CFileCB* aFile) =0;
   939 
   940 
   941     /**
   942     Customises the opening of a directory on the mount.
   943 
   944     The function is called internally, and the directory will have been created
   945     and initialised by the calling function. Any customisation specific to
   946     a file system should be implemented in this function.
   947 
   948     Note that aName is of the form
   949     @code
   950     \\dirA\\dirB\\dirC\\file.ext
   951     @endcode
   952     
   953     where \\dirA\\dirB\\dirC\\ is the directory to be opened and file.ext is
   954     an optional entry name and extension.
   955 
   956     After successful completion of the function, the directory control block
   957     pointer will be added to the file server global directories container.
   958 
   959     The function should leave with a suitable error code if it cannot complete
   960     successfully for any reason.
   961 
   962     @param aName A reference to a descriptor containing the full name of
   963                  the directory that will be opened.
   964     @param aDir  Points to a directory control block which will, on success,
   965                  represent the open directory.
   966     */
   967 	virtual void DirOpenL(const TDesC& aName,CDirCB* aDir) =0;
   968 
   969 
   970     /**
   971     Reads the specified length of data from the specified position on
   972     the volume directly into the client thread.
   973 
   974     It can be assumed that if this function is called,
   975     then there has been a successful mount.
   976 
   977     This function should leave with an appropriate error code when
   978     an error is detected.
   979 
   980     @param aPos     Start position in the volume for the read operation,
   981                     in bytes.
   982     @param aLength  The number of bytes to be read.
   983     @param aTrg     A pointer to the buffer into which data is to be read.
   984     @param anOffset The offset at which to start adding data to the read buffer.
   985     @param aMessage
   986     */
   987 	virtual void RawReadL(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt anOffset,const RMessagePtr2& aMessage) const = 0;
   988 
   989 
   990     /**
   991     Writes a specified length of data from the client thread to the volume
   992     at the specified position.
   993 
   994     It can be assumed that if this function is called, then there has been
   995     a successful mount.
   996 
   997     This function should leave with an appropriate error code when
   998     an error is detected.
   999 
  1000     @param aPos     Start position in the volume for the write operation,
  1001                     in bytes.
  1002     @param aLength  The number of bytes to be written.
  1003     @param aSrc     Pointer to the buffer from which data will be written.
  1004     @param anOffset The offset in the buffer at which to start writing data.
  1005     @param aMessage
  1006     */
  1007 	virtual void RawWriteL(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt anOffset,const RMessagePtr2& aMessage) = 0;
  1008 
  1009 
  1010     /**
  1011     Gets the short name of the file or directory with the given full name.
  1012 
  1013     This function is used in circumstances where a file system mangles
  1014     Symbian OS natural names, in order to be able to store them on
  1015     a file system that is not entirely compatible.
  1016 
  1017     The function should leave with a suitable error code if it cannot complete
  1018     successfully for any reason.
  1019 
  1020 	@param aLongName  A reference to a descriptor containing the full name
  1021 	                  of the entry.
  1022 	@param aShortName On return, a reference to a descriptor containing
  1023 	                  the short name of the entry.
  1024     
  1025     @leave KErrNotFound The entry specified by its long name cannot be found.
  1026     */
  1027 	virtual void GetShortNameL(const TDesC& aLongName,TDes& aShortName) = 0;
  1028 
  1029 
  1030     /**
  1031     Gets the long name of the file or directory associated with
  1032     the given short name.
  1033 
  1034     This function is used in circumstances where a file system mangles
  1035     Symbian OS natural names in order to be able to store them on
  1036     a file system that is not entirely compatible. 
  1037 
  1038     The function should leave with a suitable error code if it cannot complete
  1039     successfully for any reason.
  1040 
  1041 	@param aShorName  A reference to a descriptor containing the short name
  1042 	                  of the entry.
  1043 
  1044     @param aLongName  On return, a reference to a descriptor containing
  1045                       the long name of the entry.
  1046 
  1047     @leave KErrNotFound The entry specified by its short name cannot be found.
  1048     */
  1049 	virtual void GetLongNameL(const TDesC& aShorName,TDes& aLongName) = 0;
  1050 
  1051 
  1052     /**
  1053     Reads a specified section of the file, regardless of the file's lock state.
  1054 
  1055     The function should leave with a suitable error code if it cannot complete
  1056     successfully for any reason.
  1057     
  1058     @param aName   A reference to a descriptor containing the full name of
  1059                    the file to be read from
  1060     @param aPos    The byte position to start reading from.
  1061     @param aTrg    A pointer to the buffer into which data is to be read.
  1062     @param aLength The length of data to be read, in bytes.
  1063     @param aMessage
  1064 
  1065 	@leave KErrEof aPos is past the end of the file.
  1066     */
  1067 	virtual void ReadSectionL(const TDesC& aName,TInt aPos,TAny* aTrg,TInt aLength,const RMessagePtr2& aMessage)=0;
  1068 
  1069 
  1070     /**
  1071     Checks the integrity of the file system on the volume and returns an appropriate error value. 
  1072     The default implementation must be overridden by a derived class.
  1073     
  1074     @return KErrNone if the file system is stable; otherwise one of the other system wide error codes.
  1075             The default implementation returns KErrNotSupported.
  1076     */
  1077     virtual TInt CheckDisk() {return(KErrNotSupported);}
  1078     
  1079     /**
  1080     The same as original CheckDisk(), but with some parameters.
  1081     */
  1082     virtual TInt CheckDisk(TInt aOperation, TAny* aParam1=NULL, TAny* aParam2=NULL);
  1083 
  1084 	
  1085 	/**
  1086     Scans through and corrects errors found in the volume.
  1087 
  1088     The default implementation must be overridden by a derived class.
  1089     
  1090     @return KErrNone if no errors are found or all errors are corrected; otherwise one of the other system wide error codes.
  1091             The default implementation returns KErrNotSupported.
  1092     */
  1093 	virtual TInt ScanDrive() {return(KErrNotSupported);}
  1094 
  1095     /**
  1096     The same as original ScanDrive(), but with some parameters.
  1097     */
  1098     virtual TInt ScanDrive(TInt aOperation, TAny* aParam1=NULL, TAny* aParam2=NULL);
  1099     
  1100     IMPORT_C virtual void IsFileInRom(const TDesC& aFileName,TUint8*& aFileStart);
  1101 	
  1102 	
  1103 	/**
  1104         Low-level control IO
  1105     */
  1106 	virtual TInt ControlIO( const RMessagePtr2& /*aMessage*/,TInt /*aCommand*/,TAny* /*aParam1*/,TAny* /*aParam2*/)  {return(KErrNotSupported);}
  1107 
  1108 
  1109 	/**
  1110 	Locks a media which supports password protection and replaces
  1111 	the old password with a new one. 
  1112 
  1113     If aStore is set to ETrue, then the new password should be saved to
  1114     the password store file, KMediaPWrdFile, using the exported file server
  1115     function WriteToDisk(). 
  1116 
  1117     The password file is used to initialise the password store on boot up,
  1118     so the user does not need to be prompted for the password again if
  1119     it is saved here.
  1120 
  1121     The default implementation must be overridden in a derived class.
  1122 
  1123     @param aOld   A reference to the old password.
  1124     @param aNew   A reference to the new password.
  1125     @param aStore ETrue if the new password is to be saved to 
  1126                   the password file store; EFalse if not.
  1127 
  1128     @return KErrNone if successful; otherwise another of the system wide
  1129             error codes. The default implementation returns KErrNotSupported.
  1130     */
  1131 	virtual TInt Lock(TMediaPassword& /*aOld*/,TMediaPassword& /*aNew*/,TBool /*aStore*/) {return(KErrNotSupported);}
  1132 
  1133 
  1134 	/**
  1135 	Unlocks a media which supports password protection.
  1136 
  1137     If aStore is set to ETrue then the password should be saved to
  1138     the password store file specified by KMediaPWrdFile using the exported file
  1139     server function WriteToDisk().
  1140 
  1141     The password file is used to initialise the password store on boot up,
  1142     so the user does not need to be prompted for the password again if
  1143     it is saved here.
  1144 
  1145     The default implementation must be overridden in a derived class.
  1146 
  1147     @param aPassword A reference to the password.
  1148     @param aStore    ETrue if the password is to be saved to
  1149                      the password store file; EFalse otherwise.
  1150                      
  1151     @return KErrNone if successful; otherwise another of the system wide
  1152             error codes. The default implementation returns KErrNotSupported.                     
  1153     */
  1154 	virtual TInt Unlock(TMediaPassword& /*aPassword*/,TBool /*aStore*/) {return(KErrNotSupported);}
  1155 
  1156 
  1157 	/**
  1158 	Clears a password from a media that supports write protection. 
  1159 
  1160     The default implementation must be overridden in a derived class.
  1161 
  1162     @param aPassword A reference to the password to be cleared.
  1163 
  1164     @return KErrNone if successful; otherwise another of the system wide
  1165             error codes. The default implementation returns KErrNotSupported.
  1166     */
  1167 	virtual TInt ClearPassword(TMediaPassword& /*aPassword*/) {return(KErrNotSupported);}
  1168 
  1169 
  1170 	/**
  1171     */
  1172 	virtual TInt ForceRemountDrive(const TDesC8* /*aMountInfo*/,TInt /*aMountInfoMessageHandle*/,TUint /*aFlags*/) {return(KErrNotSupported);}
  1173 
  1174     
  1175     /**
  1176         Legacy method: finalise the mount and put it to the consistent state.
  1177     */
  1178 	virtual void FinaliseMountL() {return;}
  1179     
  1180     /** 
  1181         finalise the mount and put it to the consistent state.
  1182 
  1183         @param  aOperation  describes finalisation operation, see RFs::TFinaliseDrvMode
  1184         @param  aParam1     not used, for future expansion
  1185         @param  aParam2     not used, for future expansion
  1186    */
  1187     virtual	void FinaliseMountL(TInt aOperation, TAny* aParam1=NULL, TAny* aParam2=NULL);
  1188     
  1189     
  1190     protected:
  1191     /** Mount Control levels or operations to perform */
  1192     enum TMntCtlLevel 
  1193         {
  1194         //-- reserved generic mount (CMountCB) control codes
  1195         
  1196         EMountStateQuery,       ///< query mount state, see TMntCtlOption, ESQ_IsMountFinalised
  1197         EMountVolParamQuery,    ///< mount-specific queries for volume parameters. See ESQ_RequestFreeSpace, ESQ_GetCurrentFreeSpace 
  1198         ECheckFsMountable,      ///< extended mount functionality, checks if this file system can be mounted on specified drive. See CheckFileSystemMountable()
  1199         
  1200         //-- starting from the next code someone may define some specific mount type control codes, like ESpecificMountCtl+17
  1201         ESpecificMountCtl = 0x40000000,
  1202 
  1203         //-- starting from the next code someone may define some specific File System control codes
  1204         ESpecificFsCtl = 0x40001000,
  1205         
  1206         EMountFsParamQuery,     ///< File System parameters queries; File System properties can be "static" i.e not requiring properly mounted volume. See ESpecificFsCtlOpt
  1207 
  1208         };
  1209 
  1210     /** Mount Control options that makes sense only for certain control codes, see TMntCtlLevel */
  1211     enum TMntCtlOption
  1212         {
  1213         //-- reserved generic mount (CMountCB) control options codes
  1214         
  1215         /** query if the mount is finalised, corresponds to the EMountStateQuery control code only. @see IsMountFinalised() */
  1216         ESQ_IsMountFinalised, 
  1217 
  1218         //-----------------------------------------------------------------------------------------------------------------------------
  1219         
  1220         //-- starting from the next code someone may define some specific mount type control options
  1221         ESpecificMountCtlOpt = 0x40000000,
  1222 
  1223         /** Corresponds to EMountVolParamQuery. Request a certain amount of free space on the volume. @see RequestFreeSpace() */
  1224         ESQ_RequestFreeSpace,
  1225         
  1226         /** Corresponds to EMountVolParamQuery. A request to obtain the _current_ amount of free space on the volume asynchronously, without blocking. */
  1227         ESQ_GetCurrentFreeSpace,
  1228         
  1229         /** Corresponds to EMountVolParamQuery. A request to obtain size of the mounted volume without blocking (CMountCB::VolumeL() can block). */
  1230         ESQ_MountedVolumeSize,
  1231 
  1232         //-----------------------------------------------------------------------------------------------------------------------------
  1233         
  1234         //-- starting from the next code someone may define some specific File System control options
  1235         ESpecificFsCtlOpt = 0x40001000,
  1236 
  1237         /** Get Maximum file size, which is supported by the file system that has produced this mount. */
  1238         ESQ_GetMaxSupportedFileSize, 
  1239 
  1240         };
  1241 
  1242     
  1243     public:
  1244     
  1245     /**
  1246         Generic mount control method.
  1247         @param  aLevel  specifies the operation to perfrom on the mount
  1248         @param  aOption specific option for the given operation
  1249         @param  aParam  pointer to generic parameter, its meaning depends on aLevel and aOption
  1250 
  1251         @return standard error code. Default imlementation returns KErrNotSupported
  1252     */
  1253     virtual	TInt MountControl(TInt aLevel, TInt aOption, TAny* aParam);
  1254 
  1255 
  1256 	/**
  1257 	Erase a password from a media that supports write protection. 
  1258 
  1259     The default implementation must be overridden in a derived class.
  1260 
  1261     @return KErrNone if successful; otherwise another of the system wide
  1262             error codes. The default implementation returns KErrNotSupported.
  1263     */
  1264 	virtual TInt ErasePassword() {return(KErrNotSupported);}
  1265 
  1266 	/** 
  1267 	An interface class which may optionally be returned by a file system
  1268 	by calling GetInterface(EFileAccessor, ...)
  1269 	*/
  1270 	class MFileAccessor
  1271 		{
  1272 	public:
  1273 		virtual TInt GetFileUniqueId(const TDesC& aName, TInt64& aUniqueId) = 0;
  1274 		virtual TInt Spare3(TInt aVal, TAny* aPtr1, TAny* aPtr2) = 0;
  1275 		virtual TInt Spare2(TInt aVal, TAny* aPtr1, TAny* aPtr2) = 0;
  1276 		virtual TInt Spare1(TInt aVal, TAny* aPtr1, TAny* aPtr2) = 0;
  1277 		};
  1278 
  1279 	/**
  1280 	@prototype
  1281 
  1282 	CMountCB::MFileExtendedInterface interface provides extended interface for CMountCB to 
  1283 	read a specified section of large file (size greater than 2GB - 1). 
  1284 
  1285 	The interface could be retrieved by calling CMountCB::GetInterface() with 
  1286 	EFileExtendedInterface as an argument.
  1287 
  1288 	Sub classes of CMountCB who does support large file access will need to multiple-inherit 
  1289 	with this class and implement the interface. The implementation of the interface will be 
  1290 	retrieved via GetInterface() and provided to user by non-virtual APIs to avoid breaking
  1291 	binary compatibility.
  1292 
  1293 	NOTE: Do not try to delete CMountCB::MFileExtendedInterface interface pointer!
  1294 
  1295 	@see CMountCB::GetInterface()
  1296 	*/
  1297 
  1298 	class MFileExtendedInterface
  1299 		{
  1300 	public:
  1301 		/**
  1302 	    Reads a specified section of the file, regardless of the file's lock state.
  1303 	    
  1304 	    The function should leave with a suitable error code if it cannot complete
  1305 	    successfully for any reason.
  1306 	    
  1307 		This function should be implemented in file systems supporting files 
  1308 		of size greater than 2GB - 1.
  1309 		
  1310 	    @param aName   A reference to a descriptor containing the full name of
  1311 	                   the file to be read from
  1312 	    @param aPos    The byte position to start reading from.
  1313 	    @param aTrg    A pointer to the buffer into which data is to be read.
  1314 	    @param aLength The length of data to be read, in bytes.
  1315 	    @param aMessage
  1316 
  1317 		@leave KErrEof aPos is past the end of the file.
  1318 		
  1319 		@see CMountCB::ReadSectionL()
  1320 		*/
  1321 		virtual void ReadSection64L(const TDesC& aName, TInt64 aPos, TAny* aTrg, TInt aLength, const RMessagePtr2& aMessage) = 0;
  1322 		};
  1323 	
  1324 	/**
  1325 	Enumeration of the aInterfaceIDs used in GetInterface.
  1326 	*/
  1327 	enum TInterfaceIds
  1328 		{
  1329 		EAddFsToCompositeMount = 0,
  1330 		EGetLocalDrive = 1,
  1331 		EFileAccessor = 2,
  1332 		EGetFileSystemSubType = 3,
  1333 		EGetClusterSize = 4,
  1334 		ELocalBufferSupport = 5,
  1335 		EAddToCompositeMount = 6,
  1336 		EGetProxyDrive = 7,
  1337 		EFileExtendedInterface = 8
  1338 		};
  1339 
  1340 	// File clamping support
  1341 	TInt ClampFile(const TInt aDriveNo,const TDesC& aName,TAny* aHandle);
  1342 	TInt UnclampFile(RFileClamp* aHandle);
  1343 	IMPORT_C TInt IsFileClamped(const TInt64 aUniqueId);
  1344 	TInt NoOfClamps();
  1345 
  1346 	// File accessor support
  1347 	TInt GetFileUniqueId(const TDesC& aName, TInt64& aUniqueId);
  1348 	TInt Spare3(TInt aVal, TAny* aPtr1, TAny* aPtr2);
  1349 	TInt Spare2(TInt aVal, TAny* aPtr1, TAny* aPtr2);
  1350 	TInt Spare1(TInt aVal, TAny* aPtr1, TAny* aPtr2);
  1351 
  1352 	// Extensions of interface
  1353 	TInt FileSystemSubType(TDes& aName);
  1354 	TInt FileSystemClusterSize();
  1355 	void FileSystemName(TDes& aName);
  1356 
  1357 	// Large file support 
  1358 	void ReadSection64L(const TDesC& aName,TInt64 aPos,TAny* aTrg,TInt aLength,const RMessagePtr2& aMessage);
  1359 
  1360     inline TInt CheckFileSystemMountable();
  1361     inline TInt RequestFreeSpace(TUint64 &aFreeSpaceBytes);
  1362     inline TInt MountedVolumeSize(TUint64& aVolSizeBytes);
  1363     inline TInt GetCurrentFreeSpaceAvailable(TInt64 &aFreeSpaceBytes);
  1364     inline TInt IsMountFinalised(TBool &aFinalised);
  1365     inline TInt GetMaxSupportedFileSize(TUint64 &aSize);
  1366 	
  1367 protected:
  1368 	inline void SetMountNumber(TInt aMountNumber);
  1369 	inline void SetDismounted(TBool aDismounted=ETrue);
  1370 	inline TInt MountNumber() const;
  1371 	inline TBool IsDismounted() const;
  1372 
  1373 	void SetProxyDriveDismounted();
  1374 	TBool ProxyDriveDismounted();
  1375 
  1376     IMPORT_C CFileSystem* FileSystem() const;
  1377 
  1378 	/**
  1379 	Return a pointer to a specified interface extension - to allow future extension of this class without breaking
  1380 	binary compatibility.
  1381 	@param aInterfaceId Interface identifier of the interface to be retrieved.
  1382 	@param aInterface A reference to a pointer that retrieves the specified interface.
  1383 	@param aInput An arbitrary input argument.
  1384 	@return KErrNone If the interface is supported, KErrNotSupported otherwise.
  1385 	*/	
  1386 	IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
  1387 	
  1388 	// calls GetInterface() with tracepoints added
  1389 	TInt GetInterfaceTraced(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
  1390 
  1391 
  1392     
  1393 
  1394 private:
  1395     void SetFileSystem(CFileSystem* aFS);
  1396 
  1397     //-- these factory methods mus be used to produce objects representing files, directories etc. as soon as all these objects are
  1398     //-- associated with the mount, not the file sytem (file system is a factory for corresponding mounts)
  1399     //-- corresponding CFileSystem:: methods must not be used. 
  1400     //-- CMountCB has a reference to the CFileSystem that produced it. 
  1401     CFileCB* NewFileL() const;
  1402     CDirCB* NewDirL() const;
  1403     CFormatCB* NewFormatL() const;
  1404 
  1405 protected:
  1406 
  1407 	TInt iMountNumber;  ///< Unique mount number set by the TDrive object representing the drive on which the object resides.
  1408 	TUint iUniqueID;    ///< volume Unique ID. Set in MountL().
  1409 	TInt64 iSize;       ///< Size of the volume. First set in MountL().
  1410 
  1411     /**
  1412     A list of all open files on that mount.
  1413     Set by the TDrive object representing the drive of which the mount resides.
  1414     */
  1415 	TDblQue<CFileCB> iMountQ;
  1416 	
  1417     friend class TDrive;
  1418 	friend class TFsAddCompositeMount;
  1419 
  1420 private:
  1421 	TInt        iLockMount;
  1422 	TDrive*     iDrive;
  1423 	HBufC*      iVolumeName;
  1424 	CMountBody* iBody;          ///< used for extending CMountCB functionality
  1425 	};
  1426 
  1427 
  1428 /**
  1429 @internalTechnology
  1430 
  1431 MFileSystemSubType interface provides extended interface for CMountCB to retrieve sub type
  1432 of mounted file systems.
  1433 
  1434 The interface could be retrieved by calling CMountCB::GetInterface() with EGetFileSystemSubType
  1435 as an argument.
  1436 
  1437 If the file system does not support sub types, MFileSystemSubType cannot be retieved.
  1438 Sub classes of CMountCB who does support sub types will need to multiple-inherit with
  1439 this class and implement the interface. The implementation of the interface will be 
  1440 retrieved via GetInterface() and provided to user by non-virtual APIs to avoid breaking
  1441 binary compatibility.
  1442 
  1443 NOTE: Do not try to delete MFileSystemSubType interface pointer!
  1444 
  1445 @see CMountCB::GetInterface()
  1446 */
  1447 class MFileSystemSubType
  1448 	{
  1449 public:
  1450 	/**
  1451 	Retrieves file system's sub type name (E.g. FAT16), if the file system does not have sub 
  1452 	types (E.g. Rofs), return the file system's name.
  1453 	@param aName Returned descriptor contains file system name or sub type name.
  1454 	@return KErrNone if successful. 
  1455 	*/
  1456 	virtual TInt SubType(TDes& aName) const = 0;
  1457 	};
  1458 
  1459 /**
  1460 @internalTechnology
  1461 
  1462 MFileSystemClusterSize interface provides extended interface for CMountCB to retrieve cluster size
  1463 of mounted file systems.
  1464 
  1465 The interface could be retrieved by calling CMountCB::GetInterface() with EGetClusterSize
  1466 as an argument.
  1467 
  1468 If the file system does not support clustering, MFileSystemClusterSize cannot be retieved.
  1469 Sub classes of CMountCB who does support clustering will need to multiple-inherit with
  1470 this class and implement the interface. The implementation of the interface will be 
  1471 retrieved via GetInterface() and provided to user by non-virtual APIs to avoid breaking
  1472 binary compatibility.
  1473 
  1474 NOTE: Do not try to delete MFileSystemSubType interface pointer!
  1475 
  1476 @see CMountCB::GetInterface()
  1477 */
  1478 class MFileSystemClusterSize
  1479 	{
  1480 public:
  1481 	/**
  1482 	Retrieves file system's cluster size
  1483 	@return None-zero cluster size if successful.
  1484 	*/
  1485 	virtual TInt ClusterSize() const = 0;
  1486 	};
  1487 
  1488 
  1489 class CFileShare;
  1490 
  1491 
  1492 
  1493 /**
  1494 @internalTechnology
  1495 */
  1496 class TAsyncReadRequest
  1497 	{
  1498 public:
  1499 	TAsyncReadRequest(TInt64 aEndPos, CFileShare* aOwningShareP, CFsRequest* aRequestP);
  1500 	TBool CompleteIfMatching(CFileShare* aOwningShareP, TRequestStatus* aStatusP, TInt aError);
  1501 private:
  1502 	TAsyncReadRequest();
  1503 public:
  1504 	TInt64 iEndPos;					// The request is completed file length >= iEndPos.
  1505 	CFileShare* iOwningShareP;		// The share that owns this outstanding request.
  1506 	const TRequestStatus* iStatusP;	// Used to identify the request when cancelling.
  1507 	CSessionFs* iSessionP;			// The owning session of the original request.
  1508 	RMessage2 iMessage;				// The message to be completed when data is available.
  1509 	};
  1510 
  1511 
  1512 /**
  1513     @internalTechnology
  1514     @released
  1515 
  1516     File share lock
  1517 
  1518     The lock specifies the lowest and highest position in the file to be locked.
  1519     Note that files may have many locks on it, but overlapping sections cannot be locked.
  1520     This is used by a file control block, a CFileCB object.
  1521 
  1522     @see CFileCB
  1523 */
  1524 class TFileShareLock
  1525 	{
  1526 public:
  1527     TFileShareLock(const CFileShare* aOwner, TUint64 aPosLow, TUint64 aPosHigh);
  1528 
  1529    
  1530     inline TUint64  PosLow()  const; 
  1531     inline TUint64  PosHigh() const; 
  1532     inline TBool MatchOwner(const CFileShare* aShare) const;
  1533 
  1534     TBool MatchByPos(TUint64 aPosLow, TUint64 aPosHigh) const;
  1535 
  1536 private:
  1537     TFileShareLock();
  1538     TFileShareLock(const TFileShareLock&);
  1539     TFileShareLock& operator=(const TFileShareLock&);
  1540 
  1541 private:
  1542 
  1543 	const CFileShare* iOwner;   ///<The owning file share object.
  1544 	TUint64 iPosLow;            ///<The start of the section of the file to be locked.
  1545 	TUint64 iPosHigh;           ///<The end of the section of the file to be locked.
  1546 
  1547     friend class CFileCB;	
  1548     };
  1549 
  1550 /** @internalTechnology */
  1551 typedef RArray<TFileShareLock> TFileLocksArray;
  1552 
  1553 
  1554 /**
  1555 @publishedPartner
  1556 @released
  1557 
  1558 A file server interface class representing an open file.
  1559 
  1560 An instance of this object is referred to as a file control block.
  1561 
  1562 A file control block needs to be created for a specific file to be able to
  1563 access that file within a directory.
  1564 
  1565 A plug-in file system implements this class.
  1566 */
  1567 class CFileCB : public CFsDispatchObject
  1568 	{
  1569 public:
  1570 	IMPORT_C CFileCB();
  1571 	IMPORT_C ~CFileCB();
  1572 	
  1573     IMPORT_C void InitL(TDrive* aDrive,TDrive* aCreatedDrive, HBufC* aName);
  1574 	
  1575     inline void SetMount(CMountCB * aMount);
  1576 	inline TDrive& Drive() const;
  1577 	inline TDrive& CreatedDrive() const;
  1578 	inline CMountCB& Mount() const;
  1579 	inline HBufC& FileName() const;
  1580 	inline HBufC& FileNameF() const;
  1581     inline TInt UniqueID() const;
  1582 	TInt FindLock(TInt aPosLow,TInt aPosHigh);
  1583 	TInt AddLock(CFileShare* aFileShare,TInt aPos,TInt aLength);
  1584 	TInt RemoveLock(CFileShare* aFileShare,TInt aPos,TInt aLength);
  1585 	TInt CheckLock(CFileShare* aFileShare,TInt aPos,TInt aLength);
  1586 	void RemoveLocks(CFileShare* aFileShare);
  1587 	inline TShare Share() const;
  1588 	inline void SetShare(TShare aShare);
  1589 	inline TInt Size() const;
  1590 	inline void SetSize(TInt aSize);
  1591 	inline TInt Att() const;
  1592 	inline void SetAtt(TInt aAtt);
  1593 	inline TTime Modified() const;
  1594 	inline void SetModified(TTime aModified);
  1595 	inline TBool FileCorrupt() const;
  1596 	inline void SetFileCorrupt(TBool aFileCorrupt);
  1597 	inline TBool BadPower() const; 
  1598 	inline void SetBadPower(TBool aBadPower);
  1599 	inline TUint32 NameHash() const;
  1600 	TInt CheckMount();
  1601 	inline TInt BlockMap(SBlockMapInfo& aInfo, TInt64& aStartPos, TInt64 aEndPos=-1);
  1602 	inline TInt LocalDrive(TBusLocalDrive*& aLocalDrive);
  1603 
  1604 	TBool LocalBufferSupport() const;
  1605 	void SetLocalBufferSupport(TBool aEnabled);
  1606 
  1607 	/** File caching support methods */
  1608 
  1609 	CFileCache* FileCache() const;
  1610 	TInt FairSchedulingLen() const;
  1611 	void ResetReadAhead();
  1612 
  1613 	void SetDeleteOnClose();
  1614 	TBool DeleteOnClose() const;
  1615  
  1616 	
  1617 
  1618 	void SetNotifyAsyncReadersPending(TBool aNotifyAsyncReadersPending);
  1619 	TBool NotifyAsyncReadersPending() const;
  1620 	TInt CancelAsyncReadRequest(CFileShare* aShareP, TRequestStatus* aStatusP);
  1621 
  1622 	/** Extended API support methods */
  1623 
  1624 	TBool ExtendedFileInterfaceSupported();
  1625 	void ReadL(TInt64 aPos,TInt& aLength,TDes8* aDes,const RMessagePtr2& aMessage, TInt aOffset);
  1626 	void WriteL(TInt64 aPos,TInt& aLength,const TDesC8* aDes,const RMessagePtr2& aMessage, TInt aOffset);
  1627 	void SetSizeL(TInt64 aSize);
  1628 
  1629 	IMPORT_C TInt64 Size64() const;
  1630 	IMPORT_C void SetSize64(TInt64 aSize, TBool aDriveLocked);
  1631     IMPORT_C void SetMaxSupportedSize(TUint64 aMaxFileSize);
  1632 
  1633 
  1634     TInt64 CachedSize64() const;
  1635 	void SetCachedSize64(TInt64 aSize);
  1636 	TInt FindLock64(TInt64 aPosLow,TInt64 aPosHigh);
  1637 	TInt AddLock64(CFileShare* aFileShare,TInt64 aPos,TInt64 aLength);
  1638 	TInt RemoveLock64(CFileShare* aFileShare,TInt64 aPos,TInt64 aLength);
  1639 	TInt CheckLock64(CFileShare* aFileShare,TInt64 aPos,TInt64 aLength);
  1640 
  1641     /**
  1642     Renames the file with the full file name provided.
  1643 
  1644     Because the full name of the file includes the path, the function can
  1645     also be used to move the file.
  1646 
  1647     It can be assumed that no other sub-session has access to the file:
  1648     i.e. the file has not been opened in EFileShareAny share mode.
  1649     It can also be assumed that the file has been opened for writing. 
  1650 
  1651     The function should leave with KErrAlreadyExists if aNewName already exists.
  1652     An appropriate error code should also be generated if the function leaves
  1653     before completion for any other reason.
  1654 
  1655 	@param aNewName The new full name of the file.
  1656 	
  1657 	@see CFileCB::iFileName
  1658     */
  1659 	virtual void RenameL(const TDesC& aNewName) =0;
  1660 	
  1661 	
  1662     /**
  1663     Reads a specified number of bytes from the open file starting at
  1664     the specified postition, and writes the result into a descriptor.
  1665 
  1666     It can be assumed that aPos is inside the file and aLength > 0.
  1667     The file should only be read up to its end regardless of
  1668     the value of aPos + aLength. The number of bytes read should be stored
  1669     in aLength on return.
  1670 
  1671     If the function leaves before completion for any reason it should generate
  1672     an appropriate error code, and in this situation,
  1673     the arguments are not valid on return.
  1674 
  1675 	@param aPos     Represents a position relative to the start of the file
  1676 	                where ReadL() should start to read.
  1677 	@param aLength  On entry, specifies the number of bytes to be read
  1678 	                from the file. On return, this should contain the number
  1679 	                of bytes read, but this is not valid if the function leaves.
  1680 	@param aDes     Pointer to a descriptor into which the data should be written.
  1681 	@param aMessage
  1682     */
  1683     virtual void ReadL(TInt aPos,TInt& aLength,const TAny* aDes,const RMessagePtr2& aMessage) =0;
  1684 	
  1685 	
  1686     /**
  1687     Writes data to the open file.
  1688 
  1689     iModified and iSize are set by the file server after this function
  1690     has completed successfully.
  1691 
  1692     It can be assumed that aPos is within the file range and aLength > 0.
  1693     When aPos + aLength is greater than the file size then the file should
  1694     be enlarged using SetSizeL(). The number of bytes written should be
  1695     returned through the argument aLength. 
  1696 
  1697     If the function leaves before completion for any reason it should generate
  1698     an appropriate error code, and in this situation the arguments are
  1699     not valid on return.
  1700 
  1701    	@param aPos     Represents a position relative to the start of the file
  1702    	                where WriteL() should start to write.
  1703 	@param aLength  Specifies the number of bytes to be written to the file.
  1704 	                On return, the number of bytes written, but this is not
  1705 	                valid if the function leaves.
  1706 	@param aDes     Pointer to a descriptor containing the data to be written
  1707 	                to the file.
  1708 	@param aMessage 
  1709 	
  1710 	@see CFileCB::iModified
  1711 	@see CFileCB::iSize
  1712 	@see CFileCB::SetSizeL
  1713 	
  1714     @leave KErrDiskFull The operation cannot be completed because the disk is full.
  1715     */
  1716 	virtual void WriteL(TInt aPos,TInt& aLength,const TAny* aDes,const RMessagePtr2& aMessage) =0;
  1717 	
  1718 	
  1719     /**
  1720     Extends or truncates the file by re-setting the file size.
  1721 
  1722     The function should not change iModified and iSize attributes of
  1723     the file object: this is done by the file server.
  1724     If the file is extended, nothing should be written in the extended area.
  1725 
  1726     The function should leave with a suitable error code on error detection.
  1727 
  1728     @param aSize The new file size in number of bytes.
  1729     
  1730     @leave KErrDiskFull The operation cannot be completed because the disk is full.
  1731     
  1732     @see CFileCB::iModified
  1733 	@see CFileCB::iSize
  1734     */
  1735 	virtual void SetSizeL(TInt aSize) =0;
  1736 	
  1737 	
  1738     /**
  1739     Sets the attribute mask, iAtt, and the modified time of the file, iModified.
  1740 
  1741     If aMask|aVal does not equal zero, then aMask should be OR'ed with iAtt,
  1742     whilst the inverse of aVal should be AND'ed with iAtt.
  1743     If the modified flag is set in aMask then iModified should be set to aTime.
  1744 
  1745     The function should leave with a suitable error code on error detection.
  1746 
  1747 	@param aTime The new modified time, if the modified flag is set in aMask.
  1748 	@param aMask Bit mask containing bits set (to 1) that are to be set (to 1)
  1749 	             in iAtt.
  1750 	@param aVal  Bitmask containing bits set (to 1) that are to be unset (to 0)
  1751 	             in iAtt.
  1752 	
  1753     @see CFileCB::iModified
  1754 	@see CFileCB::iAtt
  1755     */
  1756     virtual void SetEntryL(const TTime& aTime,TUint aMask,TUint aVal) =0;
  1757 	
  1758 	
  1759     /**
  1760     Flushes, to disk, the cached information necessary for the integrity
  1761     of recently written data, such as the file size.
  1762 
  1763     The function should leave with a suitable error code on error detection.
  1764     */
  1765 	virtual void FlushDataL() =0;
  1766 	
  1767 	
  1768     /**
  1769     Flushes, to disk, all cached file data (e.g. attributes, modification time,
  1770     file size). 
  1771 
  1772     The modified bit in the file attributes mask should be cleared if
  1773     the flush was successful.
  1774 
  1775     The function should leave with a suitable error code on error detection.
  1776     */
  1777 	virtual void FlushAllL() =0;
  1778 	IMPORT_C virtual TInt Address(TInt& aPos) const;
  1779 	IMPORT_C void SetArchiveAttribute();
  1780 
  1781 	/**
  1782 	Block Map API interface 
  1783 	*/
  1784 	class MBlockMapInterface
  1785 		{
  1786 	public:
  1787 		virtual TInt BlockMap(SBlockMapInfo& aInfo, TInt64& aStartPos, TInt64 aEndPos)=0;
  1788 		};
  1789 		
  1790 	/** 
  1791 	An interface class which may optionally be returned by a file system
  1792 	by calling GetInterface(EExtendedFileInterface, ...)
  1793 	The purpose of this interface is twofold:
  1794 	- to support fair scheduling (by use of the aOffset parameter)
  1795 	- to enable large file support
  1796 	*/
  1797 	class MExtendedFileInterface
  1798 		{
  1799 	public:
  1800 		/** 
  1801 		Functionally equivalent to CFileCB::ReadL(), but supports large files and fair scheduling
  1802 
  1803 		Reads a specified number of bytes from the open file starting at
  1804 		the specified postition, and writes the result into a descriptor.
  1805 
  1806 		@param aPos     Represents a position relative to the start of the file
  1807 						where ReadL() should start to read. 
  1808 						Note that the filesystem may not support positions above KMaxTInt,
  1809 						in which case it leaves with KErrNotSupported.
  1810 		@param aLength  On entry, specifies the number of bytes to be read
  1811 						from the file. On return, this contains the number
  1812 						of bytes read, this value is not valid if the function leaves.
  1813 		@param aDes     Pointer to a descriptor into which the data is written.
  1814 		@param aMessage A reference to a client message or an RLocalMessage.
  1815 		@param aOffset	The offset into the descriptor where the data is to be written.
  1816 						This is non-zero if the read was fair-scheduled
  1817 						
  1818 		@see CFileCB::ReadL		
  1819 		@see RLocalMessage				
  1820 		*/
  1821 		virtual void ReadL(TInt64 aPos,TInt& aLength,TDes8* aDes,const RMessagePtr2& aMessage, TInt aOffset) = 0;
  1822 		
  1823 		/** 
  1824 		Functionally equivalent to CFileCB::WriteL(), but supports large files and fair scheduling
  1825 
  1826 	    Writes data to the open file.
  1827 
  1828    		@param aPos     Represents a position relative to the start of the file
  1829    						where WriteL() starts to write.
  1830 						Note that the filesystem may not support positions above KMaxTInt,
  1831 						in which case it leaves with KErrNotSupported.
  1832 		@param aLength  Specifies the number of bytes to be written to the file.
  1833 						On return this is the number of bytes written, this value is not
  1834 						valid if the function leaves.
  1835 		@param aDes     Pointer to a descriptor containing the data to be written
  1836 						to the file.
  1837 		@param aMessage A reference to a client message or an RLocalMessage
  1838 		@param aOffset	The offset into the descriptor where the data is to be read from.
  1839 						This is non-zero if the read was fair-scheduled
  1840 						
  1841 		@see CFileCB::WriteL
  1842 		@see RLocalMessage						
  1843 		*/
  1844 		virtual void WriteL(TInt64 aPos,TInt& aLength,const TDesC8* aDes,const RMessagePtr2& aMessage, TInt aOffset) = 0;
  1845 
  1846 		/** 
  1847 		Functionally equivalent to CFileCB::SetSizeL(), but supports large files
  1848 
  1849 		Extends or truncates the file by re-setting the file size.
  1850 
  1851 		The function does not change the iModified and iSize attributes of
  1852 		the file object: this is done by the file server.
  1853 		If the file is extended, nothing is written in the extended area.
  1854 
  1855 		The function leaves with a suitable error code when an error is to detected.
  1856 
  1857 		@param aSize The new file size in bytes.
  1858     
  1859 		@leave KErrDiskFull The operation cannot be completed because the disk is full.
  1860     		
  1861     	@see CFileCB::SetSizeL
  1862 		@see CFileCB::iModified
  1863 		@see CFileCB::iSize
  1864 		*/
  1865 		virtual void SetSizeL(TInt64 aSize) = 0;
  1866 		};
  1867 
  1868 
  1869 protected:
  1870 	
  1871 	/**
  1872 	Return a pointer to a specified interface extension - to allow future extension of this class without breaking
  1873 	binary compatibility.
  1874 	@param aInterfaceId Interface identifier of the interface to be retrieved.
  1875 	@param aInterface A reference to a pointer that retrieves the specified interface.
  1876 	@param aInput An arbitrary input argument.
  1877 	@return KErrNone If the interface is supported, KErrNotSupported otherwise.
  1878 	*/	
  1879 	IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
  1880 
  1881 	// calls GetInterface() with tracepoints added
  1882 	TInt GetInterfaceTraced(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
  1883 
  1884 
  1885    	enum TInterfaceIds
  1886    		{
  1887 		EBlockMapInterface = 0,
  1888 		EGetLocalDrive = 1,
  1889 		EExtendedFileInterface
  1890    		};
  1891 
  1892     TUint64 MaxSupportedSize(void) const;
  1893 
  1894     
  1895     inline TFileLocksArray& FileLocks(); 
  1896 
  1897 
  1898 
  1899 private:
  1900 
  1901 	void DemoteShare(CFileShare* aFileShare);
  1902 	void PromoteShare(CFileShare* aFileShare);
  1903 
  1904 	RArray<TAsyncReadRequest>& AsyncReadRequests();
  1905 	TInt AddAsyncReadRequest(CFileShare* aFileShareP, TInt64 aPos, TInt aLength, CFsRequest* aRequestP);
  1906 	void NotifyAsyncReaders();
  1907 
  1908 protected:
  1909 
  1910     /**
  1911     Inititally, the mode that the file was opened with, which defines the level
  1912     of access allowed to the file. Set by the TDrive object
  1913     (representing the drive on which the file resides) when the file
  1914     control block is created.
  1915     */
  1916 	TShare iShare;
  1917 
  1918 
  1919     /**
  1920     The size of the file. This is the low 32 bit part of the file size.
  1921     The upper 32 bit part of the file size is saved on the file server side 
  1922     for File Systems supporting file size > 4GB - 1.
  1923     File Systems supporting file size > 4GB - 1 shall use CFileCB::Size64() 
  1924     to query the file size and CFileCB::SetSize64() to set file size. 
  1925     */
  1926     TInt iSize;
  1927 
  1928 
  1929     /**
  1930     The attributes of the file.
  1931     */
  1932 	TInt iAtt;
  1933 
  1934 
  1935     /**
  1936     The universal time at which the file was last modified.
  1937     */
  1938 	TTime iModified;
  1939 
  1940 
  1941     /**
  1942     Indicates whether the file that the object represents is corrupt:
  1943     true if it is corrupt, false otherwise.
  1944     */
  1945 	TBool iFileCorrupt;
  1946 
  1947 
  1948     /**
  1949     Indicates whether a recent access to the file that the object represents
  1950     failed due to KErrBadPower.
  1951     */
  1952 	TBool iBadPower;
  1953 
  1954 public:
  1955 
  1956 	/**
  1957 	The full name of the file, including drive and extensions.
  1958 	*/
  1959 	HBufC* iFileName;
  1960 
  1961 	/**
  1962 	The full name of the file, including drive and extensions - Folded.
  1963 	*/
  1964 	HBufC* iFileNameF;
  1965 
  1966 private:
  1967 	TUint32	            iNameHash;
  1968 	TDrive*             iCreatedDrive;
  1969 	TDrive*             iDrive;
  1970 	CMountCB*           iMount;
  1971 	TFileLocksArray*    iFileLocks; ///< an array of file position locks
  1972 	TDblQueLink         iMountLink;
  1973 	
  1974 private:
  1975 	CFileBody* iBody;
  1976 
  1977 	friend class TDrive;
  1978 	friend class CMountCB;
  1979 	friend class CFileShare;
  1980 	friend class TFsFileRead;
  1981 	friend class TFsFileWrite;
  1982 	friend class TFsFileSetSize;
  1983 	friend class TFsFileReadCancel;
  1984 	friend class TFsFileDuplicate;
  1985 	friend class TFsFileRename;
  1986 	friend class CCompFileCB;
  1987 	friend class CFileCache;
  1988 	};
  1989 
  1990 
  1991 /**
  1992 Helper class to construct a dummy RMessage2 object. This allows the file server to 
  1993 read and write local buffers to a file system's CFileCB-derived interface.
  1994 
  1995 @internalTechnology
  1996 */
  1997 class RLocalMessage : public RMessage2
  1998 	{
  1999 public:
  2000 	inline RLocalMessage();
  2001 
  2002 	inline void InitHandle();
  2003 	inline void SetFunction(TInt aFunction);
  2004 	inline void SetArgs(TIpcArgs& aArgs);
  2005 	inline TInt Arg(TInt aIndex) const;
  2006 	};
  2007 
  2008 
  2009 /**
  2010 @publishedPartner
  2011 @released
  2012 
  2013 A file server interface class representing an open file that is being shared.
  2014 For example multiple reading of the same file.
  2015 
  2016 @see CFileCB
  2017 @see TFileMode
  2018 */
  2019 NONSHARABLE_CLASS(CFileShare) : public CFsDispatchObject
  2020 	{
  2021 public:
  2022 	CFileShare(CFileCB* aFileCB);
  2023 	~CFileShare();
  2024 	TInt CheckMount();
  2025 	void InitL();
  2026 	inline CFileCB& File();
  2027 
  2028 	// For serialising aync requests 
  2029 	TBool RequestStart(CFsMessageRequest* aRequest);
  2030 	void RequestEnd(CFsMessageRequest* aRequest);
  2031 	TBool RequestInProgress() const;
  2032 	inline TBool IsFileModeBig();
  2033 	
  2034 public:
  2035 	/**
  2036 	File share mode. The mode in which the file was opened first.
  2037 	@see TFileMode.
  2038 	*/
  2039 	TUint iMode;   
  2040 	/**
  2041 	Current file position. This is the position at which reading and writing takes place.
  2042 	*/
  2043 	TInt64 iPos;
  2044 	/**
  2045 	Error condition due to flush.
  2046 	*/
  2047 	TInt iFlushError;
  2048 private:
  2049 	CFileCB* iFile;
  2050 
  2051 	// A pointer to the current request. Used for serializing client 
  2052 	// async read/write requests which might otherwise be processed out
  2053 	// of order due to fair scheduling
  2054 	CFsMessageRequest* iCurrentRequest;	
  2055 	};
  2056 
  2057 
  2058 
  2059 
  2060 /**
  2061 @publishedPartner
  2062 @released
  2063 
  2064 A file server interface class representing an open directory
  2065 
  2066 An instance of this object is referred to as a directory control block.
  2067 
  2068 A directory control block must be created for a specific directory to access
  2069 that directory within a volume.
  2070 
  2071 A plug-in file system implements this class.
  2072 */
  2073 class CDirCB : public CFsDispatchObject
  2074 	{
  2075 public:
  2076 	IMPORT_C CDirCB();
  2077 	IMPORT_C ~CDirCB();
  2078 	TInt CheckMount();
  2079 	IMPORT_C void InitL(TDrive* aDrive);
  2080 	inline void SetMount(CMountCB * aMount){iMount=aMount;};
  2081 	inline TDrive& Drive() const;
  2082 	inline CMountCB& Mount() const;
  2083 	inline TBool Pending() const; 
  2084 	inline void SetPending(TBool aPending);
  2085 	
  2086 
  2087     /**
  2088     Gets information from the first suitable entry in the directory,
  2089     starting from the current read position.
  2090 
  2091     The function should read successive entries until a suitable entry is found.
  2092     An entry is suitable if the entry attributes match the criteria set by this
  2093     object's attributes, which are set on initialisation.
  2094     For example, if the directory control block has the attribute
  2095     KEntryAttMaskSupported, and the file has the attribute KEntryAttVolume,
  2096     then the entry will be deemed unsuitable and the next entry will be read.
  2097 
  2098     This function is called by the file server.
  2099 
  2100     If, on return, the entry's full file name, TEntry::iName, is longer than
  2101     the maximum buffer size, then the entry cannot be returned to the client.
  2102     In this case the file server will set iPending to true and will call
  2103     StoreLongEntryName() before calling this function again.
  2104     In this case (when iPending is true), the function should re-read
  2105     the last entry to be read; it should also set iPending to false and
  2106     should not advance the current read position.
  2107 
  2108     The time stored in the iModified member of anEntry should not be converted,
  2109     but left as UTC time.
  2110 
  2111     When storing the iName member of anEntry, the current (.),
  2112     or parent marker (..) in the directory should not be returned.
  2113 
  2114     If the KEntryAttAllowUid flag is set in the iAtt member of anEntry, then
  2115     the entry UID type of an entry will be read. If, on reading the UID from
  2116     a file, KErrCorrupt is generated, because the file is corrupt,
  2117     ReadL() should not leave with this error message, but should return
  2118     as normal.
  2119     If any other errors are raised the function should leave.
  2120 
  2121     All of the properties of a TEntry, other than the UID types, are always read.
  2122 
  2123     ReadL() should leave with a suitable error code if it cannot complete
  2124     successfully for any reason. 
  2125 
  2126     @param anEntry Entry information object.
  2127     */
  2128 	virtual void ReadL(TEntry& anEntry) =0;
  2129 	
  2130 public:
  2131 	IMPORT_C virtual void StoreLongEntryNameL(const TDesC& aName);
  2132 	
  2133 protected:
  2134 	/**
  2135 	Return a pointer to a specified interface extension - to allow future extension of this class without breaking
  2136 	binary compatibility.
  2137 	@param aInterfaceId Interface identifier of the interface to be retrieved.
  2138 	@param aInterface A reference to a pointer that retrieves the specified interface.
  2139 	@param aInput An arbitrary input argument.
  2140 	@return KErrNone If the interface is supported, KErrNotSupported otherwise.
  2141 	*/	
  2142 	IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
  2143 	
  2144 protected:
  2145     /**
  2146     Bitmask of the attributes of interest.
  2147 
  2148     Set using the the TDrive friend class instance representing
  2149     the directory's drive after the object is made.
  2150     */
  2151 	TUint iAtt;
  2152 	
  2153 	
  2154 	/**
  2155 	Set after construction using the TDrive friend class instance representing
  2156 	the directory's drive.
  2157 	*/
  2158 	TUidType iUidType;
  2159 
  2160 
  2161     /**
  2162     Flag to indicate whether preceding entry details should be returned when
  2163     multiple entries are being read.
  2164     */
  2165 	TBool iPending;
  2166 	friend class TDrive;
  2167 private:
  2168 	TDrive* iDrive;
  2169 	CMountCB* iMount;
  2170 	TUint32 iReserved;				// Reserved for future expansion
  2171 	};
  2172 
  2173 
  2174 
  2175 
  2176 class CFormatCBBody;
  2177 
  2178 /**
  2179 @publishedPartner
  2180 @released
  2181 
  2182 A file server interface class representing a format operation on a disk.
  2183 
  2184 An instance of this object is referred to as a format control block.
  2185 
  2186 The type of format operation to be applied depends on the type of disk,
  2187 and is stored in iMode. Each format operation has a number of steps and
  2188 is kept track of using iCurrentStep.
  2189 
  2190 A format control block needs to be created for a specific mount control block
  2191 for the disk controlled via that mount to be formatted.
  2192 
  2193 A plug-in file system provides an implementation of this class.
  2194 */
  2195 
  2196 class CFormatCB : public CFsDispatchObject
  2197 	{
  2198 public:
  2199 	IMPORT_C CFormatCB();
  2200 	IMPORT_C ~CFormatCB();
  2201 	IMPORT_C TInt CheckMount();
  2202 	
  2203     void InitL(TDrive* aDrive, TFormatMode aMode);
  2204     
  2205     void SetFormatParameters(const TLDFormatInfo* apLDFormatInfo);
  2206 	TInt SetFormatParameters(const TVolFormatParam* apVolFormatParam);
  2207 
  2208 
  2209     inline TDrive& Drive() const;
  2210 	inline CMountCB& Mount()  const;
  2211 	inline TFormatMode Mode()  const; 
  2212 	inline TInt& CurrentStep();
  2213 
  2214     /**
  2215     Performs a formatting step on the drive.
  2216 
  2217     The step performed should depend on the values of iMode and iCurrentStep. 
  2218 
  2219     It can be assumed that there are no resources open on the mount,
  2220     that the media is formattable, and that the media is not write protected.
  2221 
  2222     If iMode == EQuickFormat, then only meta data is to be written.
  2223     This should be carried out in a single step, with iCurrentStep set
  2224     to zero on completion.
  2225 
  2226     If iMode != EQuickFormat, then the format step performed by
  2227     this function should depend on iCurrentStep. When the function
  2228     returns with iCurrentStep set to zero, the formatting of the drive is complete.
  2229 
  2230     On error detection, the function should leave with an appropriate error code.
  2231 
  2232     @see CFormatCB::iMode
  2233     @see CFormatCB::iCurrentStep
  2234     */
  2235 	virtual void DoFormatStepL() =0;
  2236 	
  2237 protected:
  2238 	
  2239     /** Enumeration of the aInterfaceIDs used in GetInterface */
  2240 	enum TInterfaceIds
  2241 		{
  2242 		ESetFmtParameters = 1, ///< used in implementation of SetFormatParameters(const TVolFormatParam* apVolFormatParam)
  2243 		};
  2244 
  2245 
  2246 
  2247 	/**
  2248 	Return a pointer to a specified interface extension - to allow future extension of this class without breaking
  2249 	binary compatibility.
  2250 	@param aInterfaceId Interface identifier of the interface to be retrieved.
  2251 	@param aInterface A reference to a pointer that retrieves the specified interface.
  2252 	@param aInput An arbitrary input argument.
  2253 	@return KErrNone If the interface is supported, KErrNotSupported otherwise.
  2254 	*/	
  2255 	IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
  2256 		
  2257 protected:
  2258 
  2259 	TInt                  iCurrentStep; ///< current format step counter 100...0
  2260 	TFormatMode           iMode;        ///< Format mode. This is set by the file server when this objetc is instantiated.
  2261     TSpecialFormatInfoBuf iSpecialInfo; ///< Buffer containing user-specified format parameters.
  2262 
  2263 private:
  2264 	
  2265     TDrive*         iDrive; 
  2266 	CMountCB*       iMount;  ///< parent Mount   
  2267     CFormatCBBody*  iBody;   ///< additional data holder
  2268 	};
  2269 
  2270 
  2271 
  2272 
  2273 /**
  2274 @publishedPartner
  2275 @released
  2276 
  2277 A file server interface class representing a raw disk.
  2278 
  2279 An instance of this object is referred to as a raw disk control block.
  2280 
  2281 This is not an abstract base class and does not need to be derived from
  2282 when implementing a file system. This is because direct disk access is
  2283 implemented by the file server directly calling RawReadL() and RawWriteL()
  2284 from the derived CMountCB object of the file system.
  2285 */
  2286 NONSHARABLE_CLASS(CRawDiskCB) : public CFsDispatchObject
  2287 	{
  2288 public:
  2289 	CRawDiskCB();
  2290 	~CRawDiskCB();
  2291 	void InitL(CMountCB* aMount,TBool aIsWriteProtected);
  2292 	inline CMountCB& Mount();
  2293 	inline TDrive& Drive();
  2294 	inline TBool IsWriteProtected() const;
  2295 	inline void SetChanged();
  2296 private:
  2297 	enum { EWriteProtected = 1, EChanged = 2 };
  2298 	inline void SetWriteProtected();
  2299 	inline TBool IsChanged() const;
  2300 private:
  2301 	CMountCB* iMount;
  2302 	TUint32 iFlags;
  2303 	};
  2304 
  2305 
  2306 class CFileSystemBody;
  2307 
  2308 /**
  2309 @publishedPartner
  2310 @released
  2311 
  2312 A file server interface class, representing the factory class for a file system.
  2313 
  2314 A plug-in file system implements this class.
  2315 
  2316 Creates objects derived from CMountCB, CFileCB, CDirCB and CFormatCB.
  2317 
  2318 @see CMountCB
  2319 @see CFileCB
  2320 @see CDirCB
  2321 @see CFormatCB
  2322 */
  2323 class CFileSystem : public CFsObject
  2324 	{
  2325 public:
  2326 	IMPORT_C CFileSystem();
  2327 	IMPORT_C ~CFileSystem();
  2328 	IMPORT_C virtual TInt Remove();
  2329 	IMPORT_C virtual TBool QueryVersionSupported(const TVersion& aVer) const;
  2330 	IMPORT_C virtual TBool IsExtensionSupported() const;
  2331 	IMPORT_C TBool IsProxyDriveSupported();
  2332 	IMPORT_C void SetLibrary(RLibrary aLib);
  2333 	IMPORT_C RLibrary Library() const;
  2334 // Pure virtual
  2335     
  2336 
  2337 	/**
  2338     Installs the file system.
  2339 
  2340     The function should set the name of the file system object through a call
  2341     to CObject::SetName(), thus making it accessible, internally, 
  2342     using FileSystems->FindByFullName(). This enables the file server
  2343     to find and handle installed file systems. 
  2344     The function should also set the file system version.
  2345     The version is determined by the file system implementation.
  2346     It is used in calls to CFileSystem::QueryVersionSupported().
  2347 
  2348     This function is called as a result of a call to RFs::AddFileSystem().
  2349     
  2350     @return KErrNone if succesful; otherwise one of the other  system-wide error
  2351     codes.
  2352     
  2353     @see RFs::AddFileSystem
  2354     @see CObject::SetName
  2355     @see RFs
  2356     @see CObject
  2357     */
  2358 	virtual TInt Install() =0;
  2359 	
  2360 		
  2361 	/**
  2362 	Creates a new mount control block, a CMountCB derived object. 
  2363 
  2364     On success, a pointer to the new mount object should be returned,
  2365     otherwise the function should leave.
  2366 
  2367 	@return A pointer to the new mount object.
  2368 
  2369     @see CMountCB
  2370 	*/
  2371 	virtual CMountCB* NewMountL() const =0;
  2372 	
  2373 	
  2374 	/**
  2375 	Creates a new file control block, i.e. a CFileCB derived object.
  2376 
  2377     On success, a pointer to the new file object should be returned,
  2378     otherwise the function should leave.
  2379 
  2380     @return A pointer to the new file object.
  2381     
  2382     @see CFileCB
  2383 	*/
  2384 	virtual CFileCB* NewFileL() const =0;
  2385 	
  2386 	
  2387 	/**
  2388 	Creates a new directory control block, i.e. a CDirCB derived object.
  2389 
  2390     On success, a pointer to the new directory control block should be returned,
  2391     otherwise the function should leave.
  2392 
  2393     @return A pointer to the new directory object.
  2394     
  2395     @see CDirCB
  2396 	*/
  2397 	virtual CDirCB* NewDirL() const =0;
  2398 	
  2399 	
  2400 	/**
  2401 	Creates a new volume format control block, i.e. a CFormatCB derived object.
  2402 
  2403     On success, a pointer to the new volume format control block should be returned,
  2404     otherwise the function should leave.
  2405 
  2406     @return A pointer to the new volume format object.
  2407     
  2408     @see CFormatCB
  2409 	*/
  2410 	virtual CFormatCB* NewFormatL() const =0;
  2411 	
  2412 	
  2413 	/**
  2414 	Retrieves drive information.
  2415 
  2416     The function should set anInfo.iMediaAtt and anInfo.iType according to
  2417     the specified drive number.
  2418 
  2419     Note that anInfo.iDriveAtt will already have been set by the calling
  2420     function.
  2421 
  2422     The function can obtain the necessary information by calling
  2423     the appropriate TBusLocalDrive::Caps() function using the argument aDriveNumber.
  2424 
  2425 	@param anInfo       On return, contains the drive information.
  2426 	@param aDriveNumber The drive number.
  2427 	*/
  2428 	IMPORT_C virtual void DriveInfo(TDriveInfo& anInfo,TInt aDriveNumber) const;
  2429 		
  2430     virtual TInt DefaultPath(TDes& aPath) const;
  2431 
  2432 	/** Enumeration of the aInterfaceIDs used in GetInterface.*/
  2433 	enum TInterfaceIds
  2434 		{
  2435 		EProxyDriveSupport = 0,
  2436 		EExtendedFunctionality, ///< corresponds to MFileSystemExtInterface
  2437 		};
  2438    
  2439     /** This is interface corresponds to the extended CFileSystem functionality*/
  2440     class MFileSystemExtInterface
  2441         {
  2442     public:
  2443         virtual CMountCB* NewMountExL(TDrive* apDrive, CFileSystem** apFileSystem, TBool aForceMount, TUint32 aFsNameHash) = 0;
  2444         virtual TInt GetSupportedFileSystemName(TInt aFsNumber, TDes& aFsName) const = 0;   
  2445 
  2446         };
  2447 
  2448 public:	
  2449      CMountCB* NewMountExL(TDrive* apDrive, CFileSystem** apFileSystem, TBool aForceMount, TUint32 aFsNameHash);
  2450      TInt GetSupportedFileSystemName(TInt aFsNumber, TDes& aFsName);
  2451 
  2452 
  2453 protected:	
  2454 	/**
  2455 	Return a pointer to a specified interface extension - to allow future extension of this class without breaking
  2456 	binary compatibility.
  2457 	@param aInterfaceId Interface identifier of the interface to be retrieved.
  2458 	@param aInterface A reference to a pointer that retrieves the specified interface.
  2459 	@param aInput An arbitrary input argument.
  2460 	@return KErrNone If the interface is supported, KErrNotSupported otherwise.
  2461 	*/	
  2462 	IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
  2463 	
  2464 protected:
  2465 	TVersion iVersion;
  2466 private:
  2467 	RLibrary         iLibrary;  ///< *.fsy file system plugin dll handle
  2468     CFileSystemBody* iBody;     ///< extension of this class, used to provide extended functionality w/o changing this class size (BC issue)
  2469 
  2470 friend class TDrive;
  2471 
  2472 	};
  2473 
  2474 
  2475 
  2476 
  2477 /**
  2478 @publishedPartner
  2479 @released
  2480 
  2481 Base abstract class.
  2482 Interface between a local plugin file system and a media subsystem.
  2483 
  2484 @see CLocalProxyDrive
  2485 @see CBaseExtProxyDrive
  2486 */
  2487 class CProxyDrive : public CBase	
  2488 	{
  2489 public:
  2490 	CProxyDrive(CMountCB* aMount);
  2491 	~CProxyDrive();		
  2492 	inline CMountCB* Mount() const;
  2493 	inline void SetMount(CMountCB *aMount);
  2494 // virtual
  2495 	IMPORT_C virtual TInt ControlIO(const RMessagePtr2& aMessage,TInt aCommand,TAny* aParam1,TAny* aParam2);
  2496 	IMPORT_C virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt aOffset,TInt aFlags);
  2497 	IMPORT_C virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt anOffset,TInt aFlags);
  2498 	IMPORT_C virtual TInt DeleteNotify(TInt64 aPos, TInt aLength);
  2499 	IMPORT_C virtual TInt GetLastErrorInfo(TDes8& aErrorInfo);
  2500 
  2501 	inline TInt LocalBufferSupport();
  2502 	
  2503 // pure virtual
  2504 
  2505 	/**
  2506 	Initialise the proxy drive. 
  2507 	
  2508 	Derived class must provide an implementation for it.
  2509 	
  2510 	@return KErrNone if successful, otherwise one of the system-wide error codes.
  2511 	*/
  2512 	virtual TInt Initialise()=0;
  2513 	
  2514 	/**
  2515 	It invokes Dismounted() on the proxy drive.
  2516 	
  2517 	Derived class must provide an implementation for it. 
  2518 	
  2519 	@return KErrNone if successful, otherwise one of the system-wide error codes.
  2520 	*/
  2521 	virtual TInt Dismounted()=0;
  2522 	
  2523 	/**
  2524 	Increase the size of the proxy drive by the specified length (in bytes).
  2525 	
  2526 	Derived class must provide an implementation for it. 
  2527 
  2528 	@param aLength The length (in bytes) of which the drive is to be increased by.
  2529 	
  2530 	@return KErrNone if successful, otherwise one of the system-wide error codes.
  2531 	*/
  2532 	virtual TInt Enlarge(TInt aLength)=0;
  2533 	
  2534 	/**
  2535 	Reduce the size of the proxy drive by removing the specified length
  2536 	(in bytes) starting at the specified position.
  2537 
  2538 	Derived class must provide an implementation for it.
  2539 
  2540 	@param aPos    The start position of area to be removed.
  2541 	@param aLength The length/size (in bytes) by which the drive is to be reduced.
  2542 	
  2543 	@return System-wide error codes based on the status of the operation.
  2544 	*/	
  2545 	virtual TInt ReduceSize(TInt aPos, TInt aLength)=0;
  2546 	
  2547 	/**
  2548 	Read from the proxy drive.
  2549 
  2550 	Derived class must provide an implementation for it.
  2551 
  2552 	@param aPos    The address from where the read begins.
  2553 	@param aLength The length of the read.
  2554 	@param aTrg    A descriptor of the memory buffer from which to read.
  2555 	@param aThreadHandle The handle-number representing the drive thread.
  2556 	@param aOffset Offset into aTrg to read the data from.
  2557 	
  2558 	@return System-wide error codes based on the status of the operation.
  2559 	*/
  2560 	virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt anOffset)=0;
  2561 	
  2562 	/**
  2563 	Read from the proxy drive.
  2564 
  2565 	Derived class must provide an implementation for it.
  2566 	
  2567 	@param aPos    The address from where the read begins.
  2568 	@param aLength The length of the read.
  2569 	@param aTrg    A descriptor of the memory buffer from which to read.
  2570 	
  2571 	@return System-wide error codes based on the status of the operation.
  2572 	*/
  2573 	virtual TInt Read(TInt64 aPos,TInt aLength,TDes8& aTrg)=0;
  2574 	
  2575 	/**
  2576 	Write to the proxy drive.
  2577 
  2578 	Derived class must provide an implementation for it.
  2579 	
  2580 	@param aPos    The address from where the write begins.
  2581 	@param aLength The length of the write.
  2582 	@param aSrc    A descriptor of the memory buffer from which to write.
  2583 	@param aThreadHandle The handle-number representing the drive thread.
  2584 	@param aOffset Offset into aSrc to write the data to.
  2585 	
  2586 	@return System-wide error codes based on the status of the operation.
  2587 	*/
  2588 	virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt anOffset)=0;
  2589 	
  2590 	/**
  2591 	Write to the proxy drive.
  2592 	
  2593 	Derived class must provide an implementation for it.
  2594 	
  2595 	@param aPos    The address from where the write begins.
  2596 	@param aSrc    A descriptor of the memory buffer from which to write.
  2597 	
  2598 	@return System-wide error codes based on the status of the operation.
  2599 	*/
  2600 	virtual TInt Write(TInt64 aPos,const TDesC8& aSrc)=0;
  2601 	
  2602 	/**
  2603 	Get the proxy drive's capabilities information.
  2604 	
  2605 	Derived class must provide an implementation for it.
  2606 
  2607 	@param anInfo A descriptor of the connected drives capabilities.
  2608 	
  2609 	@return System-wide error codes based on the status of the operation.
  2610 	*/
  2611 	virtual TInt Caps(TDes8& anInfo)=0;
  2612 	
  2613 	/**
  2614 	Format the connected drive.
  2615 	
  2616 	Derived class must provide an implementation for it.
  2617 	
  2618 	@param anInfo Device specific format information.
  2619 	
  2620 	@return System-wide error codes based on the status of the operation.
  2621 	*/
  2622 	virtual TInt Format(TFormatInfo& anInfo)=0;
  2623 	
  2624 	/**
  2625 	Format the proxy drive.
  2626 
  2627 	Derived class must provide an implementation for it.
  2628 	
  2629 	@param aPos    The position of the data which is being formatted.
  2630 	@param aLength The length of the data which is being formatted.
  2631 	
  2632 	@return System-wide error codes based on the status of the operation.
  2633 	*/
  2634 	virtual TInt Format(TInt64 aPos,TInt aLength)=0;
  2635 	
  2636 	/**
  2637 	Set the mount information on the proxy drive.
  2638 	
  2639 	Derived class must provide an implementation for it.
  2640 	
  2641 	@param aMountInfo Information passed down to the media driver. 
  2642 					  The meaning of this information depends on the media driver.
  2643 	@param aMountInfoThreadHandle  Message thread handle number.
  2644 	
  2645 	@return System-wide error codes based on the status of the operation.
  2646 	*/
  2647 	virtual TInt SetMountInfo(const TDesC8* aMountInfo,TInt aMountInfoThreadHandle=KCurrentThreadHandle)=0;
  2648 	
  2649 	/**
  2650 	Forces a remount on the proxy drive
  2651 	
  2652 	Derived class must provide an implementation for it.
  2653 	
  2654 	@param aFlags Flags to be passed into the driver.
  2655 	
  2656 	@return System-wide error codes based on the status of the operation.
  2657 	*/
  2658 	virtual TInt ForceRemount(TUint aFlags=0)=0;
  2659 	
  2660 	/**
  2661 	Unlocks a password-enabled proxy drive.
  2662 
  2663 	Derived class must provide an implementation for it.
  2664 
  2665 	@param aPassword A descriptor containing the existing password.
  2666 	@param aStorePassword If ETrue, the password is added to the password store.
  2667 	
  2668 	@return System-wide error codes based on the status of the operation.
  2669 	*/
  2670 	virtual TInt Unlock(TMediaPassword &aPassword, TBool aStorePassword)=0;
  2671 	
  2672 	/**
  2673 	Locks a password-enabled proxy drive with the new password.
  2674 	
  2675 	Derived class must provide an implementation for it.
  2676 
  2677 	@param aOldPassword A descriptor containing the existing password.
  2678 	@param aNewPassword A descriptor containing the new password.
  2679 	@param aStorePassword If ETrue, the password is added to the password store.
  2680 	
  2681 	@return System-wide error codes based on the status of the operation.
  2682 	*/
  2683 	virtual TInt Lock(TMediaPassword &aOldPassword, TMediaPassword &aNewPassword, TBool aStorePassword)=0;
  2684 	
  2685 	/**
  2686 	Clears a password from a proxy drive - controller sets password to null.
  2687 
  2688 	Derived class must provide an implementation for it.
  2689 
  2690 	@param aPassword A descriptor containing the password.
  2691 	
  2692 	@return System-wide error codes based on the status of the operation.
  2693 	*/
  2694 	virtual TInt Clear(TMediaPassword &aPassword)=0;
  2695 	
  2696 	/**
  2697 	Forcibly unlock a password-enabled proxy drive.
  2698 	
  2699 	Derived class must provide an implementation for it.
  2700 	
  2701 	@return System-wide error codes based on the status of the operation.
  2702 	*/
  2703 	virtual TInt ErasePassword()=0;
  2704 
  2705 // implementation using GetInterface(..)
  2706 	enum TInterfaceIds
  2707 		{
  2708 		EGetLocalDrive,
  2709 		ELocalBufferSupport,
  2710 		EGetProxyDrive,
  2711 		EFinalised,
  2712 		};
  2713 
  2714 	/**
  2715 	Retrieves TBusLocalDrive object associated with the file.
  2716 	
  2717 	@return System-wide error codes based on the status of the operation.
  2718 	*/
  2719 	IMPORT_C TInt GetLocalDrive(TBusLocalDrive*& aLocDrv);
  2720 	
  2721 	/**
  2722 	Informs the extension that the mount has been finalised and is in a consistent state.
  2723 	
  2724 	@return System-wide error codes based on the status of the operation.
  2725 
  2726 	@internalTechnology
  2727 	*/
  2728 	IMPORT_C TInt Finalise(TBool aFinalised);
  2729 
  2730 protected:
  2731 	/**
  2732 	Return a pointer to a specified interface extension - to allow future extension of this class without breaking
  2733 	binary compatibility.
  2734 	
  2735 	@param aInterfaceId Interface identifier of the interface to be retrieved.
  2736 	@param aInterface A reference to a pointer that retrieves the specified interface.
  2737 	@param aInput An arbitrary input argument.
  2738 	
  2739 	@return KErrNone If the interface is supported, KErrNotSupported otherwise.
  2740 	*/	
  2741 	IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
  2742 		
  2743 private:
  2744 	CMountCB* iMount;
  2745 	TUint32 iReserved;				// Reserved for future expansion
  2746 	};
  2747 
  2748 
  2749 
  2750 
  2751 /**
  2752 @publishedPartner
  2753 @released
  2754 
  2755 Local drive specific mount control block.
  2756 */
  2757 class CLocDrvMountCB : public CMountCB
  2758 	{
  2759 public:
  2760 	IMPORT_C CLocDrvMountCB();
  2761 	IMPORT_C ~CLocDrvMountCB();			
  2762 	IMPORT_C TInt CreateLocalDrive(TBusLocalDrive& aLocDrv);
  2763 	IMPORT_C TInt CreateDrive(TInt aDriveNumber);
  2764 	IMPORT_C TInt InitLocalDrive();
  2765 	IMPORT_C void DismountedLocalDrive();
  2766 	inline CProxyDrive* LocalDrive() const;	
  2767 
  2768 private:
  2769 	CProxyDrive* iProxyDrive;
  2770 	};
  2771 
  2772 
  2773 
  2774 
  2775 
  2776 /**
  2777 @publishedPartner
  2778 @released
  2779 
  2780 Local drive specific proxy drive interface.
  2781 Class passes commands directly to TBusLocalDrive.
  2782 
  2783 @see CProxyDrive   
  2784 */
  2785 NONSHARABLE_CLASS(CLocalProxyDrive) : public CProxyDrive
  2786 	{
  2787 public:	
  2788 	static CLocalProxyDrive* New(CMountCB* aMount,TBusLocalDrive& aLocDrv);
  2789 // virtual
  2790 	virtual TInt Initialise();	
  2791 	virtual TInt Dismounted();
  2792 	virtual TInt Enlarge(TInt aLength);
  2793 	virtual TInt ReduceSize(TInt aPos, TInt aLength);
  2794 	virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt aOffset, TInt aFlags);
  2795 	virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt anOffset);
  2796 	virtual TInt Read(TInt64 aPos,TInt aLength,TDes8& aTrg);
  2797 	virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt aOffset,TInt aFlags);
  2798 	virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt anOffset);
  2799 	virtual TInt Write(TInt64 aPos,const TDesC8& aSrc);
  2800 	virtual TInt Caps(TDes8& anInfo);
  2801 	virtual TInt Format(TFormatInfo& anInfo);
  2802 	virtual TInt Format(TInt64 aPos,TInt aLength);
  2803 	virtual TInt SetMountInfo(const TDesC8* aMountInfo,TInt aMountInfoThreadHandle=KCurrentThreadHandle);
  2804 	virtual TInt ForceRemount(TUint aFlags=0);
  2805 	virtual TInt ControlIO(const RMessagePtr2& aMessage,TInt aCommand,TAny* aParam1,TAny* aParam2);
  2806 	virtual TInt Unlock(TMediaPassword &aPassword, TBool aStorePassword);
  2807 	virtual TInt Lock(TMediaPassword &aOldPassword, TMediaPassword &aNewPassword, TBool aStorePassword);
  2808 	virtual TInt Clear(TMediaPassword &aPassword);
  2809 	virtual TInt ErasePassword();
  2810 	virtual TInt DeleteNotify(TInt64 aPos, TInt aLength);
  2811 	virtual TInt GetLastErrorInfo(TDes8& aErrorInfo);
  2812 protected:
  2813 	virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);	
  2814 private:
  2815 	CLocalProxyDrive(CMountCB* aMount,TBusLocalDrive& aLocDrv);
  2816 private:
  2817 	TBusLocalDrive& iLocDrv;
  2818 	};
  2819 
  2820 
  2821 
  2822 
  2823 /**
  2824 @publishedPartner
  2825 @released
  2826 
  2827 Media subsystem extensions must be derived from this specific class interface.
  2828 Objects of this type should be created through use of a derived CProxyDriveFactory class.
  2829 
  2830 Class passes commands directly to CProxyDrive.
  2831 
  2832 @see CProxyDrive
  2833 @see CProxyDriveFactory
  2834 */
  2835 class CBaseExtProxyDrive : public CProxyDrive
  2836 	{
  2837 public:
  2838 	IMPORT_C CBaseExtProxyDrive(CProxyDrive* aProxyDrive, CMountCB* aMount);
  2839 	IMPORT_C ~CBaseExtProxyDrive();
  2840 	IMPORT_C virtual TInt Initialise();
  2841 	IMPORT_C virtual TInt Dismounted();
  2842 	IMPORT_C virtual TInt Enlarge(TInt aLength);
  2843 	IMPORT_C virtual TInt ReduceSize(TInt aPos, TInt aLength);
  2844 	IMPORT_C virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt aOffset,TInt aFlags);
  2845 	IMPORT_C virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt anOffset);
  2846 	IMPORT_C virtual TInt Read(TInt64 aPos,TInt aLength,TDes8& aTrg);
  2847 	IMPORT_C virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt aOffset,TInt aFlags);
  2848 	IMPORT_C virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt anOffset);
  2849 	IMPORT_C virtual TInt Write(TInt64 aPos,const TDesC8& aSrc);
  2850 	IMPORT_C virtual TInt Caps(TDes8& anInfo);
  2851 	IMPORT_C virtual TInt Format(TFormatInfo& anInfo);
  2852 	IMPORT_C virtual TInt Format(TInt64 aPos,TInt aLength);
  2853 	IMPORT_C virtual TInt SetMountInfo(const TDesC8* aMountInfo,TInt aMountInfoThreadHandle=KCurrentThreadHandle);
  2854 	IMPORT_C virtual TInt ForceRemount(TUint aFlags=0);
  2855 	IMPORT_C virtual TInt Unlock(TMediaPassword &aPassword, TBool aStorePassword);
  2856 	IMPORT_C virtual TInt Lock(TMediaPassword &aOldPassword, TMediaPassword &aNewPassword, TBool aStorePassword);
  2857 	IMPORT_C virtual TInt Clear(TMediaPassword &aPassword);
  2858 	IMPORT_C virtual TInt ControlIO(const RMessagePtr2& aMessage,TInt aCommand,TAny* aParam1,TAny* aParam2);
  2859 	IMPORT_C virtual TInt ErasePassword();
  2860 	IMPORT_C virtual TInt GetLastErrorInfo(TDes8& aErrorInfo);
  2861     IMPORT_C virtual TInt DeleteNotify(TInt64 aPos, TInt aLength);
  2862 	inline TInt LocalBufferSupport();
  2863 
  2864 protected:
  2865 	/**
  2866 	Return a pointer to a specified interface extension - to allow future extension of this class without breaking
  2867 	binary compatibility.
  2868 	@param aInterfaceId Interface identifier of the interface to be retrieved.
  2869 	@param aInterface A reference to a pointer that retrieves the specified interface.
  2870 	@param aInput An arbitrary input argument.
  2871 	@return KErrNone If the interface is supported, KErrNotSupported otherwise.
  2872 	*/	
  2873 	IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);	
  2874 private:
  2875 	CProxyDrive* iProxy;
  2876 	};
  2877 
  2878 
  2879 
  2880 
  2881 /**
  2882 @publishedPartner
  2883 @released
  2884 
  2885 Abstract base class for Proxy drive factory classes.
  2886 
  2887 Class is used for the creation of media subsystem extensions CBaseExtProxyDrive.
  2888 
  2889 @see CBaseExtProxyDrive
  2890 */
  2891 class CProxyDriveFactory : public CFsObject
  2892 	{
  2893 public:
  2894 	IMPORT_C CProxyDriveFactory();
  2895 	IMPORT_C virtual TInt Remove();
  2896 	inline void SetLibrary(RLibrary aLib);
  2897 	inline RLibrary Library() const;
  2898 
  2899     /**
  2900     Installation of the factory object.
  2901     @return system wide error code
  2902     */
  2903 	virtual TInt Install() =0;	
  2904 	/**
  2905 	Instantiates a CProxyDrive object.
  2906 	@param aProxy Proxy drive to be used.
  2907 	@param aMount Mount control block.
  2908 	
  2909 	@return pointer to Instantiated CProxyDrive object.
  2910 	*/		
  2911 	virtual CProxyDrive* NewProxyDriveL(CProxyDrive* aProxy,CMountCB* aMount)=0;
  2912 private:
  2913 	RLibrary iLibrary;
  2914 	};
  2915 
  2916 
  2917 
  2918 /**
  2919 @internalTechnology
  2920 */
  2921 class CExtProxyDriveFactory : public CFsObject
  2922 	{
  2923 public:
  2924 	IMPORT_C CExtProxyDriveFactory();
  2925 	IMPORT_C virtual TInt Remove();
  2926 	inline void SetLibrary(RLibrary aLib);
  2927 	inline RLibrary Library() const;
  2928 // pure virtual
  2929 	virtual TInt Install() =0;			
  2930 	virtual TInt CreateProxyDrive(CProxyDrive*& aMountProxyDrive, CMountCB* aMount)=0;
  2931 
  2932 	IMPORT_C virtual void AsyncEnumerate();
  2933 
  2934 private:
  2935 	RLibrary iLibrary;
  2936 	};
  2937 
  2938 
  2939 /**
  2940 @internalTechnology
  2941 */
  2942 class CExtProxyDrive : public CProxyDrive
  2943 	{
  2944 public:
  2945 	IMPORT_C CExtProxyDrive(CMountCB* aMount,CExtProxyDriveFactory* aDevice);
  2946 	IMPORT_C ~CExtProxyDrive();
  2947 	
  2948 	IMPORT_C virtual TInt NotifyChange(TDes8 &aChanged, TRequestStatus* aStatus);
  2949 	IMPORT_C virtual void NotifyChangeCancel();
  2950 	IMPORT_C virtual TInt SetInfo(const RMessage2 &msg, TAny* aMessageParam2, TAny* aMessageParam3);
  2951 
  2952 	inline TInt DriveNumber();
  2953 	inline void SetDriveNumber(TInt aDrive);
  2954 	inline CExtProxyDriveFactory* FactoryP();
  2955 
  2956 protected:
  2957 	/**
  2958 	Return a pointer to a specified interface extension - to allow future extension of this class without breaking
  2959 	binary compatibility.
  2960 	@param aInterfaceId Interface identifier of the interface to be retrieved.
  2961 	@param aInterface A reference to a pointer that retrieves the specified interface.
  2962 	@param aInput An arbitrary input argument.
  2963 	@return KErrNone If the interface is supported, KErrNotSupported otherwise.
  2964 	*/	
  2965 	IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
  2966 
  2967 	TInt SetupMediaChange();
  2968 
  2969 protected:
  2970 	CExtProxyDriveFactory* iFactory;
  2971 	TInt iDriveNumber;
  2972 
  2973 private:
  2974 	CExtNotifyMediaChange* iMediaChangeNotifier;
  2975 
  2976 	TUint32 iReserved[4];	// Reserved bytes for future expansion
  2977 	
  2978 	friend class LocalDrives;
  2979 	};
  2980 
  2981 
  2982 /**
  2983 @internalTechnology
  2984 */
  2985 NONSHARABLE_CLASS(CExtNotifyMediaChange) : public CActive
  2986 	{
  2987 public:
  2988 	static CExtNotifyMediaChange* NewL(CExtProxyDrive* aDrive);
  2989     ~CExtNotifyMediaChange();
  2990 	void RequestL();
  2991 
  2992 private:
  2993 	CExtNotifyMediaChange(CExtProxyDrive* aDrive);
  2994 	void ConstructL();
  2995 
  2996 	void DoCancel();
  2997 	void RunL();
  2998 
  2999 private:
  3000 	CExtProxyDrive* iDrive;
  3001 	TPtr8 iPtr;
  3002 	};
  3003 
  3004 /**
  3005 @publishedPartner
  3006 @released
  3007 
  3008 Gets the local bus drive.
  3009 
  3010 @param aLocalDrive The local drive number.
  3011 
  3012 @return The local bus drive.
  3013 */
  3014 IMPORT_C TBusLocalDrive& GetLocalDrive(TInt aLocalDrive);
  3015 
  3016 /**
  3017 @internalTechnology
  3018 
  3019 Gets the proxy drive device for a given drive
  3020 
  3021 @param aLocalDrive The local drive number.
  3022 
  3023 @return The local bus drive.
  3024 */
  3025 IMPORT_C CExtProxyDrive* GetProxyDrive(TInt aDrive);
  3026 
  3027 /**
  3028 @internalTechnology
  3029 
  3030 Gets the proxy drive for a given drive
  3031 
  3032 @param aLocalDrive The local drive number.
  3033 
  3034 @return The proxy drive
  3035 */
  3036 IMPORT_C TInt GetProxyDrive(TInt aDrive, CProxyDrive*& aProxyDrive);
  3037 
  3038 /**
  3039 @internalTechnology
  3040 
  3041 Return ETrue if drive is actually a proxy instead of a local drive 
  3042 
  3043 @param The drive number.
  3044 
  3045 @return ETrue if drive is actually a proxy instead of a local drive 
  3046 */
  3047 IMPORT_C TBool IsProxyDrive(TInt aDrive);
  3048 
  3049 /**
  3050 @publishedPartner
  3051 @released
  3052 
  3053 Checks a given drive number is mapped to a local drive.
  3054 
  3055 @param aDrive The local drive number.
  3056 
  3057 @return specified drive number is mapped to a local drive.
  3058 */
  3059 IMPORT_C TBool IsValidLocalDriveMapping(TInt aDrive);
  3060 
  3061 /** 
  3062 @internalTechnology 
  3063  
  3064 Sets the media attributes and type in the anInfo parameter to those of the 
  3065 specified drive. 
  3066 
  3067 @param anInfo TDriveInfo object to store the drive information.
  3068 @param aDriveNumber The number of the drive to get the information from.
  3069 */
  3070 IMPORT_C void GetDriveInfo(TDriveInfo& anInfo,TInt aDriveNumber);
  3071 
  3072 /**
  3073 @publishedPartner
  3074 @released
  3075 
  3076 Returns the local drive number for a given drive number.
  3077 
  3078 @param aDrive The drive number.
  3079 
  3080 @return KDriveInvalid if drive is not mapped to a local drive.
  3081         otherwise the local drive number.
  3082 */
  3083 IMPORT_C TInt DriveNumberToLocalDriveNumber(TInt aDrive);
  3084 
  3085 /**
  3086 */
  3087 IMPORT_C TInt GetLocalDriveNumber(TBusLocalDrive* aLocDrv);
  3088 
  3089 
  3090 /**
  3091 @internalTechnology
  3092 */
  3093 struct TFatUtilityFunctions;
  3094 
  3095 /**
  3096 	Representation of FAT Utility Functions as provided by a Code Page DLL.
  3097 	These functions are to be implemented by Code Page-DLLs.
  3098 	@internaltechnology
  3099 */
  3100 
  3101 struct TCodePageFunctions
  3102 	{
  3103 	typedef TBool (*TConvertFromUnicode)(TDes8& aForeign, const TDesC16& aUnicode, const TDesC8& aReplacementForUnconvertibleCharacter);
  3104 	typedef TInt  (*TConvertFromUnicodeL)(TDes8& aForeign, const TDesC16& aUnicode, TBool leaveWhenOverflow);
  3105 	typedef TBool (*TConvertToUnicode)(TDes16& aUnicode, const TDesC8& aForeign);
  3106 	typedef TInt  (*TConvertToUnicodeL)(TDes16& aUnicode, const TDesC8& aForeign, TBool leaveWhenOverflow);
  3107 	typedef TBool (*TIsLegalShortNameCharacter)(TUint aCharacter);	
  3108 
  3109 	TConvertFromUnicode iConvertFromUnicode;
  3110 	TConvertFromUnicodeL iConvertFromUnicodeL;
  3111 	TConvertToUnicode iConvertToUnicode;
  3112 	TConvertToUnicodeL iConvertToUnicodeL;
  3113 	TIsLegalShortNameCharacter iIsLegalShortNameCharacter;
  3114 	};
  3115 
  3116 /**
  3117 	A utility class for Codepage Dll. Controls overflow action. Provides current status of 
  3118 	Locale/codepage dll loaded. Provides conversions functions to be used by Codepage Dlls.
  3119 	
  3120 	@internaltechnology
  3121 */
  3122 class TCodePageUtils
  3123 	{
  3124 public:
  3125 
  3126 	/** 
  3127 	Determines the Overflow action in case of if overflow occurs.
  3128 	*/
  3129  	enum TOverflowAction
  3130 		{
  3131 		/**
  3132 		Will leave if an overflow occurs.
  3133 		*/
  3134 		EOverflowActionLeave,
  3135 		/** 
  3136 		Will truncate the data if an overflow occurs.
  3137 		*/
  3138 		EOverflowActionTruncate
  3139 		};
  3140 
  3141 	/** 
  3142 	Determines the current status of Locale dll / Codepage dll.
  3143 	*/
  3144 	enum TCodepageLoaded
  3145 		{
  3146 		/** 
  3147 		No Locale Dll or Codepage Dll is loaded.
  3148 		*/
  3149 		ENone = 0,
  3150 		/** 
  3151 		Locale Dll is loaded.
  3152 		*/
  3153 		ELocaleDll,
  3154 		/** 
  3155 		Codepage Dll is loaded.
  3156 		*/
  3157 		ECodePageDll
  3158 		};
  3159 public:
  3160 
  3161 	/**
  3162 	Convert from Unicode, truncating if there is not enough room in the output.
  3163 
  3164 	@param aForeign The output is appended here.
  3165 	@param aUnicode The input.
  3166 
  3167 	@return False if and only if aForeign has not enough space remaining. 
  3168 	*/
  3169 	TBool ConvertFromUnicode(TDes8& aForeign, const TDesC16& aUnicode, TOverflowAction aOverflowAction) const;
  3170 
  3171 	/**
  3172 	Convert from Unicode, truncating if there is not enough room in the output.
  3173 
  3174 	@param aForeign The output is appended here.
  3175 	@param aUnicode The input.
  3176 
  3177 	@leave KErrOverflow if aForeign is too short for the output.
  3178 	*/
  3179 	IMPORT_C void ConvertFromUnicodeL(TDes8& aForeign, const TDesC16& aUnicode, TOverflowAction aOverflowAction=EOverflowActionLeave) const;
  3180 
  3181 	/* 
  3182 	Convert to Unicode, truncating if there is not enough room in the output.
  3183 
  3184 	@param aUnicode The output is appended here.
  3185 	@param aForeign The input.
  3186 
  3187 	@return False if and only if aUnicode has not enough space remaining.
  3188 	*/
  3189 	TBool ConvertToUnicode(TDes16& aUnicode, const TDesC8& aForeign ) const;
  3190 
  3191 	/* 
  3192 	Convert to Unicode, leaving if there is not enough room in the output.
  3193 
  3194 	@param aUnicode The output is appended here.
  3195 	@param aForeign The input.
  3196 
  3197 	@leave KErrOverflow if aUnicode is too short for the output.
  3198 	*/
  3199 	IMPORT_C void ConvertToUnicodeL(TDes16& aUnicode, const TDesC8& aForeign, TOverflowAction aOverflowAction=EOverflowActionLeave) const;
  3200 
  3201 	/** 
  3202 	Returns true if the input character is legal in a short name.
  3203 
  3204 	@param aCharacter Character, in the foreign character encoding.
  3205 
  3206 	@return true if aCharacter is legal in a FAT short name.
  3207 	*/
  3208 	IMPORT_C TBool IsLegalShortNameCharacter(TUint aCharacter,TBool aUseExtendedChars=EFalse) const;
  3209 
  3210 public:
  3211 
  3212 	/** 
  3213 	Constructor for TCodePageUtils.
  3214 	*/
  3215 	TCodePageUtils();
  3216 
  3217 	/** 
  3218 	Returns whether a Codepage dll is loaded.
  3219 	
  3220 	@return True if Codepage dll is loaded.
  3221 			False otherwise
  3222 	*/
  3223 	TBool IsCodepageLoaded() const;
  3224 
  3225 	/** 
  3226 	Returns the type of active codepage.
  3227 	@return 	ENone			if no dll is loaded
  3228 				ELocaleDll		if Locale Dll is loaded
  3229 				ECodepageDll	if Codepage Dll is loaded
  3230 	*/
  3231 	TCodepageLoaded CodepageLoaded() const;
  3232 
  3233 	/** 
  3234 	Sets the current codepage to that provided by the current Locale DLL.
  3235 	
  3236 	@param		aFunctions	Pointer to FAT conversion functions to be used.
  3237 	
  3238 	@return 	None
  3239 	*/
  3240 	void SetLocaleCodePage(TFatUtilityFunctions* aFunctions);
  3241 
  3242 	/** 
  3243 	Gets the function pointer to the read Locale conversions functions.
  3244 	
  3245 	@return function pointer to the read Locale conversions functions.
  3246 	*/
  3247 	TFatUtilityFunctions* LocaleFatUtilityFunctions() const;
  3248 
  3249 	/** 
  3250 	Gets structure to function pointers to the read Codepage conversions functions.
  3251 	
  3252 	@return structure to function pointers to the read Codepage conversions functions.
  3253 	*/
  3254 	TCodePageFunctions CodepageFatUtilityFunctions() const;
  3255 
  3256 private:
  3257 
  3258 	/** 
  3259 	Structure to function pointers to the read Codepage conversions functions.
  3260 	*/
  3261 	TCodePageFunctions iCodePageFunctions;
  3262 
  3263 	/** 
  3264 	Function pointer to the read Locale conversions functions.
  3265 	*/
  3266 	TFatUtilityFunctions* iLocaleFatUtilityFunctions;
  3267 
  3268 	/** 
  3269 	Variable to hold the active codepage type.
  3270 	*/
  3271 	TCodepageLoaded iCodepageLoaded;
  3272 
  3273 	friend class TFsLoadCodePage;
  3274 	};
  3275 
  3276 /** 
  3277 @internaltechnology
  3278 
  3279 Gets the pointer to the current FAT conversions functions.
  3280 
  3281 @return 	Pointer to the current FAT conversions functions.
  3282 */
  3283 IMPORT_C const TFatUtilityFunctions* GetFatUtilityFunctions();
  3284 
  3285 /** 
  3286 @internaltechnology
  3287 
  3288 Gets the instance of TCodePageUtils class.
  3289 
  3290 @return 	Instance of TCodePageUtils class.
  3291 */
  3292 IMPORT_C const TCodePageUtils& GetCodePage();
  3293 
  3294 
  3295 
  3296 /**
  3297 @publishedPartner
  3298 @released
  3299 
  3300 Copies data to a buffer.
  3301 
  3302 If necessary, the buffer, a heap descriptor, is allocated or re-allocated
  3303 before copying takes place.
  3304 
  3305 @param aBuf A reference to a pointer to heap descriptor forming the buffer.
  3306             This will be allocated if it does not already exist,
  3307             or re-allocated if the existing buffer is not large enough.
  3308 @param aDes The data to be copied.
  3309 */
  3310 IMPORT_C void AllocBufferL(HBufC*& aBuf,const TDesC& aDes);
  3311 
  3312 
  3313 
  3314 
  3315 
  3316 /**
  3317 @publishedPartner
  3318 @released
  3319 
  3320 Notifies sessions of a debug event if aFunction has the KDebugNotifyMask set.
  3321 
  3322 This function can only be used in debug builds or if _DEBUG
  3323 or _DEBUG_RELEASE is defined.
  3324 
  3325 @param aFunction A function.
  3326 @param aDrive    A drive.
  3327 */
  3328 IMPORT_C void DebugNotifySessions(TInt aFunction,TInt aDrive);
  3329 
  3330 
  3331 
  3332 
  3333 /**
  3334 @publishedPartner
  3335 @released
  3336 
  3337 Writes data from a buffer to a file.
  3338 
  3339 Called by the mount control block lock and the unlock functions.
  3340 
  3341 @param aFileName The file to be written to.
  3342 @param aBuf      The data to be written.
  3343 */
  3344 IMPORT_C void WriteToDisk(const TDesC& aFileName,const TDesC8& aBuf);
  3345 
  3346 
  3347 
  3348 
  3349 /**
  3350 Create a proxy drive using the local proxy drive passed in
  3351 and any extensions that have been added to the drive.
  3352 
  3353 @param aConcreteDrive local proxy drive
  3354 @param aMount local proxy drive mount control block
  3355 
  3356 @return pointer to instantiated CProxyDrive object.
  3357 */
  3358 IMPORT_C CProxyDrive* CreateProxyDriveL(CProxyDrive* aConcreteDrive,CMountCB* aMount);
  3359 
  3360 
  3361 
  3362 /**
  3363 @deprecated 6.1
  3364 */
  3365 IMPORT_C TInt CompareFilenames(const TDesC& aFileName1,const TDesC& aFileName2);
  3366 //
  3367 /**
  3368 Lookup a file system by name.
  3369 
  3370 @param aName file system name.
  3371 
  3372 @return pointer to instantiated CFileSystem object.
  3373 */
  3374 IMPORT_C CFileSystem* GetFileSystem(const TDesC& aName);
  3375 
  3376 
  3377 
  3378 /**
  3379 @internalTechnology
  3380 
  3381 A static class for retrieving F32 properties
  3382 */
  3383 class F32Properties
  3384 	{
  3385 private:
  3386 	F32Properties();
  3387 public:
  3388 	IMPORT_C static TBool Initialise(TInt aRomAddress, TInt aLength);
  3389 	IMPORT_C static TBool GetString(const TDesC8& aSection, const TDesC8& aProperty, TDes8&  aPropVal);
  3390 	IMPORT_C static TBool GetInt(const TDesC8& aSection,    const TDesC8& aProperty, TInt32& aPropVal);
  3391 	IMPORT_C static TBool GetBool(const TDesC8& aSection,   const TDesC8& aProperty, TBool&  aPropVal);
  3392 private:
  3393 	static TBool iInitialised;
  3394 	static TInt iRomAddress;
  3395 	static TInt iRomLength;
  3396 	};
  3397 
  3398 #include <f32fsys.inl>
  3399 #endif