0
|
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".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
|
|
15 |
/*
|
|
16 |
@file
|
|
17 |
@internalTechnology
|
|
18 |
|
|
19 |
"fs_auto_mounter" filesystem classes definition
|
|
20 |
*/
|
|
21 |
|
|
22 |
|
|
23 |
#ifndef AUTOMOUNTER_FILESYSTEM_H
|
|
24 |
#define AUTOMOUNTER_FILESYSTEM_H
|
|
25 |
|
|
26 |
#include <f32fsys.h>
|
|
27 |
#include <f32dbg.h>
|
|
28 |
|
|
29 |
|
|
30 |
IMPORT_C TUint32 DebugRegister();
|
|
31 |
|
|
32 |
//-- define this for having logs disregarding DebugRegister() settings
|
|
33 |
//#define FORCE_LOGS
|
|
34 |
|
|
35 |
|
|
36 |
#if defined(_DEBUG) || defined(_DEBUG_RELEASE)
|
|
37 |
//----------------- DEBUG mode -----------------
|
|
38 |
|
|
39 |
#ifndef FORCE_LOGS
|
|
40 |
#define __PRINT(t) {if (DebugRegister()&KFSYS) RDebug::Print(t);}
|
|
41 |
#define __PRINT1(t,a) {if (DebugRegister()&KFSYS) RDebug::Print(t,a);}
|
|
42 |
#define __PRINT2(t,a,b) {if (DebugRegister()&KFSYS) RDebug::Print(t,a,b);}
|
|
43 |
#define __PRINT3(t,a,b,c) {if (DebugRegister()&KFSYS) RDebug::Print(t,a,b,c);}
|
|
44 |
#define __PRINT4(t,a,b,c,d) {if (DebugRegister()&KFSYS) RDebug::Print(t,a,b,c,d);}
|
|
45 |
#else
|
|
46 |
#define __PRINT(t) {RDebug::Print(t);}
|
|
47 |
#define __PRINT1(t,a) {RDebug::Print(t,a);}
|
|
48 |
#define __PRINT2(t,a,b) {RDebug::Print(t,a,b);}
|
|
49 |
#define __PRINT3(t,a,b,c) {RDebug::Print(t,a,b,c);}
|
|
50 |
#define __PRINT4(t,a,b,c,d) {RDebug::Print(t,a,b,c,d);}
|
|
51 |
#endif
|
|
52 |
|
|
53 |
#define DBG_STATEMENT(text) text
|
|
54 |
|
|
55 |
#else
|
|
56 |
//----------------- RELEASE mode -----------------
|
|
57 |
#define __PRINT(t)
|
|
58 |
#define __PRINT1(t,a)
|
|
59 |
#define __PRINT2(t,a,b)
|
|
60 |
#define __PRINT3(t,a,b,c)
|
|
61 |
#define __PRINT4(t,a,b,c,d)
|
|
62 |
#define __PRINT8BIT1(t,a)
|
|
63 |
#define __PRINT1TEMP(t,a)
|
|
64 |
|
|
65 |
#define DBG_STATEMENT(text)
|
|
66 |
|
|
67 |
#endif //#if defined(_DEBUG) || defined(_DEBUG_RELEASE)
|
|
68 |
|
|
69 |
|
|
70 |
//#######################################################################################################################################
|
|
71 |
//# constants definitions here
|
|
72 |
//#######################################################################################################################################
|
|
73 |
|
|
74 |
|
|
75 |
//-----------------------------------------------------------------------------
|
|
76 |
|
|
77 |
const TUint32 K1KiloByte = 1<<10;
|
|
78 |
const TUint32 K1MegaByte = 1<<20;
|
|
79 |
|
|
80 |
const TUint32 K1uSec = 1; ///< 1 microsecond in TTimeIntervalMicroSeconds32
|
|
81 |
const TUint32 K1mSec = 1000; ///< 1 millisecond in TTimeIntervalMicroSeconds32
|
|
82 |
const TUint32 K1Sec = 1000*K1mSec; ///< 1 second in TTimeIntervalMicroSeconds32
|
|
83 |
|
|
84 |
|
|
85 |
const TUint KBitsInByteLog2 = 3;
|
|
86 |
const TUint KBitsInByte = 1<<KBitsInByteLog2;
|
|
87 |
|
|
88 |
|
|
89 |
|
|
90 |
//-----------------------------------------------------------------------------
|
|
91 |
|
|
92 |
/**
|
|
93 |
Internal fault codes for Automounter.fsy
|
|
94 |
*/
|
|
95 |
enum TFault
|
|
96 |
{
|
|
97 |
ENotImplemented,
|
|
98 |
EWrongDriveAttributes,
|
|
99 |
EPluginInitialise,
|
|
100 |
EFileSysNotAdded,
|
|
101 |
EWrongConfiguration,
|
|
102 |
EIncompatibleFileSystems,
|
|
103 |
|
|
104 |
EMustNotBeCalled
|
|
105 |
|
|
106 |
};
|
|
107 |
|
|
108 |
//-----------------------------------------------------------------------------
|
|
109 |
|
|
110 |
void Fault(TFault aFault);
|
|
111 |
|
|
112 |
|
|
113 |
//-----------------------------------------------------------------------------
|
|
114 |
/**
|
|
115 |
This class is a container for child file system names that are supported by automounter.
|
|
116 |
Child FS names are stored in Upper Case to enable simple FSName hash calculations.
|
|
117 |
The names must be unique.
|
|
118 |
*/
|
|
119 |
class XStringArray
|
|
120 |
{
|
|
121 |
public:
|
|
122 |
XStringArray();
|
|
123 |
~XStringArray();
|
|
124 |
|
|
125 |
void Reset();
|
|
126 |
const TDesC& operator[](TUint aIndex) const;
|
|
127 |
TInt Append(const TDesC& aString);
|
|
128 |
TUint Count() const {return iStrings.Count();}
|
|
129 |
TUint32 GetStringHash(TUint aIndex) const;
|
|
130 |
|
|
131 |
|
|
132 |
private:
|
|
133 |
XStringArray(const XStringArray&);
|
|
134 |
XStringArray& operator=(const XStringArray&);
|
|
135 |
|
|
136 |
/** panic codes */
|
|
137 |
enum TPanicCode
|
|
138 |
{
|
|
139 |
EIndexOutOfRange, ///< index out of range
|
|
140 |
ENotImplemented, ///< functionality isn't implemented
|
|
141 |
};
|
|
142 |
|
|
143 |
void Panic(TPanicCode aPanicCode) const;
|
|
144 |
|
|
145 |
private:
|
|
146 |
RPointerArray<HBufC> iStrings;
|
|
147 |
|
|
148 |
};
|
|
149 |
|
|
150 |
|
|
151 |
//-----------------------------------------------------------------------------
|
|
152 |
|
|
153 |
/**
|
|
154 |
File system class definition
|
|
155 |
*/
|
|
156 |
class CAutoMounterFileSystem : public CFileSystem, CFileSystem::MFileSystemExtInterface
|
|
157 |
{
|
|
158 |
public:
|
|
159 |
static CAutoMounterFileSystem* New();
|
|
160 |
~CAutoMounterFileSystem();
|
|
161 |
public:
|
|
162 |
|
|
163 |
//-- pure virtual interface implementation, overrides from CFileSystem
|
|
164 |
TInt Install();
|
|
165 |
CMountCB* NewMountL() const;
|
|
166 |
CFileCB* NewFileL() const;
|
|
167 |
CDirCB* NewDirL() const;
|
|
168 |
CFormatCB* NewFormatL() const;
|
|
169 |
void DriveInfo(TDriveInfo& anInfo,TInt aDriveNumber) const;
|
|
170 |
|
|
171 |
//-- non-pure virtual interface, overrides from CFileSystem
|
|
172 |
#ifdef _DEBUG
|
|
173 |
TInt Remove();
|
|
174 |
TBool QueryVersionSupported(const TVersion& aVer) const;
|
|
175 |
#endif
|
|
176 |
|
|
177 |
TBool IsExtensionSupported() const;
|
|
178 |
TInt DefaultPath(TDes& aPath) const;
|
|
179 |
TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
|
|
180 |
|
|
181 |
|
|
182 |
|
|
183 |
|
|
184 |
protected:
|
|
185 |
CAutoMounterFileSystem();
|
|
186 |
|
|
187 |
TInt TryMountFilesystem(TDrive* apDrive, CMountCB** apMount, CFileSystem** apFS);
|
|
188 |
|
|
189 |
|
|
190 |
//-------------------------------
|
|
191 |
virtual CMountCB* NewMountExL(TDrive* apDrive, CFileSystem** apFileSystem, TBool aForceMount, TUint32 aFsNameHash);
|
|
192 |
virtual TInt GetSupportedFileSystemName(TInt aFsNumber, TDes& aFsName) const;
|
|
193 |
|
|
194 |
|
|
195 |
private:
|
|
196 |
|
|
197 |
/** possible states of this object */
|
|
198 |
enum TState
|
|
199 |
{
|
|
200 |
EInvalid = 0, ///< initial, invalid
|
|
201 |
ENotInitialised,
|
|
202 |
EInitialised,
|
|
203 |
};
|
|
204 |
|
|
205 |
inline TState State() const {return iState;}
|
|
206 |
inline void SetState(TState aState) {iState = aState;}
|
|
207 |
|
|
208 |
|
|
209 |
/** "default child" file system name index in the child names container. "default child" is used in some weir cases, when
|
|
210 |
it doesn't matter which particular child FS to use, e.g. getting access to the media driver for media unlocking. */
|
|
211 |
enum {KDefaultFSNo = 0};
|
|
212 |
|
|
213 |
|
|
214 |
CFileSystem* GetChildFileSystem(TUint aIndex) const;
|
|
215 |
CFileSystem* GetChildFileSysteByNameHash(TUint32 aFsNameHash) const;
|
|
216 |
|
|
217 |
void InitialiseFileSystem();
|
|
218 |
TInt DoProcessProxyDriveSupport();
|
|
219 |
|
|
220 |
private:
|
|
221 |
|
|
222 |
TState iState; ///< this object current state
|
|
223 |
XStringArray iFSNames; ///< child file system names container.
|
|
224 |
|
|
225 |
};
|
|
226 |
|
|
227 |
|
|
228 |
//-----------------------------------------------------------------------------
|
|
229 |
|
|
230 |
#endif //AUTOMOUNTER_FILESYSTEM_H
|
|
231 |
|
|
232 |
|
|
233 |
|
|
234 |
|
|
235 |
|
|
236 |
|