Update contrib.
1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
19 "fs_auto_mounter" filesystem classes definition
23 #ifndef AUTOMOUNTER_FILESYSTEM_H
24 #define AUTOMOUNTER_FILESYSTEM_H
26 #include "filesystem_utils.h"
31 IMPORT_C TUint32 DebugRegister();
33 //-- define this for having logs disregarding DebugRegister() settings
37 #if defined(_DEBUG) || defined(_DEBUG_RELEASE)
38 //----------------- DEBUG mode -----------------
41 #define __PRINT(t) {if (DebugRegister()&KFSYS) RDebug::Print(t);}
42 #define __PRINT1(t,a) {if (DebugRegister()&KFSYS) RDebug::Print(t,a);}
43 #define __PRINT2(t,a,b) {if (DebugRegister()&KFSYS) RDebug::Print(t,a,b);}
44 #define __PRINT3(t,a,b,c) {if (DebugRegister()&KFSYS) RDebug::Print(t,a,b,c);}
45 #define __PRINT4(t,a,b,c,d) {if (DebugRegister()&KFSYS) RDebug::Print(t,a,b,c,d);}
47 #define __PRINT(t) {RDebug::Print(t);}
48 #define __PRINT1(t,a) {RDebug::Print(t,a);}
49 #define __PRINT2(t,a,b) {RDebug::Print(t,a,b);}
50 #define __PRINT3(t,a,b,c) {RDebug::Print(t,a,b,c);}
51 #define __PRINT4(t,a,b,c,d) {RDebug::Print(t,a,b,c,d);}
54 #define DBG_STATEMENT(text) text
57 //----------------- RELEASE mode -----------------
60 #define __PRINT2(t,a,b)
61 #define __PRINT3(t,a,b,c)
62 #define __PRINT4(t,a,b,c,d)
63 #define __PRINT8BIT1(t,a)
64 #define __PRINT1TEMP(t,a)
66 #define DBG_STATEMENT(text)
68 #endif //#if defined(_DEBUG) || defined(_DEBUG_RELEASE)
71 //#######################################################################################################################################
72 //# constants definitions here
73 //#######################################################################################################################################
77 //-----------------------------------------------------------------------------
80 Internal fault codes for Automounter.fsy
85 EWrongDriveAttributes,
89 EIncompatibleFileSystems,
95 //-----------------------------------------------------------------------------
97 void Fault(TFault aFault);
100 //-----------------------------------------------------------------------------
102 This class is a container for child file system names that are supported by automounter.
103 Child FS names are stored in Upper Case to enable simple FSName hash calculations.
104 The names must be unique.
113 const TDesC& operator[](TUint aIndex) const;
114 TInt Append(const TDesC& aString);
115 TUint Count() const {return iStrings.Count();}
116 TUint32 GetStringHash(TUint aIndex) const;
120 XStringArray(const XStringArray&);
121 XStringArray& operator=(const XStringArray&);
126 EIndexOutOfRange, ///< index out of range
127 ENotImplemented, ///< functionality isn't implemented
130 void Panic(TPanicCode aPanicCode) const;
133 RPointerArray<HBufC> iStrings;
138 //-----------------------------------------------------------------------------
141 File system class definition
143 class CAutoMounterFileSystem : public CFileSystem, CFileSystem::MFileSystemExtInterface
146 static CAutoMounterFileSystem* New();
147 ~CAutoMounterFileSystem();
150 //-- pure virtual interface implementation, overrides from CFileSystem
152 CMountCB* NewMountL() const;
153 CFileCB* NewFileL() const;
154 CDirCB* NewDirL() const;
155 CFormatCB* NewFormatL() const;
157 //-- non-pure virtual interface, overrides from CFileSystem
160 TBool QueryVersionSupported(const TVersion& aVer) const;
163 TBool IsExtensionSupported() const;
164 TInt DefaultPath(TDes& aPath) const;
165 TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
171 CAutoMounterFileSystem();
173 TInt TryMountFilesystem(TDrive* apDrive, CMountCB** apMount, CFileSystem** apFS);
176 //-------------------------------
177 virtual CMountCB* NewMountExL(TDrive* apDrive, CFileSystem** apFileSystem, TBool aForceMount, TUint32 aFsNameHash);
178 virtual TInt GetSupportedFileSystemName(TInt aFsNumber, TDes& aFsName) const;
183 /** possible states of this object */
186 EInvalid = 0, ///< initial, invalid
191 inline TState State() const {return iState;}
192 inline void SetState(TState aState) {iState = aState;}
195 /** "default child" file system name index in the child names container. "default child" is used in some weir cases, when
196 it doesn't matter which particular child FS to use, e.g. getting access to the media driver for media unlocking. */
197 enum {KDefaultFSNo = 0};
200 CFileSystem* GetChildFileSystem(TUint aIndex) const;
201 CFileSystem* GetChildFileSysteByNameHash(TUint32 aFsNameHash) const;
203 void InitialiseFileSystem();
204 TInt DoProcessProxyDriveSupport();
208 TState iState; ///< this object current state
209 XStringArray iFSNames; ///< child file system names container.
214 //-----------------------------------------------------------------------------
216 #endif //AUTOMOUNTER_FILESYSTEM_H