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