32 #include <e32const_private.h> |
32 #include <e32const_private.h> |
33 #include "sf_plugin.h" |
33 #include "sf_plugin.h" |
34 #include "sf_func.h" |
34 #include "sf_func.h" |
35 #include <f32plugin.h> |
35 #include <f32plugin.h> |
36 #include "f32trace.h" |
36 #include "f32trace.h" |
|
37 |
37 |
38 |
38 #define __PRINT1TEMP_ALWAYS(t,a) {{TBuf<KMaxFileName>temp(a);RDebug::Print(t,&temp);}} |
39 #define __PRINT1TEMP_ALWAYS(t,a) {{TBuf<KMaxFileName>temp(a);RDebug::Print(t,&temp);}} |
39 #define __PRINT2TEMP_ALWAYS(t,a,b) {{TBuf<KMaxFileName>temp(b);RDebug::Print(t,a,&temp);}} |
40 #define __PRINT2TEMP_ALWAYS(t,a,b) {{TBuf<KMaxFileName>temp(b);RDebug::Print(t,a,&temp);}} |
40 #define __PRINT3TEMP_ALWAYS(t,a,b,c) {{TBuf<KMaxFileName>temp(c);RDebug::Print(t,a,b,&temp);}} |
41 #define __PRINT3TEMP_ALWAYS(t,a,b,c) {{TBuf<KMaxFileName>temp(c);RDebug::Print(t,a,b,&temp);}} |
41 #define __PRINT4TEMP_ALWAYS(t,a,b,c,d) {{TBuf<KMaxFileName>temp(d);RDebug::Print(t,a,b,c,&temp);}} |
42 #define __PRINT4TEMP_ALWAYS(t,a,b,c,d) {{TBuf<KMaxFileName>temp(d);RDebug::Print(t,a,b,c,&temp);}} |
767 |
768 |
768 NONSHARABLE_CLASS(CDriveThread) : public CRequestThread |
769 NONSHARABLE_CLASS(CDriveThread) : public CRequestThread |
769 { |
770 { |
770 public: |
771 public: |
771 void CompleteReadWriteRequests(); |
772 void CompleteReadWriteRequests(); |
772 void CompleteSessionRequests(CSessionFs* aSession, TInt aValue); |
|
773 void CompleteClientRequests(TInt aValue); |
773 void CompleteClientRequests(TInt aValue); |
774 TBool IsRequestWriteable(); |
774 TBool IsRequestWriteable(); |
775 TBool IsSessionNotifyUser(); |
775 TBool IsSessionNotifyUser(); |
776 private: |
776 private: |
777 CDriveThread(); |
777 CDriveThread(); |
790 friend class FsThreadManager; |
790 friend class FsThreadManager; |
791 }; |
791 }; |
792 |
792 |
793 class CFsInternalRequest; |
793 class CFsInternalRequest; |
794 |
794 |
795 NONSHARABLE_CLASS(CDisconnectThread) : public CRequestThread |
|
796 { |
|
797 public: |
|
798 inline CFsInternalRequest* GetRequest(); |
|
799 private: |
|
800 static CDisconnectThread* NewL(); |
|
801 TUint StartL(); |
|
802 ~CDisconnectThread(); |
|
803 private: |
|
804 CFsInternalRequest* iRequest; |
|
805 friend class FsThreadManager; |
|
806 }; |
|
807 |
|
808 class CFsPlugin; |
795 class CFsPlugin; |
809 NONSHARABLE_CLASS(CPluginThread) : public CRequestThread |
796 NONSHARABLE_CLASS(CPluginThread) : public CRequestThread |
810 { |
797 { |
811 public: |
798 public: |
812 CPluginThread(CFsPlugin& aPlugin, RLibrary aLibrary); |
799 CPluginThread(CFsPlugin& aPlugin, RLibrary aLibrary); |
813 ~CPluginThread(); |
800 ~CPluginThread(); |
814 |
801 |
815 void CompleteSessionRequests(CSessionFs* aSession, TInt aValue); |
|
816 |
|
817 /** @prototype */ |
802 /** @prototype */ |
818 void OperationLockWait(); |
803 void OperationLockWait(); |
819 |
804 |
820 /** @prototype */ |
805 /** @prototype */ |
821 void OperationLockSignal(); |
806 void OperationLockSignal(); |
850 |
835 |
851 |
836 |
852 class FsThreadManager |
837 class FsThreadManager |
853 { |
838 { |
854 public: |
839 public: |
855 static TInt CreateDisconnectThread(); |
|
856 static inline CDisconnectThread* GetDisconnectThread() {return(iDisconnectThread);} |
|
857 static TBool IsDisconnectThread(); |
|
858 // |
840 // |
859 static void SetMainThreadId(); |
841 static void SetMainThreadId(); |
860 static TBool IsMainThread(); |
842 static TBool IsMainThread(); |
861 // |
843 // |
862 static TInt InitDrive(TInt aDrvNumber,TBool aIsSync); |
844 static TInt InitDrive(TInt aDrvNumber,TBool aIsSync); |
877 private: |
859 private: |
878 inline static TFsDriveThread& GetFsDriveThread(TInt aDrvNumber) {return(iFsThreads[aDrvNumber]);} |
860 inline static TFsDriveThread& GetFsDriveThread(TInt aDrvNumber) {return(iFsThreads[aDrvNumber]);} |
879 private: |
861 private: |
880 static TFsDriveThread iFsThreads[KMaxDrives]; |
862 static TFsDriveThread iFsThreads[KMaxDrives]; |
881 static TUint iMainId; |
863 static TUint iMainId; |
882 static CDisconnectThread* iDisconnectThread; |
|
883 static TUint iDisconnectThreadId; |
864 static TUint iDisconnectThreadId; |
884 }; |
865 }; |
885 |
866 |
886 |
867 |
887 const TInt KReservedDriveAccessArrayGranularity = 2; |
868 const TInt KReservedDriveAccessArrayGranularity = 2; |
903 class CFsMessageRequest; |
884 class CFsMessageRequest; |
904 NONSHARABLE_CLASS(CSessionFs) : public CSession2 |
885 NONSHARABLE_CLASS(CSessionFs) : public CSession2 |
905 { |
886 { |
906 public: |
887 public: |
907 static CSessionFs* NewL(); |
888 static CSessionFs* NewL(); |
908 ~CSessionFs(); |
|
909 virtual void CreateL(); |
889 virtual void CreateL(); |
|
890 |
|
891 inline void Open(); |
|
892 void Close(); |
|
893 |
910 TInt CurrentDrive(); |
894 TInt CurrentDrive(); |
911 void ServiceL(const RMessage2& aMessage); |
895 void ServiceL(const RMessage2& aMessage); |
912 TInt CountResources(); |
896 TInt CountResources(); |
913 void ResourceCountMarkStart(); |
897 void ResourceCountMarkStart(); |
914 void ResourceCountMarkEnd(const RMessage2& aMessage); |
898 void ResourceCountMarkEnd(const RMessage2& aMessage); |
935 TInt SetReserved(const TInt aDriveNumber, const TInt aReservedValue); |
919 TInt SetReserved(const TInt aDriveNumber, const TInt aReservedValue); |
936 TBool ReservedAccess(TInt aDriveNumber) const; |
920 TBool ReservedAccess(TInt aDriveNumber) const; |
937 void SetReservedAccess(const TInt aDriveNumber, const TBool aReservedAccess); |
921 void SetReservedAccess(const TInt aDriveNumber, const TBool aReservedAccess); |
938 private: |
922 private: |
939 CSessionFs(); |
923 CSessionFs(); |
|
924 ~CSessionFs(); |
940 |
925 |
941 private: |
926 private: |
942 TInt iResourceCountMark; |
927 TInt iResourceCountMark; |
943 TInt iResourceCount; |
928 TInt iResourceCount; |
944 TInt iSessionFlags; |
929 TInt iSessionFlags; |
945 RFastLock iSessionFlagsLock; |
930 RFastLock iSessionFlagsLock; |
946 CFsObjectIx* iHandles; |
931 CFsObjectIx* iHandles; |
947 HBufC* iPath; |
932 HBufC* iPath; |
948 CFsMessageRequest* iDisconnectRequest; |
|
949 RArray<TReservedDriveAccess> iReservedDriveAccess; |
933 RArray<TReservedDriveAccess> iReservedDriveAccess; |
950 TThreadId iId; |
934 TThreadId iId; |
951 TInt iCloseRequestCount; // number of close requests owned by this sessions on the RequestAllocator close queue |
935 TInt iCloseRequestCount; // number of close requests owned by this sessions on the RequestAllocator close queue |
952 friend class CFsDisconnectRequest; |
936 TInt iAccessCount; |
|
937 RMessage2 iMessage; // message passed to CSessionFs::Disconnect() |
953 }; |
938 }; |
954 |
939 |
955 NONSHARABLE_CLASS(CServerFs) : public CServer2 |
940 NONSHARABLE_CLASS(CServerFs) : public CServer2 |
956 { |
941 { |
957 public: |
942 public: |
1219 inline TBool IsChangeNotify() const; |
1205 inline TBool IsChangeNotify() const; |
1220 inline void SetState(TReqStates aReqState); |
1206 inline void SetState(TReqStates aReqState); |
1221 inline TBool DirectToDrive(); |
1207 inline TBool DirectToDrive(); |
1222 inline TBool IsDescData(TInt aMsgNum); |
1208 inline TBool IsDescData(TInt aMsgNum); |
1223 inline TInt FsFunction(); |
1209 inline TInt FsFunction(); |
|
1210 void Close(); // close the session & dispatch object this request is using |
1224 |
1211 |
1225 public: |
1212 public: |
1226 CFsRequest(); |
1213 CFsRequest(); |
1227 protected: |
1214 protected: |
1228 inline void Set(const TOperation& aOperation,CSessionFs* aSession); |
1215 inline void Set(const TOperation& aOperation,CSessionFs* aSession); |
1229 inline void Set(CSessionFs* aSession); |
1216 inline void Set(CSessionFs* aSession); |
1230 inline void SetError(TInt aError); |
1217 inline void SetError(TInt aError); |
1231 inline TInt GetError() const; |
1218 inline TInt GetError() const; |
1232 inline void SetPostOperation(TBool aSet); |
1219 inline void SetPostOperation(TBool aSet); |
1233 |
1220 |
1234 inline TBool IsFsObjectOpen(); |
1221 |
1235 inline void SetFsObjectOpen(TBool aSet); |
1222 void OpenDispatchObject(const TInt64& aValue); // open the dispatch object this request is using |
1236 void SetAndOpenScratchValue(const TInt64& aValue); |
1223 void CloseDispatchObject(); |
|
1224 void OpenSession(CSessionFs* aSession); // open the session this request is using |
|
1225 void CloseSession(); |
1237 |
1226 |
1238 private: |
1227 private: |
1239 TInt GetSlot(TFsPluginRequest::TF32ArgType aType); |
1228 TInt GetSlot(TFsPluginRequest::TF32ArgType aType); |
1240 public: |
1229 public: |
1241 TDblQueLink iLink; |
1230 TDblQueLink iLink; |
1258 { |
1247 { |
1259 EIsAllocated = 0x01, |
1248 EIsAllocated = 0x01, |
1260 EFreeChanged = 0x02, // valid only for EFsFileWrite |
1249 EFreeChanged = 0x02, // valid only for EFsFileWrite |
1261 EPostInterceptEnabled = 0x04, |
1250 EPostInterceptEnabled = 0x04, |
1262 EPostOperation = 0x08, |
1251 EPostOperation = 0x08, |
1263 EFsObjectOpen = 0x10, |
1252 EFsDspObjOpen = 0x10, // scratch value (a CFsDispatchObject) has been opened |
1264 }; |
1253 }; |
1265 TUint iFlags; |
1254 TUint iFlags; |
1266 |
1255 |
1267 TInt iError; |
1256 TInt iError; |
1268 }; |
1257 }; |
1377 public: |
1366 public: |
1378 CFsClientMessageRequest* iNext; |
1367 CFsClientMessageRequest* iNext; |
1379 protected: |
1368 protected: |
1380 TParsePool* iPoolSrc; |
1369 TParsePool* iPoolSrc; |
1381 TParsePool* iPoolDest; |
1370 TParsePool* iPoolDest; |
1382 }; |
|
1383 |
|
1384 NONSHARABLE_CLASS(CFsDisconnectRequest) : public CFsMessageRequest |
|
1385 { |
|
1386 public: |
|
1387 virtual void Process(); |
|
1388 virtual void Dispatch(); |
|
1389 virtual void Complete(TInt aError); |
|
1390 }; |
1371 }; |
1391 |
1372 |
1392 NONSHARABLE_CLASS(CFsInternalRequest) : public CFsRequest |
1373 NONSHARABLE_CLASS(CFsInternalRequest) : public CFsRequest |
1393 { |
1374 { |
1394 public: |
1375 public: |
1719 |
1700 |
1720 extern SCapabilitySet AllCapabilities; |
1701 extern SCapabilitySet AllCapabilities; |
1721 extern SCapabilitySet DisabledCapabilities; |
1702 extern SCapabilitySet DisabledCapabilities; |
1722 |
1703 |
1723 const TInt KDispatchObjectClose=KMaxTInt-1; |
1704 const TInt KDispatchObjectClose=KMaxTInt-1; |
1724 const TInt KSessionDisconnect=KMaxTInt-2; |
1705 const TInt KSessionInternalReserved2=KMaxTInt-2; // not used any more - placeholder |
1725 const TInt KCancelSession=KMaxTInt-3; |
1706 const TInt KSessionInternalReserved3=KMaxTInt-3; // not used any more - placeholder |
1726 const TInt KCancelPlugin=KMaxTInt-4; |
1707 const TInt KSessionInternalReserved4=KMaxTInt-4; // not used any more - placeholder |
1727 const TInt KFileShareClose=KMaxTInt-5; |
1708 const TInt KFileShareClose=KMaxTInt-5; |
1728 const TInt KFlushDirtyData=KMaxTInt-6; |
1709 const TInt KFlushDirtyData=KMaxTInt-6; |
1729 |
1710 |
1730 const TOperation DispatchObjectCloseOp= {KDispatchObjectClose, EInternalRequest, &TFsCloseObject::Initialise, NULL, &TFsCloseObject::DoRequestL }; |
1711 const TOperation DispatchObjectCloseOp= {KDispatchObjectClose, EInternalRequest, &TFsCloseObject::Initialise, NULL, &TFsCloseObject::DoRequestL }; |
1731 const TOperation SessionDisconnectOp= {KSessionDisconnect, EInternalRequest, &TFsSessionDisconnect::Initialise, NULL, &TFsSessionDisconnect::DoRequestL }; |
|
1732 const TOperation CancelSessionOp= {KCancelSession, EInternalRequest, &TFsCancelSession::Initialise, NULL, &TFsCancelSession::DoRequestL }; |
|
1733 const TOperation CancelPluginOp= {KCancelPlugin, EInternalRequest, &TFsCancelPlugin::Initialise, NULL, &TFsCancelPlugin::DoRequestL }; |
|
1734 const TOperation FileShareCloseOp= {KFileShareClose, EInternalRequest, &TFsCloseFileShare::Initialise, NULL, &TFsCloseFileShare::DoRequestL }; |
1712 const TOperation FileShareCloseOp= {KFileShareClose, EInternalRequest, &TFsCloseFileShare::Initialise, NULL, &TFsCloseFileShare::DoRequestL }; |
1735 const TOperation FlushDirtyDataOp= {KFlushDirtyData, EInternalRequest, &TFsFlushDirtyData::Initialise, NULL, &TFsFlushDirtyData::DoRequestL }; |
|
1736 |
1713 |
1737 extern TBool OpenOnDriveZOnly; |
1714 extern TBool OpenOnDriveZOnly; |
1738 extern TBool LocalFileSystemInitialized; |
1715 extern TBool LocalFileSystemInitialized; |
1739 extern TBool StartupInitCompleted; |
1716 extern TBool StartupInitCompleted; |
1740 extern TBool RefreshZDriveCache; |
1717 extern TBool RefreshZDriveCache; |