sl@0: // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // f32\inc\f32fsys.h sl@0: // sl@0: // WARNING: This file contains some APIs which are internal and are subject sl@0: // to change without notice. Such APIs should therefore not be used sl@0: // outside the Kernel and Hardware Services package. sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: sl@0: #if !defined(__F32FSYS_H__) sl@0: #define __F32FSYS_H__ sl@0: #if !defined(__F32FILE_H__) sl@0: #include sl@0: #endif sl@0: #include sl@0: #include sl@0: sl@0: // sl@0: #if defined(_UNICODE) sl@0: #define KFileSystemUidValue KFileSystemUidValue16 sl@0: #define KFileServerUidValue KFileServerUidValue16 sl@0: #define KFileServerDllUidValue KFileServerDllUidValue16 sl@0: #else sl@0: #define KFileSystemUidValue KFileSystemUidValue8 sl@0: #define KFileServerUidValueKFileServerUidValue8 sl@0: #define KFileServerDllUidValueKFileServerDllUidValue8 sl@0: #endif sl@0: sl@0: sl@0: /** sl@0: Filesystem error code 1 : indicates an item cannot be found, sl@0: because it has been hidden. sl@0: */ sl@0: const TInt KErrHidden=(1); sl@0: sl@0: /** sl@0: Filesystem error code 2 : in the context of file operations, a path sl@0: was not found, because it has been hidden. sl@0: */ sl@0: const TInt KErrPathHidden=(2); sl@0: sl@0: sl@0: const TInt KFileShareLockGranularity=2; sl@0: const TInt KAsyncRequestArrayGranularity=2; sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: File system UID value 16. sl@0: */ sl@0: const TInt KFileSystemUidValue16=0x100039df; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: File system UID value 8. sl@0: */ sl@0: const TInt KFileSystemUidValue8=0x1000008f; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: File server UID value 16. sl@0: */ sl@0: const TInt KFileServerUidValue16=0x100039e3; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: File server UID value 8. sl@0: */ sl@0: const TInt KFileServerUidValue8=0x100000bb; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: File server DLL UID value 16. sl@0: */ sl@0: const TInt KFileServerDllUidValue16=0x100039e4; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: File server DLL UID value 8. sl@0: */ sl@0: const TInt KFileServerDllUidValue8=0x100000bd; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: Local file system UID value. sl@0: */ sl@0: const TInt KLocalFileSystemUidValue=0x100000d6; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: Estart component UID value. sl@0: */ sl@0: const TInt KEstartUidValue=0x10272C04; sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: Maximum length of a volume name. sl@0: */ sl@0: const TInt KMaxVolumeNameLength=11; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: First local drive indicator. sl@0: */ sl@0: const TInt KFirstLocalDrive=EDriveC; sl@0: sl@0: sl@0: const TInt KMaxExtensionCount=2; sl@0: // sl@0: const TInt KDriveInvalid=-1; sl@0: // sl@0: _LIT(KMediaPWrdFile, "?:\\sys\\data\\mmcstore"); sl@0: // sl@0: sl@0: /** sl@0: @internalTechnology sl@0: */ sl@0: const TUint KSystemDriveKey = 0x10283049; sl@0: sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: Enumeration that specifies whether, on opening a file: sl@0: - an existing file is opened sl@0: - a new file is created sl@0: - an existing file is replaced. sl@0: */ sl@0: enum TFileOpen {EFileOpen,EFileCreate,EFileReplace}; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: The file share mode. sl@0: */ sl@0: typedef TFileMode TShare; sl@0: sl@0: sl@0: sl@0: sl@0: class CMountCB; sl@0: class CFileSystem; sl@0: class CFileCB; sl@0: class CDirCB; sl@0: class CFileShare; sl@0: class CSessionFs; sl@0: class CFsPlugin; sl@0: class CFileBody; sl@0: class CMountBody; sl@0: class CFsMessageRequest; sl@0: class CProxyDrive; sl@0: class CFormatCB; sl@0: sl@0: // sl@0: class CFsObjectCon; sl@0: class CFileCache; sl@0: // sl@0: class CExtNotifyMediaChange; sl@0: // sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: Implements reference counting to track concurrent references to itself. sl@0: sl@0: An object of this type arranges automatic destruction of itself when the final sl@0: reference is removed. sl@0: sl@0: A reference counting object is any object which has CFsObject as its base class. sl@0: Constructing a CFsObject derived type or calling its Open() member function sl@0: adds a reference to that object by adding one to the reference count; calling sl@0: its Close() member function removes a reference by subtracting one from the sl@0: reference count; when the last user of the object calls Close(), the reference sl@0: count becomes zero and the object is automatically destroyed. sl@0: */ sl@0: class CFsObject : public CBase sl@0: sl@0: { sl@0: public: sl@0: IMPORT_C CFsObject(); sl@0: IMPORT_C virtual TInt Open(); sl@0: IMPORT_C virtual void Close(); sl@0: IMPORT_C TInt SetName(const TDesC* aName); sl@0: IMPORT_C TName Name() const; sl@0: IMPORT_C virtual TBool IsCorrectThread(); sl@0: inline CFsObjectCon* Container() const; sl@0: protected: sl@0: void DoClose(); sl@0: TInt UniqueID() const; sl@0: inline TInt Inc(); sl@0: inline TInt Dec(); sl@0: IMPORT_C ~CFsObject(); sl@0: private: sl@0: TInt iAccessCount; sl@0: CFsObjectCon* iContainer; sl@0: HBufC* iName; sl@0: friend class CFsObjectCon; sl@0: friend class CFsObjectIx; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: class CFsRequest; sl@0: class CFsInternalRequest; sl@0: sl@0: /** sl@0: Implements a request dispatcher. sl@0: sl@0: Base class for file server resources. sl@0: for example subsessions that are opened, such as RFile etc, that need closing are closed by sl@0: issuing a subsession close request, handled by this object. sl@0: sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: class CFsDispatchObject : public CFsObject sl@0: { sl@0: public: sl@0: CFsDispatchObject(); sl@0: /** sl@0: Returns the drive number. sl@0: @return Drive number. sl@0: */ sl@0: TInt DriveNumber() const {return(iDriveNumber);} sl@0: IMPORT_C void Close(); sl@0: IMPORT_C virtual TBool IsCorrectThread(); sl@0: protected: sl@0: void DoInitL(TInt aDrvNumber); sl@0: void Dispatch(); sl@0: ~CFsDispatchObject(); sl@0: private: sl@0: CFsInternalRequest* iRequest; sl@0: TInt iDriveNumber; sl@0: friend class TFsCloseObject; sl@0: friend class CFileShare; // needed to override the close operation so that the file cache can be flushed on a close sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Notifier class must be unique to each thread so one per drive or threaded plugin should be used sl@0: allocated in the file system. No longer global sl@0: sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: NONSHARABLE_CLASS(CAsyncNotifier) : public CBase sl@0: { sl@0: public: sl@0: IMPORT_C static CAsyncNotifier* New(); sl@0: IMPORT_C ~CAsyncNotifier(); sl@0: IMPORT_C TInt Notify(const TDesC& aLine1,const TDesC& aLine2,const TDesC& aButton1,const TDesC& aButton2,TInt& aButtonVal); sl@0: inline void SetMount(CMountCB* aMount) { iMount = aMount; }; sl@0: protected: sl@0: CAsyncNotifier(); sl@0: TInt Connect(); sl@0: private: sl@0: RNotifier iNotifier; sl@0: CMountCB* iMount; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: class CProxyDriveFactory; sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: Structure containing information related to a single drive extension. sl@0: */ sl@0: struct TExtensionInfo sl@0: { sl@0: TBool iIsPrimary; ///< Is the primary drive extension for a given drive sl@0: CProxyDriveFactory* iFactory; ///< Pointer to the drive extension's object factory sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: Represents information related to the Drive extension(s) in use for a given drive. sl@0: */ sl@0: struct TDriveExtInfo sl@0: { sl@0: TDriveExtInfo(); sl@0: sl@0: TInt iCount; ///< Number of drive extensions in use sl@0: sl@0: TExtensionInfo iInfo[KMaxExtensionCount]; ///< Drive extension related information sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: Represents a drive in the file server. sl@0: sl@0: Note that drives may act as substitutes for paths on other drives, sl@0: in which case any access to this drive letter will be translated into sl@0: a reference to the assigned path. In this way drives can act as short sl@0: cuts to paths on other drives. sl@0: */ sl@0: class TDrive sl@0: { sl@0: public: sl@0: TDrive(); sl@0: void CreateL(TInt aDriveNumber); sl@0: TInt CheckMount(); sl@0: TInt CheckMountAndEntryName(const TDesC& aName); sl@0: TInt FinaliseMount(); sl@0: TInt FinaliseMount(TInt aOperation, TAny* aParam1=NULL, TAny* aParam2=NULL); sl@0: TInt MountControl(TInt aLevel, TInt aOption, TAny* aParam); sl@0: void MountFileSystem(TBool aForceMount, TUint32 aFsNameHash = 0); sl@0: void FlushCachedFileInfoL(); sl@0: TInt FlushCachedFileInfo(TBool aPurgeCache = EFalse); sl@0: void PurgeDirty(CMountCB& aMount); sl@0: void DriveInfo(TDriveInfo& anInfo); sl@0: TInt Volume(TVolumeInfo& aVolume); sl@0: TInt SetVolume(const TDesC& aName); sl@0: TInt MkDir(const TDesC& aName); sl@0: TInt RmDir(const TDesC& aName); sl@0: TInt Delete(const TDesC& aName); sl@0: TInt Rename(const TDesC& anOldName,const TDesC& aNewName); sl@0: TInt Replace(const TDesC& anOldName,const TDesC& aNewName); sl@0: TInt Entry(const TDesC& aName,TEntry& anEntry); sl@0: TInt SetEntry(const TDesC& aName,const TTime& aTime,TUint aMask,TUint aVal); sl@0: TInt FileTemp(CFsRequest* aRequest,TInt& aHandle,const TDesC& aPath,TDes& aName,TUint aMode); sl@0: TInt FileOpen(CFsRequest* aRequest,TInt& aHandle,const TDesC& aName,TUint aMode,TFileOpen anOpen); sl@0: TInt DirOpen(CSessionFs* aSession,TInt& aHandle,const TDesC& aName,TUint anAtt,const TUidType& aUidType); sl@0: CFormatCB* FormatOpenL(CFsRequest* aRequest, TInt& aFmtHandle, TFormatMode aFmtMode, const TLDFormatInfo* apLDFormatInfo, const TVolFormatParam* apVolFormatParam); sl@0: sl@0: TInt CheckDisk(); sl@0: TInt CheckDisk(TInt aOperation, TAny* aParam1=NULL, TAny* aParam2=NULL); sl@0: sl@0: TInt ScanDrive(); sl@0: TInt ScanDrive(TInt aOperation, TAny* aParam1=NULL, TAny* aParam2=NULL); sl@0: sl@0: TInt ReadFileSection(const TDesC& aName,TInt aPos,TAny* aTrg,TInt aLength,const RMessagePtr2& aMessage); sl@0: TInt ReadFileSection64(const TDesC& aName,TInt64 aPos,TAny* aTrg,TInt aLength,const RMessagePtr2& aMessage); sl@0: TInt GetShortName(const TDesC& aLongName,TDes& aShortName); sl@0: TInt GetLongName(const TDesC& aShortName,TDes& aLongName); sl@0: TInt IsFileOpen(const TDesC& aFileName,CFileCB*& aFileCB); sl@0: TInt IsFileInRom(const TDesC& aFileName,TUint8*& aFileStart); sl@0: TInt LockDevice(TMediaPassword& aOld,TMediaPassword& aNew,TBool aStore); sl@0: TInt UnlockDevice(TMediaPassword& aPassword,TBool aStore); sl@0: TInt ClearDevicePassword(TMediaPassword& aPassword); sl@0: TInt EraseDevicePassword(); sl@0: TInt FreeDiskSpace(TInt64& aFreeDiskSpace); sl@0: TInt ForceRemountDrive(const TDesC8* aMountInfo,TInt aMountInfoMessageHandle,TUint aFlags); sl@0: TBool IsWriteProtected(); sl@0: TInt MountExtension(CProxyDriveFactory* aFactory,TBool aIsPrimary); sl@0: TInt DismountExtension(CProxyDriveFactory* aFactory,TBool aIsPrimary); sl@0: TInt ExtensionName(TDes& aExtensionName,TInt aPos); sl@0: TInt ControlIO(const RMessagePtr2& aMessage,TInt aCommand,TAny* aParam1,TAny* aParam2); sl@0: void SetAtt(TUint aValue); sl@0: IMPORT_C TUint Att(); sl@0: IMPORT_C TBool GetNotifyUser(); sl@0: IMPORT_C void Dismount(); sl@0: IMPORT_C TBool IsWriteableResource() const; sl@0: IMPORT_C TBool IsCurrentWriteFunction() const; sl@0: inline TInt GetReason() const; sl@0: inline void SetChanged(TBool aValue); sl@0: inline TBool IsChanged() const; sl@0: inline TInt DriveNumber() const; sl@0: inline TBool IsMounted() const; sl@0: inline TBool IsLocal() const; sl@0: inline TBool IsRom() const; sl@0: inline TBool IsRemovable() const; sl@0: inline TBool IsSubsted() const; sl@0: inline CMountCB& CurrentMount() const; sl@0: inline TBool IsCurrentMount(CMountCB& aMount) const; sl@0: inline TDrive& SubstedDrive() const; sl@0: inline void SetSubstedDrive(TDrive* aDrive); sl@0: inline HBufC& Subst() const; sl@0: inline void SetSubst(HBufC* aSubst); sl@0: inline CFsObjectCon& Mount() const; sl@0: inline CFileSystem& FSys(); sl@0: inline CFileSystem*& GetFSys(); sl@0: inline TDriveExtInfo& ExtInfo(); sl@0: inline void SetNotifyOn(); sl@0: inline void SetNotifyOff(); sl@0: inline TInt ReservedSpace() const; sl@0: inline void SetReservedSpace(const TInt aReservedSpace); sl@0: sl@0: inline void SetRugged(TBool aIsRugged); sl@0: inline TBool IsRugged() const; sl@0: sl@0: inline TBool IsSynchronous() const; sl@0: inline void SetSynchronous(TBool aIsSynch); sl@0: sl@0: TInt DismountProxyDrive(); sl@0: TInt ForceUnmountFileSystemForFormatting(); sl@0: sl@0: public: sl@0: void DismountLock(); sl@0: TInt DismountUnlock(); sl@0: TInt DismountLocked() const; sl@0: void SetDismountDeferred(TBool aPending); sl@0: void ForceDismount(); sl@0: TInt ActiveMounts() const; sl@0: void ReactivateMounts(); sl@0: TInt ClampFile(const TDesC& aName,TAny* aHandle); sl@0: TInt UnclampFile(CMountCB* aMount, RFileClamp* aHandle); sl@0: TInt ClampsOnDrive(); sl@0: inline TBool DismountDeferred() const; sl@0: TInt DeferredDismount(); sl@0: #if defined(_DEBUG) || defined(_DEBUG_RELEASE) sl@0: TInt ClearDeferredDismount(); sl@0: #endif sl@0: void SetClampFlag(TBool aClamped); sl@0: TBool ClampFlag(); sl@0: inline void Lock(); sl@0: inline void UnLock(); sl@0: void MultiSlotDriveCheck(); sl@0: sl@0: TInt RequestFreeSpaceOnMount(TUint64 aFreeSpaceRequired); sl@0: TInt MountedVolumeSize(TUint64& aSize); sl@0: sl@0: TBool ReMount(CMountCB& aMount); sl@0: sl@0: private: sl@0: sl@0: void DoMountFileSystemL(CMountCB*& apMount, TBool aForceMount, TUint32 aFsNameHash); sl@0: sl@0: void SetVolumeL(const TDesC& aName,HBufC*& aBuf); sl@0: void DirOpenL(CSessionFs* aSession,TInt& aHandle,const TDesC& aName,TUint anAtt,const TUidType& aUidType,CDirCB*& aDir); sl@0: void FileOpenL(CFsRequest* aRequest,TInt& aHandle,const TDesC& aName,TUint aMode,TFileOpen anOpen,CFileCB*& aFileCB,CFileShare*& aFileShare); sl@0: TInt CheckMountAndEntryNames(const TDesC& anOldName,const TDesC& aNewName); sl@0: CFileCB* LocateFileByPath(const TDesC& aPath); sl@0: TInt CheckDirectories(const TDesC& anOldName,const TDesC& aNewName); sl@0: void DoEntryL(const TDesC& aName,TEntry& anEntry); sl@0: void ReadSectionL(const TDesC& aName,TInt64 aPos,TAny* aTrg,TInt aLength,const RMessagePtr2& aMessage); sl@0: TInt ValidateShare(CFileCB& aFile,TShare aReqShare); sl@0: TInt CheckAttributes(const TDesC& aName,TUint& aSetAttMask,TUint& aClearAttMask); sl@0: TBool IsExtensionMounted(CProxyDriveFactory* aFactory); sl@0: CFileCB* LocateFile(const TDesC& aName); sl@0: CFileCache* LocateClosedFile(const TDesC& aName, TBool aResurrect = ETrue); sl@0: TBool ReMount(); sl@0: IMPORT_C TBool IsDriveThread() const; sl@0: IMPORT_C TBool IsMainThread() const; sl@0: IMPORT_C void DriveFault(TBool aDriveError) const; sl@0: void DoDismount(); sl@0: void DoCompleteDismountNotify(TInt aCompletionCode); sl@0: sl@0: private: sl@0: sl@0: //-- intrinsic TDrive flags. Used in iDriveFlags. sl@0: enum sl@0: { sl@0: ENotifyOff = 0x01, sl@0: EDismountDeferred= 0x02, sl@0: ENotRugged = 0x04, sl@0: EClampPresent = 0x08, sl@0: EDriveIsSynch = 0x10, //-- is set on mount when the drive is synchronous (doesn't have its own thread) sl@0: }; sl@0: sl@0: private: sl@0: TInt iDriveNumber; sl@0: TUint iAtt; sl@0: TBool iChanged; sl@0: TInt iReason; sl@0: TInt iMountNumber; sl@0: CFileSystem* iFSys; sl@0: CMountCB* iCurrentMount; sl@0: TDrive* iSubstedDrive; sl@0: HBufC* iSubst; sl@0: CFsObjectCon* iMount; sl@0: RFastLock iLock; sl@0: TDriveExtInfo iExtInfo; sl@0: TInt iDriveFlags; ///< intrinsic TDrive flags sl@0: TInt iReservedSpace; sl@0: TInt iDismountLock; sl@0: TInt iMountFailures; // number of times the mount has failed sl@0: TInt iLastMountError; sl@0: sl@0: TInt iSpare1; sl@0: TInt iSpare2; sl@0: sl@0: sl@0: friend class LocalDrives; // for access to iChanged flag sl@0: friend class CExtNotifyMediaChange; // for access to iChanged flag sl@0: }; sl@0: sl@0: class CFileCB; sl@0: class CDirCB; sl@0: sl@0: __ASSERT_COMPILE(sizeof(TVolFormatParam) != sizeof(TLDFormatInfo)); sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: A file server interface class representing a mount. sl@0: sl@0: An instance of this object is referred to as a mount control block. sl@0: sl@0: A mount control block needs to be created for a specific volume (partition) on sl@0: a drive in order to be able to access that volume. Volumes may be permanent sl@0: or represent removable media. Note that removable media may also be mounted directly onto sl@0: a device with no drive. Volumes can be formatted, unlike drives. sl@0: sl@0: The volume represented is either a currently mounted volume in the system or, sl@0: in the case of removable volumes, a volume that has been removed but still has sl@0: subsession objects open. sl@0: sl@0: A plug-in file system implements this class. sl@0: */ sl@0: class CMountCB : public CFsDispatchObject sl@0: { sl@0: public: sl@0: IMPORT_C CMountCB(); sl@0: IMPORT_C ~CMountCB(); sl@0: IMPORT_C TBool operator!=(const CMountCB& aMount) const; sl@0: IMPORT_C TBool MatchEntryAtt(TUint anAtt,TUint aMatt) const; sl@0: IMPORT_C void SetDiskSpaceChange(TInt64 aFreeDiskSpace); sl@0: IMPORT_C void InitL(TDrive& aDrive, CFileSystem* apFileSystem); sl@0: sl@0: inline TDrive& Drive() const; sl@0: inline void SetDrive(TDrive* aDrive); sl@0: inline HBufC& VolumeName() const; sl@0: inline void SetVolumeName(HBufC* aName); sl@0: inline TBool GetNotifyUser() const; sl@0: inline void SetNotifyOn(); sl@0: inline void SetNotifyOff(); sl@0: inline void IncLock(); sl@0: inline void DecLock(); sl@0: inline TInt LockStatus() const; sl@0: inline TBool IsCurrentMount() const; sl@0: inline TBool Locked() const; sl@0: inline TInt64 Size() const; sl@0: inline TInt LocalDrive(TBusLocalDrive*& aLocalDrive); sl@0: inline TInt ProxyDrive(CProxyDrive*& aProxyDrive); sl@0: inline TInt LocalBufferSupport(CFileCB* aFile = NULL); sl@0: inline TInt AddToCompositeMount(TInt aMountIndex); sl@0: sl@0: // Pure virtual sl@0: sl@0: /** sl@0: Attempts to set the mount control block properties using sl@0: the current mount (i.e. volume) on the associated drive. sl@0: sl@0: The function should set the volume name (iVolumeName), sl@0: the unique ID (iUniqueID) and the volume size (iSize) sl@0: by reading and processing the current mount. sl@0: sl@0: When aForceMount is set to ETrue, the properties of a corrupt volume should sl@0: be forcibly stored. The classic case of when this is desirable is when sl@0: a corrupt volume needs to be formatted. sl@0: sl@0: The function should leave, on error detection, with an appropriate error code. sl@0: sl@0: @param aForceMount Indicates whether the properties of a corrupt sl@0: volume should be stored. sl@0: sl@0: @leave KErrCorrupt The properties of the current mount on the drive were sl@0: not successfully mounted due to corruption of volume information, sl@0: assuming that aForceMount is not set. sl@0: */ sl@0: virtual void MountL(TBool aForceMount) =0; sl@0: sl@0: sl@0: /** sl@0: Checks whether the mount control block represents the current mount on sl@0: the associated drive. sl@0: sl@0: The function should read mount information from the current volume, sl@0: and check it against the mount information from this mount - typically sl@0: iVolumeName and iUniqueID. If the mount information matches, the function sl@0: should return KErrNone, otherwise it should return KErrGeneral. sl@0: sl@0: Called by the associated TDrive object when the drive has no current mounts, sl@0: which is the case on first access to the drive and following a volume sl@0: change on a drive associated with removable media. In this circumstance, sl@0: this function is called systematically on every mount control block owned sl@0: by the drive. If ReMount() calls for all existing mount sl@0: control blocks fail, the drive creates a new mount control block and calls sl@0: CMountCB::MountL() on that object; the new object is added to the list of sl@0: mount control blocks owned by the drive. sl@0: sl@0: @return KErrNone if the mount represented by this object is found to be sl@0: the current mount; sl@0: KErrGeneral if this object is found not to represent sl@0: the current mount; sl@0: otherwise one of the other sytem wide error codes. sl@0: */ sl@0: virtual TInt ReMount() =0; sl@0: sl@0: sl@0: /** sl@0: Carries out any clean-up necessary for a volume dismount. sl@0: sl@0: Dismounting a volume will always succeed, so the function does not need sl@0: to return an error value. Any cached information should be discarded and no sl@0: attempt should be made to access the volume. For removable media it may be sl@0: that the media has already been removed. This function is called when sl@0: a media change is detected. sl@0: */ sl@0: virtual void Dismounted() =0; sl@0: sl@0: sl@0: /** sl@0: Gets volume information. sl@0: sl@0: The only information that the function has to supply is the free space, sl@0: TVolumeInfo::iFree, since the remaining members have already been set by sl@0: the calling function. sl@0: sl@0: The function should leave, on error detection, with sl@0: an appropriate error code. sl@0: sl@0: @param aVolume On return, a reference to the filled volume sl@0: information object. sl@0: */ sl@0: virtual void VolumeL(TVolumeInfo& aVolume) const =0; sl@0: sl@0: sl@0: /** sl@0: Sets the volume name for the mount, thus writing the new volume name sl@0: to the corresponding volume. sl@0: sl@0: This function should leave on error detection. sl@0: sl@0: @param aName A reference to a descriptor containing the new volume name. sl@0: sl@0: @leave KErrBadName If the specified volume name is longer than the maximum sl@0: allowed length for a volume name sl@0: */ sl@0: virtual void SetVolumeL(TDes& aName) =0; sl@0: sl@0: sl@0: /** sl@0: Creates a new directory on the mount. sl@0: sl@0: The directory to be created is identified through its full name in aName. sl@0: The full name is in the form: sl@0: @code sl@0: \\dirA\\dirB\\dirC\\dirD sl@0: @endcode sl@0: where dirD is the new directory to be created in \\dirA\\dirB\\dirC\\. sl@0: This means that dirC is the leaf directory in which dirD will be created. sl@0: sl@0: The function should leave, on error detection, with an appropriate sl@0: error code. sl@0: sl@0: @param aName A reference to a descriptor containing the full name of sl@0: the directory to be created. sl@0: sl@0: @leave KErrPathNotFound Part of the path in aName does not exist. sl@0: @leave KErrAlreadyExists dirD already exists in \\dirA\\dirB\\dirC\\ sl@0: @leave KErrAccessDenied dirD already exists but is not a directory. sl@0: @leave KErrDirFull There is no room in \\dirA\\dirB\\dirC\\ for the new entry, sl@0: which is especially applicable to the root directory. sl@0: */ sl@0: virtual void MkDirL(const TDesC& aName) =0; sl@0: sl@0: sl@0: /** sl@0: Removes the directory specified by aName (its full name) from the volume. sl@0: sl@0: The directory specified by aName is in the form: sl@0: @code sl@0: \\dirA\\dirB\\dirC\\dirD sl@0: @endcode sl@0: where dirD is the directory to be removed from \\dirA\\dirB\\dirC\\. sl@0: This means that dirC is the leaf directory from which dirD should be removed. sl@0: sl@0: The function can assume that the directory exists and is not read-only. sl@0: sl@0: The function should leave with a suitable error code if it cannot complete sl@0: successfully for any reason. sl@0: sl@0: @param aName A reference to a descriptor containing the full name of sl@0: the directory to be removed. sl@0: sl@0: @leave KErrInUse dirD contains entries other than the parent (..) sl@0: and current (.) entries. sl@0: */ sl@0: virtual void RmDirL(const TDesC& aName) =0; sl@0: sl@0: sl@0: /** sl@0: Deletes the specified file from the mount. sl@0: sl@0: The function can assume that the file is closed. sl@0: sl@0: The file name specified by aName is of the form: sl@0: @code sl@0: \\dirA\\dirB\\dirC\\file.ext sl@0: @endcode sl@0: sl@0: The extension is optional. sl@0: sl@0: The function should leave on error detection, with sl@0: an appropriate error code. sl@0: sl@0: @param aName A reference to a descriptor containing the full path name sl@0: of the file that will be removed. sl@0: sl@0: @leave KErrAccessDenied aName specifies a file whose attributes state that sl@0: the file is read-only or aName specifies a directory. sl@0: */ sl@0: virtual void DeleteL(const TDesC& aName) =0; sl@0: sl@0: sl@0: /** sl@0: Renames or moves a single file or directory on the mount. sl@0: sl@0: It can be used to move a file or directory since both sl@0: anOldName and anNewName specify the respective entries with full names; sl@0: for example, sl@0: @code sl@0: \\dirA\\dirB\\dirC\\oldEntryName sl@0: @endcode sl@0: sl@0: and sl@0: sl@0: @code sl@0: \\dirE\\dirF\\dirG\\newEntryName sl@0: @endcode sl@0: sl@0: If oldEntryName is a file, it can be assumed that it is closed. sl@0: If oldEntryName is a directory, it can be assumed that there are no sl@0: open files in this directory. Furthermore, if newEntryName specifies sl@0: a directory, it can be assumed that it is not a subdirectory of oldEntryName. sl@0: sl@0: The function should leave with an appropriate error code if it cannot sl@0: complete successfully for any reason. sl@0: sl@0: @param anOldName A reference to a descriptor containing the full entry sl@0: name of the entry to be renamed. sl@0: sl@0: @param anNewName A reference to a descriptor containing the new full entry sl@0: name for the entry to be renamed. sl@0: sl@0: @leave KErrAlreadyExists The new entry already exists. sl@0: */ sl@0: virtual void RenameL(const TDesC& anOldName,const TDesC& anNewName) =0; sl@0: sl@0: sl@0: /** sl@0: Replaces one file on the mount with another. sl@0: sl@0: The function can assume that both anOldName and, if it exists, anNewName sl@0: contain the full file names of files, and that these files are not open. sl@0: sl@0: If the file aNewName does not exist it should be created. sl@0: sl@0: The file anOldName should have its contents, attributes, and the universal sl@0: date and time of its last modification, copied to the file aNewName, sl@0: overwriting any existing contents and attribute details. sl@0: Finally anOldName should be deleted. sl@0: sl@0: The function should leave with an appropriate error code if it cannot sl@0: complete successfully for any reason. sl@0: sl@0: @param anOldName A reference to a descriptor containing the full file name sl@0: of the file to replace the file specified by anNewName sl@0: @param anNewName A reference to a descriptor containing the new full file sl@0: name for the entry to be replaced. sl@0: */ sl@0: virtual void ReplaceL(const TDesC& anOldName,const TDesC& anNewName) =0; sl@0: sl@0: sl@0: /** sl@0: Gets the entry details for the specified file or directory. sl@0: sl@0: anEntry should be filled with details from the file or directory with the sl@0: full name aName. aName is of the form sl@0: @code sl@0: \\dirA\\dirB\\dirC\\entry. sl@0: @endcode sl@0: sl@0: Note that anEntry.iType (the entry UID) should only be set for a file whose sl@0: size is greater than or equal to sizeof(TCheckedUid). sl@0: sl@0: The function should leave with an appropriate error code if it cannot sl@0: complete successfully for any reason. sl@0: sl@0: @param aName A reference to a descriptor containing the full name of sl@0: the entry whose details are required. sl@0: @param anEntry On return, a reference to the filled entry object. sl@0: sl@0: @leave KErrPathNotFound The entry, aName, cannot be found. sl@0: */ sl@0: virtual void EntryL(const TDesC& aName,TEntry& anEntry) const =0; sl@0: sl@0: sl@0: /** sl@0: Sets entry details for a specified file or directory. sl@0: sl@0: The entry identfied by the full name descriptor aName should have sl@0: its modification time and its attributes mask updated as required. sl@0: sl@0: The entry receives a new universal modified time from aTime. sl@0: The entry attributes are set with aSetAttMask and cleared sl@0: with aClearAttMask: sl@0: the bits that are set in aSetAttMask should be set sl@0: in the entry attribute mask; sl@0: the bits that are set in aClearAttMask sl@0: should be cleared from the entry attribute mask. sl@0: sl@0: The function can assume that aSetAttMask and aClearAttMask do not change sl@0: the type of attribute (i.e. volume or directory). Furthermore, if aName sl@0: specifies a file, it can be assumed that this file is closed. sl@0: sl@0: The function should leave with an appropriate error code on error detection. sl@0: sl@0: @param aName A reference to a descriptor containing the full name of sl@0: the entry to be updated. sl@0: @param aTime A reference to the time object holding the new universal sl@0: modified time for aName. sl@0: @param aSetAttMask Attribute mask for setting the entry's attributes. sl@0: @param aClearAttMask Attribute mask for clearing the entry's attributes. sl@0: */ sl@0: virtual void SetEntryL(const TDesC& aName,const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask) =0; sl@0: sl@0: sl@0: /** sl@0: Customises the opening of a new or existing file on the mount. sl@0: sl@0: The function is called internally (via TDrive::FileOpen()) as a result of sl@0: a call by the client, and the file is created, if necessary, and opened by sl@0: the calling function. However this function implements any replacement sl@0: functionality, as well as any other behaviour particular to the file system. sl@0: sl@0: If anOpen specifies EFileReplace (rather than EFileCreate or EFileOpen) then, sl@0: if replacement functionality is required, the data contained in the file sl@0: should be discarded, the archive attribute should be set, and the size of sl@0: the file should be set to zero. Note that it can be assumed that if anOpen sl@0: specifies EFileReplace then the file already exists. sl@0: sl@0: After successful completion of the function, the file control block pointer sl@0: will be added to the file server's global files container. sl@0: sl@0: The function should leave with a suitable error code if it cannot be completed sl@0: successfully. sl@0: sl@0: @param aName The full name of the file that will be opened. sl@0: @param aMode The file share mode. The following share modes are available: sl@0: EFileShareExclusive; sl@0: EFileShareReadersOnly; sl@0: EFileShareAny; sl@0: EFileShareReadersOrWriters; sl@0: EFileStream; sl@0: EFileStreamText; sl@0: EFileRead; sl@0: EFileWrite. sl@0: @param anOpen IndicatES how the file will be opened. It can be one of sl@0: the following: sl@0: EFileOpen; sl@0: EFileCreate; sl@0: EFileReplace. sl@0: @param aFile Pointer to the file control block which will, on success, sl@0: represent the open file. sl@0: sl@0: @leave KErrAccessDenied aName may specify a directory, or the function may sl@0: be attempting to open a file on a ROM drive. sl@0: */ sl@0: virtual void FileOpenL(const TDesC& aName,TUint aMode,TFileOpen anOpen,CFileCB* aFile) =0; sl@0: sl@0: sl@0: /** sl@0: Customises the opening of a directory on the mount. sl@0: sl@0: The function is called internally, and the directory will have been created sl@0: and initialised by the calling function. Any customisation specific to sl@0: a file system should be implemented in this function. sl@0: sl@0: Note that aName is of the form sl@0: @code sl@0: \\dirA\\dirB\\dirC\\file.ext sl@0: @endcode sl@0: sl@0: where \\dirA\\dirB\\dirC\\ is the directory to be opened and file.ext is sl@0: an optional entry name and extension. sl@0: sl@0: After successful completion of the function, the directory control block sl@0: pointer will be added to the file server global directories container. sl@0: sl@0: The function should leave with a suitable error code if it cannot complete sl@0: successfully for any reason. sl@0: sl@0: @param aName A reference to a descriptor containing the full name of sl@0: the directory that will be opened. sl@0: @param aDir Points to a directory control block which will, on success, sl@0: represent the open directory. sl@0: */ sl@0: virtual void DirOpenL(const TDesC& aName,CDirCB* aDir) =0; sl@0: sl@0: sl@0: /** sl@0: Reads the specified length of data from the specified position on sl@0: the volume directly into the client thread. sl@0: sl@0: It can be assumed that if this function is called, sl@0: then there has been a successful mount. sl@0: sl@0: This function should leave with an appropriate error code when sl@0: an error is detected. sl@0: sl@0: @param aPos Start position in the volume for the read operation, sl@0: in bytes. sl@0: @param aLength The number of bytes to be read. sl@0: @param aTrg A pointer to the buffer into which data is to be read. sl@0: @param anOffset The offset at which to start adding data to the read buffer. sl@0: @param aMessage sl@0: */ sl@0: virtual void RawReadL(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt anOffset,const RMessagePtr2& aMessage) const = 0; sl@0: sl@0: sl@0: /** sl@0: Writes a specified length of data from the client thread to the volume sl@0: at the specified position. sl@0: sl@0: It can be assumed that if this function is called, then there has been sl@0: a successful mount. sl@0: sl@0: This function should leave with an appropriate error code when sl@0: an error is detected. sl@0: sl@0: @param aPos Start position in the volume for the write operation, sl@0: in bytes. sl@0: @param aLength The number of bytes to be written. sl@0: @param aSrc Pointer to the buffer from which data will be written. sl@0: @param anOffset The offset in the buffer at which to start writing data. sl@0: @param aMessage sl@0: */ sl@0: virtual void RawWriteL(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt anOffset,const RMessagePtr2& aMessage) = 0; sl@0: sl@0: sl@0: /** sl@0: Gets the short name of the file or directory with the given full name. sl@0: sl@0: This function is used in circumstances where a file system mangles sl@0: Symbian OS natural names, in order to be able to store them on sl@0: a file system that is not entirely compatible. sl@0: sl@0: The function should leave with a suitable error code if it cannot complete sl@0: successfully for any reason. sl@0: sl@0: @param aLongName A reference to a descriptor containing the full name sl@0: of the entry. sl@0: @param aShortName On return, a reference to a descriptor containing sl@0: the short name of the entry. sl@0: sl@0: @leave KErrNotFound The entry specified by its long name cannot be found. sl@0: */ sl@0: virtual void GetShortNameL(const TDesC& aLongName,TDes& aShortName) = 0; sl@0: sl@0: sl@0: /** sl@0: Gets the long name of the file or directory associated with sl@0: the given short name. sl@0: sl@0: This function is used in circumstances where a file system mangles sl@0: Symbian OS natural names in order to be able to store them on sl@0: a file system that is not entirely compatible. sl@0: sl@0: The function should leave with a suitable error code if it cannot complete sl@0: successfully for any reason. sl@0: sl@0: @param aShorName A reference to a descriptor containing the short name sl@0: of the entry. sl@0: sl@0: @param aLongName On return, a reference to a descriptor containing sl@0: the long name of the entry. sl@0: sl@0: @leave KErrNotFound The entry specified by its short name cannot be found. sl@0: */ sl@0: virtual void GetLongNameL(const TDesC& aShorName,TDes& aLongName) = 0; sl@0: sl@0: sl@0: /** sl@0: Reads a specified section of the file, regardless of the file's lock state. sl@0: sl@0: The function should leave with a suitable error code if it cannot complete sl@0: successfully for any reason. sl@0: sl@0: @param aName A reference to a descriptor containing the full name of sl@0: the file to be read from sl@0: @param aPos The byte position to start reading from. sl@0: @param aTrg A pointer to the buffer into which data is to be read. sl@0: @param aLength The length of data to be read, in bytes. sl@0: @param aMessage sl@0: sl@0: @leave KErrEof aPos is past the end of the file. sl@0: */ sl@0: virtual void ReadSectionL(const TDesC& aName,TInt aPos,TAny* aTrg,TInt aLength,const RMessagePtr2& aMessage)=0; sl@0: sl@0: sl@0: /** sl@0: Checks the integrity of the file system on the volume and returns an appropriate error value. sl@0: The default implementation must be overridden by a derived class. sl@0: sl@0: @return KErrNone if the file system is stable; otherwise one of the other system wide error codes. sl@0: The default implementation returns KErrNotSupported. sl@0: */ sl@0: virtual TInt CheckDisk() {return(KErrNotSupported);} sl@0: sl@0: /** sl@0: The same as original CheckDisk(), but with some parameters. sl@0: */ sl@0: virtual TInt CheckDisk(TInt aOperation, TAny* aParam1=NULL, TAny* aParam2=NULL); sl@0: sl@0: sl@0: /** sl@0: Scans through and corrects errors found in the volume. sl@0: sl@0: The default implementation must be overridden by a derived class. sl@0: sl@0: @return KErrNone if no errors are found or all errors are corrected; otherwise one of the other system wide error codes. sl@0: The default implementation returns KErrNotSupported. sl@0: */ sl@0: virtual TInt ScanDrive() {return(KErrNotSupported);} sl@0: sl@0: /** sl@0: The same as original ScanDrive(), but with some parameters. sl@0: */ sl@0: virtual TInt ScanDrive(TInt aOperation, TAny* aParam1=NULL, TAny* aParam2=NULL); sl@0: sl@0: IMPORT_C virtual void IsFileInRom(const TDesC& aFileName,TUint8*& aFileStart); sl@0: sl@0: sl@0: /** sl@0: Low-level control IO sl@0: */ sl@0: virtual TInt ControlIO( const RMessagePtr2& /*aMessage*/,TInt /*aCommand*/,TAny* /*aParam1*/,TAny* /*aParam2*/) {return(KErrNotSupported);} sl@0: sl@0: sl@0: /** sl@0: Locks a media which supports password protection and replaces sl@0: the old password with a new one. sl@0: sl@0: If aStore is set to ETrue, then the new password should be saved to sl@0: the password store file, KMediaPWrdFile, using the exported file server sl@0: function WriteToDisk(). sl@0: sl@0: The password file is used to initialise the password store on boot up, sl@0: so the user does not need to be prompted for the password again if sl@0: it is saved here. sl@0: sl@0: The default implementation must be overridden in a derived class. sl@0: sl@0: @param aOld A reference to the old password. sl@0: @param aNew A reference to the new password. sl@0: @param aStore ETrue if the new password is to be saved to sl@0: the password file store; EFalse if not. sl@0: sl@0: @return KErrNone if successful; otherwise another of the system wide sl@0: error codes. The default implementation returns KErrNotSupported. sl@0: */ sl@0: virtual TInt Lock(TMediaPassword& /*aOld*/,TMediaPassword& /*aNew*/,TBool /*aStore*/) {return(KErrNotSupported);} sl@0: sl@0: sl@0: /** sl@0: Unlocks a media which supports password protection. sl@0: sl@0: If aStore is set to ETrue then the password should be saved to sl@0: the password store file specified by KMediaPWrdFile using the exported file sl@0: server function WriteToDisk(). sl@0: sl@0: The password file is used to initialise the password store on boot up, sl@0: so the user does not need to be prompted for the password again if sl@0: it is saved here. sl@0: sl@0: The default implementation must be overridden in a derived class. sl@0: sl@0: @param aPassword A reference to the password. sl@0: @param aStore ETrue if the password is to be saved to sl@0: the password store file; EFalse otherwise. sl@0: sl@0: @return KErrNone if successful; otherwise another of the system wide sl@0: error codes. The default implementation returns KErrNotSupported. sl@0: */ sl@0: virtual TInt Unlock(TMediaPassword& /*aPassword*/,TBool /*aStore*/) {return(KErrNotSupported);} sl@0: sl@0: sl@0: /** sl@0: Clears a password from a media that supports write protection. sl@0: sl@0: The default implementation must be overridden in a derived class. sl@0: sl@0: @param aPassword A reference to the password to be cleared. sl@0: sl@0: @return KErrNone if successful; otherwise another of the system wide sl@0: error codes. The default implementation returns KErrNotSupported. sl@0: */ sl@0: virtual TInt ClearPassword(TMediaPassword& /*aPassword*/) {return(KErrNotSupported);} sl@0: sl@0: sl@0: /** sl@0: */ sl@0: virtual TInt ForceRemountDrive(const TDesC8* /*aMountInfo*/,TInt /*aMountInfoMessageHandle*/,TUint /*aFlags*/) {return(KErrNotSupported);} sl@0: sl@0: sl@0: /** sl@0: Legacy method: finalise the mount and put it to the consistent state. sl@0: */ sl@0: virtual void FinaliseMountL() {return;} sl@0: sl@0: /** sl@0: finalise the mount and put it to the consistent state. sl@0: sl@0: @param aOperation describes finalisation operation, see RFs::TFinaliseDrvMode sl@0: @param aParam1 not used, for future expansion sl@0: @param aParam2 not used, for future expansion sl@0: */ sl@0: virtual void FinaliseMountL(TInt aOperation, TAny* aParam1=NULL, TAny* aParam2=NULL); sl@0: sl@0: sl@0: protected: sl@0: /** Mount Control levels or operations to perform */ sl@0: enum TMntCtlLevel sl@0: { sl@0: //-- reserved generic mount (CMountCB) control codes sl@0: sl@0: EMountStateQuery, ///< query mount state, see TMntCtlOption, ESQ_IsMountFinalised sl@0: EMountVolParamQuery, ///< mount-specific queries for volume parameters. See ESQ_RequestFreeSpace, ESQ_GetCurrentFreeSpace sl@0: ECheckFsMountable, ///< extended mount functionality, checks if this file system can be mounted on specified drive. See CheckFileSystemMountable() sl@0: sl@0: //-- starting from the next code someone may define some specific mount type control codes, like ESpecificMountCtl+17 sl@0: ESpecificMountCtl = 0x40000000, sl@0: sl@0: //-- starting from the next code someone may define some specific File System control codes sl@0: ESpecificFsCtl = 0x40001000, sl@0: sl@0: EMountFsParamQuery, ///< File System parameters queries; File System properties can be "static" i.e not requiring properly mounted volume. See ESpecificFsCtlOpt sl@0: sl@0: }; sl@0: sl@0: /** Mount Control options that makes sense only for certain control codes, see TMntCtlLevel */ sl@0: enum TMntCtlOption sl@0: { sl@0: //-- reserved generic mount (CMountCB) control options codes sl@0: sl@0: /** query if the mount is finalised, corresponds to the EMountStateQuery control code only. @see IsMountFinalised() */ sl@0: ESQ_IsMountFinalised, sl@0: sl@0: //----------------------------------------------------------------------------------------------------------------------------- sl@0: sl@0: //-- starting from the next code someone may define some specific mount type control options sl@0: ESpecificMountCtlOpt = 0x40000000, sl@0: sl@0: /** Corresponds to EMountVolParamQuery. Request a certain amount of free space on the volume. @see RequestFreeSpace() */ sl@0: ESQ_RequestFreeSpace, sl@0: sl@0: /** Corresponds to EMountVolParamQuery. A request to obtain the _current_ amount of free space on the volume asynchronously, without blocking. */ sl@0: ESQ_GetCurrentFreeSpace, sl@0: sl@0: /** Corresponds to EMountVolParamQuery. A request to obtain size of the mounted volume without blocking (CMountCB::VolumeL() can block). */ sl@0: ESQ_MountedVolumeSize, sl@0: sl@0: //----------------------------------------------------------------------------------------------------------------------------- sl@0: sl@0: //-- starting from the next code someone may define some specific File System control options sl@0: ESpecificFsCtlOpt = 0x40001000, sl@0: sl@0: /** Get Maximum file size, which is supported by the file system that has produced this mount. */ sl@0: ESQ_GetMaxSupportedFileSize, sl@0: sl@0: }; sl@0: sl@0: sl@0: public: sl@0: sl@0: /** sl@0: Generic mount control method. sl@0: @param aLevel specifies the operation to perfrom on the mount sl@0: @param aOption specific option for the given operation sl@0: @param aParam pointer to generic parameter, its meaning depends on aLevel and aOption sl@0: sl@0: @return standard error code. Default imlementation returns KErrNotSupported sl@0: */ sl@0: virtual TInt MountControl(TInt aLevel, TInt aOption, TAny* aParam); sl@0: sl@0: sl@0: /** sl@0: Erase a password from a media that supports write protection. sl@0: sl@0: The default implementation must be overridden in a derived class. sl@0: sl@0: @return KErrNone if successful; otherwise another of the system wide sl@0: error codes. The default implementation returns KErrNotSupported. sl@0: */ sl@0: virtual TInt ErasePassword() {return(KErrNotSupported);} sl@0: sl@0: /** sl@0: An interface class which may optionally be returned by a file system sl@0: by calling GetInterface(EFileAccessor, ...) sl@0: */ sl@0: class MFileAccessor sl@0: { sl@0: public: sl@0: virtual TInt GetFileUniqueId(const TDesC& aName, TInt64& aUniqueId) = 0; sl@0: virtual TInt Spare3(TInt aVal, TAny* aPtr1, TAny* aPtr2) = 0; sl@0: virtual TInt Spare2(TInt aVal, TAny* aPtr1, TAny* aPtr2) = 0; sl@0: virtual TInt Spare1(TInt aVal, TAny* aPtr1, TAny* aPtr2) = 0; sl@0: }; sl@0: sl@0: /** sl@0: @prototype sl@0: sl@0: CMountCB::MFileExtendedInterface interface provides extended interface for CMountCB to sl@0: read a specified section of large file (size greater than 2GB - 1). sl@0: sl@0: The interface could be retrieved by calling CMountCB::GetInterface() with sl@0: EFileExtendedInterface as an argument. sl@0: sl@0: Sub classes of CMountCB who does support large file access will need to multiple-inherit sl@0: with this class and implement the interface. The implementation of the interface will be sl@0: retrieved via GetInterface() and provided to user by non-virtual APIs to avoid breaking sl@0: binary compatibility. sl@0: sl@0: NOTE: Do not try to delete CMountCB::MFileExtendedInterface interface pointer! sl@0: sl@0: @see CMountCB::GetInterface() sl@0: */ sl@0: sl@0: class MFileExtendedInterface sl@0: { sl@0: public: sl@0: /** sl@0: Reads a specified section of the file, regardless of the file's lock state. sl@0: sl@0: The function should leave with a suitable error code if it cannot complete sl@0: successfully for any reason. sl@0: sl@0: This function should be implemented in file systems supporting files sl@0: of size greater than 2GB - 1. sl@0: sl@0: @param aName A reference to a descriptor containing the full name of sl@0: the file to be read from sl@0: @param aPos The byte position to start reading from. sl@0: @param aTrg A pointer to the buffer into which data is to be read. sl@0: @param aLength The length of data to be read, in bytes. sl@0: @param aMessage sl@0: sl@0: @leave KErrEof aPos is past the end of the file. sl@0: sl@0: @see CMountCB::ReadSectionL() sl@0: */ sl@0: virtual void ReadSection64L(const TDesC& aName, TInt64 aPos, TAny* aTrg, TInt aLength, const RMessagePtr2& aMessage) = 0; sl@0: }; sl@0: sl@0: /** sl@0: Enumeration of the aInterfaceIDs used in GetInterface. sl@0: */ sl@0: enum TInterfaceIds sl@0: { sl@0: EAddFsToCompositeMount = 0, sl@0: EGetLocalDrive = 1, sl@0: EFileAccessor = 2, sl@0: EGetFileSystemSubType = 3, sl@0: EGetClusterSize = 4, sl@0: ELocalBufferSupport = 5, sl@0: EAddToCompositeMount = 6, sl@0: EGetProxyDrive = 7, sl@0: EFileExtendedInterface = 8 sl@0: }; sl@0: sl@0: // File clamping support sl@0: TInt ClampFile(const TInt aDriveNo,const TDesC& aName,TAny* aHandle); sl@0: TInt UnclampFile(RFileClamp* aHandle); sl@0: IMPORT_C TInt IsFileClamped(const TInt64 aUniqueId); sl@0: TInt NoOfClamps(); sl@0: sl@0: // File accessor support sl@0: TInt GetFileUniqueId(const TDesC& aName, TInt64& aUniqueId); sl@0: TInt Spare3(TInt aVal, TAny* aPtr1, TAny* aPtr2); sl@0: TInt Spare2(TInt aVal, TAny* aPtr1, TAny* aPtr2); sl@0: TInt Spare1(TInt aVal, TAny* aPtr1, TAny* aPtr2); sl@0: sl@0: // Extensions of interface sl@0: TInt FileSystemSubType(TDes& aName); sl@0: TInt FileSystemClusterSize(); sl@0: void FileSystemName(TDes& aName); sl@0: sl@0: // Large file support sl@0: void ReadSection64L(const TDesC& aName,TInt64 aPos,TAny* aTrg,TInt aLength,const RMessagePtr2& aMessage); sl@0: sl@0: inline TInt CheckFileSystemMountable(); sl@0: inline TInt RequestFreeSpace(TUint64 &aFreeSpaceBytes); sl@0: inline TInt MountedVolumeSize(TUint64& aVolSizeBytes); sl@0: inline TInt GetCurrentFreeSpaceAvailable(TInt64 &aFreeSpaceBytes); sl@0: inline TInt IsMountFinalised(TBool &aFinalised); sl@0: inline TInt GetMaxSupportedFileSize(TUint64 &aSize); sl@0: sl@0: protected: sl@0: inline void SetMountNumber(TInt aMountNumber); sl@0: inline void SetDismounted(TBool aDismounted=ETrue); sl@0: inline TInt MountNumber() const; sl@0: inline TBool IsDismounted() const; sl@0: sl@0: void SetProxyDriveDismounted(); sl@0: TBool ProxyDriveDismounted(); sl@0: sl@0: IMPORT_C CFileSystem* FileSystem() const; sl@0: sl@0: /** sl@0: Return a pointer to a specified interface extension - to allow future extension of this class without breaking sl@0: binary compatibility. sl@0: @param aInterfaceId Interface identifier of the interface to be retrieved. sl@0: @param aInterface A reference to a pointer that retrieves the specified interface. sl@0: @param aInput An arbitrary input argument. sl@0: @return KErrNone If the interface is supported, KErrNotSupported otherwise. sl@0: */ sl@0: IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput); sl@0: sl@0: // calls GetInterface() with tracepoints added sl@0: TInt GetInterfaceTraced(TInt aInterfaceId,TAny*& aInterface,TAny* aInput); sl@0: sl@0: sl@0: sl@0: sl@0: private: sl@0: void SetFileSystem(CFileSystem* aFS); sl@0: sl@0: //-- these factory methods mus be used to produce objects representing files, directories etc. as soon as all these objects are sl@0: //-- associated with the mount, not the file sytem (file system is a factory for corresponding mounts) sl@0: //-- corresponding CFileSystem:: methods must not be used. sl@0: //-- CMountCB has a reference to the CFileSystem that produced it. sl@0: CFileCB* NewFileL() const; sl@0: CDirCB* NewDirL() const; sl@0: CFormatCB* NewFormatL() const; sl@0: sl@0: protected: sl@0: sl@0: TInt iMountNumber; ///< Unique mount number set by the TDrive object representing the drive on which the object resides. sl@0: TUint iUniqueID; ///< volume Unique ID. Set in MountL(). sl@0: TInt64 iSize; ///< Size of the volume. First set in MountL(). sl@0: sl@0: /** sl@0: A list of all open files on that mount. sl@0: Set by the TDrive object representing the drive of which the mount resides. sl@0: */ sl@0: TDblQue iMountQ; sl@0: sl@0: friend class TDrive; sl@0: friend class TFsAddCompositeMount; sl@0: sl@0: private: sl@0: TInt iLockMount; sl@0: TDrive* iDrive; sl@0: HBufC* iVolumeName; sl@0: CMountBody* iBody; ///< used for extending CMountCB functionality sl@0: }; sl@0: sl@0: sl@0: /** sl@0: @internalTechnology sl@0: sl@0: MFileSystemSubType interface provides extended interface for CMountCB to retrieve sub type sl@0: of mounted file systems. sl@0: sl@0: The interface could be retrieved by calling CMountCB::GetInterface() with EGetFileSystemSubType sl@0: as an argument. sl@0: sl@0: If the file system does not support sub types, MFileSystemSubType cannot be retieved. sl@0: Sub classes of CMountCB who does support sub types will need to multiple-inherit with sl@0: this class and implement the interface. The implementation of the interface will be sl@0: retrieved via GetInterface() and provided to user by non-virtual APIs to avoid breaking sl@0: binary compatibility. sl@0: sl@0: NOTE: Do not try to delete MFileSystemSubType interface pointer! sl@0: sl@0: @see CMountCB::GetInterface() sl@0: */ sl@0: class MFileSystemSubType sl@0: { sl@0: public: sl@0: /** sl@0: Retrieves file system's sub type name (E.g. FAT16), if the file system does not have sub sl@0: types (E.g. Rofs), return the file system's name. sl@0: @param aName Returned descriptor contains file system name or sub type name. sl@0: @return KErrNone if successful. sl@0: */ sl@0: virtual TInt SubType(TDes& aName) const = 0; sl@0: }; sl@0: sl@0: /** sl@0: @internalTechnology sl@0: sl@0: MFileSystemClusterSize interface provides extended interface for CMountCB to retrieve cluster size sl@0: of mounted file systems. sl@0: sl@0: The interface could be retrieved by calling CMountCB::GetInterface() with EGetClusterSize sl@0: as an argument. sl@0: sl@0: If the file system does not support clustering, MFileSystemClusterSize cannot be retieved. sl@0: Sub classes of CMountCB who does support clustering will need to multiple-inherit with sl@0: this class and implement the interface. The implementation of the interface will be sl@0: retrieved via GetInterface() and provided to user by non-virtual APIs to avoid breaking sl@0: binary compatibility. sl@0: sl@0: NOTE: Do not try to delete MFileSystemSubType interface pointer! sl@0: sl@0: @see CMountCB::GetInterface() sl@0: */ sl@0: class MFileSystemClusterSize sl@0: { sl@0: public: sl@0: /** sl@0: Retrieves file system's cluster size sl@0: @return None-zero cluster size if successful. sl@0: */ sl@0: virtual TInt ClusterSize() const = 0; sl@0: }; sl@0: sl@0: sl@0: class CFileShare; sl@0: sl@0: sl@0: sl@0: /** sl@0: @internalTechnology sl@0: */ sl@0: class TAsyncReadRequest sl@0: { sl@0: public: sl@0: TAsyncReadRequest(TInt64 aEndPos, CFileShare* aOwningShareP, CFsRequest* aRequestP); sl@0: TBool CompleteIfMatching(CFileShare* aOwningShareP, TRequestStatus* aStatusP, TInt aError); sl@0: private: sl@0: TAsyncReadRequest(); sl@0: public: sl@0: TInt64 iEndPos; // The request is completed file length >= iEndPos. sl@0: CFileShare* iOwningShareP; // The share that owns this outstanding request. sl@0: const TRequestStatus* iStatusP; // Used to identify the request when cancelling. sl@0: CSessionFs* iSessionP; // The owning session of the original request. sl@0: RMessage2 iMessage; // The message to be completed when data is available. sl@0: }; sl@0: sl@0: sl@0: /** sl@0: @internalTechnology sl@0: @released sl@0: sl@0: File share lock sl@0: sl@0: The lock specifies the lowest and highest position in the file to be locked. sl@0: Note that files may have many locks on it, but overlapping sections cannot be locked. sl@0: This is used by a file control block, a CFileCB object. sl@0: sl@0: @see CFileCB sl@0: */ sl@0: class TFileShareLock sl@0: { sl@0: public: sl@0: TFileShareLock(const CFileShare* aOwner, TUint64 aPosLow, TUint64 aPosHigh); sl@0: sl@0: sl@0: inline TUint64 PosLow() const; sl@0: inline TUint64 PosHigh() const; sl@0: inline TBool MatchOwner(const CFileShare* aShare) const; sl@0: sl@0: TBool MatchByPos(TUint64 aPosLow, TUint64 aPosHigh) const; sl@0: sl@0: private: sl@0: TFileShareLock(); sl@0: TFileShareLock(const TFileShareLock&); sl@0: TFileShareLock& operator=(const TFileShareLock&); sl@0: sl@0: private: sl@0: sl@0: const CFileShare* iOwner; /// TFileLocksArray; sl@0: sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: A file server interface class representing an open file. sl@0: sl@0: An instance of this object is referred to as a file control block. sl@0: sl@0: A file control block needs to be created for a specific file to be able to sl@0: access that file within a directory. sl@0: sl@0: A plug-in file system implements this class. sl@0: */ sl@0: class CFileCB : public CFsDispatchObject sl@0: { sl@0: public: sl@0: IMPORT_C CFileCB(); sl@0: IMPORT_C ~CFileCB(); sl@0: sl@0: IMPORT_C void InitL(TDrive* aDrive,TDrive* aCreatedDrive, HBufC* aName); sl@0: sl@0: inline void SetMount(CMountCB * aMount); sl@0: inline TDrive& Drive() const; sl@0: inline TDrive& CreatedDrive() const; sl@0: inline CMountCB& Mount() const; sl@0: inline HBufC& FileName() const; sl@0: inline HBufC& FileNameF() const; sl@0: inline TInt UniqueID() const; sl@0: TInt FindLock(TInt aPosLow,TInt aPosHigh); sl@0: TInt AddLock(CFileShare* aFileShare,TInt aPos,TInt aLength); sl@0: TInt RemoveLock(CFileShare* aFileShare,TInt aPos,TInt aLength); sl@0: TInt CheckLock(CFileShare* aFileShare,TInt aPos,TInt aLength); sl@0: void RemoveLocks(CFileShare* aFileShare); sl@0: inline TShare Share() const; sl@0: inline void SetShare(TShare aShare); sl@0: inline TInt Size() const; sl@0: inline void SetSize(TInt aSize); sl@0: inline TInt Att() const; sl@0: inline void SetAtt(TInt aAtt); sl@0: inline TTime Modified() const; sl@0: inline void SetModified(TTime aModified); sl@0: inline TBool FileCorrupt() const; sl@0: inline void SetFileCorrupt(TBool aFileCorrupt); sl@0: inline TBool BadPower() const; sl@0: inline void SetBadPower(TBool aBadPower); sl@0: inline TUint32 NameHash() const; sl@0: TInt CheckMount(); sl@0: inline TInt BlockMap(SBlockMapInfo& aInfo, TInt64& aStartPos, TInt64 aEndPos=-1); sl@0: inline TInt LocalDrive(TBusLocalDrive*& aLocalDrive); sl@0: sl@0: TBool LocalBufferSupport() const; sl@0: void SetLocalBufferSupport(TBool aEnabled); sl@0: sl@0: /** File caching support methods */ sl@0: sl@0: CFileCache* FileCache() const; sl@0: TInt FairSchedulingLen() const; sl@0: void ResetReadAhead(); sl@0: sl@0: void SetDeleteOnClose(); sl@0: TBool DeleteOnClose() const; sl@0: sl@0: sl@0: sl@0: void SetNotifyAsyncReadersPending(TBool aNotifyAsyncReadersPending); sl@0: TBool NotifyAsyncReadersPending() const; sl@0: TInt CancelAsyncReadRequest(CFileShare* aShareP, TRequestStatus* aStatusP); sl@0: sl@0: /** Extended API support methods */ sl@0: sl@0: TBool ExtendedFileInterfaceSupported(); sl@0: void ReadL(TInt64 aPos,TInt& aLength,TDes8* aDes,const RMessagePtr2& aMessage, TInt aOffset); sl@0: void WriteL(TInt64 aPos,TInt& aLength,const TDesC8* aDes,const RMessagePtr2& aMessage, TInt aOffset); sl@0: void SetSizeL(TInt64 aSize); sl@0: sl@0: IMPORT_C TInt64 Size64() const; sl@0: IMPORT_C void SetSize64(TInt64 aSize, TBool aDriveLocked); sl@0: IMPORT_C void SetMaxSupportedSize(TUint64 aMaxFileSize); sl@0: sl@0: sl@0: TInt64 CachedSize64() const; sl@0: void SetCachedSize64(TInt64 aSize); sl@0: TInt FindLock64(TInt64 aPosLow,TInt64 aPosHigh); sl@0: TInt AddLock64(CFileShare* aFileShare,TInt64 aPos,TInt64 aLength); sl@0: TInt RemoveLock64(CFileShare* aFileShare,TInt64 aPos,TInt64 aLength); sl@0: TInt CheckLock64(CFileShare* aFileShare,TInt64 aPos,TInt64 aLength); sl@0: sl@0: /** sl@0: Renames the file with the full file name provided. sl@0: sl@0: Because the full name of the file includes the path, the function can sl@0: also be used to move the file. sl@0: sl@0: It can be assumed that no other sub-session has access to the file: sl@0: i.e. the file has not been opened in EFileShareAny share mode. sl@0: It can also be assumed that the file has been opened for writing. sl@0: sl@0: The function should leave with KErrAlreadyExists if aNewName already exists. sl@0: An appropriate error code should also be generated if the function leaves sl@0: before completion for any other reason. sl@0: sl@0: @param aNewName The new full name of the file. sl@0: sl@0: @see CFileCB::iFileName sl@0: */ sl@0: virtual void RenameL(const TDesC& aNewName) =0; sl@0: sl@0: sl@0: /** sl@0: Reads a specified number of bytes from the open file starting at sl@0: the specified postition, and writes the result into a descriptor. sl@0: sl@0: It can be assumed that aPos is inside the file and aLength > 0. sl@0: The file should only be read up to its end regardless of sl@0: the value of aPos + aLength. The number of bytes read should be stored sl@0: in aLength on return. sl@0: sl@0: If the function leaves before completion for any reason it should generate sl@0: an appropriate error code, and in this situation, sl@0: the arguments are not valid on return. sl@0: sl@0: @param aPos Represents a position relative to the start of the file sl@0: where ReadL() should start to read. sl@0: @param aLength On entry, specifies the number of bytes to be read sl@0: from the file. On return, this should contain the number sl@0: of bytes read, but this is not valid if the function leaves. sl@0: @param aDes Pointer to a descriptor into which the data should be written. sl@0: @param aMessage sl@0: */ sl@0: virtual void ReadL(TInt aPos,TInt& aLength,const TAny* aDes,const RMessagePtr2& aMessage) =0; sl@0: sl@0: sl@0: /** sl@0: Writes data to the open file. sl@0: sl@0: iModified and iSize are set by the file server after this function sl@0: has completed successfully. sl@0: sl@0: It can be assumed that aPos is within the file range and aLength > 0. sl@0: When aPos + aLength is greater than the file size then the file should sl@0: be enlarged using SetSizeL(). The number of bytes written should be sl@0: returned through the argument aLength. sl@0: sl@0: If the function leaves before completion for any reason it should generate sl@0: an appropriate error code, and in this situation the arguments are sl@0: not valid on return. sl@0: sl@0: @param aPos Represents a position relative to the start of the file sl@0: where WriteL() should start to write. sl@0: @param aLength Specifies the number of bytes to be written to the file. sl@0: On return, the number of bytes written, but this is not sl@0: valid if the function leaves. sl@0: @param aDes Pointer to a descriptor containing the data to be written sl@0: to the file. sl@0: @param aMessage sl@0: sl@0: @see CFileCB::iModified sl@0: @see CFileCB::iSize sl@0: @see CFileCB::SetSizeL sl@0: sl@0: @leave KErrDiskFull The operation cannot be completed because the disk is full. sl@0: */ sl@0: virtual void WriteL(TInt aPos,TInt& aLength,const TAny* aDes,const RMessagePtr2& aMessage) =0; sl@0: sl@0: sl@0: /** sl@0: Extends or truncates the file by re-setting the file size. sl@0: sl@0: The function should not change iModified and iSize attributes of sl@0: the file object: this is done by the file server. sl@0: If the file is extended, nothing should be written in the extended area. sl@0: sl@0: The function should leave with a suitable error code on error detection. sl@0: sl@0: @param aSize The new file size in number of bytes. sl@0: sl@0: @leave KErrDiskFull The operation cannot be completed because the disk is full. sl@0: sl@0: @see CFileCB::iModified sl@0: @see CFileCB::iSize sl@0: */ sl@0: virtual void SetSizeL(TInt aSize) =0; sl@0: sl@0: sl@0: /** sl@0: Sets the attribute mask, iAtt, and the modified time of the file, iModified. sl@0: sl@0: If aMask|aVal does not equal zero, then aMask should be OR'ed with iAtt, sl@0: whilst the inverse of aVal should be AND'ed with iAtt. sl@0: If the modified flag is set in aMask then iModified should be set to aTime. sl@0: sl@0: The function should leave with a suitable error code on error detection. sl@0: sl@0: @param aTime The new modified time, if the modified flag is set in aMask. sl@0: @param aMask Bit mask containing bits set (to 1) that are to be set (to 1) sl@0: in iAtt. sl@0: @param aVal Bitmask containing bits set (to 1) that are to be unset (to 0) sl@0: in iAtt. sl@0: sl@0: @see CFileCB::iModified sl@0: @see CFileCB::iAtt sl@0: */ sl@0: virtual void SetEntryL(const TTime& aTime,TUint aMask,TUint aVal) =0; sl@0: sl@0: sl@0: /** sl@0: Flushes, to disk, the cached information necessary for the integrity sl@0: of recently written data, such as the file size. sl@0: sl@0: The function should leave with a suitable error code on error detection. sl@0: */ sl@0: virtual void FlushDataL() =0; sl@0: sl@0: sl@0: /** sl@0: Flushes, to disk, all cached file data (e.g. attributes, modification time, sl@0: file size). sl@0: sl@0: The modified bit in the file attributes mask should be cleared if sl@0: the flush was successful. sl@0: sl@0: The function should leave with a suitable error code on error detection. sl@0: */ sl@0: virtual void FlushAllL() =0; sl@0: IMPORT_C virtual TInt Address(TInt& aPos) const; sl@0: IMPORT_C void SetArchiveAttribute(); sl@0: sl@0: /** sl@0: Block Map API interface sl@0: */ sl@0: class MBlockMapInterface sl@0: { sl@0: public: sl@0: virtual TInt BlockMap(SBlockMapInfo& aInfo, TInt64& aStartPos, TInt64 aEndPos)=0; sl@0: }; sl@0: sl@0: /** sl@0: An interface class which may optionally be returned by a file system sl@0: by calling GetInterface(EExtendedFileInterface, ...) sl@0: The purpose of this interface is twofold: sl@0: - to support fair scheduling (by use of the aOffset parameter) sl@0: - to enable large file support sl@0: */ sl@0: class MExtendedFileInterface sl@0: { sl@0: public: sl@0: /** sl@0: Functionally equivalent to CFileCB::ReadL(), but supports large files and fair scheduling sl@0: sl@0: Reads a specified number of bytes from the open file starting at sl@0: the specified postition, and writes the result into a descriptor. sl@0: sl@0: @param aPos Represents a position relative to the start of the file sl@0: where ReadL() should start to read. sl@0: Note that the filesystem may not support positions above KMaxTInt, sl@0: in which case it leaves with KErrNotSupported. sl@0: @param aLength On entry, specifies the number of bytes to be read sl@0: from the file. On return, this contains the number sl@0: of bytes read, this value is not valid if the function leaves. sl@0: @param aDes Pointer to a descriptor into which the data is written. sl@0: @param aMessage A reference to a client message or an RLocalMessage. sl@0: @param aOffset The offset into the descriptor where the data is to be written. sl@0: This is non-zero if the read was fair-scheduled sl@0: sl@0: @see CFileCB::ReadL sl@0: @see RLocalMessage sl@0: */ sl@0: virtual void ReadL(TInt64 aPos,TInt& aLength,TDes8* aDes,const RMessagePtr2& aMessage, TInt aOffset) = 0; sl@0: sl@0: /** sl@0: Functionally equivalent to CFileCB::WriteL(), but supports large files and fair scheduling sl@0: sl@0: Writes data to the open file. sl@0: sl@0: @param aPos Represents a position relative to the start of the file sl@0: where WriteL() starts to write. sl@0: Note that the filesystem may not support positions above KMaxTInt, sl@0: in which case it leaves with KErrNotSupported. sl@0: @param aLength Specifies the number of bytes to be written to the file. sl@0: On return this is the number of bytes written, this value is not sl@0: valid if the function leaves. sl@0: @param aDes Pointer to a descriptor containing the data to be written sl@0: to the file. sl@0: @param aMessage A reference to a client message or an RLocalMessage sl@0: @param aOffset The offset into the descriptor where the data is to be read from. sl@0: This is non-zero if the read was fair-scheduled sl@0: sl@0: @see CFileCB::WriteL sl@0: @see RLocalMessage sl@0: */ sl@0: virtual void WriteL(TInt64 aPos,TInt& aLength,const TDesC8* aDes,const RMessagePtr2& aMessage, TInt aOffset) = 0; sl@0: sl@0: /** sl@0: Functionally equivalent to CFileCB::SetSizeL(), but supports large files sl@0: sl@0: Extends or truncates the file by re-setting the file size. sl@0: sl@0: The function does not change the iModified and iSize attributes of sl@0: the file object: this is done by the file server. sl@0: If the file is extended, nothing is written in the extended area. sl@0: sl@0: The function leaves with a suitable error code when an error is to detected. sl@0: sl@0: @param aSize The new file size in bytes. sl@0: sl@0: @leave KErrDiskFull The operation cannot be completed because the disk is full. sl@0: sl@0: @see CFileCB::SetSizeL sl@0: @see CFileCB::iModified sl@0: @see CFileCB::iSize sl@0: */ sl@0: virtual void SetSizeL(TInt64 aSize) = 0; sl@0: }; sl@0: sl@0: sl@0: protected: sl@0: sl@0: /** sl@0: Return a pointer to a specified interface extension - to allow future extension of this class without breaking sl@0: binary compatibility. sl@0: @param aInterfaceId Interface identifier of the interface to be retrieved. sl@0: @param aInterface A reference to a pointer that retrieves the specified interface. sl@0: @param aInput An arbitrary input argument. sl@0: @return KErrNone If the interface is supported, KErrNotSupported otherwise. sl@0: */ sl@0: IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput); sl@0: sl@0: // calls GetInterface() with tracepoints added sl@0: TInt GetInterfaceTraced(TInt aInterfaceId,TAny*& aInterface,TAny* aInput); sl@0: sl@0: sl@0: enum TInterfaceIds sl@0: { sl@0: EBlockMapInterface = 0, sl@0: EGetLocalDrive = 1, sl@0: EExtendedFileInterface sl@0: }; sl@0: sl@0: TUint64 MaxSupportedSize(void) const; sl@0: sl@0: sl@0: inline TFileLocksArray& FileLocks(); sl@0: sl@0: sl@0: sl@0: private: sl@0: sl@0: void DemoteShare(CFileShare* aFileShare); sl@0: void PromoteShare(CFileShare* aFileShare); sl@0: sl@0: RArray& AsyncReadRequests(); sl@0: TInt AddAsyncReadRequest(CFileShare* aFileShareP, TInt64 aPos, TInt aLength, CFsRequest* aRequestP); sl@0: void NotifyAsyncReaders(); sl@0: sl@0: protected: sl@0: sl@0: /** sl@0: Inititally, the mode that the file was opened with, which defines the level sl@0: of access allowed to the file. Set by the TDrive object sl@0: (representing the drive on which the file resides) when the file sl@0: control block is created. sl@0: */ sl@0: TShare iShare; sl@0: sl@0: sl@0: /** sl@0: The size of the file. This is the low 32 bit part of the file size. sl@0: The upper 32 bit part of the file size is saved on the file server side sl@0: for File Systems supporting file size > 4GB - 1. sl@0: File Systems supporting file size > 4GB - 1 shall use CFileCB::Size64() sl@0: to query the file size and CFileCB::SetSize64() to set file size. sl@0: */ sl@0: TInt iSize; sl@0: sl@0: sl@0: /** sl@0: The attributes of the file. sl@0: */ sl@0: TInt iAtt; sl@0: sl@0: sl@0: /** sl@0: The universal time at which the file was last modified. sl@0: */ sl@0: TTime iModified; sl@0: sl@0: sl@0: /** sl@0: Indicates whether the file that the object represents is corrupt: sl@0: true if it is corrupt, false otherwise. sl@0: */ sl@0: TBool iFileCorrupt; sl@0: sl@0: sl@0: /** sl@0: Indicates whether a recent access to the file that the object represents sl@0: failed due to KErrBadPower. sl@0: */ sl@0: TBool iBadPower; sl@0: sl@0: public: sl@0: sl@0: /** sl@0: The full name of the file, including drive and extensions. sl@0: */ sl@0: HBufC* iFileName; sl@0: sl@0: /** sl@0: The full name of the file, including drive and extensions - Folded. sl@0: */ sl@0: HBufC* iFileNameF; sl@0: sl@0: private: sl@0: TUint32 iNameHash; sl@0: TDrive* iCreatedDrive; sl@0: TDrive* iDrive; sl@0: CMountCB* iMount; sl@0: TFileLocksArray* iFileLocks; ///< an array of file position locks sl@0: TDblQueLink iMountLink; sl@0: sl@0: private: sl@0: CFileBody* iBody; sl@0: sl@0: friend class TDrive; sl@0: friend class CMountCB; sl@0: friend class CFileShare; sl@0: friend class TFsFileRead; sl@0: friend class TFsFileWrite; sl@0: friend class TFsFileSetSize; sl@0: friend class TFsFileReadCancel; sl@0: friend class TFsFileDuplicate; sl@0: friend class TFsFileRename; sl@0: friend class CCompFileCB; sl@0: friend class CFileCache; sl@0: }; sl@0: sl@0: sl@0: /** sl@0: Helper class to construct a dummy RMessage2 object. This allows the file server to sl@0: read and write local buffers to a file system's CFileCB-derived interface. sl@0: sl@0: @internalTechnology sl@0: */ sl@0: class RLocalMessage : public RMessage2 sl@0: { sl@0: public: sl@0: inline RLocalMessage(); sl@0: sl@0: inline void InitHandle(); sl@0: inline void SetFunction(TInt aFunction); sl@0: inline void SetArgs(TIpcArgs& aArgs); sl@0: inline TInt Arg(TInt aIndex) const; sl@0: }; sl@0: sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: A file server interface class representing an open file that is being shared. sl@0: For example multiple reading of the same file. sl@0: sl@0: @see CFileCB sl@0: @see TFileMode sl@0: */ sl@0: NONSHARABLE_CLASS(CFileShare) : public CFsDispatchObject sl@0: { sl@0: public: sl@0: CFileShare(CFileCB* aFileCB); sl@0: ~CFileShare(); sl@0: TInt CheckMount(); sl@0: void InitL(); sl@0: inline CFileCB& File(); sl@0: sl@0: // For serialising aync requests sl@0: TBool RequestStart(CFsMessageRequest* aRequest); sl@0: void RequestEnd(CFsMessageRequest* aRequest); sl@0: TBool RequestInProgress() const; sl@0: inline TBool IsFileModeBig(); sl@0: sl@0: public: sl@0: /** sl@0: File share mode. The mode in which the file was opened first. sl@0: @see TFileMode. sl@0: */ sl@0: TUint iMode; sl@0: /** sl@0: Current file position. This is the position at which reading and writing takes place. sl@0: */ sl@0: TInt64 iPos; sl@0: /** sl@0: Error condition due to flush. sl@0: */ sl@0: TInt iFlushError; sl@0: private: sl@0: CFileCB* iFile; sl@0: sl@0: // A pointer to the current request. Used for serializing client sl@0: // async read/write requests which might otherwise be processed out sl@0: // of order due to fair scheduling sl@0: CFsMessageRequest* iCurrentRequest; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: A file server interface class representing an open directory sl@0: sl@0: An instance of this object is referred to as a directory control block. sl@0: sl@0: A directory control block must be created for a specific directory to access sl@0: that directory within a volume. sl@0: sl@0: A plug-in file system implements this class. sl@0: */ sl@0: class CDirCB : public CFsDispatchObject sl@0: { sl@0: public: sl@0: IMPORT_C CDirCB(); sl@0: IMPORT_C ~CDirCB(); sl@0: TInt CheckMount(); sl@0: IMPORT_C void InitL(TDrive* aDrive); sl@0: inline void SetMount(CMountCB * aMount){iMount=aMount;}; sl@0: inline TDrive& Drive() const; sl@0: inline CMountCB& Mount() const; sl@0: inline TBool Pending() const; sl@0: inline void SetPending(TBool aPending); sl@0: sl@0: sl@0: /** sl@0: Gets information from the first suitable entry in the directory, sl@0: starting from the current read position. sl@0: sl@0: The function should read successive entries until a suitable entry is found. sl@0: An entry is suitable if the entry attributes match the criteria set by this sl@0: object's attributes, which are set on initialisation. sl@0: For example, if the directory control block has the attribute sl@0: KEntryAttMaskSupported, and the file has the attribute KEntryAttVolume, sl@0: then the entry will be deemed unsuitable and the next entry will be read. sl@0: sl@0: This function is called by the file server. sl@0: sl@0: If, on return, the entry's full file name, TEntry::iName, is longer than sl@0: the maximum buffer size, then the entry cannot be returned to the client. sl@0: In this case the file server will set iPending to true and will call sl@0: StoreLongEntryName() before calling this function again. sl@0: In this case (when iPending is true), the function should re-read sl@0: the last entry to be read; it should also set iPending to false and sl@0: should not advance the current read position. sl@0: sl@0: The time stored in the iModified member of anEntry should not be converted, sl@0: but left as UTC time. sl@0: sl@0: When storing the iName member of anEntry, the current (.), sl@0: or parent marker (..) in the directory should not be returned. sl@0: sl@0: If the KEntryAttAllowUid flag is set in the iAtt member of anEntry, then sl@0: the entry UID type of an entry will be read. If, on reading the UID from sl@0: a file, KErrCorrupt is generated, because the file is corrupt, sl@0: ReadL() should not leave with this error message, but should return sl@0: as normal. sl@0: If any other errors are raised the function should leave. sl@0: sl@0: All of the properties of a TEntry, other than the UID types, are always read. sl@0: sl@0: ReadL() should leave with a suitable error code if it cannot complete sl@0: successfully for any reason. sl@0: sl@0: @param anEntry Entry information object. sl@0: */ sl@0: virtual void ReadL(TEntry& anEntry) =0; sl@0: sl@0: public: sl@0: IMPORT_C virtual void StoreLongEntryNameL(const TDesC& aName); sl@0: sl@0: protected: sl@0: /** sl@0: Return a pointer to a specified interface extension - to allow future extension of this class without breaking sl@0: binary compatibility. sl@0: @param aInterfaceId Interface identifier of the interface to be retrieved. sl@0: @param aInterface A reference to a pointer that retrieves the specified interface. sl@0: @param aInput An arbitrary input argument. sl@0: @return KErrNone If the interface is supported, KErrNotSupported otherwise. sl@0: */ sl@0: IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput); sl@0: sl@0: protected: sl@0: /** sl@0: Bitmask of the attributes of interest. sl@0: sl@0: Set using the the TDrive friend class instance representing sl@0: the directory's drive after the object is made. sl@0: */ sl@0: TUint iAtt; sl@0: sl@0: sl@0: /** sl@0: Set after construction using the TDrive friend class instance representing sl@0: the directory's drive. sl@0: */ sl@0: TUidType iUidType; sl@0: sl@0: sl@0: /** sl@0: Flag to indicate whether preceding entry details should be returned when sl@0: multiple entries are being read. sl@0: */ sl@0: TBool iPending; sl@0: friend class TDrive; sl@0: private: sl@0: TDrive* iDrive; sl@0: CMountCB* iMount; sl@0: TUint32 iReserved; // Reserved for future expansion sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: class CFormatCBBody; sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: A file server interface class representing a format operation on a disk. sl@0: sl@0: An instance of this object is referred to as a format control block. sl@0: sl@0: The type of format operation to be applied depends on the type of disk, sl@0: and is stored in iMode. Each format operation has a number of steps and sl@0: is kept track of using iCurrentStep. sl@0: sl@0: A format control block needs to be created for a specific mount control block sl@0: for the disk controlled via that mount to be formatted. sl@0: sl@0: A plug-in file system provides an implementation of this class. sl@0: */ sl@0: sl@0: class CFormatCB : public CFsDispatchObject sl@0: { sl@0: public: sl@0: IMPORT_C CFormatCB(); sl@0: IMPORT_C ~CFormatCB(); sl@0: IMPORT_C TInt CheckMount(); sl@0: sl@0: void InitL(TDrive* aDrive, TFormatMode aMode); sl@0: sl@0: void SetFormatParameters(const TLDFormatInfo* apLDFormatInfo); sl@0: TInt SetFormatParameters(const TVolFormatParam* apVolFormatParam); sl@0: sl@0: sl@0: inline TDrive& Drive() const; sl@0: inline CMountCB& Mount() const; sl@0: inline TFormatMode Mode() const; sl@0: inline TInt& CurrentStep(); sl@0: sl@0: /** sl@0: Performs a formatting step on the drive. sl@0: sl@0: The step performed should depend on the values of iMode and iCurrentStep. sl@0: sl@0: It can be assumed that there are no resources open on the mount, sl@0: that the media is formattable, and that the media is not write protected. sl@0: sl@0: If iMode == EQuickFormat, then only meta data is to be written. sl@0: This should be carried out in a single step, with iCurrentStep set sl@0: to zero on completion. sl@0: sl@0: If iMode != EQuickFormat, then the format step performed by sl@0: this function should depend on iCurrentStep. When the function sl@0: returns with iCurrentStep set to zero, the formatting of the drive is complete. sl@0: sl@0: On error detection, the function should leave with an appropriate error code. sl@0: sl@0: @see CFormatCB::iMode sl@0: @see CFormatCB::iCurrentStep sl@0: */ sl@0: virtual void DoFormatStepL() =0; sl@0: sl@0: protected: sl@0: sl@0: /** Enumeration of the aInterfaceIDs used in GetInterface */ sl@0: enum TInterfaceIds sl@0: { sl@0: ESetFmtParameters = 1, ///< used in implementation of SetFormatParameters(const TVolFormatParam* apVolFormatParam) sl@0: }; sl@0: sl@0: sl@0: sl@0: /** sl@0: Return a pointer to a specified interface extension - to allow future extension of this class without breaking sl@0: binary compatibility. sl@0: @param aInterfaceId Interface identifier of the interface to be retrieved. sl@0: @param aInterface A reference to a pointer that retrieves the specified interface. sl@0: @param aInput An arbitrary input argument. sl@0: @return KErrNone If the interface is supported, KErrNotSupported otherwise. sl@0: */ sl@0: IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput); sl@0: sl@0: protected: sl@0: sl@0: TInt iCurrentStep; ///< current format step counter 100...0 sl@0: TFormatMode iMode; ///< Format mode. This is set by the file server when this objetc is instantiated. sl@0: TSpecialFormatInfoBuf iSpecialInfo; ///< Buffer containing user-specified format parameters. sl@0: sl@0: private: sl@0: sl@0: TDrive* iDrive; sl@0: CMountCB* iMount; ///< parent Mount sl@0: CFormatCBBody* iBody; ///< additional data holder sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: A file server interface class representing a raw disk. sl@0: sl@0: An instance of this object is referred to as a raw disk control block. sl@0: sl@0: This is not an abstract base class and does not need to be derived from sl@0: when implementing a file system. This is because direct disk access is sl@0: implemented by the file server directly calling RawReadL() and RawWriteL() sl@0: from the derived CMountCB object of the file system. sl@0: */ sl@0: NONSHARABLE_CLASS(CRawDiskCB) : public CFsDispatchObject sl@0: { sl@0: public: sl@0: CRawDiskCB(); sl@0: ~CRawDiskCB(); sl@0: void InitL(CMountCB* aMount,TBool aIsWriteProtected); sl@0: inline CMountCB& Mount(); sl@0: inline TDrive& Drive(); sl@0: inline TBool IsWriteProtected() const; sl@0: inline void SetChanged(); sl@0: private: sl@0: enum { EWriteProtected = 1, EChanged = 2 }; sl@0: inline void SetWriteProtected(); sl@0: inline TBool IsChanged() const; sl@0: private: sl@0: CMountCB* iMount; sl@0: TUint32 iFlags; sl@0: }; sl@0: sl@0: sl@0: class CFileSystemBody; sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: A file server interface class, representing the factory class for a file system. sl@0: sl@0: A plug-in file system implements this class. sl@0: sl@0: Creates objects derived from CMountCB, CFileCB, CDirCB and CFormatCB. sl@0: sl@0: @see CMountCB sl@0: @see CFileCB sl@0: @see CDirCB sl@0: @see CFormatCB sl@0: */ sl@0: class CFileSystem : public CFsObject sl@0: { sl@0: public: sl@0: IMPORT_C CFileSystem(); sl@0: IMPORT_C ~CFileSystem(); sl@0: IMPORT_C virtual TInt Remove(); sl@0: IMPORT_C virtual TBool QueryVersionSupported(const TVersion& aVer) const; sl@0: IMPORT_C virtual TBool IsExtensionSupported() const; sl@0: IMPORT_C TBool IsProxyDriveSupported(); sl@0: IMPORT_C void SetLibrary(RLibrary aLib); sl@0: IMPORT_C RLibrary Library() const; sl@0: // Pure virtual sl@0: sl@0: sl@0: /** sl@0: Installs the file system. sl@0: sl@0: The function should set the name of the file system object through a call sl@0: to CObject::SetName(), thus making it accessible, internally, sl@0: using FileSystems->FindByFullName(). This enables the file server sl@0: to find and handle installed file systems. sl@0: The function should also set the file system version. sl@0: The version is determined by the file system implementation. sl@0: It is used in calls to CFileSystem::QueryVersionSupported(). sl@0: sl@0: This function is called as a result of a call to RFs::AddFileSystem(). sl@0: sl@0: @return KErrNone if succesful; otherwise one of the other system-wide error sl@0: codes. sl@0: sl@0: @see RFs::AddFileSystem sl@0: @see CObject::SetName sl@0: @see RFs sl@0: @see CObject sl@0: */ sl@0: virtual TInt Install() =0; sl@0: sl@0: sl@0: /** sl@0: Creates a new mount control block, a CMountCB derived object. sl@0: sl@0: On success, a pointer to the new mount object should be returned, sl@0: otherwise the function should leave. sl@0: sl@0: @return A pointer to the new mount object. sl@0: sl@0: @see CMountCB sl@0: */ sl@0: virtual CMountCB* NewMountL() const =0; sl@0: sl@0: sl@0: /** sl@0: Creates a new file control block, i.e. a CFileCB derived object. sl@0: sl@0: On success, a pointer to the new file object should be returned, sl@0: otherwise the function should leave. sl@0: sl@0: @return A pointer to the new file object. sl@0: sl@0: @see CFileCB sl@0: */ sl@0: virtual CFileCB* NewFileL() const =0; sl@0: sl@0: sl@0: /** sl@0: Creates a new directory control block, i.e. a CDirCB derived object. sl@0: sl@0: On success, a pointer to the new directory control block should be returned, sl@0: otherwise the function should leave. sl@0: sl@0: @return A pointer to the new directory object. sl@0: sl@0: @see CDirCB sl@0: */ sl@0: virtual CDirCB* NewDirL() const =0; sl@0: sl@0: sl@0: /** sl@0: Creates a new volume format control block, i.e. a CFormatCB derived object. sl@0: sl@0: On success, a pointer to the new volume format control block should be returned, sl@0: otherwise the function should leave. sl@0: sl@0: @return A pointer to the new volume format object. sl@0: sl@0: @see CFormatCB sl@0: */ sl@0: virtual CFormatCB* NewFormatL() const =0; sl@0: sl@0: sl@0: /** sl@0: Retrieves drive information. sl@0: sl@0: The function should set anInfo.iMediaAtt and anInfo.iType according to sl@0: the specified drive number. sl@0: sl@0: Note that anInfo.iDriveAtt will already have been set by the calling sl@0: function. sl@0: sl@0: The function can obtain the necessary information by calling sl@0: the appropriate TBusLocalDrive::Caps() function using the argument aDriveNumber. sl@0: sl@0: @param anInfo On return, contains the drive information. sl@0: @param aDriveNumber The drive number. sl@0: */ sl@0: IMPORT_C virtual void DriveInfo(TDriveInfo& anInfo,TInt aDriveNumber) const; sl@0: sl@0: virtual TInt DefaultPath(TDes& aPath) const; sl@0: sl@0: /** Enumeration of the aInterfaceIDs used in GetInterface.*/ sl@0: enum TInterfaceIds sl@0: { sl@0: EProxyDriveSupport = 0, sl@0: EExtendedFunctionality, ///< corresponds to MFileSystemExtInterface sl@0: }; sl@0: sl@0: /** This is interface corresponds to the extended CFileSystem functionality*/ sl@0: class MFileSystemExtInterface sl@0: { sl@0: public: sl@0: virtual CMountCB* NewMountExL(TDrive* apDrive, CFileSystem** apFileSystem, TBool aForceMount, TUint32 aFsNameHash) = 0; sl@0: virtual TInt GetSupportedFileSystemName(TInt aFsNumber, TDes& aFsName) const = 0; sl@0: sl@0: }; sl@0: sl@0: public: sl@0: CMountCB* NewMountExL(TDrive* apDrive, CFileSystem** apFileSystem, TBool aForceMount, TUint32 aFsNameHash); sl@0: TInt GetSupportedFileSystemName(TInt aFsNumber, TDes& aFsName); sl@0: sl@0: sl@0: protected: sl@0: /** sl@0: Return a pointer to a specified interface extension - to allow future extension of this class without breaking sl@0: binary compatibility. sl@0: @param aInterfaceId Interface identifier of the interface to be retrieved. sl@0: @param aInterface A reference to a pointer that retrieves the specified interface. sl@0: @param aInput An arbitrary input argument. sl@0: @return KErrNone If the interface is supported, KErrNotSupported otherwise. sl@0: */ sl@0: IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput); sl@0: sl@0: protected: sl@0: TVersion iVersion; sl@0: private: sl@0: RLibrary iLibrary; ///< *.fsy file system plugin dll handle sl@0: CFileSystemBody* iBody; ///< extension of this class, used to provide extended functionality w/o changing this class size (BC issue) sl@0: sl@0: friend class TDrive; sl@0: sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: Base abstract class. sl@0: Interface between a local plugin file system and a media subsystem. sl@0: sl@0: @see CLocalProxyDrive sl@0: @see CBaseExtProxyDrive sl@0: */ sl@0: class CProxyDrive : public CBase sl@0: { sl@0: public: sl@0: CProxyDrive(CMountCB* aMount); sl@0: ~CProxyDrive(); sl@0: inline CMountCB* Mount() const; sl@0: inline void SetMount(CMountCB *aMount); sl@0: // virtual sl@0: IMPORT_C virtual TInt ControlIO(const RMessagePtr2& aMessage,TInt aCommand,TAny* aParam1,TAny* aParam2); sl@0: IMPORT_C virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt aOffset,TInt aFlags); sl@0: IMPORT_C virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt anOffset,TInt aFlags); sl@0: IMPORT_C virtual TInt DeleteNotify(TInt64 aPos, TInt aLength); sl@0: IMPORT_C virtual TInt GetLastErrorInfo(TDes8& aErrorInfo); sl@0: sl@0: inline TInt LocalBufferSupport(); sl@0: sl@0: // pure virtual sl@0: sl@0: /** sl@0: Initialise the proxy drive. sl@0: sl@0: Derived class must provide an implementation for it. sl@0: sl@0: @return KErrNone if successful, otherwise one of the system-wide error codes. sl@0: */ sl@0: virtual TInt Initialise()=0; sl@0: sl@0: /** sl@0: It invokes Dismounted() on the proxy drive. sl@0: sl@0: Derived class must provide an implementation for it. sl@0: sl@0: @return KErrNone if successful, otherwise one of the system-wide error codes. sl@0: */ sl@0: virtual TInt Dismounted()=0; sl@0: sl@0: /** sl@0: Increase the size of the proxy drive by the specified length (in bytes). sl@0: sl@0: Derived class must provide an implementation for it. sl@0: sl@0: @param aLength The length (in bytes) of which the drive is to be increased by. sl@0: sl@0: @return KErrNone if successful, otherwise one of the system-wide error codes. sl@0: */ sl@0: virtual TInt Enlarge(TInt aLength)=0; sl@0: sl@0: /** sl@0: Reduce the size of the proxy drive by removing the specified length sl@0: (in bytes) starting at the specified position. sl@0: sl@0: Derived class must provide an implementation for it. sl@0: sl@0: @param aPos The start position of area to be removed. sl@0: @param aLength The length/size (in bytes) by which the drive is to be reduced. sl@0: sl@0: @return System-wide error codes based on the status of the operation. sl@0: */ sl@0: virtual TInt ReduceSize(TInt aPos, TInt aLength)=0; sl@0: sl@0: /** sl@0: Read from the proxy drive. sl@0: sl@0: Derived class must provide an implementation for it. sl@0: sl@0: @param aPos The address from where the read begins. sl@0: @param aLength The length of the read. sl@0: @param aTrg A descriptor of the memory buffer from which to read. sl@0: @param aThreadHandle The handle-number representing the drive thread. sl@0: @param aOffset Offset into aTrg to read the data from. sl@0: sl@0: @return System-wide error codes based on the status of the operation. sl@0: */ sl@0: virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt anOffset)=0; sl@0: sl@0: /** sl@0: Read from the proxy drive. sl@0: sl@0: Derived class must provide an implementation for it. sl@0: sl@0: @param aPos The address from where the read begins. sl@0: @param aLength The length of the read. sl@0: @param aTrg A descriptor of the memory buffer from which to read. sl@0: sl@0: @return System-wide error codes based on the status of the operation. sl@0: */ sl@0: virtual TInt Read(TInt64 aPos,TInt aLength,TDes8& aTrg)=0; sl@0: sl@0: /** sl@0: Write to the proxy drive. sl@0: sl@0: Derived class must provide an implementation for it. sl@0: sl@0: @param aPos The address from where the write begins. sl@0: @param aLength The length of the write. sl@0: @param aSrc A descriptor of the memory buffer from which to write. sl@0: @param aThreadHandle The handle-number representing the drive thread. sl@0: @param aOffset Offset into aSrc to write the data to. sl@0: sl@0: @return System-wide error codes based on the status of the operation. sl@0: */ sl@0: virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt anOffset)=0; sl@0: sl@0: /** sl@0: Write to the proxy drive. sl@0: sl@0: Derived class must provide an implementation for it. sl@0: sl@0: @param aPos The address from where the write begins. sl@0: @param aSrc A descriptor of the memory buffer from which to write. sl@0: sl@0: @return System-wide error codes based on the status of the operation. sl@0: */ sl@0: virtual TInt Write(TInt64 aPos,const TDesC8& aSrc)=0; sl@0: sl@0: /** sl@0: Get the proxy drive's capabilities information. sl@0: sl@0: Derived class must provide an implementation for it. sl@0: sl@0: @param anInfo A descriptor of the connected drives capabilities. sl@0: sl@0: @return System-wide error codes based on the status of the operation. sl@0: */ sl@0: virtual TInt Caps(TDes8& anInfo)=0; sl@0: sl@0: /** sl@0: Format the connected drive. sl@0: sl@0: Derived class must provide an implementation for it. sl@0: sl@0: @param anInfo Device specific format information. sl@0: sl@0: @return System-wide error codes based on the status of the operation. sl@0: */ sl@0: virtual TInt Format(TFormatInfo& anInfo)=0; sl@0: sl@0: /** sl@0: Format the proxy drive. sl@0: sl@0: Derived class must provide an implementation for it. sl@0: sl@0: @param aPos The position of the data which is being formatted. sl@0: @param aLength The length of the data which is being formatted. sl@0: sl@0: @return System-wide error codes based on the status of the operation. sl@0: */ sl@0: virtual TInt Format(TInt64 aPos,TInt aLength)=0; sl@0: sl@0: /** sl@0: Set the mount information on the proxy drive. sl@0: sl@0: Derived class must provide an implementation for it. sl@0: sl@0: @param aMountInfo Information passed down to the media driver. sl@0: The meaning of this information depends on the media driver. sl@0: @param aMountInfoThreadHandle Message thread handle number. sl@0: sl@0: @return System-wide error codes based on the status of the operation. sl@0: */ sl@0: virtual TInt SetMountInfo(const TDesC8* aMountInfo,TInt aMountInfoThreadHandle=KCurrentThreadHandle)=0; sl@0: sl@0: /** sl@0: Forces a remount on the proxy drive sl@0: sl@0: Derived class must provide an implementation for it. sl@0: sl@0: @param aFlags Flags to be passed into the driver. sl@0: sl@0: @return System-wide error codes based on the status of the operation. sl@0: */ sl@0: virtual TInt ForceRemount(TUint aFlags=0)=0; sl@0: sl@0: /** sl@0: Unlocks a password-enabled proxy drive. sl@0: sl@0: Derived class must provide an implementation for it. sl@0: sl@0: @param aPassword A descriptor containing the existing password. sl@0: @param aStorePassword If ETrue, the password is added to the password store. sl@0: sl@0: @return System-wide error codes based on the status of the operation. sl@0: */ sl@0: virtual TInt Unlock(TMediaPassword &aPassword, TBool aStorePassword)=0; sl@0: sl@0: /** sl@0: Locks a password-enabled proxy drive with the new password. sl@0: sl@0: Derived class must provide an implementation for it. sl@0: sl@0: @param aOldPassword A descriptor containing the existing password. sl@0: @param aNewPassword A descriptor containing the new password. sl@0: @param aStorePassword If ETrue, the password is added to the password store. sl@0: sl@0: @return System-wide error codes based on the status of the operation. sl@0: */ sl@0: virtual TInt Lock(TMediaPassword &aOldPassword, TMediaPassword &aNewPassword, TBool aStorePassword)=0; sl@0: sl@0: /** sl@0: Clears a password from a proxy drive - controller sets password to null. sl@0: sl@0: Derived class must provide an implementation for it. sl@0: sl@0: @param aPassword A descriptor containing the password. sl@0: sl@0: @return System-wide error codes based on the status of the operation. sl@0: */ sl@0: virtual TInt Clear(TMediaPassword &aPassword)=0; sl@0: sl@0: /** sl@0: Forcibly unlock a password-enabled proxy drive. sl@0: sl@0: Derived class must provide an implementation for it. sl@0: sl@0: @return System-wide error codes based on the status of the operation. sl@0: */ sl@0: virtual TInt ErasePassword()=0; sl@0: sl@0: // implementation using GetInterface(..) sl@0: enum TInterfaceIds sl@0: { sl@0: EGetLocalDrive, sl@0: ELocalBufferSupport, sl@0: EGetProxyDrive, sl@0: EFinalised, sl@0: }; sl@0: sl@0: /** sl@0: Retrieves TBusLocalDrive object associated with the file. sl@0: sl@0: @return System-wide error codes based on the status of the operation. sl@0: */ sl@0: IMPORT_C TInt GetLocalDrive(TBusLocalDrive*& aLocDrv); sl@0: sl@0: /** sl@0: Informs the extension that the mount has been finalised and is in a consistent state. sl@0: sl@0: @return System-wide error codes based on the status of the operation. sl@0: sl@0: @internalTechnology sl@0: */ sl@0: IMPORT_C TInt Finalise(TBool aFinalised); sl@0: sl@0: protected: sl@0: /** sl@0: Return a pointer to a specified interface extension - to allow future extension of this class without breaking sl@0: binary compatibility. sl@0: sl@0: @param aInterfaceId Interface identifier of the interface to be retrieved. sl@0: @param aInterface A reference to a pointer that retrieves the specified interface. sl@0: @param aInput An arbitrary input argument. sl@0: sl@0: @return KErrNone If the interface is supported, KErrNotSupported otherwise. sl@0: */ sl@0: IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput); sl@0: sl@0: private: sl@0: CMountCB* iMount; sl@0: TUint32 iReserved; // Reserved for future expansion sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: Local drive specific mount control block. sl@0: */ sl@0: class CLocDrvMountCB : public CMountCB sl@0: { sl@0: public: sl@0: IMPORT_C CLocDrvMountCB(); sl@0: IMPORT_C ~CLocDrvMountCB(); sl@0: IMPORT_C TInt CreateLocalDrive(TBusLocalDrive& aLocDrv); sl@0: IMPORT_C TInt CreateDrive(TInt aDriveNumber); sl@0: IMPORT_C TInt InitLocalDrive(); sl@0: IMPORT_C void DismountedLocalDrive(); sl@0: inline CProxyDrive* LocalDrive() const; sl@0: sl@0: private: sl@0: CProxyDrive* iProxyDrive; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: Local drive specific proxy drive interface. sl@0: Class passes commands directly to TBusLocalDrive. sl@0: sl@0: @see CProxyDrive sl@0: */ sl@0: NONSHARABLE_CLASS(CLocalProxyDrive) : public CProxyDrive sl@0: { sl@0: public: sl@0: static CLocalProxyDrive* New(CMountCB* aMount,TBusLocalDrive& aLocDrv); sl@0: // virtual sl@0: virtual TInt Initialise(); sl@0: virtual TInt Dismounted(); sl@0: virtual TInt Enlarge(TInt aLength); sl@0: virtual TInt ReduceSize(TInt aPos, TInt aLength); sl@0: virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt aOffset, TInt aFlags); sl@0: virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt anOffset); sl@0: virtual TInt Read(TInt64 aPos,TInt aLength,TDes8& aTrg); sl@0: virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt aOffset,TInt aFlags); sl@0: virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt anOffset); sl@0: virtual TInt Write(TInt64 aPos,const TDesC8& aSrc); sl@0: virtual TInt Caps(TDes8& anInfo); sl@0: virtual TInt Format(TFormatInfo& anInfo); sl@0: virtual TInt Format(TInt64 aPos,TInt aLength); sl@0: virtual TInt SetMountInfo(const TDesC8* aMountInfo,TInt aMountInfoThreadHandle=KCurrentThreadHandle); sl@0: virtual TInt ForceRemount(TUint aFlags=0); sl@0: virtual TInt ControlIO(const RMessagePtr2& aMessage,TInt aCommand,TAny* aParam1,TAny* aParam2); sl@0: virtual TInt Unlock(TMediaPassword &aPassword, TBool aStorePassword); sl@0: virtual TInt Lock(TMediaPassword &aOldPassword, TMediaPassword &aNewPassword, TBool aStorePassword); sl@0: virtual TInt Clear(TMediaPassword &aPassword); sl@0: virtual TInt ErasePassword(); sl@0: virtual TInt DeleteNotify(TInt64 aPos, TInt aLength); sl@0: virtual TInt GetLastErrorInfo(TDes8& aErrorInfo); sl@0: protected: sl@0: virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput); sl@0: private: sl@0: CLocalProxyDrive(CMountCB* aMount,TBusLocalDrive& aLocDrv); sl@0: private: sl@0: TBusLocalDrive& iLocDrv; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: Media subsystem extensions must be derived from this specific class interface. sl@0: Objects of this type should be created through use of a derived CProxyDriveFactory class. sl@0: sl@0: Class passes commands directly to CProxyDrive. sl@0: sl@0: @see CProxyDrive sl@0: @see CProxyDriveFactory sl@0: */ sl@0: class CBaseExtProxyDrive : public CProxyDrive sl@0: { sl@0: public: sl@0: IMPORT_C CBaseExtProxyDrive(CProxyDrive* aProxyDrive, CMountCB* aMount); sl@0: IMPORT_C ~CBaseExtProxyDrive(); sl@0: IMPORT_C virtual TInt Initialise(); sl@0: IMPORT_C virtual TInt Dismounted(); sl@0: IMPORT_C virtual TInt Enlarge(TInt aLength); sl@0: IMPORT_C virtual TInt ReduceSize(TInt aPos, TInt aLength); sl@0: IMPORT_C virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt aOffset,TInt aFlags); sl@0: IMPORT_C virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt anOffset); sl@0: IMPORT_C virtual TInt Read(TInt64 aPos,TInt aLength,TDes8& aTrg); sl@0: IMPORT_C virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt aOffset,TInt aFlags); sl@0: IMPORT_C virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt anOffset); sl@0: IMPORT_C virtual TInt Write(TInt64 aPos,const TDesC8& aSrc); sl@0: IMPORT_C virtual TInt Caps(TDes8& anInfo); sl@0: IMPORT_C virtual TInt Format(TFormatInfo& anInfo); sl@0: IMPORT_C virtual TInt Format(TInt64 aPos,TInt aLength); sl@0: IMPORT_C virtual TInt SetMountInfo(const TDesC8* aMountInfo,TInt aMountInfoThreadHandle=KCurrentThreadHandle); sl@0: IMPORT_C virtual TInt ForceRemount(TUint aFlags=0); sl@0: IMPORT_C virtual TInt Unlock(TMediaPassword &aPassword, TBool aStorePassword); sl@0: IMPORT_C virtual TInt Lock(TMediaPassword &aOldPassword, TMediaPassword &aNewPassword, TBool aStorePassword); sl@0: IMPORT_C virtual TInt Clear(TMediaPassword &aPassword); sl@0: IMPORT_C virtual TInt ControlIO(const RMessagePtr2& aMessage,TInt aCommand,TAny* aParam1,TAny* aParam2); sl@0: IMPORT_C virtual TInt ErasePassword(); sl@0: IMPORT_C virtual TInt GetLastErrorInfo(TDes8& aErrorInfo); sl@0: IMPORT_C virtual TInt DeleteNotify(TInt64 aPos, TInt aLength); sl@0: inline TInt LocalBufferSupport(); sl@0: sl@0: protected: sl@0: /** sl@0: Return a pointer to a specified interface extension - to allow future extension of this class without breaking sl@0: binary compatibility. sl@0: @param aInterfaceId Interface identifier of the interface to be retrieved. sl@0: @param aInterface A reference to a pointer that retrieves the specified interface. sl@0: @param aInput An arbitrary input argument. sl@0: @return KErrNone If the interface is supported, KErrNotSupported otherwise. sl@0: */ sl@0: IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput); sl@0: private: sl@0: CProxyDrive* iProxy; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: Abstract base class for Proxy drive factory classes. sl@0: sl@0: Class is used for the creation of media subsystem extensions CBaseExtProxyDrive. sl@0: sl@0: @see CBaseExtProxyDrive sl@0: */ sl@0: class CProxyDriveFactory : public CFsObject sl@0: { sl@0: public: sl@0: IMPORT_C CProxyDriveFactory(); sl@0: IMPORT_C virtual TInt Remove(); sl@0: inline void SetLibrary(RLibrary aLib); sl@0: inline RLibrary Library() const; sl@0: sl@0: /** sl@0: Installation of the factory object. sl@0: @return system wide error code sl@0: */ sl@0: virtual TInt Install() =0; sl@0: /** sl@0: Instantiates a CProxyDrive object. sl@0: @param aProxy Proxy drive to be used. sl@0: @param aMount Mount control block. sl@0: sl@0: @return pointer to Instantiated CProxyDrive object. sl@0: */ sl@0: virtual CProxyDrive* NewProxyDriveL(CProxyDrive* aProxy,CMountCB* aMount)=0; sl@0: private: sl@0: RLibrary iLibrary; sl@0: }; sl@0: sl@0: sl@0: sl@0: /** sl@0: @internalTechnology sl@0: */ sl@0: class CExtProxyDriveFactory : public CFsObject sl@0: { sl@0: public: sl@0: IMPORT_C CExtProxyDriveFactory(); sl@0: IMPORT_C virtual TInt Remove(); sl@0: inline void SetLibrary(RLibrary aLib); sl@0: inline RLibrary Library() const; sl@0: // pure virtual sl@0: virtual TInt Install() =0; sl@0: virtual TInt CreateProxyDrive(CProxyDrive*& aMountProxyDrive, CMountCB* aMount)=0; sl@0: sl@0: IMPORT_C virtual void AsyncEnumerate(); sl@0: sl@0: private: sl@0: RLibrary iLibrary; sl@0: }; sl@0: sl@0: sl@0: /** sl@0: @internalTechnology sl@0: */ sl@0: class CExtProxyDrive : public CProxyDrive sl@0: { sl@0: public: sl@0: IMPORT_C CExtProxyDrive(CMountCB* aMount,CExtProxyDriveFactory* aDevice); sl@0: IMPORT_C ~CExtProxyDrive(); sl@0: sl@0: IMPORT_C virtual TInt NotifyChange(TDes8 &aChanged, TRequestStatus* aStatus); sl@0: IMPORT_C virtual void NotifyChangeCancel(); sl@0: IMPORT_C virtual TInt SetInfo(const RMessage2 &msg, TAny* aMessageParam2, TAny* aMessageParam3); sl@0: sl@0: inline TInt DriveNumber(); sl@0: inline void SetDriveNumber(TInt aDrive); sl@0: inline CExtProxyDriveFactory* FactoryP(); sl@0: sl@0: protected: sl@0: /** sl@0: Return a pointer to a specified interface extension - to allow future extension of this class without breaking sl@0: binary compatibility. sl@0: @param aInterfaceId Interface identifier of the interface to be retrieved. sl@0: @param aInterface A reference to a pointer that retrieves the specified interface. sl@0: @param aInput An arbitrary input argument. sl@0: @return KErrNone If the interface is supported, KErrNotSupported otherwise. sl@0: */ sl@0: IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput); sl@0: sl@0: TInt SetupMediaChange(); sl@0: sl@0: protected: sl@0: CExtProxyDriveFactory* iFactory; sl@0: TInt iDriveNumber; sl@0: sl@0: private: sl@0: CExtNotifyMediaChange* iMediaChangeNotifier; sl@0: sl@0: TUint32 iReserved[4]; // Reserved bytes for future expansion sl@0: sl@0: friend class LocalDrives; sl@0: }; sl@0: sl@0: sl@0: /** sl@0: @internalTechnology sl@0: */ sl@0: NONSHARABLE_CLASS(CExtNotifyMediaChange) : public CActive sl@0: { sl@0: public: sl@0: static CExtNotifyMediaChange* NewL(CExtProxyDrive* aDrive); sl@0: ~CExtNotifyMediaChange(); sl@0: void RequestL(); sl@0: sl@0: private: sl@0: CExtNotifyMediaChange(CExtProxyDrive* aDrive); sl@0: void ConstructL(); sl@0: sl@0: void DoCancel(); sl@0: void RunL(); sl@0: sl@0: private: sl@0: CExtProxyDrive* iDrive; sl@0: TPtr8 iPtr; sl@0: }; sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: Gets the local bus drive. sl@0: sl@0: @param aLocalDrive The local drive number. sl@0: sl@0: @return The local bus drive. sl@0: */ sl@0: IMPORT_C TBusLocalDrive& GetLocalDrive(TInt aLocalDrive); sl@0: sl@0: /** sl@0: @internalTechnology sl@0: sl@0: Gets the proxy drive device for a given drive sl@0: sl@0: @param aLocalDrive The local drive number. sl@0: sl@0: @return The local bus drive. sl@0: */ sl@0: IMPORT_C CExtProxyDrive* GetProxyDrive(TInt aDrive); sl@0: sl@0: /** sl@0: @internalTechnology sl@0: sl@0: Gets the proxy drive for a given drive sl@0: sl@0: @param aLocalDrive The local drive number. sl@0: sl@0: @return The proxy drive sl@0: */ sl@0: IMPORT_C TInt GetProxyDrive(TInt aDrive, CProxyDrive*& aProxyDrive); sl@0: sl@0: /** sl@0: @internalTechnology sl@0: sl@0: Return ETrue if drive is actually a proxy instead of a local drive sl@0: sl@0: @param The drive number. sl@0: sl@0: @return ETrue if drive is actually a proxy instead of a local drive sl@0: */ sl@0: IMPORT_C TBool IsProxyDrive(TInt aDrive); sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: Checks a given drive number is mapped to a local drive. sl@0: sl@0: @param aDrive The local drive number. sl@0: sl@0: @return specified drive number is mapped to a local drive. sl@0: */ sl@0: IMPORT_C TBool IsValidLocalDriveMapping(TInt aDrive); sl@0: sl@0: /** sl@0: @internalTechnology sl@0: sl@0: Sets the media attributes and type in the anInfo parameter to those of the sl@0: specified drive. sl@0: sl@0: @param anInfo TDriveInfo object to store the drive information. sl@0: @param aDriveNumber The number of the drive to get the information from. sl@0: */ sl@0: IMPORT_C void GetDriveInfo(TDriveInfo& anInfo,TInt aDriveNumber); sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: Returns the local drive number for a given drive number. sl@0: sl@0: @param aDrive The drive number. sl@0: sl@0: @return KDriveInvalid if drive is not mapped to a local drive. sl@0: otherwise the local drive number. sl@0: */ sl@0: IMPORT_C TInt DriveNumberToLocalDriveNumber(TInt aDrive); sl@0: sl@0: /** sl@0: */ sl@0: IMPORT_C TInt GetLocalDriveNumber(TBusLocalDrive* aLocDrv); sl@0: sl@0: sl@0: /** sl@0: @internalTechnology sl@0: */ sl@0: struct TFatUtilityFunctions; sl@0: sl@0: /** sl@0: Representation of FAT Utility Functions as provided by a Code Page DLL. sl@0: These functions are to be implemented by Code Page-DLLs. sl@0: @internaltechnology sl@0: */ sl@0: sl@0: struct TCodePageFunctions sl@0: { sl@0: typedef TBool (*TConvertFromUnicode)(TDes8& aForeign, const TDesC16& aUnicode, const TDesC8& aReplacementForUnconvertibleCharacter); sl@0: typedef TInt (*TConvertFromUnicodeL)(TDes8& aForeign, const TDesC16& aUnicode, TBool leaveWhenOverflow); sl@0: typedef TBool (*TConvertToUnicode)(TDes16& aUnicode, const TDesC8& aForeign); sl@0: typedef TInt (*TConvertToUnicodeL)(TDes16& aUnicode, const TDesC8& aForeign, TBool leaveWhenOverflow); sl@0: typedef TBool (*TIsLegalShortNameCharacter)(TUint aCharacter); sl@0: sl@0: TConvertFromUnicode iConvertFromUnicode; sl@0: TConvertFromUnicodeL iConvertFromUnicodeL; sl@0: TConvertToUnicode iConvertToUnicode; sl@0: TConvertToUnicodeL iConvertToUnicodeL; sl@0: TIsLegalShortNameCharacter iIsLegalShortNameCharacter; sl@0: }; sl@0: sl@0: /** sl@0: A utility class for Codepage Dll. Controls overflow action. Provides current status of sl@0: Locale/codepage dll loaded. Provides conversions functions to be used by Codepage Dlls. sl@0: sl@0: @internaltechnology sl@0: */ sl@0: class TCodePageUtils sl@0: { sl@0: public: sl@0: sl@0: /** sl@0: Determines the Overflow action in case of if overflow occurs. sl@0: */ sl@0: enum TOverflowAction sl@0: { sl@0: /** sl@0: Will leave if an overflow occurs. sl@0: */ sl@0: EOverflowActionLeave, sl@0: /** sl@0: Will truncate the data if an overflow occurs. sl@0: */ sl@0: EOverflowActionTruncate sl@0: }; sl@0: sl@0: /** sl@0: Determines the current status of Locale dll / Codepage dll. sl@0: */ sl@0: enum TCodepageLoaded sl@0: { sl@0: /** sl@0: No Locale Dll or Codepage Dll is loaded. sl@0: */ sl@0: ENone = 0, sl@0: /** sl@0: Locale Dll is loaded. sl@0: */ sl@0: ELocaleDll, sl@0: /** sl@0: Codepage Dll is loaded. sl@0: */ sl@0: ECodePageDll sl@0: }; sl@0: public: sl@0: sl@0: /** sl@0: Convert from Unicode, truncating if there is not enough room in the output. sl@0: sl@0: @param aForeign The output is appended here. sl@0: @param aUnicode The input. sl@0: sl@0: @return False if and only if aForeign has not enough space remaining. sl@0: */ sl@0: TBool ConvertFromUnicode(TDes8& aForeign, const TDesC16& aUnicode, TOverflowAction aOverflowAction) const; sl@0: sl@0: /** sl@0: Convert from Unicode, truncating if there is not enough room in the output. sl@0: sl@0: @param aForeign The output is appended here. sl@0: @param aUnicode The input. sl@0: sl@0: @leave KErrOverflow if aForeign is too short for the output. sl@0: */ sl@0: IMPORT_C void ConvertFromUnicodeL(TDes8& aForeign, const TDesC16& aUnicode, TOverflowAction aOverflowAction=EOverflowActionLeave) const; sl@0: sl@0: /* sl@0: Convert to Unicode, truncating if there is not enough room in the output. sl@0: sl@0: @param aUnicode The output is appended here. sl@0: @param aForeign The input. sl@0: sl@0: @return False if and only if aUnicode has not enough space remaining. sl@0: */ sl@0: TBool ConvertToUnicode(TDes16& aUnicode, const TDesC8& aForeign ) const; sl@0: sl@0: /* sl@0: Convert to Unicode, leaving if there is not enough room in the output. sl@0: sl@0: @param aUnicode The output is appended here. sl@0: @param aForeign The input. sl@0: sl@0: @leave KErrOverflow if aUnicode is too short for the output. sl@0: */ sl@0: IMPORT_C void ConvertToUnicodeL(TDes16& aUnicode, const TDesC8& aForeign, TOverflowAction aOverflowAction=EOverflowActionLeave) const; sl@0: sl@0: /** sl@0: Returns true if the input character is legal in a short name. sl@0: sl@0: @param aCharacter Character, in the foreign character encoding. sl@0: sl@0: @return true if aCharacter is legal in a FAT short name. sl@0: */ sl@0: IMPORT_C TBool IsLegalShortNameCharacter(TUint aCharacter,TBool aUseExtendedChars=EFalse) const; sl@0: sl@0: public: sl@0: sl@0: /** sl@0: Constructor for TCodePageUtils. sl@0: */ sl@0: TCodePageUtils(); sl@0: sl@0: /** sl@0: Returns whether a Codepage dll is loaded. sl@0: sl@0: @return True if Codepage dll is loaded. sl@0: False otherwise sl@0: */ sl@0: TBool IsCodepageLoaded() const; sl@0: sl@0: /** sl@0: Returns the type of active codepage. sl@0: @return ENone if no dll is loaded sl@0: ELocaleDll if Locale Dll is loaded sl@0: ECodepageDll if Codepage Dll is loaded sl@0: */ sl@0: TCodepageLoaded CodepageLoaded() const; sl@0: sl@0: /** sl@0: Sets the current codepage to that provided by the current Locale DLL. sl@0: sl@0: @param aFunctions Pointer to FAT conversion functions to be used. sl@0: sl@0: @return None sl@0: */ sl@0: void SetLocaleCodePage(TFatUtilityFunctions* aFunctions); sl@0: sl@0: /** sl@0: Gets the function pointer to the read Locale conversions functions. sl@0: sl@0: @return function pointer to the read Locale conversions functions. sl@0: */ sl@0: TFatUtilityFunctions* LocaleFatUtilityFunctions() const; sl@0: sl@0: /** sl@0: Gets structure to function pointers to the read Codepage conversions functions. sl@0: sl@0: @return structure to function pointers to the read Codepage conversions functions. sl@0: */ sl@0: TCodePageFunctions CodepageFatUtilityFunctions() const; sl@0: sl@0: private: sl@0: sl@0: /** sl@0: Structure to function pointers to the read Codepage conversions functions. sl@0: */ sl@0: TCodePageFunctions iCodePageFunctions; sl@0: sl@0: /** sl@0: Function pointer to the read Locale conversions functions. sl@0: */ sl@0: TFatUtilityFunctions* iLocaleFatUtilityFunctions; sl@0: sl@0: /** sl@0: Variable to hold the active codepage type. sl@0: */ sl@0: TCodepageLoaded iCodepageLoaded; sl@0: sl@0: friend class TFsLoadCodePage; sl@0: }; sl@0: sl@0: /** sl@0: @internaltechnology sl@0: sl@0: Gets the pointer to the current FAT conversions functions. sl@0: sl@0: @return Pointer to the current FAT conversions functions. sl@0: */ sl@0: IMPORT_C const TFatUtilityFunctions* GetFatUtilityFunctions(); sl@0: sl@0: /** sl@0: @internaltechnology sl@0: sl@0: Gets the instance of TCodePageUtils class. sl@0: sl@0: @return Instance of TCodePageUtils class. sl@0: */ sl@0: IMPORT_C const TCodePageUtils& GetCodePage(); sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: Copies data to a buffer. sl@0: sl@0: If necessary, the buffer, a heap descriptor, is allocated or re-allocated sl@0: before copying takes place. sl@0: sl@0: @param aBuf A reference to a pointer to heap descriptor forming the buffer. sl@0: This will be allocated if it does not already exist, sl@0: or re-allocated if the existing buffer is not large enough. sl@0: @param aDes The data to be copied. sl@0: */ sl@0: IMPORT_C void AllocBufferL(HBufC*& aBuf,const TDesC& aDes); sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: Notifies sessions of a debug event if aFunction has the KDebugNotifyMask set. sl@0: sl@0: This function can only be used in debug builds or if _DEBUG sl@0: or _DEBUG_RELEASE is defined. sl@0: sl@0: @param aFunction A function. sl@0: @param aDrive A drive. sl@0: */ sl@0: IMPORT_C void DebugNotifySessions(TInt aFunction,TInt aDrive); sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: Writes data from a buffer to a file. sl@0: sl@0: Called by the mount control block lock and the unlock functions. sl@0: sl@0: @param aFileName The file to be written to. sl@0: @param aBuf The data to be written. sl@0: */ sl@0: IMPORT_C void WriteToDisk(const TDesC& aFileName,const TDesC8& aBuf); sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Create a proxy drive using the local proxy drive passed in sl@0: and any extensions that have been added to the drive. sl@0: sl@0: @param aConcreteDrive local proxy drive sl@0: @param aMount local proxy drive mount control block sl@0: sl@0: @return pointer to instantiated CProxyDrive object. sl@0: */ sl@0: IMPORT_C CProxyDrive* CreateProxyDriveL(CProxyDrive* aConcreteDrive,CMountCB* aMount); sl@0: sl@0: sl@0: sl@0: /** sl@0: @deprecated 6.1 sl@0: */ sl@0: IMPORT_C TInt CompareFilenames(const TDesC& aFileName1,const TDesC& aFileName2); sl@0: // sl@0: /** sl@0: Lookup a file system by name. sl@0: sl@0: @param aName file system name. sl@0: sl@0: @return pointer to instantiated CFileSystem object. sl@0: */ sl@0: IMPORT_C CFileSystem* GetFileSystem(const TDesC& aName); sl@0: sl@0: sl@0: sl@0: /** sl@0: @internalTechnology sl@0: sl@0: A static class for retrieving F32 properties sl@0: */ sl@0: class F32Properties sl@0: { sl@0: private: sl@0: F32Properties(); sl@0: public: sl@0: IMPORT_C static TBool Initialise(TInt aRomAddress, TInt aLength); sl@0: IMPORT_C static TBool GetString(const TDesC8& aSection, const TDesC8& aProperty, TDes8& aPropVal); sl@0: IMPORT_C static TBool GetInt(const TDesC8& aSection, const TDesC8& aProperty, TInt32& aPropVal); sl@0: IMPORT_C static TBool GetBool(const TDesC8& aSection, const TDesC8& aProperty, TBool& aPropVal); sl@0: private: sl@0: static TBool iInitialised; sl@0: static TInt iRomAddress; sl@0: static TInt iRomLength; sl@0: }; sl@0: sl@0: #include sl@0: #endif