userlibandfileserver/fileserver/sfile/sf_std.h
branchGCC_SURGE
changeset 221 39b39e1a406e
parent 201 43365a9b78a3
child 247 d8d70de2bd36
equal deleted inserted replaced
219:0ff03867bdb6 221:39b39e1a406e
    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 #include <utraceefile.h>
       
    38 
    37 
    39 #define __PRINT1TEMP_ALWAYS(t,a) {{TBuf<KMaxFileName>temp(a);RDebug::Print(t,&temp);}}
    38 #define __PRINT1TEMP_ALWAYS(t,a) {{TBuf<KMaxFileName>temp(a);RDebug::Print(t,&temp);}}
    40 #define __PRINT2TEMP_ALWAYS(t,a,b) {{TBuf<KMaxFileName>temp(b);RDebug::Print(t,a,&temp);}}
    39 #define __PRINT2TEMP_ALWAYS(t,a,b) {{TBuf<KMaxFileName>temp(b);RDebug::Print(t,a,&temp);}}
    41 #define __PRINT3TEMP_ALWAYS(t,a,b,c) {{TBuf<KMaxFileName>temp(c);RDebug::Print(t,a,b,&temp);}}
    40 #define __PRINT3TEMP_ALWAYS(t,a,b,c) {{TBuf<KMaxFileName>temp(c);RDebug::Print(t,a,b,&temp);}}
    42 #define __PRINT4TEMP_ALWAYS(t,a,b,c,d) {{TBuf<KMaxFileName>temp(d);RDebug::Print(t,a,b,c,&temp);}}
    41 #define __PRINT4TEMP_ALWAYS(t,a,b,c,d) {{TBuf<KMaxFileName>temp(d);RDebug::Print(t,a,b,c,&temp);}}
   113 #define __PLUGIN_PRINT1(t,a)
   112 #define __PLUGIN_PRINT1(t,a)
   114 #define __PLUGIN_PRINT2(t,a,b)
   113 #define __PLUGIN_PRINT2(t,a,b)
   115 #define __PLUGIN_PRINT3(t,a,b,c)
   114 #define __PLUGIN_PRINT3(t,a,b,c)
   116 #endif
   115 #endif
   117 
   116 
       
   117 #define _LOFF(p,T,f) ((T*)(((TUint8*)(p))-_FOFF(T,f)))
       
   118 
   118 const TInt KMaxTotalDriveReserved	=0x100000;
   119 const TInt KMaxTotalDriveReserved	=0x100000;
   119 const TInt KMaxSessionDriveReserved	=0x10000;
   120 const TInt KMaxSessionDriveReserved	=0x10000;
   120 
   121 
   121 // If TFsFileDuplciate::DoRequestL() is called a new sub-session is created and 
   122 // If TFsFileDuplciate::DoRequestL() is called a new sub-session is created and 
   122 // the new sub-session handle is returned, mangled by KSubSessionMangleBit - 
   123 // the new sub-session handle is returned, mangled by KSubSessionMangleBit - 
   141 //-- It is 2G-1. Used in legacy code that does not understand RFile64
   142 //-- It is 2G-1. Used in legacy code that does not understand RFile64
   142 const TUint64 KMaxLegacyFileSize    = 0x7fffffff;
   143 const TUint64 KMaxLegacyFileSize    = 0x7fffffff;
   143 
   144 
   144 //-- absolute maximum file size that file server supports
   145 //-- absolute maximum file size that file server supports
   145 const TUint64 KMaxSupportedFileSize = KMaxTUint64;
   146 const TUint64 KMaxSupportedFileSize = KMaxTUint64;
       
   147 
       
   148 //-- this is a speculative value of a min. amount of free space on the volume necessary to create a file, directory etc.
       
   149 //-- it is used mostly in "reserve drive space" functionality, which is, actually, fundamentally flawed.
       
   150 //-- the problem is that the file server can't know exactly how much space is required to create some fs object on the volume, 
       
   151 //-- so, it has to guess. This is a default "sector size" value; the file system can round it up internally to its cluster size if any.
       
   152 const TInt KMinFsCreateObjTreshold = KDefaultVolumeBlockSize;
       
   153 
   146 
   154 
   147 //__DATA_CAGING__
   155 //__DATA_CAGING__
   148 const TUint SHA1_LBLOCK=16;
   156 const TUint SHA1_LBLOCK=16;
   149 const TUint SHA1_HASH=20;
   157 const TUint SHA1_HASH=20;
   150 #if defined(_DEBUG) || defined(_DEBUG_RELEASE)
   158 #if defined(_DEBUG) || defined(_DEBUG_RELEASE)
   799 
   807 
   800 class CFsPlugin;
   808 class CFsPlugin;
   801 NONSHARABLE_CLASS(CPluginThread) : public CRequestThread
   809 NONSHARABLE_CLASS(CPluginThread) : public CRequestThread
   802 	{
   810 	{
   803 public:
   811 public:
   804 	CPluginThread(CFsPlugin& aPlugin);
   812 	CPluginThread(CFsPlugin& aPlugin, RLibrary aLibrary);
   805 	~CPluginThread();
   813 	~CPluginThread();
   806 	
   814 	
   807 	void CompleteSessionRequests(CSessionFs* aSession, TInt aValue);
   815 	void CompleteSessionRequests(CSessionFs* aSession, TInt aValue);
   808 
   816 
   809 	/** @prototype */
   817 	/** @prototype */
   811 
   819 
   812 	/** @prototype */
   820 	/** @prototype */
   813 	void OperationLockSignal();
   821 	void OperationLockSignal();
   814 
   822 
   815 private:
   823 private:
   816 	static CPluginThread* NewL(CFsPlugin& aPlugin);
   824 	static CPluginThread* NewL(CFsPlugin& aPlugin, RLibrary aLibrary);
   817 	TUint StartL();
   825 	TUint StartL();
   818 	virtual TInt DoThreadInitialise();
   826 	virtual TInt DoThreadInitialise();
   819 private:
   827 private:
   820 	CFsPlugin& iPlugin;
   828 	CFsPlugin& iPlugin;
   821 
   829 
   822 	/** @prototype */
   830 	/** @prototype */
   823 	RSemaphore iOperationLock;
   831 	RSemaphore iOperationLock;
   824 
   832 
       
   833 	RLibrary iLib;	// contains a handle to the library	which created the plugin
   825 friend class FsPluginManager;
   834 friend class FsPluginManager;
   826 	};
   835 	};
   827 
   836 
   828 class TFsDriveThread
   837 class TFsDriveThread
   829 	{
   838 	{
  1303 	inline TInt& LastError();
  1312 	inline TInt& LastError();
  1304 	inline void SetLastError(TInt aLastError);
  1313 	inline void SetLastError(TInt aLastError);
  1305 	inline void Init();
  1314 	inline void Init();
  1306 	void ReStart();
  1315 	void ReStart();
  1307 	TBool IsPluginRequest();
  1316 	TBool IsPluginRequest();
       
  1317 	static inline CFsMessageRequest* RequestFromMessage(const RMessagePtr2& aMessage);
  1308 	
  1318 	
  1309    // UID of the process to touching the file. (To be used in notification framework).
  1319    // UID of the process to touching the file. (To be used in notification framework).
  1310    // TUid iUID;
  1320    // TUid iUID;
  1311 private:
  1321 private:
  1312 	void DoNotify(TInt aError);
  1322 	void DoNotify(TInt aError);
  1703 extern CServerFs* TheFileServer;
  1713 extern CServerFs* TheFileServer;
  1704 
  1714 
  1705 extern HBufC* TheDriveNames[];
  1715 extern HBufC* TheDriveNames[];
  1706 extern TDrive TheDrives[KMaxDrives];
  1716 extern TDrive TheDrives[KMaxDrives];
  1707 extern TFileName TheDefaultPath;
  1717 extern TFileName TheDefaultPath;
  1708 extern RFTrace TheFtrace;
       
  1709 
  1718 
  1710 extern SCapabilitySet AllCapabilities;
  1719 extern SCapabilitySet AllCapabilities;
  1711 extern SCapabilitySet DisabledCapabilities;
  1720 extern SCapabilitySet DisabledCapabilities;
  1712 
  1721 
  1713 const TInt KDispatchObjectClose=KMaxTInt-1;
  1722 const TInt KDispatchObjectClose=KMaxTInt-1;
  1741  CFsObject* SessionObjectFromHandle(TInt aHandle,TInt aUniqueID, CSessionFs* aSession);
  1750  CFsObject* SessionObjectFromHandle(TInt aHandle,TInt aUniqueID, CSessionFs* aSession);
  1742  CFileShare* GetShareFromHandle(CSessionFs* aSession, TInt aHandle);
  1751  CFileShare* GetShareFromHandle(CSessionFs* aSession, TInt aHandle);
  1743 
  1752 
  1744  TInt  ValidateDrive(TInt aDriveNumber,CFsRequest* aRequest);
  1753  TInt  ValidateDrive(TInt aDriveNumber,CFsRequest* aRequest);
  1745  TInt  ValidateDriveDoSubst(TInt aDriveNumber,CFsRequest* aRequest);
  1754  TInt  ValidateDriveDoSubst(TInt aDriveNumber,CFsRequest* aRequest);
  1746  void  ValidateAtts(TUint anEntryAtt,TUint& aSetAttMask,TUint& aClearAttMask);
  1755  void  ValidateAtts(TUint& aSetAttMask,TUint& aClearAttMask);
  1747  TInt  ParseSubstPtr0(CFsRequest* aRequest,TParse& aParse, TBool aUseSessionPath = ETrue);
  1756  TInt  ParseSubstPtr0(CFsRequest* aRequest,TParse& aParse, TBool aUseSessionPath = ETrue);
  1748  TInt  ParseNoWildSubstPtr0(CFsRequest* aRequest,TParse& aParse, TBool aUseSessionPath = ETrue);
  1757  TInt  ParseNoWildSubstPtr0(CFsRequest* aRequest,TParse& aParse, TBool aUseSessionPath = ETrue);
  1749  TInt  ParseNoWildSubstPtr1(CFsRequest* aRequest,TParse& aParse);
  1758  TInt  ParseNoWildSubstPtr1(CFsRequest* aRequest,TParse& aParse);
  1750  TInt  ParseNoWildSubstCheckPtr0(CFsRequest* aRequest,TParse& aParse, TBool aUseSessionPath = ETrue);
  1759  TInt  ParseNoWildSubstCheckPtr0(CFsRequest* aRequest,TParse& aParse, TBool aUseSessionPath = ETrue);
  1751  TInt  ParseNoWildSubstCheckPtr1(CFsRequest* aRequest,TParse& aParse);
  1760  TInt  ParseNoWildSubstCheckPtr1(CFsRequest* aRequest,TParse& aParse);
  1837 extern HBufC* gCorruptFileNamesListFile;
  1846 extern HBufC* gCorruptFileNamesListFile;
  1838 #endif
  1847 #endif
  1839 
  1848 
  1840 typedef TPckgBuf<TMediaPswdReplyNotifyInfoV1> TMediaPswdReplyNotifyInfoV1Buf;
  1849 typedef TPckgBuf<TMediaPswdReplyNotifyInfoV1> TMediaPswdReplyNotifyInfoV1Buf;
  1841 
  1850 
  1842 #if defined(__WINS__)
       
  1843  TInt MapWindowsFileName(TDes& aBuffer,const TDesC& aFileName);
       
  1844 #endif
       
  1845 
       
  1846 enum TDllFindMethod {EFindInPath, EFindInSystemLibs, EFindInSystemBin, EFindExhausted};
  1851 enum TDllFindMethod {EFindInPath, EFindInSystemLibs, EFindInSystemBin, EFindExhausted};
  1847 
  1852 
  1848 //---------------------------------------------------------------------------------------------------------------------
  1853 //---------------------------------------------------------------------------------------------------------------------
  1849 
  1854 
  1850 NONSHARABLE_CLASS(CFileBody) : public CBase, public CFileCB::MExtendedFileInterface
  1855 NONSHARABLE_CLASS(CFileBody) : public CBase, public CFileCB::MExtendedFileInterface
  1946 	TBool iProxyDriveDismounted;
  1951 	TBool iProxyDriveDismounted;
  1947 	CFileSystem* iFSys;  ///< link to the FileSystem object that has produced the mount (iMountCB)
  1952 	CFileSystem* iFSys;  ///< link to the FileSystem object that has produced the mount (iMountCB)
  1948 friend class CMountCB;
  1953 friend class CMountCB;
  1949 	};
  1954 	};
  1950 
  1955 
       
  1956 // extension to CProxyDrive
       
  1957 class CProxyDriveBody : public CBase
       
  1958 	{
       
  1959 public:
       
  1960 	RLibrary iLibrary;
       
  1961 	};
  1951 
  1962 
  1952 #include "sf_ops.h"
  1963 #include "sf_ops.h"
  1953 #include "sf_std.inl"
  1964 #include "sf_std.inl"
  1954 
  1965 
  1955 
  1966