author | mikek |
Fri, 02 Jul 2010 11:29:58 +0100 | |
branch | GCC_SURGE |
changeset 191 | 00cd07a1b0af |
parent 109 | b3a1d9898418 |
child 200 | 73ea206103e6 |
permissions | -rw-r--r-- |
0 | 1 |
// Copyright (c) 1995-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 |
// f32\inc\f32fsys.h |
|
15 |
// |
|
16 |
// WARNING: This file contains some APIs which are internal and are subject |
|
17 |
// to change without notice. Such APIs should therefore not be used |
|
18 |
// outside the Kernel and Hardware Services package. |
|
19 |
// |
|
20 |
||
21 |
/** |
|
22 |
@file |
|
23 |
@publishedPartner |
|
24 |
@released |
|
25 |
*/ |
|
26 |
||
27 |
#if !defined(__F32FSYS_H__) |
|
28 |
#define __F32FSYS_H__ |
|
29 |
#if !defined(__F32FILE_H__) |
|
30 |
#include <f32file.h> |
|
31 |
#endif |
|
32 |
#include <e32atomics.h> |
|
33
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
33 |
#include <d32locd.h> |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
34 |
|
0 | 35 |
// |
36 |
#if defined(_UNICODE) |
|
37 |
#define KFileSystemUidValue KFileSystemUidValue16 |
|
38 |
#define KFileServerUidValue KFileServerUidValue16 |
|
39 |
#define KFileServerDllUidValue KFileServerDllUidValue16 |
|
40 |
#else |
|
41 |
#define KFileSystemUidValue KFileSystemUidValue8 |
|
42 |
#define KFileServerUidValueKFileServerUidValue8 |
|
43 |
#define KFileServerDllUidValueKFileServerDllUidValue8 |
|
44 |
#endif |
|
45 |
||
46 |
||
47 |
/** |
|
48 |
Filesystem error code 1 : indicates an item cannot be found, |
|
49 |
because it has been hidden. |
|
50 |
*/ |
|
51 |
const TInt KErrHidden=(1); |
|
52 |
||
53 |
/** |
|
54 |
Filesystem error code 2 : in the context of file operations, a path |
|
55 |
was not found, because it has been hidden. |
|
56 |
*/ |
|
57 |
const TInt KErrPathHidden=(2); |
|
58 |
||
59 |
||
60 |
const TInt KFileShareLockGranularity=2; |
|
61 |
const TInt KAsyncRequestArrayGranularity=2; |
|
62 |
||
63 |
/** |
|
64 |
@publishedPartner |
|
65 |
@released |
|
66 |
||
67 |
File system UID value 16. |
|
68 |
*/ |
|
69 |
const TInt KFileSystemUidValue16=0x100039df; |
|
70 |
||
71 |
||
72 |
||
73 |
||
74 |
/** |
|
75 |
@publishedPartner |
|
76 |
@released |
|
77 |
||
78 |
File system UID value 8. |
|
79 |
*/ |
|
80 |
const TInt KFileSystemUidValue8=0x1000008f; |
|
81 |
||
82 |
||
83 |
||
84 |
||
85 |
/** |
|
86 |
@publishedPartner |
|
87 |
@released |
|
88 |
||
89 |
File server UID value 16. |
|
90 |
*/ |
|
91 |
const TInt KFileServerUidValue16=0x100039e3; |
|
92 |
||
93 |
||
94 |
||
95 |
||
96 |
/** |
|
97 |
@publishedPartner |
|
98 |
@released |
|
99 |
||
100 |
File server UID value 8. |
|
101 |
*/ |
|
102 |
const TInt KFileServerUidValue8=0x100000bb; |
|
103 |
||
104 |
||
105 |
||
106 |
||
107 |
/** |
|
108 |
@publishedPartner |
|
109 |
@released |
|
110 |
||
111 |
File server DLL UID value 16. |
|
112 |
*/ |
|
113 |
const TInt KFileServerDllUidValue16=0x100039e4; |
|
114 |
||
115 |
||
116 |
||
117 |
||
118 |
/** |
|
119 |
@publishedPartner |
|
120 |
@released |
|
121 |
||
122 |
File server DLL UID value 8. |
|
123 |
*/ |
|
124 |
const TInt KFileServerDllUidValue8=0x100000bd; |
|
125 |
||
126 |
||
127 |
||
128 |
||
129 |
/** |
|
130 |
@publishedPartner |
|
131 |
@released |
|
132 |
||
133 |
Local file system UID value. |
|
134 |
*/ |
|
135 |
const TInt KLocalFileSystemUidValue=0x100000d6; |
|
136 |
||
137 |
||
138 |
||
139 |
||
140 |
/** |
|
141 |
@publishedPartner |
|
142 |
@released |
|
143 |
||
144 |
Estart component UID value. |
|
145 |
*/ |
|
146 |
const TInt KEstartUidValue=0x10272C04; |
|
147 |
||
148 |
||
149 |
||
150 |
/** |
|
151 |
@publishedPartner |
|
152 |
@released |
|
153 |
Maximum length of a volume name. |
|
154 |
*/ |
|
155 |
const TInt KMaxVolumeNameLength=11; |
|
156 |
||
157 |
||
158 |
||
159 |
||
160 |
/** |
|
161 |
@publishedPartner |
|
162 |
@released |
|
163 |
||
164 |
First local drive indicator. |
|
165 |
*/ |
|
166 |
const TInt KFirstLocalDrive=EDriveC; |
|
167 |
||
168 |
||
169 |
const TInt KMaxExtensionCount=2; |
|
170 |
// |
|
171 |
const TInt KDriveInvalid=-1; |
|
172 |
// |
|
173 |
_LIT(KMediaPWrdFile, "?:\\sys\\data\\mmcstore"); |
|
174 |
// |
|
175 |
||
176 |
/** |
|
177 |
@internalTechnology |
|
178 |
*/ |
|
179 |
const TUint KSystemDriveKey = 0x10283049; |
|
180 |
||
181 |
||
182 |
/** |
|
183 |
@publishedPartner |
|
184 |
@released |
|
185 |
||
186 |
Enumeration that specifies whether, on opening a file: |
|
187 |
- an existing file is opened |
|
188 |
- a new file is created |
|
189 |
- an existing file is replaced. |
|
190 |
*/ |
|
191 |
enum TFileOpen {EFileOpen,EFileCreate,EFileReplace}; |
|
192 |
||
193 |
||
194 |
||
195 |
||
196 |
/** |
|
197 |
@publishedPartner |
|
198 |
@released |
|
199 |
||
200 |
The file share mode. |
|
201 |
*/ |
|
202 |
typedef TFileMode TShare; |
|
203 |
||
204 |
||
205 |
||
206 |
||
207 |
class CMountCB; |
|
208 |
class CFileSystem; |
|
209 |
class CFileCB; |
|
210 |
class CDirCB; |
|
211 |
class CFileShare; |
|
212 |
class CSessionFs; |
|
213 |
class CFsPlugin; |
|
214 |
class CFileBody; |
|
215 |
class CMountBody; |
|
216 |
class CFsMessageRequest; |
|
217 |
class CProxyDrive; |
|
218 |
class CFormatCB; |
|
219 |
||
220 |
// |
|
221 |
class CFsObjectCon; |
|
222 |
class CFileCache; |
|
223 |
// |
|
224 |
class CExtNotifyMediaChange; |
|
225 |
// |
|
226 |
||
227 |
/** |
|
228 |
@publishedPartner |
|
229 |
@released |
|
230 |
||
231 |
Implements reference counting to track concurrent references to itself. |
|
232 |
||
233 |
An object of this type arranges automatic destruction of itself when the final |
|
234 |
reference is removed. |
|
235 |
||
236 |
A reference counting object is any object which has CFsObject as its base class. |
|
237 |
Constructing a CFsObject derived type or calling its Open() member function |
|
238 |
adds a reference to that object by adding one to the reference count; calling |
|
239 |
its Close() member function removes a reference by subtracting one from the |
|
240 |
reference count; when the last user of the object calls Close(), the reference |
|
241 |
count becomes zero and the object is automatically destroyed. |
|
242 |
*/ |
|
243 |
class CFsObject : public CBase |
|
244 |
||
245 |
{ |
|
246 |
public: |
|
247 |
IMPORT_C CFsObject(); |
|
248 |
IMPORT_C virtual TInt Open(); |
|
249 |
IMPORT_C virtual void Close(); |
|
250 |
IMPORT_C TInt SetName(const TDesC* aName); |
|
251 |
IMPORT_C TName Name() const; |
|
252 |
IMPORT_C virtual TBool IsCorrectThread(); |
|
253 |
inline CFsObjectCon* Container() const; |
|
254 |
protected: |
|
255 |
void DoClose(); |
|
256 |
TInt UniqueID() const; |
|
257 |
inline TInt Inc(); |
|
258 |
inline TInt Dec(); |
|
259 |
IMPORT_C ~CFsObject(); |
|
260 |
private: |
|
261 |
TInt iAccessCount; |
|
262 |
CFsObjectCon* iContainer; |
|
263 |
HBufC* iName; |
|
264 |
friend class CFsObjectCon; |
|
265 |
friend class CFsObjectIx; |
|
266 |
}; |
|
267 |
||
268 |
||
269 |
||
270 |
||
271 |
class CFsRequest; |
|
272 |
class CFsInternalRequest; |
|
273 |
||
274 |
/** |
|
275 |
Implements a request dispatcher. |
|
276 |
||
277 |
Base class for file server resources. |
|
278 |
for example subsessions that are opened, such as RFile etc, that need closing are closed by |
|
279 |
issuing a subsession close request, handled by this object. |
|
280 |
||
281 |
@publishedPartner |
|
282 |
@released |
|
283 |
*/ |
|
284 |
class CFsDispatchObject : public CFsObject |
|
285 |
{ |
|
286 |
public: |
|
287 |
CFsDispatchObject(); |
|
288 |
/** |
|
289 |
Returns the drive number. |
|
290 |
@return Drive number. |
|
291 |
*/ |
|
292 |
TInt DriveNumber() const {return(iDriveNumber);} |
|
293 |
IMPORT_C void Close(); |
|
294 |
IMPORT_C virtual TBool IsCorrectThread(); |
|
295 |
protected: |
|
296 |
void DoInitL(TInt aDrvNumber); |
|
297 |
void Dispatch(); |
|
298 |
~CFsDispatchObject(); |
|
299 |
private: |
|
300 |
CFsInternalRequest* iRequest; |
|
301 |
TInt iDriveNumber; |
|
302 |
friend class TFsCloseObject; |
|
303 |
friend class CFileShare; // needed to override the close operation so that the file cache can be flushed on a close |
|
304 |
}; |
|
305 |
||
306 |
||
307 |
||
308 |
||
309 |
/** |
|
310 |
Notifier class must be unique to each thread so one per drive or threaded plugin should be used |
|
311 |
allocated in the file system. No longer global |
|
312 |
||
313 |
@publishedPartner |
|
314 |
@released |
|
315 |
*/ |
|
316 |
NONSHARABLE_CLASS(CAsyncNotifier) : public CBase |
|
317 |
{ |
|
318 |
public: |
|
319 |
IMPORT_C static CAsyncNotifier* New(); |
|
320 |
IMPORT_C ~CAsyncNotifier(); |
|
321 |
IMPORT_C TInt Notify(const TDesC& aLine1,const TDesC& aLine2,const TDesC& aButton1,const TDesC& aButton2,TInt& aButtonVal); |
|
322 |
inline void SetMount(CMountCB* aMount) { iMount = aMount; }; |
|
323 |
protected: |
|
324 |
CAsyncNotifier(); |
|
325 |
TInt Connect(); |
|
326 |
private: |
|
327 |
RNotifier iNotifier; |
|
328 |
CMountCB* iMount; |
|
329 |
}; |
|
330 |
||
331 |
||
332 |
||
333 |
||
334 |
class CProxyDriveFactory; |
|
335 |
||
336 |
/** |
|
337 |
@publishedPartner |
|
338 |
@released |
|
339 |
||
340 |
Structure containing information related to a single drive extension. |
|
341 |
*/ |
|
342 |
struct TExtensionInfo |
|
343 |
{ |
|
344 |
TBool iIsPrimary; ///< Is the primary drive extension for a given drive |
|
345 |
CProxyDriveFactory* iFactory; ///< Pointer to the drive extension's object factory |
|
346 |
}; |
|
347 |
||
348 |
||
349 |
||
350 |
||
351 |
/** |
|
352 |
@publishedPartner |
|
353 |
@released |
|
354 |
||
355 |
Represents information related to the Drive extension(s) in use for a given drive. |
|
356 |
*/ |
|
357 |
struct TDriveExtInfo |
|
358 |
{ |
|
359 |
TDriveExtInfo(); |
|
360 |
||
361 |
TInt iCount; ///< Number of drive extensions in use |
|
362 |
||
363 |
TExtensionInfo iInfo[KMaxExtensionCount]; ///< Drive extension related information |
|
364 |
}; |
|
365 |
||
366 |
||
367 |
||
368 |
||
369 |
/** |
|
370 |
@publishedPartner |
|
371 |
@released |
|
372 |
||
373 |
Represents a drive in the file server. |
|
374 |
||
375 |
Note that drives may act as substitutes for paths on other drives, |
|
376 |
in which case any access to this drive letter will be translated into |
|
377 |
a reference to the assigned path. In this way drives can act as short |
|
378 |
cuts to paths on other drives. |
|
379 |
*/ |
|
380 |
class TDrive |
|
381 |
{ |
|
382 |
public: |
|
383 |
TDrive(); |
|
384 |
void CreateL(TInt aDriveNumber); |
|
385 |
TInt CheckMount(); |
|
386 |
TInt CheckMountAndEntryName(const TDesC& aName); |
|
387 |
TInt FinaliseMount(); |
|
388 |
TInt FinaliseMount(TInt aOperation, TAny* aParam1=NULL, TAny* aParam2=NULL); |
|
389 |
TInt MountControl(TInt aLevel, TInt aOption, TAny* aParam); |
|
390 |
void MountFileSystem(TBool aForceMount, TUint32 aFsNameHash = 0); |
|
391 |
void FlushCachedFileInfoL(); |
|
392 |
TInt FlushCachedFileInfo(TBool aPurgeCache = EFalse); |
|
393 |
void PurgeDirty(CMountCB& aMount); |
|
394 |
void DriveInfo(TDriveInfo& anInfo); |
|
395 |
TInt Volume(TVolumeInfo& aVolume); |
|
396 |
TInt SetVolume(const TDesC& aName); |
|
397 |
TInt MkDir(const TDesC& aName); |
|
398 |
TInt RmDir(const TDesC& aName); |
|
399 |
TInt Delete(const TDesC& aName); |
|
400 |
TInt Rename(const TDesC& anOldName,const TDesC& aNewName); |
|
401 |
TInt Replace(const TDesC& anOldName,const TDesC& aNewName); |
|
402 |
TInt Entry(const TDesC& aName,TEntry& anEntry); |
|
403 |
TInt SetEntry(const TDesC& aName,const TTime& aTime,TUint aMask,TUint aVal); |
|
404 |
TInt FileTemp(CFsRequest* aRequest,TInt& aHandle,const TDesC& aPath,TDes& aName,TUint aMode); |
|
405 |
TInt FileOpen(CFsRequest* aRequest,TInt& aHandle,const TDesC& aName,TUint aMode,TFileOpen anOpen); |
|
406 |
TInt DirOpen(CSessionFs* aSession,TInt& aHandle,const TDesC& aName,TUint anAtt,const TUidType& aUidType); |
|
407 |
CFormatCB* FormatOpenL(CFsRequest* aRequest, TInt& aFmtHandle, TFormatMode aFmtMode, const TLDFormatInfo* apLDFormatInfo, const TVolFormatParam* apVolFormatParam); |
|
408 |
||
409 |
TInt CheckDisk(); |
|
410 |
TInt CheckDisk(TInt aOperation, TAny* aParam1=NULL, TAny* aParam2=NULL); |
|
411 |
||
412 |
TInt ScanDrive(); |
|
413 |
TInt ScanDrive(TInt aOperation, TAny* aParam1=NULL, TAny* aParam2=NULL); |
|
414 |
||
415 |
TInt ReadFileSection(const TDesC& aName,TInt aPos,TAny* aTrg,TInt aLength,const RMessagePtr2& aMessage); |
|
416 |
TInt ReadFileSection64(const TDesC& aName,TInt64 aPos,TAny* aTrg,TInt aLength,const RMessagePtr2& aMessage); |
|
417 |
TInt GetShortName(const TDesC& aLongName,TDes& aShortName); |
|
418 |
TInt GetLongName(const TDesC& aShortName,TDes& aLongName); |
|
419 |
TInt IsFileOpen(const TDesC& aFileName,CFileCB*& aFileCB); |
|
420 |
TInt IsFileInRom(const TDesC& aFileName,TUint8*& aFileStart); |
|
421 |
TInt LockDevice(TMediaPassword& aOld,TMediaPassword& aNew,TBool aStore); |
|
422 |
TInt UnlockDevice(TMediaPassword& aPassword,TBool aStore); |
|
423 |
TInt ClearDevicePassword(TMediaPassword& aPassword); |
|
424 |
TInt EraseDevicePassword(); |
|
425 |
TInt FreeDiskSpace(TInt64& aFreeDiskSpace); |
|
426 |
TInt ForceRemountDrive(const TDesC8* aMountInfo,TInt aMountInfoMessageHandle,TUint aFlags); |
|
427 |
TBool IsWriteProtected(); |
|
428 |
TInt MountExtension(CProxyDriveFactory* aFactory,TBool aIsPrimary); |
|
429 |
TInt DismountExtension(CProxyDriveFactory* aFactory,TBool aIsPrimary); |
|
430 |
TInt ExtensionName(TDes& aExtensionName,TInt aPos); |
|
431 |
TInt ControlIO(const RMessagePtr2& aMessage,TInt aCommand,TAny* aParam1,TAny* aParam2); |
|
432 |
void SetAtt(TUint aValue); |
|
433 |
IMPORT_C TUint Att(); |
|
434 |
IMPORT_C TBool GetNotifyUser(); |
|
435 |
IMPORT_C void Dismount(); |
|
436 |
IMPORT_C TBool IsWriteableResource() const; |
|
437 |
IMPORT_C TBool IsCurrentWriteFunction() const; |
|
438 |
inline TInt GetReason() const; |
|
439 |
inline void SetChanged(TBool aValue); |
|
440 |
inline TBool IsChanged() const; |
|
441 |
inline TInt DriveNumber() const; |
|
442 |
inline TBool IsMounted() const; |
|
443 |
inline TBool IsLocal() const; |
|
444 |
inline TBool IsRom() const; |
|
445 |
inline TBool IsRemovable() const; |
|
446 |
inline TBool IsSubsted() const; |
|
447 |
inline CMountCB& CurrentMount() const; |
|
448 |
inline TBool IsCurrentMount(CMountCB& aMount) const; |
|
449 |
inline TDrive& SubstedDrive() const; |
|
450 |
inline void SetSubstedDrive(TDrive* aDrive); |
|
451 |
inline HBufC& Subst() const; |
|
452 |
inline void SetSubst(HBufC* aSubst); |
|
453 |
inline CFsObjectCon& Mount() const; |
|
454 |
inline CFileSystem& FSys(); |
|
455 |
inline CFileSystem*& GetFSys(); |
|
456 |
inline TDriveExtInfo& ExtInfo(); |
|
457 |
inline void SetNotifyOn(); |
|
458 |
inline void SetNotifyOff(); |
|
459 |
inline TInt ReservedSpace() const; |
|
460 |
inline void SetReservedSpace(const TInt aReservedSpace); |
|
461 |
||
462 |
inline void SetRugged(TBool aIsRugged); |
|
463 |
inline TBool IsRugged() const; |
|
464 |
||
465 |
inline TBool IsSynchronous() const; |
|
466 |
inline void SetSynchronous(TBool aIsSynch); |
|
467 |
||
468 |
TInt DismountProxyDrive(); |
|
469 |
TInt ForceUnmountFileSystemForFormatting(); |
|
470 |
||
471 |
public: |
|
472 |
void DismountLock(); |
|
473 |
TInt DismountUnlock(); |
|
474 |
TInt DismountLocked() const; |
|
475 |
void SetDismountDeferred(TBool aPending); |
|
476 |
void ForceDismount(); |
|
477 |
TInt ActiveMounts() const; |
|
478 |
void ReactivateMounts(); |
|
479 |
TInt ClampFile(const TDesC& aName,TAny* aHandle); |
|
480 |
TInt UnclampFile(CMountCB* aMount, RFileClamp* aHandle); |
|
481 |
TInt ClampsOnDrive(); |
|
482 |
inline TBool DismountDeferred() const; |
|
483 |
TInt DeferredDismount(); |
|
484 |
#if defined(_DEBUG) || defined(_DEBUG_RELEASE) |
|
485 |
TInt ClearDeferredDismount(); |
|
486 |
#endif |
|
487 |
void SetClampFlag(TBool aClamped); |
|
488 |
TBool ClampFlag(); |
|
489 |
inline void Lock(); |
|
490 |
inline void UnLock(); |
|
491 |
void MultiSlotDriveCheck(); |
|
492 |
||
493 |
TInt RequestFreeSpaceOnMount(TUint64 aFreeSpaceRequired); |
|
494 |
TInt MountedVolumeSize(TUint64& aSize); |
|
495 |
||
496 |
TBool ReMount(CMountCB& aMount); |
|
497 |
||
498 |
private: |
|
499 |
||
500 |
void DoMountFileSystemL(CMountCB*& apMount, TBool aForceMount, TUint32 aFsNameHash); |
|
501 |
||
502 |
void SetVolumeL(const TDesC& aName,HBufC*& aBuf); |
|
503 |
void DirOpenL(CSessionFs* aSession,TInt& aHandle,const TDesC& aName,TUint anAtt,const TUidType& aUidType,CDirCB*& aDir); |
|
504 |
void FileOpenL(CFsRequest* aRequest,TInt& aHandle,const TDesC& aName,TUint aMode,TFileOpen anOpen,CFileCB*& aFileCB,CFileShare*& aFileShare); |
|
505 |
TInt CheckMountAndEntryNames(const TDesC& anOldName,const TDesC& aNewName); |
|
506 |
CFileCB* LocateFileByPath(const TDesC& aPath); |
|
507 |
TInt CheckDirectories(const TDesC& anOldName,const TDesC& aNewName); |
|
508 |
void DoEntryL(const TDesC& aName,TEntry& anEntry); |
|
509 |
void ReadSectionL(const TDesC& aName,TInt64 aPos,TAny* aTrg,TInt aLength,const RMessagePtr2& aMessage); |
|
510 |
TInt ValidateShare(CFileCB& aFile,TShare aReqShare); |
|
511 |
TInt CheckAttributes(const TDesC& aName,TUint& aSetAttMask,TUint& aClearAttMask); |
|
512 |
TBool IsExtensionMounted(CProxyDriveFactory* aFactory); |
|
513 |
CFileCB* LocateFile(const TDesC& aName); |
|
514 |
CFileCache* LocateClosedFile(const TDesC& aName, TBool aResurrect = ETrue); |
|
515 |
TBool ReMount(); |
|
516 |
IMPORT_C TBool IsDriveThread() const; |
|
517 |
IMPORT_C TBool IsMainThread() const; |
|
518 |
IMPORT_C void DriveFault(TBool aDriveError) const; |
|
519 |
void DoDismount(); |
|
520 |
void DoCompleteDismountNotify(TInt aCompletionCode); |
|
521 |
||
522 |
private: |
|
523 |
||
524 |
//-- intrinsic TDrive flags. Used in iDriveFlags. |
|
525 |
enum |
|
526 |
{ |
|
527 |
ENotifyOff = 0x01, |
|
528 |
EDismountDeferred= 0x02, |
|
529 |
ENotRugged = 0x04, |
|
530 |
EClampPresent = 0x08, |
|
531 |
EDriveIsSynch = 0x10, //-- is set on mount when the drive is synchronous (doesn't have its own thread) |
|
532 |
}; |
|
533 |
||
534 |
private: |
|
535 |
TInt iDriveNumber; |
|
536 |
TUint iAtt; |
|
537 |
TBool iChanged; |
|
538 |
TInt iReason; |
|
539 |
TInt iMountNumber; |
|
540 |
CFileSystem* iFSys; |
|
541 |
CMountCB* iCurrentMount; |
|
542 |
TDrive* iSubstedDrive; |
|
543 |
HBufC* iSubst; |
|
544 |
CFsObjectCon* iMount; |
|
545 |
RFastLock iLock; |
|
546 |
TDriveExtInfo iExtInfo; |
|
547 |
TInt iDriveFlags; ///< intrinsic TDrive flags |
|
548 |
TInt iReservedSpace; |
|
549 |
TInt iDismountLock; |
|
550 |
TInt iMountFailures; // number of times the mount has failed |
|
551 |
TInt iLastMountError; |
|
552 |
||
553 |
TInt iSpare1; |
|
554 |
TInt iSpare2; |
|
555 |
||
556 |
||
557 |
friend class LocalDrives; // for access to iChanged flag |
|
558 |
friend class CExtNotifyMediaChange; // for access to iChanged flag |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
559 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
560 |
#if defined(_USE_CONTROLIO) || defined(_DEBUG) || defined(_DEBUG_RELEASE) |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
561 |
friend class TFsControlIo; // for access to LocateDrives() |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
562 |
#endif |
0 | 563 |
}; |
564 |
||
565 |
class CFileCB; |
|
566 |
class CDirCB; |
|
567 |
||
33
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
568 |
__ASSERT_COMPILE(sizeof(TVolFormatParam) != sizeof(TLDFormatInfo)); |
0 | 569 |
|
570 |
||
571 |
||
572 |
/** |
|
573 |
@publishedPartner |
|
574 |
@released |
|
575 |
||
576 |
A file server interface class representing a mount. |
|
577 |
||
578 |
An instance of this object is referred to as a mount control block. |
|
579 |
||
580 |
A mount control block needs to be created for a specific volume (partition) on |
|
581 |
a drive in order to be able to access that volume. Volumes may be permanent |
|
582 |
or represent removable media. Note that removable media may also be mounted directly onto |
|
583 |
a device with no drive. Volumes can be formatted, unlike drives. |
|
584 |
||
585 |
The volume represented is either a currently mounted volume in the system or, |
|
586 |
in the case of removable volumes, a volume that has been removed but still has |
|
587 |
subsession objects open. |
|
588 |
||
589 |
A plug-in file system implements this class. |
|
590 |
*/ |
|
591 |
class CMountCB : public CFsDispatchObject |
|
592 |
{ |
|
593 |
public: |
|
594 |
IMPORT_C CMountCB(); |
|
595 |
IMPORT_C ~CMountCB(); |
|
596 |
IMPORT_C TBool operator!=(const CMountCB& aMount) const; |
|
597 |
IMPORT_C TBool MatchEntryAtt(TUint anAtt,TUint aMatt) const; |
|
598 |
IMPORT_C void SetDiskSpaceChange(TInt64 aFreeDiskSpace); |
|
599 |
IMPORT_C void InitL(TDrive& aDrive, CFileSystem* apFileSystem); |
|
600 |
||
601 |
inline TDrive& Drive() const; |
|
602 |
inline void SetDrive(TDrive* aDrive); |
|
603 |
inline HBufC& VolumeName() const; |
|
604 |
inline void SetVolumeName(HBufC* aName); |
|
605 |
inline TBool GetNotifyUser() const; |
|
606 |
inline void SetNotifyOn(); |
|
607 |
inline void SetNotifyOff(); |
|
608 |
inline void IncLock(); |
|
609 |
inline void DecLock(); |
|
610 |
inline TInt LockStatus() const; |
|
611 |
inline TBool IsCurrentMount() const; |
|
612 |
inline TBool Locked() const; |
|
613 |
inline TInt64 Size() const; |
|
614 |
inline TInt LocalDrive(TBusLocalDrive*& aLocalDrive); |
|
615 |
inline TInt ProxyDrive(CProxyDrive*& aProxyDrive); |
|
616 |
inline TInt LocalBufferSupport(CFileCB* aFile = NULL); |
|
617 |
inline TInt AddToCompositeMount(TInt aMountIndex); |
|
618 |
||
619 |
// Pure virtual |
|
620 |
||
621 |
/** |
|
622 |
Attempts to set the mount control block properties using |
|
623 |
the current mount (i.e. volume) on the associated drive. |
|
624 |
||
625 |
The function should set the volume name (iVolumeName), |
|
626 |
the unique ID (iUniqueID) and the volume size (iSize) |
|
627 |
by reading and processing the current mount. |
|
628 |
||
629 |
When aForceMount is set to ETrue, the properties of a corrupt volume should |
|
630 |
be forcibly stored. The classic case of when this is desirable is when |
|
631 |
a corrupt volume needs to be formatted. |
|
632 |
||
633 |
The function should leave, on error detection, with an appropriate error code. |
|
634 |
||
635 |
@param aForceMount Indicates whether the properties of a corrupt |
|
636 |
volume should be stored. |
|
637 |
||
638 |
@leave KErrCorrupt The properties of the current mount on the drive were |
|
639 |
not successfully mounted due to corruption of volume information, |
|
640 |
assuming that aForceMount is not set. |
|
641 |
*/ |
|
642 |
virtual void MountL(TBool aForceMount) =0; |
|
643 |
||
644 |
||
645 |
/** |
|
646 |
Checks whether the mount control block represents the current mount on |
|
647 |
the associated drive. |
|
648 |
||
649 |
The function should read mount information from the current volume, |
|
650 |
and check it against the mount information from this mount - typically |
|
651 |
iVolumeName and iUniqueID. If the mount information matches, the function |
|
652 |
should return KErrNone, otherwise it should return KErrGeneral. |
|
653 |
||
654 |
Called by the associated TDrive object when the drive has no current mounts, |
|
655 |
which is the case on first access to the drive and following a volume |
|
656 |
change on a drive associated with removable media. In this circumstance, |
|
657 |
this function is called systematically on every mount control block owned |
|
658 |
by the drive. If ReMount() calls for all existing mount |
|
659 |
control blocks fail, the drive creates a new mount control block and calls |
|
660 |
CMountCB::MountL() on that object; the new object is added to the list of |
|
661 |
mount control blocks owned by the drive. |
|
662 |
||
663 |
@return KErrNone if the mount represented by this object is found to be |
|
664 |
the current mount; |
|
665 |
KErrGeneral if this object is found not to represent |
|
666 |
the current mount; |
|
667 |
otherwise one of the other sytem wide error codes. |
|
668 |
*/ |
|
669 |
virtual TInt ReMount() =0; |
|
670 |
||
671 |
||
672 |
/** |
|
673 |
Carries out any clean-up necessary for a volume dismount. |
|
674 |
||
675 |
Dismounting a volume will always succeed, so the function does not need |
|
676 |
to return an error value. Any cached information should be discarded and no |
|
677 |
attempt should be made to access the volume. For removable media it may be |
|
678 |
that the media has already been removed. This function is called when |
|
679 |
a media change is detected. |
|
680 |
*/ |
|
681 |
virtual void Dismounted() =0; |
|
682 |
||
683 |
||
684 |
/** |
|
685 |
Gets volume information. |
|
686 |
||
687 |
The only information that the function has to supply is the free space, |
|
688 |
TVolumeInfo::iFree, since the remaining members have already been set by |
|
689 |
the calling function. |
|
690 |
||
691 |
The function should leave, on error detection, with |
|
692 |
an appropriate error code. |
|
693 |
||
694 |
@param aVolume On return, a reference to the filled volume |
|
695 |
information object. |
|
696 |
*/ |
|
697 |
virtual void VolumeL(TVolumeInfo& aVolume) const =0; |
|
698 |
||
699 |
||
700 |
/** |
|
701 |
Sets the volume name for the mount, thus writing the new volume name |
|
702 |
to the corresponding volume. |
|
703 |
||
704 |
This function should leave on error detection. |
|
705 |
||
706 |
@param aName A reference to a descriptor containing the new volume name. |
|
707 |
||
708 |
@leave KErrBadName If the specified volume name is longer than the maximum |
|
709 |
allowed length for a volume name |
|
710 |
*/ |
|
711 |
virtual void SetVolumeL(TDes& aName) =0; |
|
712 |
||
713 |
||
714 |
/** |
|
715 |
Creates a new directory on the mount. |
|
716 |
||
717 |
The directory to be created is identified through its full name in aName. |
|
718 |
The full name is in the form: |
|
719 |
@code |
|
720 |
\\dirA\\dirB\\dirC\\dirD |
|
721 |
@endcode |
|
722 |
where dirD is the new directory to be created in \\dirA\\dirB\\dirC\\. |
|
723 |
This means that dirC is the leaf directory in which dirD will be created. |
|
724 |
||
725 |
The function should leave, on error detection, with an appropriate |
|
726 |
error code. |
|
727 |
||
728 |
@param aName A reference to a descriptor containing the full name of |
|
729 |
the directory to be created. |
|
730 |
||
731 |
@leave KErrPathNotFound Part of the path in aName does not exist. |
|
732 |
@leave KErrAlreadyExists dirD already exists in \\dirA\\dirB\\dirC\\ |
|
733 |
@leave KErrAccessDenied dirD already exists but is not a directory. |
|
734 |
@leave KErrDirFull There is no room in \\dirA\\dirB\\dirC\\ for the new entry, |
|
735 |
which is especially applicable to the root directory. |
|
736 |
*/ |
|
737 |
virtual void MkDirL(const TDesC& aName) =0; |
|
738 |
||
739 |
||
740 |
/** |
|
741 |
Removes the directory specified by aName (its full name) from the volume. |
|
742 |
||
743 |
The directory specified by aName is in the form: |
|
744 |
@code |
|
745 |
\\dirA\\dirB\\dirC\\dirD |
|
746 |
@endcode |
|
747 |
where dirD is the directory to be removed from \\dirA\\dirB\\dirC\\. |
|
748 |
This means that dirC is the leaf directory from which dirD should be removed. |
|
749 |
||
750 |
The function can assume that the directory exists and is not read-only. |
|
751 |
||
752 |
The function should leave with a suitable error code if it cannot complete |
|
753 |
successfully for any reason. |
|
754 |
||
755 |
@param aName A reference to a descriptor containing the full name of |
|
756 |
the directory to be removed. |
|
757 |
||
758 |
@leave KErrInUse dirD contains entries other than the parent (..) |
|
759 |
and current (.) entries. |
|
760 |
*/ |
|
761 |
virtual void RmDirL(const TDesC& aName) =0; |
|
762 |
||
763 |
||
764 |
/** |
|
765 |
Deletes the specified file from the mount. |
|
766 |
||
767 |
The function can assume that the file is closed. |
|
768 |
||
769 |
The file name specified by aName is of the form: |
|
770 |
@code |
|
771 |
\\dirA\\dirB\\dirC\\file.ext |
|
772 |
@endcode |
|
773 |
||
774 |
The extension is optional. |
|
775 |
||
776 |
The function should leave on error detection, with |
|
777 |
an appropriate error code. |
|
778 |
||
779 |
@param aName A reference to a descriptor containing the full path name |
|
780 |
of the file that will be removed. |
|
781 |
||
782 |
@leave KErrAccessDenied aName specifies a file whose attributes state that |
|
783 |
the file is read-only or aName specifies a directory. |
|
784 |
*/ |
|
785 |
virtual void DeleteL(const TDesC& aName) =0; |
|
786 |
||
787 |
||
788 |
/** |
|
789 |
Renames or moves a single file or directory on the mount. |
|
790 |
||
791 |
It can be used to move a file or directory since both |
|
792 |
anOldName and anNewName specify the respective entries with full names; |
|
793 |
for example, |
|
794 |
@code |
|
795 |
\\dirA\\dirB\\dirC\\oldEntryName |
|
796 |
@endcode |
|
797 |
||
798 |
and |
|
799 |
||
800 |
@code |
|
801 |
\\dirE\\dirF\\dirG\\newEntryName |
|
802 |
@endcode |
|
803 |
||
804 |
If oldEntryName is a file, it can be assumed that it is closed. |
|
805 |
If oldEntryName is a directory, it can be assumed that there are no |
|
806 |
open files in this directory. Furthermore, if newEntryName specifies |
|
807 |
a directory, it can be assumed that it is not a subdirectory of oldEntryName. |
|
808 |
||
809 |
The function should leave with an appropriate error code if it cannot |
|
810 |
complete successfully for any reason. |
|
811 |
||
812 |
@param anOldName A reference to a descriptor containing the full entry |
|
813 |
name of the entry to be renamed. |
|
814 |
||
815 |
@param anNewName A reference to a descriptor containing the new full entry |
|
816 |
name for the entry to be renamed. |
|
817 |
||
818 |
@leave KErrAlreadyExists The new entry already exists. |
|
819 |
*/ |
|
820 |
virtual void RenameL(const TDesC& anOldName,const TDesC& anNewName) =0; |
|
821 |
||
822 |
||
823 |
/** |
|
824 |
Replaces one file on the mount with another. |
|
825 |
||
826 |
The function can assume that both anOldName and, if it exists, anNewName |
|
827 |
contain the full file names of files, and that these files are not open. |
|
828 |
||
829 |
If the file aNewName does not exist it should be created. |
|
830 |
||
831 |
The file anOldName should have its contents, attributes, and the universal |
|
832 |
date and time of its last modification, copied to the file aNewName, |
|
833 |
overwriting any existing contents and attribute details. |
|
834 |
Finally anOldName should be deleted. |
|
835 |
||
836 |
The function should leave with an appropriate error code if it cannot |
|
837 |
complete successfully for any reason. |
|
838 |
||
839 |
@param anOldName A reference to a descriptor containing the full file name |
|
840 |
of the file to replace the file specified by anNewName |
|
841 |
@param anNewName A reference to a descriptor containing the new full file |
|
842 |
name for the entry to be replaced. |
|
843 |
*/ |
|
844 |
virtual void ReplaceL(const TDesC& anOldName,const TDesC& anNewName) =0; |
|
845 |
||
846 |
||
847 |
/** |
|
848 |
Gets the entry details for the specified file or directory. |
|
849 |
||
850 |
anEntry should be filled with details from the file or directory with the |
|
851 |
full name aName. aName is of the form |
|
852 |
@code |
|
853 |
\\dirA\\dirB\\dirC\\entry. |
|
854 |
@endcode |
|
855 |
||
856 |
Note that anEntry.iType (the entry UID) should only be set for a file whose |
|
857 |
size is greater than or equal to sizeof(TCheckedUid). |
|
858 |
||
859 |
The function should leave with an appropriate error code if it cannot |
|
860 |
complete successfully for any reason. |
|
861 |
||
862 |
@param aName A reference to a descriptor containing the full name of |
|
863 |
the entry whose details are required. |
|
864 |
@param anEntry On return, a reference to the filled entry object. |
|
865 |
||
866 |
@leave KErrPathNotFound The entry, aName, cannot be found. |
|
867 |
*/ |
|
868 |
virtual void EntryL(const TDesC& aName,TEntry& anEntry) const =0; |
|
869 |
||
870 |
||
871 |
/** |
|
872 |
Sets entry details for a specified file or directory. |
|
873 |
||
874 |
The entry identfied by the full name descriptor aName should have |
|
875 |
its modification time and its attributes mask updated as required. |
|
876 |
||
877 |
The entry receives a new universal modified time from aTime. |
|
878 |
The entry attributes are set with aSetAttMask and cleared |
|
879 |
with aClearAttMask: |
|
880 |
the bits that are set in aSetAttMask should be set |
|
881 |
in the entry attribute mask; |
|
882 |
the bits that are set in aClearAttMask |
|
883 |
should be cleared from the entry attribute mask. |
|
884 |
||
885 |
The function can assume that aSetAttMask and aClearAttMask do not change |
|
886 |
the type of attribute (i.e. volume or directory). Furthermore, if aName |
|
887 |
specifies a file, it can be assumed that this file is closed. |
|
888 |
||
889 |
The function should leave with an appropriate error code on error detection. |
|
890 |
||
891 |
@param aName A reference to a descriptor containing the full name of |
|
892 |
the entry to be updated. |
|
893 |
@param aTime A reference to the time object holding the new universal |
|
894 |
modified time for aName. |
|
895 |
@param aSetAttMask Attribute mask for setting the entry's attributes. |
|
896 |
@param aClearAttMask Attribute mask for clearing the entry's attributes. |
|
897 |
*/ |
|
898 |
virtual void SetEntryL(const TDesC& aName,const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask) =0; |
|
899 |
||
900 |
||
901 |
/** |
|
902 |
Customises the opening of a new or existing file on the mount. |
|
903 |
||
904 |
The function is called internally (via TDrive::FileOpen()) as a result of |
|
905 |
a call by the client, and the file is created, if necessary, and opened by |
|
906 |
the calling function. However this function implements any replacement |
|
907 |
functionality, as well as any other behaviour particular to the file system. |
|
908 |
||
909 |
If anOpen specifies EFileReplace (rather than EFileCreate or EFileOpen) then, |
|
910 |
if replacement functionality is required, the data contained in the file |
|
911 |
should be discarded, the archive attribute should be set, and the size of |
|
912 |
the file should be set to zero. Note that it can be assumed that if anOpen |
|
913 |
specifies EFileReplace then the file already exists. |
|
914 |
||
915 |
After successful completion of the function, the file control block pointer |
|
916 |
will be added to the file server's global files container. |
|
917 |
||
918 |
The function should leave with a suitable error code if it cannot be completed |
|
919 |
successfully. |
|
920 |
||
921 |
@param aName The full name of the file that will be opened. |
|
922 |
@param aMode The file share mode. The following share modes are available: |
|
923 |
EFileShareExclusive; |
|
924 |
EFileShareReadersOnly; |
|
925 |
EFileShareAny; |
|
926 |
EFileShareReadersOrWriters; |
|
927 |
EFileStream; |
|
928 |
EFileStreamText; |
|
929 |
EFileRead; |
|
930 |
EFileWrite. |
|
931 |
@param anOpen IndicatES how the file will be opened. It can be one of |
|
932 |
the following: |
|
933 |
EFileOpen; |
|
934 |
EFileCreate; |
|
935 |
EFileReplace. |
|
936 |
@param aFile Pointer to the file control block which will, on success, |
|
937 |
represent the open file. |
|
938 |
||
939 |
@leave KErrAccessDenied aName may specify a directory, or the function may |
|
940 |
be attempting to open a file on a ROM drive. |
|
941 |
*/ |
|
942 |
virtual void FileOpenL(const TDesC& aName,TUint aMode,TFileOpen anOpen,CFileCB* aFile) =0; |
|
943 |
||
944 |
||
945 |
/** |
|
946 |
Customises the opening of a directory on the mount. |
|
947 |
||
948 |
The function is called internally, and the directory will have been created |
|
949 |
and initialised by the calling function. Any customisation specific to |
|
950 |
a file system should be implemented in this function. |
|
951 |
||
952 |
Note that aName is of the form |
|
953 |
@code |
|
954 |
\\dirA\\dirB\\dirC\\file.ext |
|
955 |
@endcode |
|
956 |
||
957 |
where \\dirA\\dirB\\dirC\\ is the directory to be opened and file.ext is |
|
958 |
an optional entry name and extension. |
|
959 |
||
960 |
After successful completion of the function, the directory control block |
|
961 |
pointer will be added to the file server global directories container. |
|
962 |
||
963 |
The function should leave with a suitable error code if it cannot complete |
|
964 |
successfully for any reason. |
|
965 |
||
966 |
@param aName A reference to a descriptor containing the full name of |
|
967 |
the directory that will be opened. |
|
968 |
@param aDir Points to a directory control block which will, on success, |
|
969 |
represent the open directory. |
|
970 |
*/ |
|
971 |
virtual void DirOpenL(const TDesC& aName,CDirCB* aDir) =0; |
|
972 |
||
973 |
||
974 |
/** |
|
975 |
Reads the specified length of data from the specified position on |
|
976 |
the volume directly into the client thread. |
|
977 |
||
978 |
It can be assumed that if this function is called, |
|
979 |
then there has been a successful mount. |
|
980 |
||
981 |
This function should leave with an appropriate error code when |
|
982 |
an error is detected. |
|
983 |
||
984 |
@param aPos Start position in the volume for the read operation, |
|
985 |
in bytes. |
|
986 |
@param aLength The number of bytes to be read. |
|
987 |
@param aTrg A pointer to the buffer into which data is to be read. |
|
988 |
@param anOffset The offset at which to start adding data to the read buffer. |
|
989 |
@param aMessage |
|
990 |
*/ |
|
991 |
virtual void RawReadL(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt anOffset,const RMessagePtr2& aMessage) const = 0; |
|
992 |
||
993 |
||
994 |
/** |
|
995 |
Writes a specified length of data from the client thread to the volume |
|
996 |
at the specified position. |
|
997 |
||
998 |
It can be assumed that if this function is called, then there has been |
|
999 |
a successful mount. |
|
1000 |
||
1001 |
This function should leave with an appropriate error code when |
|
1002 |
an error is detected. |
|
1003 |
||
1004 |
@param aPos Start position in the volume for the write operation, |
|
1005 |
in bytes. |
|
1006 |
@param aLength The number of bytes to be written. |
|
1007 |
@param aSrc Pointer to the buffer from which data will be written. |
|
1008 |
@param anOffset The offset in the buffer at which to start writing data. |
|
1009 |
@param aMessage |
|
1010 |
*/ |
|
1011 |
virtual void RawWriteL(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt anOffset,const RMessagePtr2& aMessage) = 0; |
|
1012 |
||
1013 |
||
1014 |
/** |
|
1015 |
Gets the short name of the file or directory with the given full name. |
|
1016 |
||
1017 |
This function is used in circumstances where a file system mangles |
|
1018 |
Symbian OS natural names, in order to be able to store them on |
|
1019 |
a file system that is not entirely compatible. |
|
1020 |
||
1021 |
The function should leave with a suitable error code if it cannot complete |
|
1022 |
successfully for any reason. |
|
1023 |
||
1024 |
@param aLongName A reference to a descriptor containing the full name |
|
1025 |
of the entry. |
|
1026 |
@param aShortName On return, a reference to a descriptor containing |
|
1027 |
the short name of the entry. |
|
1028 |
||
1029 |
@leave KErrNotFound The entry specified by its long name cannot be found. |
|
1030 |
*/ |
|
1031 |
virtual void GetShortNameL(const TDesC& aLongName,TDes& aShortName) = 0; |
|
1032 |
||
1033 |
||
1034 |
/** |
|
1035 |
Gets the long name of the file or directory associated with |
|
1036 |
the given short name. |
|
1037 |
||
1038 |
This function is used in circumstances where a file system mangles |
|
1039 |
Symbian OS natural names in order to be able to store them on |
|
1040 |
a file system that is not entirely compatible. |
|
1041 |
||
1042 |
The function should leave with a suitable error code if it cannot complete |
|
1043 |
successfully for any reason. |
|
1044 |
||
1045 |
@param aShorName A reference to a descriptor containing the short name |
|
1046 |
of the entry. |
|
1047 |
||
1048 |
@param aLongName On return, a reference to a descriptor containing |
|
1049 |
the long name of the entry. |
|
1050 |
||
1051 |
@leave KErrNotFound The entry specified by its short name cannot be found. |
|
1052 |
*/ |
|
1053 |
virtual void GetLongNameL(const TDesC& aShorName,TDes& aLongName) = 0; |
|
1054 |
||
1055 |
||
1056 |
/** |
|
1057 |
Reads a specified section of the file, regardless of the file's lock state. |
|
1058 |
||
1059 |
The function should leave with a suitable error code if it cannot complete |
|
1060 |
successfully for any reason. |
|
1061 |
||
1062 |
@param aName A reference to a descriptor containing the full name of |
|
1063 |
the file to be read from |
|
1064 |
@param aPos The byte position to start reading from. |
|
1065 |
@param aTrg A pointer to the buffer into which data is to be read. |
|
1066 |
@param aLength The length of data to be read, in bytes. |
|
1067 |
@param aMessage |
|
1068 |
||
1069 |
@leave KErrEof aPos is past the end of the file. |
|
1070 |
*/ |
|
1071 |
virtual void ReadSectionL(const TDesC& aName,TInt aPos,TAny* aTrg,TInt aLength,const RMessagePtr2& aMessage)=0; |
|
1072 |
||
1073 |
||
1074 |
/** |
|
1075 |
Checks the integrity of the file system on the volume and returns an appropriate error value. |
|
1076 |
The default implementation must be overridden by a derived class. |
|
1077 |
||
1078 |
@return KErrNone if the file system is stable; otherwise one of the other system wide error codes. |
|
1079 |
The default implementation returns KErrNotSupported. |
|
1080 |
*/ |
|
1081 |
virtual TInt CheckDisk() {return(KErrNotSupported);} |
|
1082 |
||
1083 |
/** |
|
1084 |
The same as original CheckDisk(), but with some parameters. |
|
1085 |
*/ |
|
1086 |
virtual TInt CheckDisk(TInt aOperation, TAny* aParam1=NULL, TAny* aParam2=NULL); |
|
1087 |
||
1088 |
||
1089 |
/** |
|
1090 |
Scans through and corrects errors found in the volume. |
|
1091 |
||
1092 |
The default implementation must be overridden by a derived class. |
|
1093 |
||
1094 |
@return KErrNone if no errors are found or all errors are corrected; otherwise one of the other system wide error codes. |
|
1095 |
The default implementation returns KErrNotSupported. |
|
1096 |
*/ |
|
1097 |
virtual TInt ScanDrive() {return(KErrNotSupported);} |
|
1098 |
||
1099 |
/** |
|
1100 |
The same as original ScanDrive(), but with some parameters. |
|
1101 |
*/ |
|
1102 |
virtual TInt ScanDrive(TInt aOperation, TAny* aParam1=NULL, TAny* aParam2=NULL); |
|
1103 |
||
1104 |
IMPORT_C virtual void IsFileInRom(const TDesC& aFileName,TUint8*& aFileStart); |
|
1105 |
||
1106 |
||
1107 |
/** |
|
1108 |
Low-level control IO |
|
1109 |
*/ |
|
1110 |
virtual TInt ControlIO( const RMessagePtr2& /*aMessage*/,TInt /*aCommand*/,TAny* /*aParam1*/,TAny* /*aParam2*/) {return(KErrNotSupported);} |
|
1111 |
||
1112 |
||
1113 |
/** |
|
1114 |
Locks a media which supports password protection and replaces |
|
1115 |
the old password with a new one. |
|
1116 |
||
1117 |
If aStore is set to ETrue, then the new password should be saved to |
|
1118 |
the password store file, KMediaPWrdFile, using the exported file server |
|
1119 |
function WriteToDisk(). |
|
1120 |
||
1121 |
The password file is used to initialise the password store on boot up, |
|
1122 |
so the user does not need to be prompted for the password again if |
|
1123 |
it is saved here. |
|
1124 |
||
1125 |
The default implementation must be overridden in a derived class. |
|
1126 |
||
1127 |
@param aOld A reference to the old password. |
|
1128 |
@param aNew A reference to the new password. |
|
1129 |
@param aStore ETrue if the new password is to be saved to |
|
1130 |
the password file store; EFalse if not. |
|
1131 |
||
1132 |
@return KErrNone if successful; otherwise another of the system wide |
|
1133 |
error codes. The default implementation returns KErrNotSupported. |
|
1134 |
*/ |
|
1135 |
virtual TInt Lock(TMediaPassword& /*aOld*/,TMediaPassword& /*aNew*/,TBool /*aStore*/) {return(KErrNotSupported);} |
|
1136 |
||
1137 |
||
1138 |
/** |
|
1139 |
Unlocks a media which supports password protection. |
|
1140 |
||
1141 |
If aStore is set to ETrue then the password should be saved to |
|
1142 |
the password store file specified by KMediaPWrdFile using the exported file |
|
1143 |
server function WriteToDisk(). |
|
1144 |
||
1145 |
The password file is used to initialise the password store on boot up, |
|
1146 |
so the user does not need to be prompted for the password again if |
|
1147 |
it is saved here. |
|
1148 |
||
1149 |
The default implementation must be overridden in a derived class. |
|
1150 |
||
1151 |
@param aPassword A reference to the password. |
|
1152 |
@param aStore ETrue if the password is to be saved to |
|
1153 |
the password store file; EFalse otherwise. |
|
1154 |
||
1155 |
@return KErrNone if successful; otherwise another of the system wide |
|
1156 |
error codes. The default implementation returns KErrNotSupported. |
|
1157 |
*/ |
|
1158 |
virtual TInt Unlock(TMediaPassword& /*aPassword*/,TBool /*aStore*/) {return(KErrNotSupported);} |
|
1159 |
||
1160 |
||
1161 |
/** |
|
1162 |
Clears a password from a media that supports write protection. |
|
1163 |
||
1164 |
The default implementation must be overridden in a derived class. |
|
1165 |
||
1166 |
@param aPassword A reference to the password to be cleared. |
|
1167 |
||
1168 |
@return KErrNone if successful; otherwise another of the system wide |
|
1169 |
error codes. The default implementation returns KErrNotSupported. |
|
1170 |
*/ |
|
1171 |
virtual TInt ClearPassword(TMediaPassword& /*aPassword*/) {return(KErrNotSupported);} |
|
1172 |
||
1173 |
||
1174 |
/** |
|
1175 |
*/ |
|
1176 |
virtual TInt ForceRemountDrive(const TDesC8* /*aMountInfo*/,TInt /*aMountInfoMessageHandle*/,TUint /*aFlags*/) {return(KErrNotSupported);} |
|
1177 |
||
1178 |
||
1179 |
/** |
|
1180 |
Legacy method: finalise the mount and put it to the consistent state. |
|
1181 |
*/ |
|
1182 |
virtual void FinaliseMountL() {return;} |
|
1183 |
||
1184 |
/** |
|
1185 |
finalise the mount and put it to the consistent state. |
|
1186 |
||
1187 |
@param aOperation describes finalisation operation, see RFs::TFinaliseDrvMode |
|
1188 |
@param aParam1 not used, for future expansion |
|
1189 |
@param aParam2 not used, for future expansion |
|
1190 |
*/ |
|
1191 |
virtual void FinaliseMountL(TInt aOperation, TAny* aParam1=NULL, TAny* aParam2=NULL); |
|
1192 |
||
1193 |
||
1194 |
protected: |
|
1195 |
/** Mount Control levels or operations to perform */ |
|
1196 |
enum TMntCtlLevel |
|
1197 |
{ |
|
1198 |
//-- reserved generic mount (CMountCB) control codes |
|
1199 |
||
1200 |
EMountStateQuery, ///< query mount state, see TMntCtlOption, ESQ_IsMountFinalised |
|
1201 |
EMountVolParamQuery, ///< mount-specific queries for volume parameters. See ESQ_RequestFreeSpace, ESQ_GetCurrentFreeSpace |
|
1202 |
ECheckFsMountable, ///< extended mount functionality, checks if this file system can be mounted on specified drive. See CheckFileSystemMountable() |
|
1203 |
||
1204 |
//-- starting from the next code someone may define some specific mount type control codes, like ESpecificMountCtl+17 |
|
1205 |
ESpecificMountCtl = 0x40000000, |
|
1206 |
||
1207 |
//-- starting from the next code someone may define some specific File System control codes |
|
1208 |
ESpecificFsCtl = 0x40001000, |
|
1209 |
||
1210 |
EMountFsParamQuery, ///< File System parameters queries; File System properties can be "static" i.e not requiring properly mounted volume. See ESpecificFsCtlOpt |
|
1211 |
||
1212 |
}; |
|
1213 |
||
1214 |
/** Mount Control options that makes sense only for certain control codes, see TMntCtlLevel */ |
|
1215 |
enum TMntCtlOption |
|
1216 |
{ |
|
1217 |
//-- reserved generic mount (CMountCB) control options codes |
|
1218 |
||
1219 |
/** query if the mount is finalised, corresponds to the EMountStateQuery control code only. @see IsMountFinalised() */ |
|
1220 |
ESQ_IsMountFinalised, |
|
1221 |
||
1222 |
//----------------------------------------------------------------------------------------------------------------------------- |
|
1223 |
||
1224 |
//-- starting from the next code someone may define some specific mount type control options |
|
1225 |
ESpecificMountCtlOpt = 0x40000000, |
|
1226 |
||
1227 |
/** Corresponds to EMountVolParamQuery. Request a certain amount of free space on the volume. @see RequestFreeSpace() */ |
|
1228 |
ESQ_RequestFreeSpace, |
|
1229 |
||
1230 |
/** Corresponds to EMountVolParamQuery. A request to obtain the _current_ amount of free space on the volume asynchronously, without blocking. */ |
|
1231 |
ESQ_GetCurrentFreeSpace, |
|
1232 |
||
1233 |
/** Corresponds to EMountVolParamQuery. A request to obtain size of the mounted volume without blocking (CMountCB::VolumeL() can block). */ |
|
1234 |
ESQ_MountedVolumeSize, |
|
1235 |
||
1236 |
//----------------------------------------------------------------------------------------------------------------------------- |
|
1237 |
||
1238 |
//-- starting from the next code someone may define some specific File System control options |
|
1239 |
ESpecificFsCtlOpt = 0x40001000, |
|
1240 |
||
1241 |
/** Get Maximum file size, which is supported by the file system that has produced this mount. */ |
|
1242 |
ESQ_GetMaxSupportedFileSize, |
|
1243 |
||
1244 |
}; |
|
1245 |
||
1246 |
||
1247 |
public: |
|
1248 |
||
1249 |
/** |
|
1250 |
Generic mount control method. |
|
1251 |
@param aLevel specifies the operation to perfrom on the mount |
|
1252 |
@param aOption specific option for the given operation |
|
1253 |
@param aParam pointer to generic parameter, its meaning depends on aLevel and aOption |
|
1254 |
||
1255 |
@return standard error code. Default imlementation returns KErrNotSupported |
|
1256 |
*/ |
|
1257 |
virtual TInt MountControl(TInt aLevel, TInt aOption, TAny* aParam); |
|
1258 |
||
1259 |
||
1260 |
/** |
|
1261 |
Erase a password from a media that supports write protection. |
|
1262 |
||
1263 |
The default implementation must be overridden in a derived class. |
|
1264 |
||
1265 |
@return KErrNone if successful; otherwise another of the system wide |
|
1266 |
error codes. The default implementation returns KErrNotSupported. |
|
1267 |
*/ |
|
1268 |
virtual TInt ErasePassword() {return(KErrNotSupported);} |
|
1269 |
||
1270 |
/** |
|
1271 |
An interface class which may optionally be returned by a file system |
|
1272 |
by calling GetInterface(EFileAccessor, ...) |
|
1273 |
*/ |
|
1274 |
class MFileAccessor |
|
1275 |
{ |
|
1276 |
public: |
|
1277 |
virtual TInt GetFileUniqueId(const TDesC& aName, TInt64& aUniqueId) = 0; |
|
1278 |
virtual TInt Spare3(TInt aVal, TAny* aPtr1, TAny* aPtr2) = 0; |
|
1279 |
virtual TInt Spare2(TInt aVal, TAny* aPtr1, TAny* aPtr2) = 0; |
|
1280 |
virtual TInt Spare1(TInt aVal, TAny* aPtr1, TAny* aPtr2) = 0; |
|
1281 |
}; |
|
1282 |
||
1283 |
/** |
|
1284 |
@prototype |
|
1285 |
||
1286 |
CMountCB::MFileExtendedInterface interface provides extended interface for CMountCB to |
|
1287 |
read a specified section of large file (size greater than 2GB - 1). |
|
1288 |
||
1289 |
The interface could be retrieved by calling CMountCB::GetInterface() with |
|
1290 |
EFileExtendedInterface as an argument. |
|
1291 |
||
1292 |
Sub classes of CMountCB who does support large file access will need to multiple-inherit |
|
1293 |
with this class and implement the interface. The implementation of the interface will be |
|
1294 |
retrieved via GetInterface() and provided to user by non-virtual APIs to avoid breaking |
|
1295 |
binary compatibility. |
|
1296 |
||
1297 |
NOTE: Do not try to delete CMountCB::MFileExtendedInterface interface pointer! |
|
1298 |
||
1299 |
@see CMountCB::GetInterface() |
|
1300 |
*/ |
|
1301 |
||
1302 |
class MFileExtendedInterface |
|
1303 |
{ |
|
1304 |
public: |
|
1305 |
/** |
|
1306 |
Reads a specified section of the file, regardless of the file's lock state. |
|
1307 |
||
1308 |
The function should leave with a suitable error code if it cannot complete |
|
1309 |
successfully for any reason. |
|
1310 |
||
1311 |
This function should be implemented in file systems supporting files |
|
1312 |
of size greater than 2GB - 1. |
|
1313 |
||
1314 |
@param aName A reference to a descriptor containing the full name of |
|
1315 |
the file to be read from |
|
1316 |
@param aPos The byte position to start reading from. |
|
1317 |
@param aTrg A pointer to the buffer into which data is to be read. |
|
1318 |
@param aLength The length of data to be read, in bytes. |
|
1319 |
@param aMessage |
|
1320 |
||
1321 |
@leave KErrEof aPos is past the end of the file. |
|
1322 |
||
1323 |
@see CMountCB::ReadSectionL() |
|
1324 |
*/ |
|
1325 |
virtual void ReadSection64L(const TDesC& aName, TInt64 aPos, TAny* aTrg, TInt aLength, const RMessagePtr2& aMessage) = 0; |
|
1326 |
}; |
|
1327 |
||
1328 |
/** |
|
1329 |
Enumeration of the aInterfaceIDs used in GetInterface. |
|
1330 |
*/ |
|
1331 |
enum TInterfaceIds |
|
1332 |
{ |
|
1333 |
EAddFsToCompositeMount = 0, |
|
1334 |
EGetLocalDrive = 1, |
|
1335 |
EFileAccessor = 2, |
|
1336 |
EGetFileSystemSubType = 3, |
|
1337 |
EGetClusterSize = 4, |
|
1338 |
ELocalBufferSupport = 5, |
|
1339 |
EAddToCompositeMount = 6, |
|
1340 |
EGetProxyDrive = 7, |
|
1341 |
EFileExtendedInterface = 8 |
|
1342 |
}; |
|
1343 |
||
1344 |
// File clamping support |
|
1345 |
TInt ClampFile(const TInt aDriveNo,const TDesC& aName,TAny* aHandle); |
|
1346 |
TInt UnclampFile(RFileClamp* aHandle); |
|
1347 |
IMPORT_C TInt IsFileClamped(const TInt64 aUniqueId); |
|
1348 |
TInt NoOfClamps(); |
|
1349 |
||
1350 |
// File accessor support |
|
1351 |
TInt GetFileUniqueId(const TDesC& aName, TInt64& aUniqueId); |
|
1352 |
TInt Spare3(TInt aVal, TAny* aPtr1, TAny* aPtr2); |
|
1353 |
TInt Spare2(TInt aVal, TAny* aPtr1, TAny* aPtr2); |
|
1354 |
TInt Spare1(TInt aVal, TAny* aPtr1, TAny* aPtr2); |
|
1355 |
||
1356 |
// Extensions of interface |
|
1357 |
TInt FileSystemSubType(TDes& aName); |
|
1358 |
TInt FileSystemClusterSize(); |
|
1359 |
void FileSystemName(TDes& aName); |
|
1360 |
||
1361 |
// Large file support |
|
1362 |
void ReadSection64L(const TDesC& aName,TInt64 aPos,TAny* aTrg,TInt aLength,const RMessagePtr2& aMessage); |
|
1363 |
||
1364 |
inline TInt CheckFileSystemMountable(); |
|
1365 |
inline TInt RequestFreeSpace(TUint64 &aFreeSpaceBytes); |
|
1366 |
inline TInt MountedVolumeSize(TUint64& aVolSizeBytes); |
|
1367 |
inline TInt GetCurrentFreeSpaceAvailable(TInt64 &aFreeSpaceBytes); |
|
1368 |
inline TInt IsMountFinalised(TBool &aFinalised); |
|
1369 |
inline TInt GetMaxSupportedFileSize(TUint64 &aSize); |
|
1370 |
||
1371 |
protected: |
|
1372 |
inline void SetMountNumber(TInt aMountNumber); |
|
1373 |
inline void SetDismounted(TBool aDismounted=ETrue); |
|
1374 |
inline TInt MountNumber() const; |
|
1375 |
inline TBool IsDismounted() const; |
|
1376 |
||
1377 |
void SetProxyDriveDismounted(); |
|
1378 |
TBool ProxyDriveDismounted(); |
|
1379 |
||
1380 |
IMPORT_C CFileSystem* FileSystem() const; |
|
1381 |
||
1382 |
/** |
|
1383 |
Return a pointer to a specified interface extension - to allow future extension of this class without breaking |
|
1384 |
binary compatibility. |
|
1385 |
@param aInterfaceId Interface identifier of the interface to be retrieved. |
|
1386 |
@param aInterface A reference to a pointer that retrieves the specified interface. |
|
1387 |
@param aInput An arbitrary input argument. |
|
1388 |
@return KErrNone If the interface is supported, KErrNotSupported otherwise. |
|
1389 |
*/ |
|
1390 |
IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput); |
|
1391 |
||
1392 |
// calls GetInterface() with tracepoints added |
|
1393 |
TInt GetInterfaceTraced(TInt aInterfaceId,TAny*& aInterface,TAny* aInput); |
|
1394 |
||
1395 |
||
1396 |
||
1397 |
||
1398 |
private: |
|
1399 |
void SetFileSystem(CFileSystem* aFS); |
|
1400 |
||
1401 |
//-- these factory methods mus be used to produce objects representing files, directories etc. as soon as all these objects are |
|
1402 |
//-- associated with the mount, not the file sytem (file system is a factory for corresponding mounts) |
|
1403 |
//-- corresponding CFileSystem:: methods must not be used. |
|
1404 |
//-- CMountCB has a reference to the CFileSystem that produced it. |
|
1405 |
CFileCB* NewFileL() const; |
|
1406 |
CDirCB* NewDirL() const; |
|
1407 |
CFormatCB* NewFormatL() const; |
|
1408 |
||
1409 |
protected: |
|
1410 |
||
1411 |
TInt iMountNumber; ///< Unique mount number set by the TDrive object representing the drive on which the object resides. |
|
1412 |
TUint iUniqueID; ///< volume Unique ID. Set in MountL(). |
|
1413 |
TInt64 iSize; ///< Size of the volume. First set in MountL(). |
|
1414 |
||
1415 |
/** |
|
1416 |
A list of all open files on that mount. |
|
1417 |
Set by the TDrive object representing the drive of which the mount resides. |
|
1418 |
*/ |
|
1419 |
TDblQue<CFileCB> iMountQ; |
|
1420 |
||
1421 |
friend class TDrive; |
|
1422 |
friend class TFsAddCompositeMount; |
|
1423 |
||
1424 |
private: |
|
1425 |
TInt iLockMount; |
|
1426 |
TDrive* iDrive; |
|
1427 |
HBufC* iVolumeName; |
|
1428 |
CMountBody* iBody; ///< used for extending CMountCB functionality |
|
1429 |
}; |
|
1430 |
||
1431 |
||
1432 |
/** |
|
1433 |
@internalTechnology |
|
1434 |
||
1435 |
MFileSystemSubType interface provides extended interface for CMountCB to retrieve sub type |
|
1436 |
of mounted file systems. |
|
1437 |
||
1438 |
The interface could be retrieved by calling CMountCB::GetInterface() with EGetFileSystemSubType |
|
1439 |
as an argument. |
|
1440 |
||
1441 |
If the file system does not support sub types, MFileSystemSubType cannot be retieved. |
|
1442 |
Sub classes of CMountCB who does support sub types will need to multiple-inherit with |
|
1443 |
this class and implement the interface. The implementation of the interface will be |
|
1444 |
retrieved via GetInterface() and provided to user by non-virtual APIs to avoid breaking |
|
1445 |
binary compatibility. |
|
1446 |
||
1447 |
NOTE: Do not try to delete MFileSystemSubType interface pointer! |
|
1448 |
||
1449 |
@see CMountCB::GetInterface() |
|
1450 |
*/ |
|
1451 |
class MFileSystemSubType |
|
1452 |
{ |
|
1453 |
public: |
|
1454 |
/** |
|
1455 |
Retrieves file system's sub type name (E.g. FAT16), if the file system does not have sub |
|
1456 |
types (E.g. Rofs), return the file system's name. |
|
1457 |
@param aName Returned descriptor contains file system name or sub type name. |
|
1458 |
@return KErrNone if successful. |
|
1459 |
*/ |
|
1460 |
virtual TInt SubType(TDes& aName) const = 0; |
|
1461 |
}; |
|
1462 |
||
1463 |
/** |
|
1464 |
@internalTechnology |
|
1465 |
||
1466 |
MFileSystemClusterSize interface provides extended interface for CMountCB to retrieve cluster size |
|
1467 |
of mounted file systems. |
|
1468 |
||
1469 |
The interface could be retrieved by calling CMountCB::GetInterface() with EGetClusterSize |
|
1470 |
as an argument. |
|
1471 |
||
1472 |
If the file system does not support clustering, MFileSystemClusterSize cannot be retieved. |
|
1473 |
Sub classes of CMountCB who does support clustering will need to multiple-inherit with |
|
1474 |
this class and implement the interface. The implementation of the interface will be |
|
1475 |
retrieved via GetInterface() and provided to user by non-virtual APIs to avoid breaking |
|
1476 |
binary compatibility. |
|
1477 |
||
1478 |
NOTE: Do not try to delete MFileSystemSubType interface pointer! |
|
1479 |
||
1480 |
@see CMountCB::GetInterface() |
|
1481 |
*/ |
|
1482 |
class MFileSystemClusterSize |
|
1483 |
{ |
|
1484 |
public: |
|
1485 |
/** |
|
1486 |
Retrieves file system's cluster size |
|
1487 |
@return None-zero cluster size if successful. |
|
1488 |
*/ |
|
1489 |
virtual TInt ClusterSize() const = 0; |
|
1490 |
}; |
|
1491 |
||
1492 |
||
1493 |
class CFileShare; |
|
1494 |
||
1495 |
||
1496 |
||
1497 |
/** |
|
1498 |
@internalTechnology |
|
1499 |
*/ |
|
1500 |
class TAsyncReadRequest |
|
1501 |
{ |
|
1502 |
public: |
|
1503 |
TAsyncReadRequest(TInt64 aEndPos, CFileShare* aOwningShareP, CFsRequest* aRequestP); |
|
1504 |
TBool CompleteIfMatching(CFileShare* aOwningShareP, TRequestStatus* aStatusP, TInt aError); |
|
1505 |
private: |
|
1506 |
TAsyncReadRequest(); |
|
1507 |
public: |
|
1508 |
TInt64 iEndPos; // The request is completed file length >= iEndPos. |
|
1509 |
CFileShare* iOwningShareP; // The share that owns this outstanding request. |
|
1510 |
const TRequestStatus* iStatusP; // Used to identify the request when cancelling. |
|
1511 |
CSessionFs* iSessionP; // The owning session of the original request. |
|
1512 |
RMessage2 iMessage; // The message to be completed when data is available. |
|
1513 |
}; |
|
1514 |
||
1515 |
||
1516 |
/** |
|
1517 |
@internalTechnology |
|
1518 |
@released |
|
1519 |
||
1520 |
File share lock |
|
1521 |
||
1522 |
The lock specifies the lowest and highest position in the file to be locked. |
|
1523 |
Note that files may have many locks on it, but overlapping sections cannot be locked. |
|
1524 |
This is used by a file control block, a CFileCB object. |
|
1525 |
||
1526 |
@see CFileCB |
|
1527 |
*/ |
|
1528 |
class TFileShareLock |
|
1529 |
{ |
|
1530 |
public: |
|
1531 |
TFileShareLock(const CFileShare* aOwner, TUint64 aPosLow, TUint64 aPosHigh); |
|
1532 |
||
1533 |
||
1534 |
inline TUint64 PosLow() const; |
|
1535 |
inline TUint64 PosHigh() const; |
|
1536 |
inline TBool MatchOwner(const CFileShare* aShare) const; |
|
1537 |
||
1538 |
TBool MatchByPos(TUint64 aPosLow, TUint64 aPosHigh) const; |
|
1539 |
||
1540 |
private: |
|
1541 |
TFileShareLock(); |
|
1542 |
TFileShareLock(const TFileShareLock&); |
|
1543 |
TFileShareLock& operator=(const TFileShareLock&); |
|
1544 |
||
1545 |
private: |
|
1546 |
||
1547 |
const CFileShare* iOwner; ///<The owning file share object. |
|
1548 |
TUint64 iPosLow; ///<The start of the section of the file to be locked. |
|
1549 |
TUint64 iPosHigh; ///<The end of the section of the file to be locked. |
|
1550 |
||
1551 |
friend class CFileCB; |
|
1552 |
}; |
|
1553 |
||
1554 |
/** @internalTechnology */ |
|
1555 |
typedef RArray<TFileShareLock> TFileLocksArray; |
|
1556 |
||
1557 |
||
1558 |
/** |
|
1559 |
@publishedPartner |
|
1560 |
@released |
|
1561 |
||
1562 |
A file server interface class representing an open file. |
|
1563 |
||
1564 |
An instance of this object is referred to as a file control block. |
|
1565 |
||
1566 |
A file control block needs to be created for a specific file to be able to |
|
1567 |
access that file within a directory. |
|
1568 |
||
1569 |
A plug-in file system implements this class. |
|
1570 |
*/ |
|
1571 |
class CFileCB : public CFsDispatchObject |
|
1572 |
{ |
|
1573 |
public: |
|
1574 |
IMPORT_C CFileCB(); |
|
1575 |
IMPORT_C ~CFileCB(); |
|
1576 |
||
1577 |
IMPORT_C void InitL(TDrive* aDrive,TDrive* aCreatedDrive, HBufC* aName); |
|
1578 |
||
1579 |
inline void SetMount(CMountCB * aMount); |
|
1580 |
inline TDrive& Drive() const; |
|
1581 |
inline TDrive& CreatedDrive() const; |
|
1582 |
inline CMountCB& Mount() const; |
|
1583 |
inline HBufC& FileName() const; |
|
1584 |
inline HBufC& FileNameF() const; |
|
1585 |
inline TInt UniqueID() const; |
|
1586 |
TInt FindLock(TInt aPosLow,TInt aPosHigh); |
|
1587 |
TInt AddLock(CFileShare* aFileShare,TInt aPos,TInt aLength); |
|
1588 |
TInt RemoveLock(CFileShare* aFileShare,TInt aPos,TInt aLength); |
|
1589 |
TInt CheckLock(CFileShare* aFileShare,TInt aPos,TInt aLength); |
|
1590 |
void RemoveLocks(CFileShare* aFileShare); |
|
1591 |
inline TShare Share() const; |
|
1592 |
inline void SetShare(TShare aShare); |
|
1593 |
inline TInt Size() const; |
|
1594 |
inline void SetSize(TInt aSize); |
|
1595 |
inline TInt Att() const; |
|
1596 |
inline void SetAtt(TInt aAtt); |
|
1597 |
inline TTime Modified() const; |
|
1598 |
inline void SetModified(TTime aModified); |
|
1599 |
inline TBool FileCorrupt() const; |
|
1600 |
inline void SetFileCorrupt(TBool aFileCorrupt); |
|
1601 |
inline TBool BadPower() const; |
|
1602 |
inline void SetBadPower(TBool aBadPower); |
|
1603 |
inline TUint32 NameHash() const; |
|
1604 |
TInt CheckMount(); |
|
1605 |
inline TInt BlockMap(SBlockMapInfo& aInfo, TInt64& aStartPos, TInt64 aEndPos=-1); |
|
1606 |
inline TInt LocalDrive(TBusLocalDrive*& aLocalDrive); |
|
1607 |
||
1608 |
TBool LocalBufferSupport() const; |
|
1609 |
void SetLocalBufferSupport(TBool aEnabled); |
|
1610 |
||
1611 |
/** File caching support methods */ |
|
1612 |
||
1613 |
CFileCache* FileCache() const; |
|
1614 |
TInt FairSchedulingLen() const; |
|
1615 |
void ResetReadAhead(); |
|
1616 |
||
1617 |
void SetDeleteOnClose(); |
|
1618 |
TBool DeleteOnClose() const; |
|
1619 |
||
1620 |
||
1621 |
void SetNotifyAsyncReadersPending(TBool aNotifyAsyncReadersPending); |
|
1622 |
TBool NotifyAsyncReadersPending() const; |
|
1623 |
TInt CancelAsyncReadRequest(CFileShare* aShareP, TRequestStatus* aStatusP); |
|
1624 |
||
1625 |
/** Extended API support methods */ |
|
1626 |
||
1627 |
TBool ExtendedFileInterfaceSupported(); |
|
1628 |
void ReadL(TInt64 aPos,TInt& aLength,TDes8* aDes,const RMessagePtr2& aMessage, TInt aOffset); |
|
1629 |
void WriteL(TInt64 aPos,TInt& aLength,const TDesC8* aDes,const RMessagePtr2& aMessage, TInt aOffset); |
|
1630 |
void SetSizeL(TInt64 aSize); |
|
1631 |
||
1632 |
IMPORT_C TInt64 Size64() const; |
|
1633 |
IMPORT_C void SetSize64(TInt64 aSize, TBool aDriveLocked); |
|
1634 |
IMPORT_C void SetMaxSupportedSize(TUint64 aMaxFileSize); |
|
1635 |
||
1636 |
||
1637 |
TInt64 CachedSize64() const; |
|
1638 |
void SetCachedSize64(TInt64 aSize); |
|
1639 |
TInt FindLock64(TInt64 aPosLow,TInt64 aPosHigh); |
|
1640 |
TInt AddLock64(CFileShare* aFileShare,TInt64 aPos,TInt64 aLength); |
|
1641 |
TInt RemoveLock64(CFileShare* aFileShare,TInt64 aPos,TInt64 aLength); |
|
1642 |
TInt CheckLock64(CFileShare* aFileShare,TInt64 aPos,TInt64 aLength); |
|
1643 |
||
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1644 |
/** Sequential mode */ |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1645 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1646 |
IMPORT_C TBool IsSequentialMode() const; |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1647 |
void SetSequentialMode(TBool aSequential); |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1648 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1649 |
/** |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1650 |
The FileShare List contains the file shares of an open file. |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1651 |
*/ |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1652 |
TDblQue<CFileShare>& FileShareList() const; |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1653 |
void AddShare(CFileShare& aFileShare); |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1654 |
|
0 | 1655 |
/** |
1656 |
Renames the file with the full file name provided. |
|
1657 |
||
1658 |
Because the full name of the file includes the path, the function can |
|
1659 |
also be used to move the file. |
|
1660 |
||
1661 |
It can be assumed that no other sub-session has access to the file: |
|
1662 |
i.e. the file has not been opened in EFileShareAny share mode. |
|
1663 |
It can also be assumed that the file has been opened for writing. |
|
1664 |
||
1665 |
The function should leave with KErrAlreadyExists if aNewName already exists. |
|
1666 |
An appropriate error code should also be generated if the function leaves |
|
1667 |
before completion for any other reason. |
|
1668 |
||
1669 |
@param aNewName The new full name of the file. |
|
1670 |
||
1671 |
@see CFileCB::iFileName |
|
1672 |
*/ |
|
1673 |
virtual void RenameL(const TDesC& aNewName) =0; |
|
1674 |
||
1675 |
||
1676 |
/** |
|
1677 |
Reads a specified number of bytes from the open file starting at |
|
1678 |
the specified postition, and writes the result into a descriptor. |
|
1679 |
||
1680 |
It can be assumed that aPos is inside the file and aLength > 0. |
|
1681 |
The file should only be read up to its end regardless of |
|
1682 |
the value of aPos + aLength. The number of bytes read should be stored |
|
1683 |
in aLength on return. |
|
1684 |
||
1685 |
If the function leaves before completion for any reason it should generate |
|
1686 |
an appropriate error code, and in this situation, |
|
1687 |
the arguments are not valid on return. |
|
1688 |
||
1689 |
@param aPos Represents a position relative to the start of the file |
|
1690 |
where ReadL() should start to read. |
|
1691 |
@param aLength On entry, specifies the number of bytes to be read |
|
1692 |
from the file. On return, this should contain the number |
|
1693 |
of bytes read, but this is not valid if the function leaves. |
|
1694 |
@param aDes Pointer to a descriptor into which the data should be written. |
|
1695 |
@param aMessage |
|
1696 |
*/ |
|
1697 |
virtual void ReadL(TInt aPos,TInt& aLength,const TAny* aDes,const RMessagePtr2& aMessage) =0; |
|
1698 |
||
1699 |
||
1700 |
/** |
|
1701 |
Writes data to the open file. |
|
1702 |
||
1703 |
iModified and iSize are set by the file server after this function |
|
1704 |
has completed successfully. |
|
1705 |
||
1706 |
It can be assumed that aPos is within the file range and aLength > 0. |
|
1707 |
When aPos + aLength is greater than the file size then the file should |
|
1708 |
be enlarged using SetSizeL(). The number of bytes written should be |
|
1709 |
returned through the argument aLength. |
|
1710 |
||
1711 |
If the function leaves before completion for any reason it should generate |
|
1712 |
an appropriate error code, and in this situation the arguments are |
|
1713 |
not valid on return. |
|
1714 |
||
1715 |
@param aPos Represents a position relative to the start of the file |
|
1716 |
where WriteL() should start to write. |
|
1717 |
@param aLength Specifies the number of bytes to be written to the file. |
|
1718 |
On return, the number of bytes written, but this is not |
|
1719 |
valid if the function leaves. |
|
1720 |
@param aDes Pointer to a descriptor containing the data to be written |
|
1721 |
to the file. |
|
1722 |
@param aMessage |
|
1723 |
||
1724 |
@see CFileCB::iModified |
|
1725 |
@see CFileCB::iSize |
|
1726 |
@see CFileCB::SetSizeL |
|
1727 |
||
1728 |
@leave KErrDiskFull The operation cannot be completed because the disk is full. |
|
1729 |
*/ |
|
1730 |
virtual void WriteL(TInt aPos,TInt& aLength,const TAny* aDes,const RMessagePtr2& aMessage) =0; |
|
1731 |
||
1732 |
||
1733 |
/** |
|
1734 |
Extends or truncates the file by re-setting the file size. |
|
1735 |
||
1736 |
The function should not change iModified and iSize attributes of |
|
1737 |
the file object: this is done by the file server. |
|
1738 |
If the file is extended, nothing should be written in the extended area. |
|
1739 |
||
1740 |
The function should leave with a suitable error code on error detection. |
|
1741 |
||
1742 |
@param aSize The new file size in number of bytes. |
|
1743 |
||
1744 |
@leave KErrDiskFull The operation cannot be completed because the disk is full. |
|
1745 |
||
1746 |
@see CFileCB::iModified |
|
1747 |
@see CFileCB::iSize |
|
1748 |
*/ |
|
1749 |
virtual void SetSizeL(TInt aSize) =0; |
|
1750 |
||
1751 |
||
1752 |
/** |
|
1753 |
Sets the attribute mask, iAtt, and the modified time of the file, iModified. |
|
1754 |
||
1755 |
If aMask|aVal does not equal zero, then aMask should be OR'ed with iAtt, |
|
1756 |
whilst the inverse of aVal should be AND'ed with iAtt. |
|
1757 |
If the modified flag is set in aMask then iModified should be set to aTime. |
|
1758 |
||
1759 |
The function should leave with a suitable error code on error detection. |
|
1760 |
||
1761 |
@param aTime The new modified time, if the modified flag is set in aMask. |
|
1762 |
@param aMask Bit mask containing bits set (to 1) that are to be set (to 1) |
|
1763 |
in iAtt. |
|
1764 |
@param aVal Bitmask containing bits set (to 1) that are to be unset (to 0) |
|
1765 |
in iAtt. |
|
1766 |
||
1767 |
@see CFileCB::iModified |
|
1768 |
@see CFileCB::iAtt |
|
1769 |
*/ |
|
1770 |
virtual void SetEntryL(const TTime& aTime,TUint aMask,TUint aVal) =0; |
|
1771 |
||
1772 |
||
1773 |
/** |
|
1774 |
Flushes, to disk, the cached information necessary for the integrity |
|
1775 |
of recently written data, such as the file size. |
|
1776 |
||
1777 |
The function should leave with a suitable error code on error detection. |
|
1778 |
*/ |
|
1779 |
virtual void FlushDataL() =0; |
|
1780 |
||
1781 |
||
1782 |
/** |
|
1783 |
Flushes, to disk, all cached file data (e.g. attributes, modification time, |
|
1784 |
file size). |
|
1785 |
||
1786 |
The modified bit in the file attributes mask should be cleared if |
|
1787 |
the flush was successful. |
|
1788 |
||
1789 |
The function should leave with a suitable error code on error detection. |
|
1790 |
*/ |
|
1791 |
virtual void FlushAllL() =0; |
|
1792 |
IMPORT_C virtual TInt Address(TInt& aPos) const; |
|
1793 |
IMPORT_C void SetArchiveAttribute(); |
|
1794 |
||
1795 |
/** |
|
1796 |
Block Map API interface |
|
1797 |
*/ |
|
1798 |
class MBlockMapInterface |
|
1799 |
{ |
|
1800 |
public: |
|
1801 |
virtual TInt BlockMap(SBlockMapInfo& aInfo, TInt64& aStartPos, TInt64 aEndPos)=0; |
|
1802 |
}; |
|
1803 |
||
1804 |
/** |
|
1805 |
An interface class which may optionally be returned by a file system |
|
1806 |
by calling GetInterface(EExtendedFileInterface, ...) |
|
1807 |
The purpose of this interface is twofold: |
|
1808 |
- to support fair scheduling (by use of the aOffset parameter) |
|
1809 |
- to enable large file support |
|
1810 |
*/ |
|
1811 |
class MExtendedFileInterface |
|
1812 |
{ |
|
1813 |
public: |
|
1814 |
/** |
|
1815 |
Functionally equivalent to CFileCB::ReadL(), but supports large files and fair scheduling |
|
1816 |
||
1817 |
Reads a specified number of bytes from the open file starting at |
|
1818 |
the specified postition, and writes the result into a descriptor. |
|
1819 |
||
1820 |
@param aPos Represents a position relative to the start of the file |
|
1821 |
where ReadL() should start to read. |
|
1822 |
Note that the filesystem may not support positions above KMaxTInt, |
|
1823 |
in which case it leaves with KErrNotSupported. |
|
1824 |
@param aLength On entry, specifies the number of bytes to be read |
|
1825 |
from the file. On return, this contains the number |
|
1826 |
of bytes read, this value is not valid if the function leaves. |
|
1827 |
@param aDes Pointer to a descriptor into which the data is written. |
|
1828 |
@param aMessage A reference to a client message or an RLocalMessage. |
|
1829 |
@param aOffset The offset into the descriptor where the data is to be written. |
|
1830 |
This is non-zero if the read was fair-scheduled |
|
1831 |
||
1832 |
@see CFileCB::ReadL |
|
1833 |
@see RLocalMessage |
|
1834 |
*/ |
|
1835 |
virtual void ReadL(TInt64 aPos,TInt& aLength,TDes8* aDes,const RMessagePtr2& aMessage, TInt aOffset) = 0; |
|
1836 |
||
1837 |
/** |
|
1838 |
Functionally equivalent to CFileCB::WriteL(), but supports large files and fair scheduling |
|
1839 |
||
1840 |
Writes data to the open file. |
|
1841 |
||
1842 |
@param aPos Represents a position relative to the start of the file |
|
1843 |
where WriteL() starts to write. |
|
1844 |
Note that the filesystem may not support positions above KMaxTInt, |
|
1845 |
in which case it leaves with KErrNotSupported. |
|
1846 |
@param aLength Specifies the number of bytes to be written to the file. |
|
1847 |
On return this is the number of bytes written, this value is not |
|
1848 |
valid if the function leaves. |
|
1849 |
@param aDes Pointer to a descriptor containing the data to be written |
|
1850 |
to the file. |
|
1851 |
@param aMessage A reference to a client message or an RLocalMessage |
|
1852 |
@param aOffset The offset into the descriptor where the data is to be read from. |
|
1853 |
This is non-zero if the read was fair-scheduled |
|
1854 |
||
1855 |
@see CFileCB::WriteL |
|
1856 |
@see RLocalMessage |
|
1857 |
*/ |
|
1858 |
virtual void WriteL(TInt64 aPos,TInt& aLength,const TDesC8* aDes,const RMessagePtr2& aMessage, TInt aOffset) = 0; |
|
1859 |
||
1860 |
/** |
|
1861 |
Functionally equivalent to CFileCB::SetSizeL(), but supports large files |
|
1862 |
||
1863 |
Extends or truncates the file by re-setting the file size. |
|
1864 |
||
1865 |
The function does not change the iModified and iSize attributes of |
|
1866 |
the file object: this is done by the file server. |
|
1867 |
If the file is extended, nothing is written in the extended area. |
|
1868 |
||
1869 |
The function leaves with a suitable error code when an error is to detected. |
|
1870 |
||
1871 |
@param aSize The new file size in bytes. |
|
1872 |
||
1873 |
@leave KErrDiskFull The operation cannot be completed because the disk is full. |
|
1874 |
||
1875 |
@see CFileCB::SetSizeL |
|
1876 |
@see CFileCB::iModified |
|
1877 |
@see CFileCB::iSize |
|
1878 |
*/ |
|
1879 |
virtual void SetSizeL(TInt64 aSize) = 0; |
|
1880 |
}; |
|
1881 |
||
1882 |
||
1883 |
protected: |
|
1884 |
||
1885 |
/** |
|
1886 |
Return a pointer to a specified interface extension - to allow future extension of this class without breaking |
|
1887 |
binary compatibility. |
|
1888 |
@param aInterfaceId Interface identifier of the interface to be retrieved. |
|
1889 |
@param aInterface A reference to a pointer that retrieves the specified interface. |
|
1890 |
@param aInput An arbitrary input argument. |
|
1891 |
@return KErrNone If the interface is supported, KErrNotSupported otherwise. |
|
1892 |
*/ |
|
1893 |
IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput); |
|
1894 |
||
1895 |
// calls GetInterface() with tracepoints added |
|
1896 |
TInt GetInterfaceTraced(TInt aInterfaceId,TAny*& aInterface,TAny* aInput); |
|
1897 |
||
1898 |
||
1899 |
enum TInterfaceIds |
|
1900 |
{ |
|
1901 |
EBlockMapInterface = 0, |
|
1902 |
EGetLocalDrive = 1, |
|
1903 |
EExtendedFileInterface |
|
1904 |
}; |
|
1905 |
||
1906 |
TUint64 MaxSupportedSize(void) const; |
|
1907 |
||
1908 |
||
1909 |
inline TFileLocksArray& FileLocks(); |
|
1910 |
||
1911 |
||
1912 |
||
1913 |
private: |
|
1914 |
||
1915 |
void DemoteShare(CFileShare* aFileShare); |
|
1916 |
void PromoteShare(CFileShare* aFileShare); |
|
1917 |
||
1918 |
RArray<TAsyncReadRequest>& AsyncReadRequests(); |
|
1919 |
TInt AddAsyncReadRequest(CFileShare* aFileShareP, TInt64 aPos, TInt aLength, CFsRequest* aRequestP); |
|
1920 |
void NotifyAsyncReaders(); |
|
1921 |
||
1922 |
protected: |
|
1923 |
||
1924 |
/** |
|
1925 |
Inititally, the mode that the file was opened with, which defines the level |
|
1926 |
of access allowed to the file. Set by the TDrive object |
|
1927 |
(representing the drive on which the file resides) when the file |
|
1928 |
control block is created. |
|
1929 |
*/ |
|
1930 |
TShare iShare; |
|
1931 |
||
1932 |
||
1933 |
/** |
|
1934 |
The size of the file. This is the low 32 bit part of the file size. |
|
1935 |
The upper 32 bit part of the file size is saved on the file server side |
|
1936 |
for File Systems supporting file size > 4GB - 1. |
|
1937 |
File Systems supporting file size > 4GB - 1 shall use CFileCB::Size64() |
|
1938 |
to query the file size and CFileCB::SetSize64() to set file size. |
|
1939 |
*/ |
|
1940 |
TInt iSize; |
|
1941 |
||
1942 |
||
1943 |
/** |
|
1944 |
The attributes of the file. |
|
1945 |
*/ |
|
1946 |
TInt iAtt; |
|
1947 |
||
1948 |
||
1949 |
/** |
|
1950 |
The universal time at which the file was last modified. |
|
1951 |
*/ |
|
1952 |
TTime iModified; |
|
1953 |
||
1954 |
||
1955 |
/** |
|
1956 |
Indicates whether the file that the object represents is corrupt: |
|
1957 |
true if it is corrupt, false otherwise. |
|
1958 |
*/ |
|
1959 |
TBool iFileCorrupt; |
|
1960 |
||
1961 |
||
1962 |
/** |
|
1963 |
Indicates whether a recent access to the file that the object represents |
|
1964 |
failed due to KErrBadPower. |
|
1965 |
*/ |
|
1966 |
TBool iBadPower; |
|
1967 |
||
1968 |
public: |
|
1969 |
||
1970 |
/** |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1971 |
The full name of the file, including its extension. |
0 | 1972 |
*/ |
1973 |
HBufC* iFileName; |
|
1974 |
||
1975 |
/** |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1976 |
The full name of the file, including its extension - Folded. |
0 | 1977 |
*/ |
1978 |
HBufC* iFileNameF; |
|
1979 |
||
1980 |
private: |
|
1981 |
TUint32 iNameHash; |
|
1982 |
TDrive* iCreatedDrive; |
|
1983 |
TDrive* iDrive; |
|
1984 |
CMountCB* iMount; |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1985 |
TFileLocksArray* iFileLocks; // An array of file position locks |
0 | 1986 |
TDblQueLink iMountLink; |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1987 |
CFileBody* iBody; |
0 | 1988 |
|
1989 |
friend class TDrive; |
|
1990 |
friend class CMountCB; |
|
1991 |
friend class CFileShare; |
|
1992 |
friend class TFsFileRead; |
|
1993 |
friend class TFsFileWrite; |
|
1994 |
friend class TFsFileSetSize; |
|
1995 |
friend class TFsFileReadCancel; |
|
1996 |
friend class TFsFileDuplicate; |
|
1997 |
friend class TFsFileRename; |
|
1998 |
friend class CCompFileCB; |
|
1999 |
friend class CFileCache; |
|
2000 |
}; |
|
2001 |
||
2002 |
||
2003 |
/** |
|
2004 |
Helper class to construct a dummy RMessage2 object. This allows the file server to |
|
2005 |
read and write local buffers to a file system's CFileCB-derived interface. |
|
2006 |
||
2007 |
@internalTechnology |
|
2008 |
*/ |
|
2009 |
class RLocalMessage : public RMessage2 |
|
2010 |
{ |
|
2011 |
public: |
|
2012 |
inline RLocalMessage(); |
|
2013 |
||
2014 |
inline void InitHandle(); |
|
2015 |
inline void SetFunction(TInt aFunction); |
|
2016 |
inline void SetArgs(TIpcArgs& aArgs); |
|
2017 |
inline TInt Arg(TInt aIndex) const; |
|
2018 |
}; |
|
2019 |
||
2020 |
||
2021 |
/** |
|
2022 |
@publishedPartner |
|
2023 |
@released |
|
2024 |
||
2025 |
A file server interface class representing an open file that is being shared. |
|
2026 |
For example multiple reading of the same file. |
|
2027 |
||
2028 |
@see CFileCB |
|
2029 |
@see TFileMode |
|
2030 |
*/ |
|
2031 |
NONSHARABLE_CLASS(CFileShare) : public CFsDispatchObject |
|
2032 |
{ |
|
2033 |
public: |
|
2034 |
CFileShare(CFileCB* aFileCB); |
|
2035 |
~CFileShare(); |
|
2036 |
TInt CheckMount(); |
|
2037 |
void InitL(); |
|
2038 |
inline CFileCB& File(); |
|
2039 |
||
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
2040 |
// For serialising async requests |
0 | 2041 |
TBool RequestStart(CFsMessageRequest* aRequest); |
2042 |
void RequestEnd(CFsMessageRequest* aRequest); |
|
2043 |
TBool RequestInProgress() const; |
|
2044 |
inline TBool IsFileModeBig(); |
|
2045 |
||
2046 |
public: |
|
2047 |
/** |
|
2048 |
File share mode. The mode in which the file was opened first. |
|
2049 |
@see TFileMode. |
|
2050 |
*/ |
|
2051 |
TUint iMode; |
|
2052 |
/** |
|
2053 |
Current file position. This is the position at which reading and writing takes place. |
|
2054 |
*/ |
|
2055 |
TInt64 iPos; |
|
2056 |
/** |
|
2057 |
Error condition due to flush. |
|
2058 |
*/ |
|
2059 |
TInt iFlushError; |
|
2060 |
private: |
|
2061 |
CFileCB* iFile; |
|
2062 |
||
2063 |
// A pointer to the current request. Used for serializing client |
|
2064 |
// async read/write requests which might otherwise be processed out |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
2065 |
// of order due to fair scheduling. |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
2066 |
CFsMessageRequest* iCurrentRequest; |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
2067 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
2068 |
// The FileShare List link object. |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
2069 |
TDblQueLink iShareLink; |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
2070 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
2071 |
friend class CFileBody; // For access to iShareLink |
0 | 2072 |
}; |
2073 |
||
2074 |
||
2075 |
||
2076 |
||
2077 |
/** |
|
2078 |
@publishedPartner |
|
2079 |
@released |
|
2080 |
||
2081 |
A file server interface class representing an open directory |
|
2082 |
||
2083 |
An instance of this object is referred to as a directory control block. |
|
2084 |
||
2085 |
A directory control block must be created for a specific directory to access |
|
2086 |
that directory within a volume. |
|
2087 |
||
2088 |
A plug-in file system implements this class. |
|
2089 |
*/ |
|
2090 |
class CDirCB : public CFsDispatchObject |
|
2091 |
{ |
|
2092 |
public: |
|
2093 |
IMPORT_C CDirCB(); |
|
2094 |
IMPORT_C ~CDirCB(); |
|
2095 |
TInt CheckMount(); |
|
2096 |
IMPORT_C void InitL(TDrive* aDrive); |
|
2097 |
inline void SetMount(CMountCB * aMount){iMount=aMount;}; |
|
2098 |
inline TDrive& Drive() const; |
|
2099 |
inline CMountCB& Mount() const; |
|
2100 |
inline TBool Pending() const; |
|
2101 |
inline void SetPending(TBool aPending); |
|
2102 |
||
2103 |
||
2104 |
/** |
|
2105 |
Gets information from the first suitable entry in the directory, |
|
2106 |
starting from the current read position. |
|
2107 |
||
2108 |
The function should read successive entries until a suitable entry is found. |
|
2109 |
An entry is suitable if the entry attributes match the criteria set by this |
|
2110 |
object's attributes, which are set on initialisation. |
|
2111 |
For example, if the directory control block has the attribute |
|
2112 |
KEntryAttMaskSupported, and the file has the attribute KEntryAttVolume, |
|
2113 |
then the entry will be deemed unsuitable and the next entry will be read. |
|
2114 |
||
2115 |
This function is called by the file server. |
|
2116 |
||
2117 |
If, on return, the entry's full file name, TEntry::iName, is longer than |
|
2118 |
the maximum buffer size, then the entry cannot be returned to the client. |
|
2119 |
In this case the file server will set iPending to true and will call |
|
2120 |
StoreLongEntryName() before calling this function again. |
|
2121 |
In this case (when iPending is true), the function should re-read |
|
2122 |
the last entry to be read; it should also set iPending to false and |
|
2123 |
should not advance the current read position. |
|
2124 |
||
2125 |
The time stored in the iModified member of anEntry should not be converted, |
|
2126 |
but left as UTC time. |
|
2127 |
||
2128 |
When storing the iName member of anEntry, the current (.), |
|
2129 |
or parent marker (..) in the directory should not be returned. |
|
2130 |
||
2131 |
If the KEntryAttAllowUid flag is set in the iAtt member of anEntry, then |
|
2132 |
the entry UID type of an entry will be read. If, on reading the UID from |
|
2133 |
a file, KErrCorrupt is generated, because the file is corrupt, |
|
2134 |
ReadL() should not leave with this error message, but should return |
|
2135 |
as normal. |
|
2136 |
If any other errors are raised the function should leave. |
|
2137 |
||
2138 |
All of the properties of a TEntry, other than the UID types, are always read. |
|
2139 |
||
2140 |
ReadL() should leave with a suitable error code if it cannot complete |
|
2141 |
successfully for any reason. |
|
2142 |
||
2143 |
@param anEntry Entry information object. |
|
2144 |
*/ |
|
2145 |
virtual void ReadL(TEntry& anEntry) =0; |
|
2146 |
||
2147 |
public: |
|
2148 |
IMPORT_C virtual void StoreLongEntryNameL(const TDesC& aName); |
|
2149 |
||
2150 |
protected: |
|
2151 |
/** |
|
2152 |
Return a pointer to a specified interface extension - to allow future extension of this class without breaking |
|
2153 |
binary compatibility. |
|
2154 |
@param aInterfaceId Interface identifier of the interface to be retrieved. |
|
2155 |
@param aInterface A reference to a pointer that retrieves the specified interface. |
|
2156 |
@param aInput An arbitrary input argument. |
|
2157 |
@return KErrNone If the interface is supported, KErrNotSupported otherwise. |
|
2158 |
*/ |
|
2159 |
IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput); |
|
2160 |
||
2161 |
protected: |
|
2162 |
/** |
|
2163 |
Bitmask of the attributes of interest. |
|
2164 |
||
2165 |
Set using the the TDrive friend class instance representing |
|
2166 |
the directory's drive after the object is made. |
|
2167 |
*/ |
|
2168 |
TUint iAtt; |
|
2169 |
||
2170 |
||
2171 |
/** |
|
2172 |
Set after construction using the TDrive friend class instance representing |
|
2173 |
the directory's drive. |
|
2174 |
*/ |
|
2175 |
TUidType iUidType; |
|
2176 |
||
2177 |
||
2178 |
/** |
|
2179 |
Flag to indicate whether preceding entry details should be returned when |
|
2180 |
multiple entries are being read. |
|
2181 |
*/ |
|
2182 |
TBool iPending; |
|
2183 |
friend class TDrive; |
|
2184 |
private: |
|
2185 |
TDrive* iDrive; |
|
2186 |
CMountCB* iMount; |
|
2187 |
TUint32 iReserved; // Reserved for future expansion |
|
2188 |
}; |
|
2189 |
||
2190 |
||
2191 |
||
2192 |
||
2193 |
class CFormatCBBody; |
|
2194 |
||
2195 |
/** |
|
2196 |
@publishedPartner |
|
2197 |
@released |
|
2198 |
||
2199 |
A file server interface class representing a format operation on a disk. |
|
2200 |
||
2201 |
An instance of this object is referred to as a format control block. |
|
2202 |
||
2203 |
The type of format operation to be applied depends on the type of disk, |
|
2204 |
and is stored in iMode. Each format operation has a number of steps and |
|
2205 |
is kept track of using iCurrentStep. |
|
2206 |
||
2207 |
A format control block needs to be created for a specific mount control block |
|
2208 |
for the disk controlled via that mount to be formatted. |
|
2209 |
||
2210 |
A plug-in file system provides an implementation of this class. |
|
2211 |
*/ |
|
2212 |
||
2213 |
class CFormatCB : public CFsDispatchObject |
|
2214 |
{ |
|
2215 |
public: |
|
2216 |
IMPORT_C CFormatCB(); |
|
2217 |
IMPORT_C ~CFormatCB(); |
|
2218 |
IMPORT_C TInt CheckMount(); |
|
2219 |
||
2220 |
void InitL(TDrive* aDrive, TFormatMode aMode); |
|
2221 |
||
2222 |
void SetFormatParameters(const TLDFormatInfo* apLDFormatInfo); |
|
2223 |
TInt SetFormatParameters(const TVolFormatParam* apVolFormatParam); |
|
2224 |
||
2225 |
||
2226 |
inline TDrive& Drive() const; |
|
2227 |
inline CMountCB& Mount() const; |
|
2228 |
inline TFormatMode Mode() const; |
|
2229 |
inline TInt& CurrentStep(); |
|
2230 |
||
2231 |
/** |
|
2232 |
Performs a formatting step on the drive. |
|
2233 |
||
2234 |
The step performed should depend on the values of iMode and iCurrentStep. |
|
2235 |
||
2236 |
It can be assumed that there are no resources open on the mount, |
|
2237 |
that the media is formattable, and that the media is not write protected. |
|
2238 |
||
2239 |
If iMode == EQuickFormat, then only meta data is to be written. |
|
2240 |
This should be carried out in a single step, with iCurrentStep set |
|
2241 |
to zero on completion. |
|
2242 |
||
2243 |
If iMode != EQuickFormat, then the format step performed by |
|
2244 |
this function should depend on iCurrentStep. When the function |
|
2245 |
returns with iCurrentStep set to zero, the formatting of the drive is complete. |
|
2246 |
||
2247 |
On error detection, the function should leave with an appropriate error code. |
|
2248 |
||
2249 |
@see CFormatCB::iMode |
|
2250 |
@see CFormatCB::iCurrentStep |
|
2251 |
*/ |
|
2252 |
virtual void DoFormatStepL() =0; |
|
2253 |
||
2254 |
protected: |
|
2255 |
||
2256 |
/** Enumeration of the aInterfaceIDs used in GetInterface */ |
|
2257 |
enum TInterfaceIds |
|
2258 |
{ |
|
2259 |
ESetFmtParameters = 1, ///< used in implementation of SetFormatParameters(const TVolFormatParam* apVolFormatParam) |
|
2260 |
}; |
|
2261 |
||
2262 |
||
2263 |
||
2264 |
/** |
|
2265 |
Return a pointer to a specified interface extension - to allow future extension of this class without breaking |
|
2266 |
binary compatibility. |
|
2267 |
@param aInterfaceId Interface identifier of the interface to be retrieved. |
|
2268 |
@param aInterface A reference to a pointer that retrieves the specified interface. |
|
2269 |
@param aInput An arbitrary input argument. |
|
2270 |
@return KErrNone If the interface is supported, KErrNotSupported otherwise. |
|
2271 |
*/ |
|
2272 |
IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput); |
|
2273 |
||
2274 |
protected: |
|
2275 |
||
2276 |
TInt iCurrentStep; ///< current format step counter 100...0 |
|
2277 |
TFormatMode iMode; ///< Format mode. This is set by the file server when this objetc is instantiated. |
|
2278 |
TSpecialFormatInfoBuf iSpecialInfo; ///< Buffer containing user-specified format parameters. |
|
2279 |
||
2280 |
private: |
|
2281 |
||
2282 |
TDrive* iDrive; |
|
2283 |
CMountCB* iMount; ///< parent Mount |
|
2284 |
CFormatCBBody* iBody; ///< additional data holder |
|
2285 |
}; |
|
2286 |
||
2287 |
||
2288 |
||
2289 |
||
2290 |
/** |
|
2291 |
@publishedPartner |
|
2292 |
@released |
|
2293 |
||
2294 |
A file server interface class representing a raw disk. |
|
2295 |
||
2296 |
An instance of this object is referred to as a raw disk control block. |
|
2297 |
||
2298 |
This is not an abstract base class and does not need to be derived from |
|
2299 |
when implementing a file system. This is because direct disk access is |
|
2300 |
implemented by the file server directly calling RawReadL() and RawWriteL() |
|
2301 |
from the derived CMountCB object of the file system. |
|
2302 |
*/ |
|
2303 |
NONSHARABLE_CLASS(CRawDiskCB) : public CFsDispatchObject |
|
2304 |
{ |
|
2305 |
public: |
|
2306 |
CRawDiskCB(); |
|
2307 |
~CRawDiskCB(); |
|
2308 |
void InitL(CMountCB* aMount,TBool aIsWriteProtected); |
|
2309 |
inline CMountCB& Mount(); |
|
2310 |
inline TDrive& Drive(); |
|
2311 |
inline TBool IsWriteProtected() const; |
|
2312 |
inline void SetChanged(); |
|
2313 |
private: |
|
2314 |
enum { EWriteProtected = 1, EChanged = 2 }; |
|
2315 |
inline void SetWriteProtected(); |
|
2316 |
inline TBool IsChanged() const; |
|
2317 |
private: |
|
2318 |
CMountCB* iMount; |
|
2319 |
TUint32 iFlags; |
|
2320 |
}; |
|
2321 |
||
2322 |
||
2323 |
class CFileSystemBody; |
|
2324 |
||
2325 |
/** |
|
2326 |
@publishedPartner |
|
2327 |
@released |
|
2328 |
||
2329 |
A file server interface class, representing the factory class for a file system. |
|
2330 |
||
2331 |
A plug-in file system implements this class. |
|
2332 |
||
2333 |
Creates objects derived from CMountCB, CFileCB, CDirCB and CFormatCB. |
|
2334 |
||
2335 |
@see CMountCB |
|
2336 |
@see CFileCB |
|
2337 |
@see CDirCB |
|
2338 |
@see CFormatCB |
|
2339 |
*/ |
|
2340 |
class CFileSystem : public CFsObject |
|
2341 |
{ |
|
2342 |
public: |
|
2343 |
IMPORT_C CFileSystem(); |
|
2344 |
IMPORT_C ~CFileSystem(); |
|
2345 |
IMPORT_C virtual TInt Remove(); |
|
2346 |
IMPORT_C virtual TBool QueryVersionSupported(const TVersion& aVer) const; |
|
2347 |
IMPORT_C virtual TBool IsExtensionSupported() const; |
|
2348 |
IMPORT_C TBool IsProxyDriveSupported(); |
|
2349 |
IMPORT_C void SetLibrary(RLibrary aLib); |
|
2350 |
IMPORT_C RLibrary Library() const; |
|
2351 |
// Pure virtual |
|
2352 |
||
2353 |
||
2354 |
/** |
|
2355 |
Installs the file system. |
|
2356 |
||
2357 |
The function should set the name of the file system object through a call |
|
2358 |
to CObject::SetName(), thus making it accessible, internally, |
|
2359 |
using FileSystems->FindByFullName(). This enables the file server |
|
2360 |
to find and handle installed file systems. |
|
2361 |
The function should also set the file system version. |
|
2362 |
The version is determined by the file system implementation. |
|
2363 |
It is used in calls to CFileSystem::QueryVersionSupported(). |
|
2364 |
||
2365 |
This function is called as a result of a call to RFs::AddFileSystem(). |
|
2366 |
||
2367 |
@return KErrNone if succesful; otherwise one of the other system-wide error |
|
2368 |
codes. |
|
2369 |
||
2370 |
@see RFs::AddFileSystem |
|
2371 |
@see CObject::SetName |
|
2372 |
@see RFs |
|
2373 |
@see CObject |
|
2374 |
*/ |
|
2375 |
virtual TInt Install() =0; |
|
2376 |
||
2377 |
||
2378 |
/** |
|
2379 |
Creates a new mount control block, a CMountCB derived object. |
|
2380 |
||
2381 |
On success, a pointer to the new mount object should be returned, |
|
2382 |
otherwise the function should leave. |
|
2383 |
||
2384 |
@return A pointer to the new mount object. |
|
2385 |
||
2386 |
@see CMountCB |
|
2387 |
*/ |
|
2388 |
virtual CMountCB* NewMountL() const =0; |
|
2389 |
||
2390 |
||
2391 |
/** |
|
2392 |
Creates a new file control block, i.e. a CFileCB derived object. |
|
2393 |
||
2394 |
On success, a pointer to the new file object should be returned, |
|
2395 |
otherwise the function should leave. |
|
2396 |
||
2397 |
@return A pointer to the new file object. |
|
2398 |
||
2399 |
@see CFileCB |
|
2400 |
*/ |
|
2401 |
virtual CFileCB* NewFileL() const =0; |
|
2402 |
||
2403 |
||
2404 |
/** |
|
2405 |
Creates a new directory control block, i.e. a CDirCB derived object. |
|
2406 |
||
2407 |
On success, a pointer to the new directory control block should be returned, |
|
2408 |
otherwise the function should leave. |
|
2409 |
||
2410 |
@return A pointer to the new directory object. |
|
2411 |
||
2412 |
@see CDirCB |
|
2413 |
*/ |
|
2414 |
virtual CDirCB* NewDirL() const =0; |
|
2415 |
||
2416 |
||
2417 |
/** |
|
2418 |
Creates a new volume format control block, i.e. a CFormatCB derived object. |
|
2419 |
||
2420 |
On success, a pointer to the new volume format control block should be returned, |
|
2421 |
otherwise the function should leave. |
|
2422 |
||
2423 |
@return A pointer to the new volume format object. |
|
2424 |
||
2425 |
@see CFormatCB |
|
2426 |
*/ |
|
2427 |
virtual CFormatCB* NewFormatL() const =0; |
|
2428 |
||
2429 |
||
2430 |
/** |
|
2431 |
Retrieves drive information. |
|
2432 |
||
2433 |
The function should set anInfo.iMediaAtt and anInfo.iType according to |
|
2434 |
the specified drive number. |
|
2435 |
||
33
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2436 |
Note that anInfo.iDriveAtt will already have been set by the calling |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2437 |
function. |
0 | 2438 |
|
2439 |
The function can obtain the necessary information by calling |
|
2440 |
the appropriate TBusLocalDrive::Caps() function using the argument aDriveNumber. |
|
2441 |
||
2442 |
@param anInfo On return, contains the drive information. |
|
2443 |
@param aDriveNumber The drive number. |
|
2444 |
*/ |
|
33
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2445 |
IMPORT_C virtual void DriveInfo(TDriveInfo& anInfo,TInt aDriveNumber) const; |
0 | 2446 |
|
2447 |
virtual TInt DefaultPath(TDes& aPath) const; |
|
2448 |
||
2449 |
/** Enumeration of the aInterfaceIDs used in GetInterface.*/ |
|
2450 |
enum TInterfaceIds |
|
2451 |
{ |
|
2452 |
EProxyDriveSupport = 0, |
|
2453 |
EExtendedFunctionality, ///< corresponds to MFileSystemExtInterface |
|
2454 |
}; |
|
2455 |
||
2456 |
/** This is interface corresponds to the extended CFileSystem functionality*/ |
|
2457 |
class MFileSystemExtInterface |
|
2458 |
{ |
|
2459 |
public: |
|
2460 |
virtual CMountCB* NewMountExL(TDrive* apDrive, CFileSystem** apFileSystem, TBool aForceMount, TUint32 aFsNameHash) = 0; |
|
2461 |
virtual TInt GetSupportedFileSystemName(TInt aFsNumber, TDes& aFsName) const = 0; |
|
2462 |
||
2463 |
}; |
|
2464 |
||
2465 |
public: |
|
2466 |
CMountCB* NewMountExL(TDrive* apDrive, CFileSystem** apFileSystem, TBool aForceMount, TUint32 aFsNameHash); |
|
2467 |
TInt GetSupportedFileSystemName(TInt aFsNumber, TDes& aFsName); |
|
2468 |
||
2469 |
||
2470 |
protected: |
|
2471 |
/** |
|
2472 |
Return a pointer to a specified interface extension - to allow future extension of this class without breaking |
|
2473 |
binary compatibility. |
|
2474 |
@param aInterfaceId Interface identifier of the interface to be retrieved. |
|
2475 |
@param aInterface A reference to a pointer that retrieves the specified interface. |
|
2476 |
@param aInput An arbitrary input argument. |
|
2477 |
@return KErrNone If the interface is supported, KErrNotSupported otherwise. |
|
2478 |
*/ |
|
2479 |
IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput); |
|
2480 |
||
2481 |
protected: |
|
2482 |
TVersion iVersion; |
|
2483 |
private: |
|
2484 |
RLibrary iLibrary; ///< *.fsy file system plugin dll handle |
|
2485 |
CFileSystemBody* iBody; ///< extension of this class, used to provide extended functionality w/o changing this class size (BC issue) |
|
2486 |
||
2487 |
friend class TDrive; |
|
2488 |
||
2489 |
}; |
|
2490 |
||
2491 |
||
2492 |
||
2493 |
||
2494 |
/** |
|
2495 |
@publishedPartner |
|
2496 |
@released |
|
2497 |
||
2498 |
Base abstract class. |
|
2499 |
Interface between a local plugin file system and a media subsystem. |
|
2500 |
||
2501 |
@see CLocalProxyDrive |
|
2502 |
@see CBaseExtProxyDrive |
|
2503 |
*/ |
|
2504 |
class CProxyDrive : public CBase |
|
2505 |
{ |
|
2506 |
public: |
|
2507 |
CProxyDrive(CMountCB* aMount); |
|
2508 |
~CProxyDrive(); |
|
2509 |
inline CMountCB* Mount() const; |
|
2510 |
inline void SetMount(CMountCB *aMount); |
|
2511 |
// virtual |
|
2512 |
IMPORT_C virtual TInt ControlIO(const RMessagePtr2& aMessage,TInt aCommand,TAny* aParam1,TAny* aParam2); |
|
2513 |
IMPORT_C virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt aOffset,TInt aFlags); |
|
2514 |
IMPORT_C virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt anOffset,TInt aFlags); |
|
2515 |
IMPORT_C virtual TInt DeleteNotify(TInt64 aPos, TInt aLength); |
|
2516 |
IMPORT_C virtual TInt GetLastErrorInfo(TDes8& aErrorInfo); |
|
2517 |
||
2518 |
inline TInt LocalBufferSupport(); |
|
2519 |
||
2520 |
// pure virtual |
|
2521 |
||
2522 |
/** |
|
2523 |
Initialise the proxy drive. |
|
2524 |
||
2525 |
Derived class must provide an implementation for it. |
|
2526 |
||
2527 |
@return KErrNone if successful, otherwise one of the system-wide error codes. |
|
2528 |
*/ |
|
2529 |
virtual TInt Initialise()=0; |
|
2530 |
||
2531 |
/** |
|
2532 |
It invokes Dismounted() on the proxy drive. |
|
2533 |
||
2534 |
Derived class must provide an implementation for it. |
|
2535 |
||
2536 |
@return KErrNone if successful, otherwise one of the system-wide error codes. |
|
2537 |
*/ |
|
2538 |
virtual TInt Dismounted()=0; |
|
2539 |
||
2540 |
/** |
|
2541 |
Increase the size of the proxy drive by the specified length (in bytes). |
|
2542 |
||
2543 |
Derived class must provide an implementation for it. |
|
2544 |
||
2545 |
@param aLength The length (in bytes) of which the drive is to be increased by. |
|
2546 |
||
2547 |
@return KErrNone if successful, otherwise one of the system-wide error codes. |
|
2548 |
*/ |
|
2549 |
virtual TInt Enlarge(TInt aLength)=0; |
|
2550 |
||
2551 |
/** |
|
2552 |
Reduce the size of the proxy drive by removing the specified length |
|
2553 |
(in bytes) starting at the specified position. |
|
2554 |
||
2555 |
Derived class must provide an implementation for it. |
|
2556 |
||
2557 |
@param aPos The start position of area to be removed. |
|
2558 |
@param aLength The length/size (in bytes) by which the drive is to be reduced. |
|
2559 |
||
2560 |
@return System-wide error codes based on the status of the operation. |
|
2561 |
*/ |
|
2562 |
virtual TInt ReduceSize(TInt aPos, TInt aLength)=0; |
|
2563 |
||
2564 |
/** |
|
2565 |
Read from the proxy drive. |
|
2566 |
||
2567 |
Derived class must provide an implementation for it. |
|
2568 |
||
2569 |
@param aPos The address from where the read begins. |
|
2570 |
@param aLength The length of the read. |
|
2571 |
@param aTrg A descriptor of the memory buffer from which to read. |
|
2572 |
@param aThreadHandle The handle-number representing the drive thread. |
|
2573 |
@param aOffset Offset into aTrg to read the data from. |
|
2574 |
||
2575 |
@return System-wide error codes based on the status of the operation. |
|
2576 |
*/ |
|
2577 |
virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt anOffset)=0; |
|
2578 |
||
2579 |
/** |
|
2580 |
Read from the proxy drive. |
|
2581 |
||
2582 |
Derived class must provide an implementation for it. |
|
2583 |
||
2584 |
@param aPos The address from where the read begins. |
|
2585 |
@param aLength The length of the read. |
|
2586 |
@param aTrg A descriptor of the memory buffer from which to read. |
|
2587 |
||
2588 |
@return System-wide error codes based on the status of the operation. |
|
2589 |
*/ |
|
2590 |
virtual TInt Read(TInt64 aPos,TInt aLength,TDes8& aTrg)=0; |
|
2591 |
||
2592 |
/** |
|
2593 |
Write to the proxy drive. |
|
2594 |
||
2595 |
Derived class must provide an implementation for it. |
|
2596 |
||
2597 |
@param aPos The address from where the write begins. |
|
2598 |
@param aLength The length of the write. |
|
2599 |
@param aSrc A descriptor of the memory buffer from which to write. |
|
2600 |
@param aThreadHandle The handle-number representing the drive thread. |
|
2601 |
@param aOffset Offset into aSrc to write the data to. |
|
2602 |
||
2603 |
@return System-wide error codes based on the status of the operation. |
|
2604 |
*/ |
|
2605 |
virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt anOffset)=0; |
|
2606 |
||
2607 |
/** |
|
2608 |
Write to the proxy drive. |
|
2609 |
||
2610 |
Derived class must provide an implementation for it. |
|
2611 |
||
2612 |
@param aPos The address from where the write begins. |
|
2613 |
@param aSrc A descriptor of the memory buffer from which to write. |
|
2614 |
||
2615 |
@return System-wide error codes based on the status of the operation. |
|
2616 |
*/ |
|
2617 |
virtual TInt Write(TInt64 aPos,const TDesC8& aSrc)=0; |
|
2618 |
||
2619 |
/** |
|
2620 |
Get the proxy drive's capabilities information. |
|
2621 |
||
2622 |
Derived class must provide an implementation for it. |
|
2623 |
||
2624 |
@param anInfo A descriptor of the connected drives capabilities. |
|
2625 |
||
2626 |
@return System-wide error codes based on the status of the operation. |
|
2627 |
*/ |
|
2628 |
virtual TInt Caps(TDes8& anInfo)=0; |
|
2629 |
||
2630 |
/** |
|
2631 |
Format the connected drive. |
|
2632 |
||
2633 |
Derived class must provide an implementation for it. |
|
2634 |
||
2635 |
@param anInfo Device specific format information. |
|
2636 |
||
2637 |
@return System-wide error codes based on the status of the operation. |
|
2638 |
*/ |
|
2639 |
virtual TInt Format(TFormatInfo& anInfo)=0; |
|
2640 |
||
2641 |
/** |
|
2642 |
Format the proxy drive. |
|
2643 |
||
2644 |
Derived class must provide an implementation for it. |
|
2645 |
||
2646 |
@param aPos The position of the data which is being formatted. |
|
2647 |
@param aLength The length of the data which is being formatted. |
|
2648 |
||
2649 |
@return System-wide error codes based on the status of the operation. |
|
2650 |
*/ |
|
2651 |
virtual TInt Format(TInt64 aPos,TInt aLength)=0; |
|
2652 |
||
2653 |
/** |
|
2654 |
Set the mount information on the proxy drive. |
|
2655 |
||
2656 |
Derived class must provide an implementation for it. |
|
2657 |
||
2658 |
@param aMountInfo Information passed down to the media driver. |
|
2659 |
The meaning of this information depends on the media driver. |
|
2660 |
@param aMountInfoThreadHandle Message thread handle number. |
|
2661 |
||
2662 |
@return System-wide error codes based on the status of the operation. |
|
2663 |
*/ |
|
2664 |
virtual TInt SetMountInfo(const TDesC8* aMountInfo,TInt aMountInfoThreadHandle=KCurrentThreadHandle)=0; |
|
2665 |
||
2666 |
/** |
|
2667 |
Forces a remount on the proxy drive |
|
2668 |
||
2669 |
Derived class must provide an implementation for it. |
|
2670 |
||
2671 |
@param aFlags Flags to be passed into the driver. |
|
2672 |
||
2673 |
@return System-wide error codes based on the status of the operation. |
|
2674 |
*/ |
|
2675 |
virtual TInt ForceRemount(TUint aFlags=0)=0; |
|
2676 |
||
2677 |
/** |
|
2678 |
Unlocks a password-enabled proxy drive. |
|
2679 |
||
2680 |
Derived class must provide an implementation for it. |
|
2681 |
||
2682 |
@param aPassword A descriptor containing the existing password. |
|
2683 |
@param aStorePassword If ETrue, the password is added to the password store. |
|
2684 |
||
2685 |
@return System-wide error codes based on the status of the operation. |
|
2686 |
*/ |
|
2687 |
virtual TInt Unlock(TMediaPassword &aPassword, TBool aStorePassword)=0; |
|
2688 |
||
2689 |
/** |
|
2690 |
Locks a password-enabled proxy drive with the new password. |
|
2691 |
||
2692 |
Derived class must provide an implementation for it. |
|
2693 |
||
2694 |
@param aOldPassword A descriptor containing the existing password. |
|
2695 |
@param aNewPassword A descriptor containing the new password. |
|
2696 |
@param aStorePassword If ETrue, the password is added to the password store. |
|
2697 |
||
2698 |
@return System-wide error codes based on the status of the operation. |
|
2699 |
*/ |
|
2700 |
virtual TInt Lock(TMediaPassword &aOldPassword, TMediaPassword &aNewPassword, TBool aStorePassword)=0; |
|
2701 |
||
2702 |
/** |
|
2703 |
Clears a password from a proxy drive - controller sets password to null. |
|
2704 |
||
2705 |
Derived class must provide an implementation for it. |
|
2706 |
||
2707 |
@param aPassword A descriptor containing the password. |
|
2708 |
||
2709 |
@return System-wide error codes based on the status of the operation. |
|
2710 |
*/ |
|
2711 |
virtual TInt Clear(TMediaPassword &aPassword)=0; |
|
2712 |
||
2713 |
/** |
|
2714 |
Forcibly unlock a password-enabled proxy drive. |
|
2715 |
||
2716 |
Derived class must provide an implementation for it. |
|
2717 |
||
2718 |
@return System-wide error codes based on the status of the operation. |
|
2719 |
*/ |
|
2720 |
virtual TInt ErasePassword()=0; |
|
2721 |
||
2722 |
// implementation using GetInterface(..) |
|
2723 |
enum TInterfaceIds |
|
2724 |
{ |
|
2725 |
EGetLocalDrive, |
|
2726 |
ELocalBufferSupport, |
|
2727 |
EGetProxyDrive, |
|
2728 |
EFinalised, |
|
2729 |
}; |
|
2730 |
||
2731 |
/** |
|
2732 |
Retrieves TBusLocalDrive object associated with the file. |
|
2733 |
||
2734 |
@return System-wide error codes based on the status of the operation. |
|
2735 |
*/ |
|
2736 |
IMPORT_C TInt GetLocalDrive(TBusLocalDrive*& aLocDrv); |
|
2737 |
||
2738 |
/** |
|
2739 |
Informs the extension that the mount has been finalised and is in a consistent state. |
|
2740 |
||
2741 |
@return System-wide error codes based on the status of the operation. |
|
2742 |
||
2743 |
@internalTechnology |
|
2744 |
*/ |
|
2745 |
IMPORT_C TInt Finalise(TBool aFinalised); |
|
2746 |
||
2747 |
protected: |
|
2748 |
/** |
|
2749 |
Return a pointer to a specified interface extension - to allow future extension of this class without breaking |
|
2750 |
binary compatibility. |
|
2751 |
||
2752 |
@param aInterfaceId Interface identifier of the interface to be retrieved. |
|
2753 |
@param aInterface A reference to a pointer that retrieves the specified interface. |
|
2754 |
@param aInput An arbitrary input argument. |
|
2755 |
||
2756 |
@return KErrNone If the interface is supported, KErrNotSupported otherwise. |
|
2757 |
*/ |
|
2758 |
IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput); |
|
2759 |
||
2760 |
private: |
|
2761 |
CMountCB* iMount; |
|
2762 |
TUint32 iReserved; // Reserved for future expansion |
|
2763 |
}; |
|
2764 |
||
2765 |
||
2766 |
||
2767 |
||
2768 |
/** |
|
2769 |
@publishedPartner |
|
2770 |
@released |
|
2771 |
||
2772 |
Local drive specific mount control block. |
|
2773 |
*/ |
|
2774 |
class CLocDrvMountCB : public CMountCB |
|
2775 |
{ |
|
2776 |
public: |
|
2777 |
IMPORT_C CLocDrvMountCB(); |
|
2778 |
IMPORT_C ~CLocDrvMountCB(); |
|
2779 |
IMPORT_C TInt CreateLocalDrive(TBusLocalDrive& aLocDrv); |
|
2780 |
IMPORT_C TInt CreateDrive(TInt aDriveNumber); |
|
2781 |
IMPORT_C TInt InitLocalDrive(); |
|
2782 |
IMPORT_C void DismountedLocalDrive(); |
|
2783 |
inline CProxyDrive* LocalDrive() const; |
|
2784 |
||
2785 |
private: |
|
2786 |
CProxyDrive* iProxyDrive; |
|
2787 |
}; |
|
2788 |
||
2789 |
||
2790 |
||
2791 |
||
2792 |
||
2793 |
/** |
|
2794 |
@publishedPartner |
|
2795 |
@released |
|
2796 |
||
2797 |
Local drive specific proxy drive interface. |
|
2798 |
Class passes commands directly to TBusLocalDrive. |
|
2799 |
||
2800 |
@see CProxyDrive |
|
2801 |
*/ |
|
2802 |
NONSHARABLE_CLASS(CLocalProxyDrive) : public CProxyDrive |
|
2803 |
{ |
|
2804 |
public: |
|
2805 |
static CLocalProxyDrive* New(CMountCB* aMount,TBusLocalDrive& aLocDrv); |
|
2806 |
// virtual |
|
2807 |
virtual TInt Initialise(); |
|
2808 |
virtual TInt Dismounted(); |
|
2809 |
virtual TInt Enlarge(TInt aLength); |
|
2810 |
virtual TInt ReduceSize(TInt aPos, TInt aLength); |
|
2811 |
virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt aOffset, TInt aFlags); |
|
2812 |
virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt anOffset); |
|
2813 |
virtual TInt Read(TInt64 aPos,TInt aLength,TDes8& aTrg); |
|
2814 |
virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt aOffset,TInt aFlags); |
|
2815 |
virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt anOffset); |
|
2816 |
virtual TInt Write(TInt64 aPos,const TDesC8& aSrc); |
|
2817 |
virtual TInt Caps(TDes8& anInfo); |
|
2818 |
virtual TInt Format(TFormatInfo& anInfo); |
|
2819 |
virtual TInt Format(TInt64 aPos,TInt aLength); |
|
2820 |
virtual TInt SetMountInfo(const TDesC8* aMountInfo,TInt aMountInfoThreadHandle=KCurrentThreadHandle); |
|
2821 |
virtual TInt ForceRemount(TUint aFlags=0); |
|
2822 |
virtual TInt ControlIO(const RMessagePtr2& aMessage,TInt aCommand,TAny* aParam1,TAny* aParam2); |
|
2823 |
virtual TInt Unlock(TMediaPassword &aPassword, TBool aStorePassword); |
|
2824 |
virtual TInt Lock(TMediaPassword &aOldPassword, TMediaPassword &aNewPassword, TBool aStorePassword); |
|
2825 |
virtual TInt Clear(TMediaPassword &aPassword); |
|
2826 |
virtual TInt ErasePassword(); |
|
2827 |
virtual TInt DeleteNotify(TInt64 aPos, TInt aLength); |
|
2828 |
virtual TInt GetLastErrorInfo(TDes8& aErrorInfo); |
|
2829 |
protected: |
|
2830 |
virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput); |
|
2831 |
private: |
|
2832 |
CLocalProxyDrive(CMountCB* aMount,TBusLocalDrive& aLocDrv); |
|
2833 |
private: |
|
2834 |
TBusLocalDrive& iLocDrv; |
|
2835 |
}; |
|
2836 |
||
2837 |
||
2838 |
||
2839 |
||
2840 |
/** |
|
2841 |
@publishedPartner |
|
2842 |
@released |
|
2843 |
||
2844 |
Media subsystem extensions must be derived from this specific class interface. |
|
2845 |
Objects of this type should be created through use of a derived CProxyDriveFactory class. |
|
2846 |
||
2847 |
Class passes commands directly to CProxyDrive. |
|
2848 |
||
2849 |
@see CProxyDrive |
|
2850 |
@see CProxyDriveFactory |
|
2851 |
*/ |
|
2852 |
class CBaseExtProxyDrive : public CProxyDrive |
|
2853 |
{ |
|
2854 |
public: |
|
2855 |
IMPORT_C CBaseExtProxyDrive(CProxyDrive* aProxyDrive, CMountCB* aMount); |
|
2856 |
IMPORT_C ~CBaseExtProxyDrive(); |
|
2857 |
IMPORT_C virtual TInt Initialise(); |
|
2858 |
IMPORT_C virtual TInt Dismounted(); |
|
2859 |
IMPORT_C virtual TInt Enlarge(TInt aLength); |
|
2860 |
IMPORT_C virtual TInt ReduceSize(TInt aPos, TInt aLength); |
|
2861 |
IMPORT_C virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt aOffset,TInt aFlags); |
|
2862 |
IMPORT_C virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt anOffset); |
|
2863 |
IMPORT_C virtual TInt Read(TInt64 aPos,TInt aLength,TDes8& aTrg); |
|
2864 |
IMPORT_C virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt aOffset,TInt aFlags); |
|
2865 |
IMPORT_C virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt anOffset); |
|
2866 |
IMPORT_C virtual TInt Write(TInt64 aPos,const TDesC8& aSrc); |
|
2867 |
IMPORT_C virtual TInt Caps(TDes8& anInfo); |
|
2868 |
IMPORT_C virtual TInt Format(TFormatInfo& anInfo); |
|
2869 |
IMPORT_C virtual TInt Format(TInt64 aPos,TInt aLength); |
|
2870 |
IMPORT_C virtual TInt SetMountInfo(const TDesC8* aMountInfo,TInt aMountInfoThreadHandle=KCurrentThreadHandle); |
|
2871 |
IMPORT_C virtual TInt ForceRemount(TUint aFlags=0); |
|
2872 |
IMPORT_C virtual TInt Unlock(TMediaPassword &aPassword, TBool aStorePassword); |
|
2873 |
IMPORT_C virtual TInt Lock(TMediaPassword &aOldPassword, TMediaPassword &aNewPassword, TBool aStorePassword); |
|
2874 |
IMPORT_C virtual TInt Clear(TMediaPassword &aPassword); |
|
2875 |
IMPORT_C virtual TInt ControlIO(const RMessagePtr2& aMessage,TInt aCommand,TAny* aParam1,TAny* aParam2); |
|
2876 |
IMPORT_C virtual TInt ErasePassword(); |
|
2877 |
IMPORT_C virtual TInt GetLastErrorInfo(TDes8& aErrorInfo); |
|
2878 |
IMPORT_C virtual TInt DeleteNotify(TInt64 aPos, TInt aLength); |
|
2879 |
inline TInt LocalBufferSupport(); |
|
2880 |
||
2881 |
protected: |
|
2882 |
/** |
|
2883 |
Return a pointer to a specified interface extension - to allow future extension of this class without breaking |
|
2884 |
binary compatibility. |
|
2885 |
@param aInterfaceId Interface identifier of the interface to be retrieved. |
|
2886 |
@param aInterface A reference to a pointer that retrieves the specified interface. |
|
2887 |
@param aInput An arbitrary input argument. |
|
2888 |
@return KErrNone If the interface is supported, KErrNotSupported otherwise. |
|
2889 |
*/ |
|
2890 |
IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput); |
|
2891 |
private: |
|
2892 |
CProxyDrive* iProxy; |
|
2893 |
}; |
|
2894 |
||
2895 |
||
2896 |
||
2897 |
||
2898 |
/** |
|
2899 |
@publishedPartner |
|
2900 |
@released |
|
2901 |
||
2902 |
Abstract base class for Proxy drive factory classes. |
|
2903 |
||
2904 |
Class is used for the creation of media subsystem extensions CBaseExtProxyDrive. |
|
2905 |
||
2906 |
@see CBaseExtProxyDrive |
|
2907 |
*/ |
|
2908 |
class CProxyDriveFactory : public CFsObject |
|
2909 |
{ |
|
2910 |
public: |
|
2911 |
IMPORT_C CProxyDriveFactory(); |
|
2912 |
IMPORT_C virtual TInt Remove(); |
|
2913 |
inline void SetLibrary(RLibrary aLib); |
|
2914 |
inline RLibrary Library() const; |
|
2915 |
||
2916 |
/** |
|
2917 |
Installation of the factory object. |
|
2918 |
@return system wide error code |
|
2919 |
*/ |
|
2920 |
virtual TInt Install() =0; |
|
2921 |
/** |
|
2922 |
Instantiates a CProxyDrive object. |
|
2923 |
@param aProxy Proxy drive to be used. |
|
2924 |
@param aMount Mount control block. |
|
2925 |
||
2926 |
@return pointer to Instantiated CProxyDrive object. |
|
2927 |
*/ |
|
2928 |
virtual CProxyDrive* NewProxyDriveL(CProxyDrive* aProxy,CMountCB* aMount)=0; |
|
2929 |
private: |
|
2930 |
RLibrary iLibrary; |
|
2931 |
}; |
|
2932 |
||
2933 |
||
2934 |
||
2935 |
/** |
|
2936 |
@internalTechnology |
|
2937 |
*/ |
|
2938 |
class CExtProxyDriveFactory : public CFsObject |
|
2939 |
{ |
|
2940 |
public: |
|
2941 |
IMPORT_C CExtProxyDriveFactory(); |
|
2942 |
IMPORT_C virtual TInt Remove(); |
|
2943 |
inline void SetLibrary(RLibrary aLib); |
|
2944 |
inline RLibrary Library() const; |
|
2945 |
// pure virtual |
|
2946 |
virtual TInt Install() =0; |
|
2947 |
virtual TInt CreateProxyDrive(CProxyDrive*& aMountProxyDrive, CMountCB* aMount)=0; |
|
2948 |
||
2949 |
IMPORT_C virtual void AsyncEnumerate(); |
|
2950 |
||
2951 |
private: |
|
2952 |
RLibrary iLibrary; |
|
2953 |
}; |
|
2954 |
||
2955 |
||
2956 |
/** |
|
2957 |
@internalTechnology |
|
2958 |
*/ |
|
2959 |
class CExtProxyDrive : public CProxyDrive |
|
2960 |
{ |
|
2961 |
public: |
|
2962 |
IMPORT_C CExtProxyDrive(CMountCB* aMount,CExtProxyDriveFactory* aDevice); |
|
2963 |
IMPORT_C ~CExtProxyDrive(); |
|
2964 |
||
2965 |
IMPORT_C virtual TInt NotifyChange(TDes8 &aChanged, TRequestStatus* aStatus); |
|
2966 |
IMPORT_C virtual void NotifyChangeCancel(); |
|
2967 |
IMPORT_C virtual TInt SetInfo(const RMessage2 &msg, TAny* aMessageParam2, TAny* aMessageParam3); |
|
2968 |
||
2969 |
inline TInt DriveNumber(); |
|
2970 |
inline void SetDriveNumber(TInt aDrive); |
|
2971 |
inline CExtProxyDriveFactory* FactoryP(); |
|
2972 |
||
2973 |
protected: |
|
2974 |
/** |
|
2975 |
Return a pointer to a specified interface extension - to allow future extension of this class without breaking |
|
2976 |
binary compatibility. |
|
2977 |
@param aInterfaceId Interface identifier of the interface to be retrieved. |
|
2978 |
@param aInterface A reference to a pointer that retrieves the specified interface. |
|
2979 |
@param aInput An arbitrary input argument. |
|
2980 |
@return KErrNone If the interface is supported, KErrNotSupported otherwise. |
|
2981 |
*/ |
|
2982 |
IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput); |
|
2983 |
||
2984 |
TInt SetupMediaChange(); |
|
2985 |
||
2986 |
protected: |
|
2987 |
CExtProxyDriveFactory* iFactory; |
|
2988 |
TInt iDriveNumber; |
|
2989 |
||
2990 |
private: |
|
2991 |
CExtNotifyMediaChange* iMediaChangeNotifier; |
|
2992 |
||
2993 |
TUint32 iReserved[4]; // Reserved bytes for future expansion |
|
2994 |
||
2995 |
friend class LocalDrives; |
|
2996 |
}; |
|
2997 |
||
2998 |
||
2999 |
/** |
|
3000 |
@internalTechnology |
|
3001 |
*/ |
|
3002 |
NONSHARABLE_CLASS(CExtNotifyMediaChange) : public CActive |
|
3003 |
{ |
|
3004 |
public: |
|
3005 |
static CExtNotifyMediaChange* NewL(CExtProxyDrive* aDrive); |
|
3006 |
~CExtNotifyMediaChange(); |
|
3007 |
void RequestL(); |
|
3008 |
||
3009 |
private: |
|
3010 |
CExtNotifyMediaChange(CExtProxyDrive* aDrive); |
|
3011 |
void ConstructL(); |
|
3012 |
||
3013 |
void DoCancel(); |
|
3014 |
void RunL(); |
|
3015 |
||
3016 |
private: |
|
3017 |
CExtProxyDrive* iDrive; |
|
3018 |
TPtr8 iPtr; |
|
3019 |
}; |
|
3020 |
||
3021 |
/** |
|
3022 |
@publishedPartner |
|
3023 |
@released |
|
3024 |
||
3025 |
Gets the local bus drive. |
|
3026 |
||
3027 |
@param aLocalDrive The local drive number. |
|
3028 |
||
3029 |
@return The local bus drive. |
|
3030 |
*/ |
|
3031 |
IMPORT_C TBusLocalDrive& GetLocalDrive(TInt aLocalDrive); |
|
3032 |
||
3033 |
/** |
|
3034 |
@internalTechnology |
|
3035 |
||
3036 |
Gets the proxy drive device for a given drive |
|
3037 |
||
3038 |
@param aLocalDrive The local drive number. |
|
3039 |
||
3040 |
@return The local bus drive. |
|
3041 |
*/ |
|
3042 |
IMPORT_C CExtProxyDrive* GetProxyDrive(TInt aDrive); |
|
3043 |
||
3044 |
/** |
|
3045 |
@internalTechnology |
|
3046 |
||
3047 |
Gets the proxy drive for a given drive |
|
3048 |
||
3049 |
@param aLocalDrive The local drive number. |
|
3050 |
||
3051 |
@return The proxy drive |
|
3052 |
*/ |
|
3053 |
IMPORT_C TInt GetProxyDrive(TInt aDrive, CProxyDrive*& aProxyDrive); |
|
3054 |
||
3055 |
/** |
|
3056 |
@internalTechnology |
|
3057 |
||
3058 |
Return ETrue if drive is actually a proxy instead of a local drive |
|
3059 |
||
3060 |
@param The drive number. |
|
3061 |
||
3062 |
@return ETrue if drive is actually a proxy instead of a local drive |
|
3063 |
*/ |
|
3064 |
IMPORT_C TBool IsProxyDrive(TInt aDrive); |
|
3065 |
||
3066 |
/** |
|
3067 |
@publishedPartner |
|
3068 |
@released |
|
3069 |
||
3070 |
Checks a given drive number is mapped to a local drive. |
|
3071 |
||
3072 |
@param aDrive The local drive number. |
|
3073 |
||
3074 |
@return specified drive number is mapped to a local drive. |
|
3075 |
*/ |
|
3076 |
IMPORT_C TBool IsValidLocalDriveMapping(TInt aDrive); |
|
3077 |
||
33
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3078 |
/** |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3079 |
@internalTechnology |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3080 |
|
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3081 |
Sets the media attributes and type in the anInfo parameter to those of the |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3082 |
specified drive. |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3083 |
|
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3084 |
@param anInfo TDriveInfo object to store the drive information. |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3085 |
@param aDriveNumber The number of the drive to get the information from. |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3086 |
*/ |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3087 |
IMPORT_C void GetDriveInfo(TDriveInfo& anInfo,TInt aDriveNumber); |
0 | 3088 |
|
3089 |
/** |
|
3090 |
@publishedPartner |
|
3091 |
@released |
|
3092 |
||
3093 |
Returns the local drive number for a given drive number. |
|
3094 |
||
3095 |
@param aDrive The drive number. |
|
3096 |
||
3097 |
@return KDriveInvalid if drive is not mapped to a local drive. |
|
3098 |
otherwise the local drive number. |
|
3099 |
*/ |
|
3100 |
IMPORT_C TInt DriveNumberToLocalDriveNumber(TInt aDrive); |
|
3101 |
||
3102 |
/** |
|
3103 |
*/ |
|
3104 |
IMPORT_C TInt GetLocalDriveNumber(TBusLocalDrive* aLocDrv); |
|
3105 |
||
3106 |
||
3107 |
/** |
|
3108 |
@internalTechnology |
|
3109 |
*/ |
|
3110 |
struct TFatUtilityFunctions; |
|
3111 |
||
3112 |
/** |
|
3113 |
Representation of FAT Utility Functions as provided by a Code Page DLL. |
|
3114 |
These functions are to be implemented by Code Page-DLLs. |
|
3115 |
@internaltechnology |
|
3116 |
*/ |
|
3117 |
||
3118 |
struct TCodePageFunctions |
|
3119 |
{ |
|
3120 |
typedef TBool (*TConvertFromUnicode)(TDes8& aForeign, const TDesC16& aUnicode, const TDesC8& aReplacementForUnconvertibleCharacter); |
|
3121 |
typedef TInt (*TConvertFromUnicodeL)(TDes8& aForeign, const TDesC16& aUnicode, TBool leaveWhenOverflow); |
|
3122 |
typedef TBool (*TConvertToUnicode)(TDes16& aUnicode, const TDesC8& aForeign); |
|
3123 |
typedef TInt (*TConvertToUnicodeL)(TDes16& aUnicode, const TDesC8& aForeign, TBool leaveWhenOverflow); |
|
3124 |
typedef TBool (*TIsLegalShortNameCharacter)(TUint aCharacter); |
|
3125 |
||
3126 |
TConvertFromUnicode iConvertFromUnicode; |
|
3127 |
TConvertFromUnicodeL iConvertFromUnicodeL; |
|
3128 |
TConvertToUnicode iConvertToUnicode; |
|
3129 |
TConvertToUnicodeL iConvertToUnicodeL; |
|
3130 |
TIsLegalShortNameCharacter iIsLegalShortNameCharacter; |
|
3131 |
}; |
|
3132 |
||
3133 |
/** |
|
3134 |
A utility class for Codepage Dll. Controls overflow action. Provides current status of |
|
3135 |
Locale/codepage dll loaded. Provides conversions functions to be used by Codepage Dlls. |
|
3136 |
||
3137 |
@internaltechnology |
|
3138 |
*/ |
|
3139 |
class TCodePageUtils |
|
3140 |
{ |
|
3141 |
public: |
|
3142 |
||
3143 |
/** |
|
3144 |
Determines the Overflow action in case of if overflow occurs. |
|
3145 |
*/ |
|
3146 |
enum TOverflowAction |
|
3147 |
{ |
|
3148 |
/** |
|
3149 |
Will leave if an overflow occurs. |
|
3150 |
*/ |
|
3151 |
EOverflowActionLeave, |
|
3152 |
/** |
|
3153 |
Will truncate the data if an overflow occurs. |
|
3154 |
*/ |
|
3155 |
EOverflowActionTruncate |
|
3156 |
}; |
|
3157 |
||
3158 |
/** |
|
3159 |
Determines the current status of Locale dll / Codepage dll. |
|
3160 |
*/ |
|
3161 |
enum TCodepageLoaded |
|
3162 |
{ |
|
3163 |
/** |
|
3164 |
No Locale Dll or Codepage Dll is loaded. |
|
3165 |
*/ |
|
3166 |
ENone = 0, |
|
3167 |
/** |
|
3168 |
Locale Dll is loaded. |
|
3169 |
*/ |
|
3170 |
ELocaleDll, |
|
3171 |
/** |
|
3172 |
Codepage Dll is loaded. |
|
3173 |
*/ |
|
3174 |
ECodePageDll |
|
3175 |
}; |
|
3176 |
public: |
|
3177 |
||
3178 |
/** |
|
3179 |
Convert from Unicode, truncating if there is not enough room in the output. |
|
3180 |
||
3181 |
@param aForeign The output is appended here. |
|
3182 |
@param aUnicode The input. |
|
3183 |
||
3184 |
@return False if and only if aForeign has not enough space remaining. |
|
3185 |
*/ |
|
3186 |
TBool ConvertFromUnicode(TDes8& aForeign, const TDesC16& aUnicode, TOverflowAction aOverflowAction) const; |
|
3187 |
||
3188 |
/** |
|
3189 |
Convert from Unicode, truncating if there is not enough room in the output. |
|
3190 |
||
3191 |
@param aForeign The output is appended here. |
|
3192 |
@param aUnicode The input. |
|
3193 |
||
3194 |
@leave KErrOverflow if aForeign is too short for the output. |
|
3195 |
*/ |
|
3196 |
IMPORT_C void ConvertFromUnicodeL(TDes8& aForeign, const TDesC16& aUnicode, TOverflowAction aOverflowAction=EOverflowActionLeave) const; |
|
3197 |
||
3198 |
/* |
|
3199 |
Convert to Unicode, truncating if there is not enough room in the output. |
|
3200 |
||
3201 |
@param aUnicode The output is appended here. |
|
3202 |
@param aForeign The input. |
|
3203 |
||
3204 |
@return False if and only if aUnicode has not enough space remaining. |
|
3205 |
*/ |
|
3206 |
TBool ConvertToUnicode(TDes16& aUnicode, const TDesC8& aForeign ) const; |
|
3207 |
||
3208 |
/* |
|
3209 |
Convert to Unicode, leaving if there is not enough room in the output. |
|
3210 |
||
3211 |
@param aUnicode The output is appended here. |
|
3212 |
@param aForeign The input. |
|
3213 |
||
3214 |
@leave KErrOverflow if aUnicode is too short for the output. |
|
3215 |
*/ |
|
3216 |
IMPORT_C void ConvertToUnicodeL(TDes16& aUnicode, const TDesC8& aForeign, TOverflowAction aOverflowAction=EOverflowActionLeave) const; |
|
3217 |
||
3218 |
/** |
|
3219 |
Returns true if the input character is legal in a short name. |
|
3220 |
||
3221 |
@param aCharacter Character, in the foreign character encoding. |
|
3222 |
||
3223 |
@return true if aCharacter is legal in a FAT short name. |
|
3224 |
*/ |
|
3225 |
IMPORT_C TBool IsLegalShortNameCharacter(TUint aCharacter,TBool aUseExtendedChars=EFalse) const; |
|
3226 |
||
3227 |
public: |
|
3228 |
||
3229 |
/** |
|
3230 |
Constructor for TCodePageUtils. |
|
3231 |
*/ |
|
3232 |
TCodePageUtils(); |
|
3233 |
||
3234 |
/** |
|
3235 |
Returns whether a Codepage dll is loaded. |
|
3236 |
||
3237 |
@return True if Codepage dll is loaded. |
|
3238 |
False otherwise |
|
3239 |
*/ |
|
3240 |
TBool IsCodepageLoaded() const; |
|
3241 |
||
3242 |
/** |
|
3243 |
Returns the type of active codepage. |
|
3244 |
@return ENone if no dll is loaded |
|
3245 |
ELocaleDll if Locale Dll is loaded |
|
3246 |
ECodepageDll if Codepage Dll is loaded |
|
3247 |
*/ |
|
3248 |
TCodepageLoaded CodepageLoaded() const; |
|
3249 |
||
3250 |
/** |
|
3251 |
Sets the current codepage to that provided by the current Locale DLL. |
|
3252 |
||
3253 |
@param aFunctions Pointer to FAT conversion functions to be used. |
|
3254 |
||
3255 |
@return None |
|
3256 |
*/ |
|
3257 |
void SetLocaleCodePage(TFatUtilityFunctions* aFunctions); |
|
3258 |
||
3259 |
/** |
|
3260 |
Gets the function pointer to the read Locale conversions functions. |
|
3261 |
||
3262 |
@return function pointer to the read Locale conversions functions. |
|
3263 |
*/ |
|
3264 |
TFatUtilityFunctions* LocaleFatUtilityFunctions() const; |
|
3265 |
||
3266 |
/** |
|
3267 |
Gets structure to function pointers to the read Codepage conversions functions. |
|
3268 |
||
3269 |
@return structure to function pointers to the read Codepage conversions functions. |
|
3270 |
*/ |
|
3271 |
TCodePageFunctions CodepageFatUtilityFunctions() const; |
|
3272 |
||
3273 |
private: |
|
3274 |
||
3275 |
/** |
|
3276 |
Structure to function pointers to the read Codepage conversions functions. |
|
3277 |
*/ |
|
3278 |
TCodePageFunctions iCodePageFunctions; |
|
3279 |
||
3280 |
/** |
|
3281 |
Function pointer to the read Locale conversions functions. |
|
3282 |
*/ |
|
3283 |
TFatUtilityFunctions* iLocaleFatUtilityFunctions; |
|
3284 |
||
3285 |
/** |
|
3286 |
Variable to hold the active codepage type. |
|
3287 |
*/ |
|
3288 |
TCodepageLoaded iCodepageLoaded; |
|
3289 |
||
3290 |
friend class TFsLoadCodePage; |
|
3291 |
}; |
|
3292 |
||
3293 |
/** |
|
3294 |
@internaltechnology |
|
3295 |
||
3296 |
Gets the pointer to the current FAT conversions functions. |
|
3297 |
||
3298 |
@return Pointer to the current FAT conversions functions. |
|
3299 |
*/ |
|
3300 |
IMPORT_C const TFatUtilityFunctions* GetFatUtilityFunctions(); |
|
3301 |
||
3302 |
/** |
|
3303 |
@internaltechnology |
|
3304 |
||
3305 |
Gets the instance of TCodePageUtils class. |
|
3306 |
||
3307 |
@return Instance of TCodePageUtils class. |
|
3308 |
*/ |
|
3309 |
IMPORT_C const TCodePageUtils& GetCodePage(); |
|
3310 |
||
3311 |
||
3312 |
||
3313 |
/** |
|
3314 |
@publishedPartner |
|
3315 |
@released |
|
3316 |
||
3317 |
Copies data to a buffer. |
|
3318 |
||
3319 |
If necessary, the buffer, a heap descriptor, is allocated or re-allocated |
|
3320 |
before copying takes place. |
|
3321 |
||
3322 |
@param aBuf A reference to a pointer to heap descriptor forming the buffer. |
|
3323 |
This will be allocated if it does not already exist, |
|
3324 |
or re-allocated if the existing buffer is not large enough. |
|
3325 |
@param aDes The data to be copied. |
|
3326 |
*/ |
|
3327 |
IMPORT_C void AllocBufferL(HBufC*& aBuf,const TDesC& aDes); |
|
3328 |
||
3329 |
||
3330 |
||
3331 |
||
3332 |
||
3333 |
/** |
|
3334 |
@publishedPartner |
|
3335 |
@released |
|
3336 |
||
3337 |
Notifies sessions of a debug event if aFunction has the KDebugNotifyMask set. |
|
3338 |
||
3339 |
This function can only be used in debug builds or if _DEBUG |
|
3340 |
or _DEBUG_RELEASE is defined. |
|
3341 |
||
3342 |
@param aFunction A function. |
|
3343 |
@param aDrive A drive. |
|
3344 |
*/ |
|
3345 |
IMPORT_C void DebugNotifySessions(TInt aFunction,TInt aDrive); |
|
3346 |
||
3347 |
||
3348 |
||
3349 |
||
3350 |
/** |
|
3351 |
@publishedPartner |
|
3352 |
@released |
|
3353 |
||
3354 |
Writes data from a buffer to a file. |
|
3355 |
||
3356 |
Called by the mount control block lock and the unlock functions. |
|
3357 |
||
3358 |
@param aFileName The file to be written to. |
|
3359 |
@param aBuf The data to be written. |
|
3360 |
*/ |
|
3361 |
IMPORT_C void WriteToDisk(const TDesC& aFileName,const TDesC8& aBuf); |
|
3362 |
||
3363 |
||
3364 |
||
3365 |
||
3366 |
/** |
|
3367 |
Create a proxy drive using the local proxy drive passed in |
|
3368 |
and any extensions that have been added to the drive. |
|
3369 |
||
3370 |
@param aConcreteDrive local proxy drive |
|
3371 |
@param aMount local proxy drive mount control block |
|
3372 |
||
3373 |
@return pointer to instantiated CProxyDrive object. |
|
3374 |
*/ |
|
3375 |
IMPORT_C CProxyDrive* CreateProxyDriveL(CProxyDrive* aConcreteDrive,CMountCB* aMount); |
|
3376 |
||
3377 |
||
3378 |
||
3379 |
/** |
|
3380 |
@deprecated 6.1 |
|
3381 |
*/ |
|
3382 |
IMPORT_C TInt CompareFilenames(const TDesC& aFileName1,const TDesC& aFileName2); |
|
3383 |
// |
|
3384 |
/** |
|
3385 |
Lookup a file system by name. |
|
3386 |
||
3387 |
@param aName file system name. |
|
3388 |
||
3389 |
@return pointer to instantiated CFileSystem object. |
|
3390 |
*/ |
|
3391 |
IMPORT_C CFileSystem* GetFileSystem(const TDesC& aName); |
|
3392 |
||
3393 |
||
3394 |
||
3395 |
/** |
|
3396 |
@internalTechnology |
|
3397 |
||
3398 |
A static class for retrieving F32 properties |
|
3399 |
*/ |
|
3400 |
class F32Properties |
|
3401 |
{ |
|
3402 |
private: |
|
3403 |
F32Properties(); |
|
3404 |
public: |
|
3405 |
IMPORT_C static TBool Initialise(TInt aRomAddress, TInt aLength); |
|
3406 |
IMPORT_C static TBool GetString(const TDesC8& aSection, const TDesC8& aProperty, TDes8& aPropVal); |
|
3407 |
IMPORT_C static TBool GetInt(const TDesC8& aSection, const TDesC8& aProperty, TInt32& aPropVal); |
|
3408 |
IMPORT_C static TBool GetBool(const TDesC8& aSection, const TDesC8& aProperty, TBool& aPropVal); |
|
3409 |
private: |
|
3410 |
static TBool iInitialised; |
|
3411 |
static TInt iRomAddress; |
|
3412 |
static TInt iRomLength; |
|
3413 |
}; |
|
3414 |
||
3415 |
#include <f32fsys.inl> |
|
3416 |
#endif |