sl@0: // Copyright (c) 1998-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: sl@0: /* sl@0: @file sl@0: @internalTechnology sl@0: sl@0: "fs_auto_mounter" filesystem classes definition sl@0: */ sl@0: sl@0: sl@0: #ifndef AUTOMOUNTER_FILESYSTEM_H sl@0: #define AUTOMOUNTER_FILESYSTEM_H sl@0: sl@0: #include "filesystem_utils.h" sl@0: #include sl@0: #include sl@0: sl@0: sl@0: IMPORT_C TUint32 DebugRegister(); sl@0: sl@0: //-- define this for having logs disregarding DebugRegister() settings sl@0: //#define FORCE_LOGS sl@0: sl@0: sl@0: #if defined(_DEBUG) || defined(_DEBUG_RELEASE) sl@0: //----------------- DEBUG mode ----------------- sl@0: sl@0: #ifndef FORCE_LOGS sl@0: #define __PRINT(t) {if (DebugRegister()&KFSYS) RDebug::Print(t);} sl@0: #define __PRINT1(t,a) {if (DebugRegister()&KFSYS) RDebug::Print(t,a);} sl@0: #define __PRINT2(t,a,b) {if (DebugRegister()&KFSYS) RDebug::Print(t,a,b);} sl@0: #define __PRINT3(t,a,b,c) {if (DebugRegister()&KFSYS) RDebug::Print(t,a,b,c);} sl@0: #define __PRINT4(t,a,b,c,d) {if (DebugRegister()&KFSYS) RDebug::Print(t,a,b,c,d);} sl@0: #else sl@0: #define __PRINT(t) {RDebug::Print(t);} sl@0: #define __PRINT1(t,a) {RDebug::Print(t,a);} sl@0: #define __PRINT2(t,a,b) {RDebug::Print(t,a,b);} sl@0: #define __PRINT3(t,a,b,c) {RDebug::Print(t,a,b,c);} sl@0: #define __PRINT4(t,a,b,c,d) {RDebug::Print(t,a,b,c,d);} sl@0: #endif sl@0: sl@0: #define DBG_STATEMENT(text) text sl@0: sl@0: #else sl@0: //----------------- RELEASE mode ----------------- sl@0: #define __PRINT(t) sl@0: #define __PRINT1(t,a) sl@0: #define __PRINT2(t,a,b) sl@0: #define __PRINT3(t,a,b,c) sl@0: #define __PRINT4(t,a,b,c,d) sl@0: #define __PRINT8BIT1(t,a) sl@0: #define __PRINT1TEMP(t,a) sl@0: sl@0: #define DBG_STATEMENT(text) sl@0: sl@0: #endif //#if defined(_DEBUG) || defined(_DEBUG_RELEASE) sl@0: sl@0: sl@0: //####################################################################################################################################### sl@0: //# constants definitions here sl@0: //####################################################################################################################################### sl@0: sl@0: sl@0: sl@0: //----------------------------------------------------------------------------- sl@0: sl@0: /** sl@0: Internal fault codes for Automounter.fsy sl@0: */ sl@0: enum TFault sl@0: { sl@0: ENotImplemented, sl@0: EWrongDriveAttributes, sl@0: EPluginInitialise, sl@0: EFileSysNotAdded, sl@0: EWrongConfiguration, sl@0: EIncompatibleFileSystems, sl@0: sl@0: EMustNotBeCalled sl@0: sl@0: }; sl@0: sl@0: //----------------------------------------------------------------------------- sl@0: sl@0: void Fault(TFault aFault); sl@0: sl@0: sl@0: //----------------------------------------------------------------------------- sl@0: /** sl@0: This class is a container for child file system names that are supported by automounter. sl@0: Child FS names are stored in Upper Case to enable simple FSName hash calculations. sl@0: The names must be unique. sl@0: */ sl@0: class XStringArray sl@0: { sl@0: public: sl@0: XStringArray(); sl@0: ~XStringArray(); sl@0: sl@0: void Reset(); sl@0: const TDesC& operator[](TUint aIndex) const; sl@0: TInt Append(const TDesC& aString); sl@0: TUint Count() const {return iStrings.Count();} sl@0: TUint32 GetStringHash(TUint aIndex) const; sl@0: sl@0: sl@0: private: sl@0: XStringArray(const XStringArray&); sl@0: XStringArray& operator=(const XStringArray&); sl@0: sl@0: /** panic codes */ sl@0: enum TPanicCode sl@0: { sl@0: EIndexOutOfRange, ///< index out of range sl@0: ENotImplemented, ///< functionality isn't implemented sl@0: }; sl@0: sl@0: void Panic(TPanicCode aPanicCode) const; sl@0: sl@0: private: sl@0: RPointerArray iStrings; sl@0: sl@0: }; sl@0: sl@0: sl@0: //----------------------------------------------------------------------------- sl@0: sl@0: /** sl@0: File system class definition sl@0: */ sl@0: class CAutoMounterFileSystem : public CFileSystem, CFileSystem::MFileSystemExtInterface sl@0: { sl@0: public: sl@0: static CAutoMounterFileSystem* New(); sl@0: ~CAutoMounterFileSystem(); sl@0: public: sl@0: sl@0: //-- pure virtual interface implementation, overrides from CFileSystem sl@0: TInt Install(); sl@0: CMountCB* NewMountL() const; sl@0: CFileCB* NewFileL() const; sl@0: CDirCB* NewDirL() const; sl@0: CFormatCB* NewFormatL() const; sl@0: sl@0: //-- non-pure virtual interface, overrides from CFileSystem sl@0: #ifdef _DEBUG sl@0: TInt Remove(); sl@0: TBool QueryVersionSupported(const TVersion& aVer) const; sl@0: #endif sl@0: sl@0: TBool IsExtensionSupported() const; sl@0: TInt DefaultPath(TDes& aPath) const; sl@0: TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput); sl@0: sl@0: sl@0: sl@0: sl@0: protected: sl@0: CAutoMounterFileSystem(); sl@0: sl@0: TInt TryMountFilesystem(TDrive* apDrive, CMountCB** apMount, CFileSystem** apFS); sl@0: sl@0: sl@0: //------------------------------- sl@0: virtual CMountCB* NewMountExL(TDrive* apDrive, CFileSystem** apFileSystem, TBool aForceMount, TUint32 aFsNameHash); sl@0: virtual TInt GetSupportedFileSystemName(TInt aFsNumber, TDes& aFsName) const; sl@0: sl@0: sl@0: private: sl@0: sl@0: /** possible states of this object */ sl@0: enum TState sl@0: { sl@0: EInvalid = 0, ///< initial, invalid sl@0: ENotInitialised, sl@0: EInitialised, sl@0: }; sl@0: sl@0: inline TState State() const {return iState;} sl@0: inline void SetState(TState aState) {iState = aState;} sl@0: sl@0: sl@0: /** "default child" file system name index in the child names container. "default child" is used in some weir cases, when sl@0: it doesn't matter which particular child FS to use, e.g. getting access to the media driver for media unlocking. */ sl@0: enum {KDefaultFSNo = 0}; sl@0: sl@0: sl@0: CFileSystem* GetChildFileSystem(TUint aIndex) const; sl@0: CFileSystem* GetChildFileSysteByNameHash(TUint32 aFsNameHash) const; sl@0: sl@0: void InitialiseFileSystem(); sl@0: TInt DoProcessProxyDriveSupport(); sl@0: sl@0: private: sl@0: sl@0: TState iState; ///< this object current state sl@0: XStringArray iFSNames; ///< child file system names container. sl@0: sl@0: }; sl@0: sl@0: sl@0: //----------------------------------------------------------------------------- sl@0: sl@0: #endif //AUTOMOUNTER_FILESYSTEM_H sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: