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