userlibandfileserver/fileserver/sfat32/inc/sl_std.h
changeset 148 31ea0f8e3c99
parent 90 947f0dc9f7a8
child 189 a5496987b1da
equal deleted inserted replaced
135:5e441a173c63 148:31ea0f8e3c99
    56 
    56 
    57 class CFatMountCB;
    57 class CFatMountCB;
    58 class CFatFileSystem;
    58 class CFatFileSystem;
    59 
    59 
    60 /**
    60 /**
    61 Represents the position of a directory entery in terms of a cluster and off set into it
    61 Represents the position of a directory entry in terms of a cluster and offset into it
    62 */
    62 */
    63 class TEntryPos
    63 class TEntryPos
    64 	{
    64 	{
    65 public:
    65 public:
    66 	TEntryPos() : iCluster(EOF_32Bit), iPos(0) {}
    66 	TEntryPos() : iCluster(EOF_32Bit), iPos(0) {}
    90 
    90 
    91 public:
    91 public:
    92 
    92 
    93     //-- public interface to the local drive. Provides media driver's error handling (critical and non-critical user notifiers)
    93     //-- public interface to the local drive. Provides media driver's error handling (critical and non-critical user notifiers)
    94     //-- and thread-safety if required.
    94     //-- and thread-safety if required.
    95 	TInt ReadNonCritical(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset) const;
    95 	TInt ReadNonCritical(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag) const;
    96 	TInt ReadNonCritical(TInt64 aPos,TInt aLength,TDes8& aTrg) const;
    96 	TInt ReadNonCritical(TInt64 aPos,TInt aLength,TDes8& aTrg) const;
    97 	TInt ReadCritical(TInt64 aPos,TInt aLength,TDes8& aTrg) const;
    97 	TInt ReadCritical(TInt64 aPos,TInt aLength,TDes8& aTrg) const;
    98 	
    98 	
    99     TInt WriteCritical(TInt64 aPos,const TDesC8& aSrc);
    99     TInt WriteCritical(TInt64 aPos,const TDesC8& aSrc);
   100     TInt WriteNonCritical(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset);
   100     TInt WriteNonCritical(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag);
   101 	
   101 	
   102     TInt GetLastErrorInfo(TDes8& aErrorInfo) const;
   102     TInt GetLastErrorInfo(TDes8& aErrorInfo) const;
   103 
   103 
   104     //-- lock the mutex guarding CProxyDrive interface in order to be sure that no other thread can access it.
   104     //-- lock the mutex guarding CProxyDrive interface in order to be sure that no other thread can access it.
   105     //-- The thread that calls this method may be suspended until another signals the mutex, i.e. leaves the critical section.
   105     //-- The thread that calls this method may be suspended until another signals the mutex, i.e. leaves the critical section.
   146             
   146             
   147         inline void EnterCriticalSection() const {iLock.Wait();}
   147         inline void EnterCriticalSection() const {iLock.Wait();}
   148         inline void LeaveCriticalSection() const {iLock.Signal();}
   148         inline void LeaveCriticalSection() const {iLock.Signal();}
   149 
   149 
   150         //-- methods' wrappers that are used by TDriveInterface
   150         //-- methods' wrappers that are used by TDriveInterface
   151         TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset) const;
   151         TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag) const;
   152         TInt Read(TInt64 aPos,TInt aLength,TDes8& aTrg) const;
   152         TInt Read(TInt64 aPos,TInt aLength,TDes8& aTrg) const;
   153         TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset);
   153         TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag);
   154         TInt Write(TInt64 aPos, const TDesC8& aSrc);
   154         TInt Write(TInt64 aPos, const TDesC8& aSrc);
   155         TInt GetLastErrorInfo(TDes8& aErrorInfo) const;
   155         TInt GetLastErrorInfo(TDes8& aErrorInfo) const;
   156         TInt Caps(TDes8& anInfo) const;
   156         TInt Caps(TDes8& anInfo) const;
   157 
   157 
   158      private:
   158      private:
   334 	@param aLength	Length in bytes of read
   334 	@param aLength	Length in bytes of read
   335 	@param aTrg		Pointer to the data descriptor, i.e. (const TAny*)(&TDes8)
   335 	@param aTrg		Pointer to the data descriptor, i.e. (const TAny*)(&TDes8)
   336 	@param aMessage	Refrence to server message from request
   336 	@param aMessage	Refrence to server message from request
   337 	@param anOffset	Offset into read data to write
   337 	@param anOffset	Offset into read data to write
   338 	*/
   338 	*/
   339 	virtual void ReadL(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset) const = 0;
   339 	virtual void ReadL(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag) const = 0;
   340 
   340 
   341 	/**
   341 	/**
   342 	Disk write function
   342 	Disk write function
   343 
   343 
   344 	@param aPos		Media position in bytes
   344 	@param aPos		Media position in bytes
   345 	@param aLength	Length in bytes of write
   345 	@param aLength	Length in bytes of write
   346 	@param aTrg		Pointer to the data descriptor, i.e. (const TAny*)(&TDes8)
   346 	@param aTrg		Pointer to the data descriptor, i.e. (const TAny*)(&TDes8)
   347 	@param aMessage	Refrence to server message from request, contains data
   347 	@param aMessage	Refrence to server message from request, contains data
   348 	@param anOffset	Offset into write data to use in write
   348 	@param anOffset	Offset into write data to use in write
   349 	*/
   349 	*/
   350 	virtual void WriteL(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset) = 0;
   350 	virtual void WriteL(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag) = 0;
   351 
   351 
   352     
   352     
   353     virtual inline MWTCacheInterface* DirCacheInterface();
   353     virtual inline MWTCacheInterface* DirCacheInterface();
   354 
   354 
   355 
   355 
   426 class TLeafDirData;
   426 class TLeafDirData;
   427 class CLeafDirCache;
   427 class CLeafDirCache;
   428 
   428 
   429 
   429 
   430 /**
   430 /**
   431 Fat file system mount implmentation, provides all that is required of a plug in
   431 Fat file system mount implementation, provides all that is required of a plug in
   432 file system mount as well as Fat mount specific functionality 
   432 file system mount as well as Fat mount specific functionality 
   433 */
   433 */
   434 class CFatMountCB : public CLocDrvMountCB, 
   434 class CFatMountCB : public CLocDrvMountCB, 
   435 					public MFileSystemSubType,
   435 					public MFileSystemSubType,
   436 					public MFileSystemClusterSize,
   436 					public MFileSystemClusterSize,
   568 	void WriteDirEntryL(const TEntryPos& aPos,const TFatDirEntry& aDirEntry);
   568 	void WriteDirEntryL(const TEntryPos& aPos,const TFatDirEntry& aDirEntry);
   569 
   569 
   570     void DirReadL(const TEntryPos& aPos,TInt aLength,TDes8& aDes) const;
   570     void DirReadL(const TEntryPos& aPos,TInt aLength,TDes8& aDes) const;
   571     void DirWriteL(const TEntryPos& aPos,const TDesC8& aDes);
   571     void DirWriteL(const TEntryPos& aPos,const TDesC8& aDes);
   572 
   572 
   573 	void ReadFromClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2& aMessage,TInt anOffset) const;
   573 	void ReadFromClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2& aMessage,TInt anOffset, TUint aFlag) const;
   574     void WriteToClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2& aMessage,TInt anOffset, TUint& aBadcluster, TUint& aGoodcluster);
   574     void WriteToClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2& aMessage,TInt anOffset, TUint& aBadcluster, TUint& aGoodcluster, TUint aFlag);
   575 	
   575 	
   576 	void MoveToNextEntryL(TEntryPos& aPos) const;
   576 	void MoveToNextEntryL(TEntryPos& aPos) const;
   577 	void MoveToDosEntryL(TEntryPos& aPos,TFatDirEntry& anEntry) const;
   577 	void MoveToDosEntryL(TEntryPos& aPos,TFatDirEntry& anEntry) const;
   578 	void EnlargeL(TInt aSize);
   578 	void EnlargeL(TInt aSize);
   579 	void ReduceSizeL(TInt aPos,TInt aLength);
   579 	void ReduceSizeL(TInt aPos,TInt aLength);
   701 
   701 
   702 	void CheckFatForLoopsL(const TFatDirEntry& anEntry) const;
   702 	void CheckFatForLoopsL(const TFatDirEntry& anEntry) const;
   703 	void DoCheckFatForLoopsL(TUint32 aCluster, TUint32& aPreviousCluster, TUint32& aChangePreviousCluster, TUint32& aCount) const;
   703 	void DoCheckFatForLoopsL(TUint32 aCluster, TUint32& aPreviousCluster, TUint32& aChangePreviousCluster, TUint32& aCount) const;
   704     void InitializeL(const TLocalDriveCaps& aLocDrvCaps, TBool aIgnoreFSInfo=EFalse);
   704     void InitializeL(const TLocalDriveCaps& aLocDrvCaps, TBool aIgnoreFSInfo=EFalse);
   705 
   705 
   706 	void DoReadFromClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2& aMessage,TInt anOffset) const;
   706 	void DoReadFromClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2& aMessage,TInt anOffset, TUint aFlag) const;
   707     void DoWriteToClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2& aMessage,TInt anOffset, TUint aLastcluster, TUint& aBadcluster, TUint& aGoodcluster);
   707     void DoWriteToClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2& aMessage,TInt anOffset, TUint aLastcluster, TUint& aBadcluster, TUint& aGoodcluster, TUint aFlag);
   708 
   708 
   709 	TBool IsUniqueNameL(const TShortName& aName, TUint32 aDirCluster);
   709 	TBool IsUniqueNameL(const TShortName& aName, TUint32 aDirCluster);
   710 	TBool FindShortNameL(const TShortName& aName,TEntryPos& anEntryPos);
   710 	TBool FindShortNameL(const TShortName& aName,TEntryPos& anEntryPos);
   711 	void ReplaceClashingNameL(const TShortName& aNewName,const TEntryPos& anEntryPos);
   711 	void ReplaceClashingNameL(const TShortName& aNewName,const TEntryPos& anEntryPos);
   712     TBool GenerateShortNameL(TUint32 aDirCluster,const TDesC& aLongName,TShortName& aShortName, TBool aForceRandomize=EFalse);
   712     TBool GenerateShortNameL(TUint32 aDirCluster,const TDesC& aLongName,TShortName& aShortName, TBool aForceRandomize=EFalse);
   898 	TInt iSeekIndexSize;    ///< size of seek index
   898 	TInt iSeekIndexSize;    ///< size of seek index
   899 	
   899 	
   900     TUint     iStartCluster;     ///< Start cluster number of file
   900     TUint     iStartCluster;     ///< Start cluster number of file
   901 	TEntryPos iCurrentPos;  ///< Current position in file data
   901 	TEntryPos iCurrentPos;  ///< Current position in file data
   902 	
   902 	
   903     TEntryPos iFileDosEntryPos;  ///< File DOS dir. entry position
   903     TEntryPos iFileDosEntryPos;	///< File DOS dir. entry position
   904 	
   904 	
   905     TBool iFileSizeModified :1;  ///< flag, indicating that file size was modified and needs to be flushed onto the media (see FlushL())
   905     TBool iFileSizeModified :1;	///< flag, indicating that file size was modified and needs to be flushed onto the media (see FlushL())
   906     TBool iFileTimeModified :1;  ///< flag, indicating that file modification time was modified and needs to be flushed onto the media (see FlushL())
   906     TBool iFileTimeModified :1;	///< flag, indicating that file modification time was modified and needs to be flushed onto the media (see FlushL())
   907 
   907 
   908 	};
   908 	};
   909 
   909 
   910 
   910 
   911 
   911