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 "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
26 #if !defined(__F32FSYS_H__)
28 #if !defined(__F32FILE_H__)
33 #define KFileSystemUidValue KFileSystemUidValue16
34 #define KFileServerUidValue KFileServerUidValue16
35 #define KFileServerDllUidValue KFileServerDllUidValue16
37 #define KFileSystemUidValue KFileSystemUidValue8
38 #define KFileServerUidValueKFileServerUidValue8
39 #define KFileServerDllUidValueKFileServerDllUidValue8
44 Filesystem error code 1 : indicates an item cannot be found,
45 because it has been hidden.
47 const TInt KErrHidden=(1);
50 Filesystem error code 2 : in the context of file operations, a path
51 was not found, because it has been hidden.
53 const TInt KErrPathHidden=(2);
56 const TInt KFileShareLockGranularity=2;
57 const TInt KAsyncRequestArrayGranularity=2;
63 File system UID value 16.
65 const TInt KFileSystemUidValue16=0x100039df;
74 File system UID value 8.
76 const TInt KFileSystemUidValue8=0x1000008f;
85 File server UID value 16.
87 const TInt KFileServerUidValue16=0x100039e3;
96 File server UID value 8.
98 const TInt KFileServerUidValue8=0x100000bb;
107 File server DLL UID value 16.
109 const TInt KFileServerDllUidValue16=0x100039e4;
118 File server DLL UID value 8.
120 const TInt KFileServerDllUidValue8=0x100000bd;
129 Local file system UID value.
131 const TInt KLocalFileSystemUidValue=0x100000d6;
140 Estart component UID value.
142 const TInt KEstartUidValue=0x10272C04;
149 Maximum length of a volume name.
151 const TInt KMaxVolumeNameLength=11;
160 First local drive indicator.
162 const TInt KFirstLocalDrive=EDriveC;
165 const TInt KMaxExtensionCount=2;
167 const TInt KDriveInvalid=-1;
169 _LIT(KMediaPWrdFile, "?:\\sys\\data\\mmcstore");
175 const TUint KSystemDriveKey = 0x10283049;
182 Enumeration that specifies whether, on opening a file:
183 - an existing file is opened
184 - a new file is created
185 - an existing file is replaced.
187 enum TFileOpen {EFileOpen,EFileCreate,EFileReplace};
198 typedef TFileMode TShare;
212 class CFsMessageRequest;
222 Implements reference counting to track concurrent references to itself.
224 An object of this type arranges automatic destruction of itself when the final
225 reference is removed.
227 A reference counting object is any object which has CFsObject as its base class.
228 Constructing a CFsObject derived type or calling its Open() member function
229 adds a reference to that object by adding one to the reference count; calling
230 its Close() member function removes a reference by subtracting one from the
231 reference count; when the last user of the object calls Close(), the reference
232 count becomes zero and the object is automatically destroyed.
234 class CFsObject : public CBase
238 IMPORT_C CFsObject();
239 IMPORT_C virtual TInt Open();
240 IMPORT_C virtual void Close();
241 IMPORT_C TInt SetName(const TDesC* aName);
242 IMPORT_C TName Name() const;
243 IMPORT_C virtual TBool IsCorrectThread();
244 inline CFsObjectCon* Container() const;
247 TInt UniqueID() const;
250 IMPORT_C ~CFsObject();
253 CFsObjectCon* iContainer;
255 friend class CFsObjectCon;
256 friend class CFsObjectIx;
263 class CFsInternalRequest;
266 Implements a request dispatcher.
268 Base class for file server resources.
269 for example subsessions that are opened, such as RFile etc, that need closing are closed by
270 issuing a subsession close request, handled by this object.
275 class CFsDispatchObject : public CFsObject
280 Returns the drive number.
281 @return Drive number.
283 TInt DriveNumber() const {return(iDriveNumber);}
284 IMPORT_C void Close();
285 IMPORT_C virtual TBool IsCorrectThread();
287 void DoInitL(TInt aDrvNumber);
289 ~CFsDispatchObject();
291 CFsInternalRequest* iRequest;
293 friend class TFsCloseObject;
294 friend class CFileShare; // needed to override the close operation so that the file cache can be flushed on a close
301 Notifier class must be unique to each thread so one per drive or threaded plugin should be used
302 allocated in the file system. No longer global
307 NONSHARABLE_CLASS(CAsyncNotifier) : public CBase
310 IMPORT_C static CAsyncNotifier* New();
311 IMPORT_C ~CAsyncNotifier();
312 IMPORT_C TInt Notify(const TDesC& aLine1,const TDesC& aLine2,const TDesC& aButton1,const TDesC& aButton2,TInt& aButtonVal);
313 inline void SetMount(CMountCB* aMount) { iMount = aMount; };
325 class CProxyDriveFactory;
331 Structure containing information related to a single drive extension.
333 struct TExtensionInfo
335 TBool iIsPrimary; ///< Is the primary drive extension for a given drive
336 CProxyDriveFactory* iFactory; ///< Pointer to the drive extension's object factory
346 Represents information related to the Drive extension(s) in use for a given drive.
352 TInt iCount; ///< Number of drive extensions in use
354 TExtensionInfo iInfo[KMaxExtensionCount]; ///< Drive extension related information
364 Represents a drive in the file server.
366 Note that drives may act as substitutes for paths on other drives,
367 in which case any access to this drive letter will be translated into
368 a reference to the assigned path. In this way drives can act as short
369 cuts to paths on other drives.
375 void CreateL(TInt aDriveNumber);
377 TInt CheckMountAndEntryName(const TDesC& aName);
378 TInt FinaliseMount();
379 TInt FinaliseMount(TInt aOperation, TAny* aParam1=NULL, TAny* aParam2=NULL);
380 TInt MountControl(TInt aLevel, TInt aOption, TAny* aParam);
382 void MountMedia(TBool aForceMount);
383 void FlushCachedFileInfoL();
384 TInt FlushCachedFileInfo(TBool aPurgeCache = EFalse);
385 void PurgeDirty(CMountCB& aMount);
386 void DriveInfo(TDriveInfo& anInfo);
387 TInt Volume(TVolumeInfo& aVolume);
388 TInt SetVolume(const TDesC& aName);
389 TInt MkDir(const TDesC& aName);
390 TInt RmDir(const TDesC& aName);
391 TInt Delete(const TDesC& aName);
392 TInt Rename(const TDesC& anOldName,const TDesC& aNewName);
393 TInt Replace(const TDesC& anOldName,const TDesC& aNewName);
394 TInt Entry(const TDesC& aName,TEntry& anEntry);
395 TInt SetEntry(const TDesC& aName,const TTime& aTime,TUint aMask,TUint aVal);
396 TInt FileTemp(CFsRequest* aRequest,TInt& aHandle,const TDesC& aPath,TDes& aName,TUint aMode);
397 TInt FileOpen(CFsRequest* aRequest,TInt& aHandle,const TDesC& aName,TUint aMode,TFileOpen anOpen);
398 TInt DirOpen(CSessionFs* aSession,TInt& aHandle,const TDesC& aName,TUint anAtt,const TUidType& aUidType);
401 TInt CheckDisk(TInt aOperation, TAny* aParam1=NULL, TAny* aParam2=NULL);
404 TInt ScanDrive(TInt aOperation, TAny* aParam1=NULL, TAny* aParam2=NULL);
406 TInt ReadFileSection(const TDesC& aName,TInt aPos,TAny* aTrg,TInt aLength,const RMessagePtr2& aMessage);
407 TInt GetShortName(const TDesC& aLongName,TDes& aShortName);
408 TInt GetLongName(const TDesC& aShortName,TDes& aLongName);
409 TInt IsFileOpen(const TDesC& aFileName,CFileCB*& aFileCB);
410 TInt IsFileInRom(const TDesC& aFileName,TUint8*& aFileStart);
411 TInt LockDevice(TMediaPassword& aOld,TMediaPassword& aNew,TBool aStore);
412 TInt UnlockDevice(TMediaPassword& aPassword,TBool aStore);
413 TInt ClearDevicePassword(TMediaPassword& aPassword);
414 TInt EraseDevicePassword();
415 TInt FreeDiskSpace(TInt64& aFreeDiskSpace);
416 TInt ForceRemountDrive(const TDesC8* aMountInfo,TInt aMountInfoMessageHandle,TUint aFlags);
417 TBool IsWriteProtected();
418 TInt MountExtension(CProxyDriveFactory* aFactory,TBool aIsPrimary);
419 TInt DismountExtension(CProxyDriveFactory* aFactory,TBool aIsPrimary);
420 TInt ExtensionName(TDes& aExtensionName,TInt aPos);
421 TInt ControlIO(const RMessagePtr2& aMessage,TInt aCommand,TAny* aParam1,TAny* aParam2);
422 void SetAtt(TUint aValue);
423 IMPORT_C TUint Att();
424 IMPORT_C TBool GetNotifyUser();
425 IMPORT_C void Dismount();
426 IMPORT_C TBool IsWriteableResource() const;
427 IMPORT_C TBool IsCurrentWriteFunction() const;
428 inline TInt GetReason() const;
429 inline void SetChanged(TBool aValue);
430 inline TBool IsChanged() const;
431 inline TInt DriveNumber() const;
432 inline TBool IsMounted() const;
433 inline TBool IsLocal() const;
434 inline TBool IsRom() const;
435 inline TBool IsRemovable() const;
436 inline TBool IsSubsted() const;
437 inline CMountCB& CurrentMount() const;
438 inline TDrive& SubstedDrive() const;
439 inline void SetSubstedDrive(TDrive* aDrive);
440 inline HBufC& Subst() const;
441 inline void SetSubst(HBufC* aSubst);
442 inline CFsObjectCon& Mount() const;
443 inline CFileSystem& FSys();
444 inline CFileSystem*& GetFSys();
445 inline TDriveExtInfo& ExtInfo();
446 inline void SetNotifyOn();
447 inline void SetNotifyOff();
448 inline TInt ReservedSpace() const;
449 inline void SetReservedSpace(const TInt aReservedSpace);
451 inline void SetRugged(TBool aIsRugged);
452 inline TBool IsRugged() const;
454 inline TBool IsSynchronous() const;
455 inline void SetSynchronous(TBool aIsSynch);
459 TInt DismountUnlock();
460 TInt DismountLocked() const;
461 void SetDismountPending(TBool aPending);
462 TBool DismountPending() const;
463 void ForceDismount();
464 TInt ActiveMounts() const;
465 void ReactivateMounts();
466 TInt ClampFile(const TDesC& aName,TAny* aHandle);
467 TInt UnclampFile(CMountCB* aMount, RFileClamp* aHandle);
468 TInt ClampsOnDrive(TBool aRequestDismount=EFalse, TInt (*aFunc)(TAny*)=NULL,TAny* aParamList=NULL);
469 TInt SetCallbackRequired(TInt (*aFunc)(TAny*),TAny* aParamList);
470 IMPORT_C void FlushOutstandingDismount(TBool *aDismountRequired);
471 TInt ClearDeferredDismount();
472 IMPORT_C void SetClampFlag(TBool aClamped);
473 IMPORT_C TBool ClampFlag();
475 inline void UnLock();
476 TBool ReMount(CMountCB& aMount);
478 TBool RequestFreeSpaceOnMount(TUint64 aFreeSpaceRequired);
479 TInt MountedVolumeSize(TUint64& aSize);
482 void MountMediaL(TBool aForceMount,CMountCB*& aMount);
483 void SetVolumeL(const TDesC& aName,HBufC*& aBuf);
484 void DirOpenL(CSessionFs* aSession,TInt& aHandle,const TDesC& aName,TUint anAtt,const TUidType& aUidType,CDirCB*& aDir);
485 void FileOpenL(CFsRequest* aRequest,TInt& aHandle,const TDesC& aName,TUint aMode,TFileOpen anOpen,CFileCB*& aFileCB,CFileShare*& aFileShare);
486 TInt CheckMountAndEntryNames(const TDesC& anOldName,const TDesC& aNewName);
487 CFileCB* LocateFileByPath(const TDesC& aPath);
488 TInt CheckDirectories(const TDesC& anOldName,const TDesC& aNewName);
489 void DoEntryL(const TDesC& aName,TEntry& anEntry);
490 void ReadSectionL(const TDesC& aName,TInt aPos,TAny* aTrg,TInt aLength,const RMessagePtr2& aMessage);
491 TInt ValidateShare(CFileCB& aFile,TShare aReqShare);
492 TInt CheckAttributes(const TDesC& aName,TUint& aSetAttMask,TUint& aClearAttMask);
493 TBool IsExtensionMounted(CProxyDriveFactory* aFactory);
494 CFileCB* LocateFile(const TDesC& aName);
495 CFileCache* LocateClosedFile(const TDesC& aName, TBool aResurrect = ETrue);
497 IMPORT_C TBool IsDriveThread() const;
498 IMPORT_C TBool IsMainThread() const;
499 IMPORT_C void DriveFault(TBool aDriveError) const;
504 //-- intrinsic TDrive flags. Used in iDriveFlags.
508 EDismountPending = 0x02,
510 EClampPresent = 0x08,
511 EDriveIsSynch = 0x10, //-- is set on mount when the drive is synchronous (doesn't have its own thread)
521 CMountCB* iCurrentMount;
522 TDrive* iSubstedDrive;
524 CFsObjectCon* iMount;
526 TDriveExtInfo iExtInfo;
527 TInt iDriveFlags; ///< intrinsic TDrive flags
530 TInt iMountFailures; // number of times the mount has failed
531 TInt iLastMountError;
532 friend class LocalDrives; // for access to iChanged flag
545 A file server interface class representing a mount.
547 An instance of this object is referred to as a mount control block.
549 A mount control block needs to be created for a specific volume (partition) on
550 a drive in order to be able to access that volume. Volumes may be permanent
551 or represent removable media. Note that removable media may also be mounted directly onto
552 a device with no drive. Volumes can be formatted, unlike drives.
554 The volume represented is either a currently mounted volume in the system or,
555 in the case of removable volumes, a volume that has been removed but still has
556 subsession objects open.
558 A plug-in file system implements this class.
560 class CMountCB : public CFsDispatchObject
564 IMPORT_C ~CMountCB();
565 IMPORT_C TBool operator!=(const CMountCB& aMount) const;
566 IMPORT_C TBool MatchEntryAtt(TUint anAtt,TUint aMatt) const;
567 IMPORT_C void SetDiskSpaceChange(TInt64 aFreeDiskSpace);
568 inline TDrive& Drive() const;
569 inline void SetDrive(TDrive* aDrive);
570 inline HBufC& VolumeName() const;
571 inline void SetVolumeName(HBufC* aName);
572 inline TBool GetNotifyUser() const;
573 inline void SetNotifyOn();
574 inline void SetNotifyOff();
575 inline void IncLock();
576 inline void DecLock();
577 inline TInt LockStatus() const;
578 inline TBool IsCurrentMount() const;
579 inline TBool Locked() const;
580 inline TInt64 Size() const;
581 inline TInt LocalDrive(TBusLocalDrive*& aLocalDrive);
582 inline TInt LocalBufferSupport(CFileCB* aFile = NULL);
583 inline TInt AddToCompositeMount(TInt aMountIndex);
588 Attempts to set the mount control block properties using
589 the current mount (i.e. volume) on the associated drive.
591 The function should set the volume name (iVolumeName),
592 the unique ID (iUniqueID) and the volume size (iSize)
593 by reading and processing the current mount.
595 When aForceMount is set to ETrue, the properties of a corrupt volume should
596 be forcibly stored. The classic case of when this is desirable is when
597 a corrupt volume needs to be formatted.
599 The function should leave, on error detection, with an appropriate error code.
601 @param aForceMount Indicates whether the properties of a corrupt
602 volume should be stored.
604 @leave KErrCorrupt The properties of the current mount on the drive were
605 not successfully mounted due to corruption of volume information,
606 assuming that aForceMount is not set.
608 virtual void MountL(TBool aForceMount) =0;
612 Checks whether the mount control block represents the current mount on
613 the associated drive.
615 The function should read mount information from the current volume,
616 and check it against the mount information from this mount - typically
617 iVolumeName and iUniqueID. If the mount information matches, the function
618 should return KErrNone, otherwise it should return KErrGeneral.
620 Called by the associated TDrive object when the drive has no current mounts,
621 which is the case on first access to the drive and following a volume
622 change on a drive associated with removable media. In this circumstance,
623 this function is called systematically on every mount control block owned
624 by the drive. If ReMount() calls for all existing mount
625 control blocks fail, the drive creates a new mount control block and calls
626 CMountCB::MountL() on that object; the new object is added to the list of
627 mount control blocks owned by the drive.
629 @return KErrNone if the mount represented by this object is found to be
631 KErrGeneral if this object is found not to represent
633 otherwise one of the other sytem wide error codes.
635 virtual TInt ReMount() =0;
639 Carries out any clean-up necessary for a volume dismount.
641 Dismounting a volume will always succeed, so the function does not need
642 to return an error value. Any cached information should be discarded and no
643 attempt should be made to access the volume. For removable media it may be
644 that the media has already been removed. This function is called when
645 a media change is detected.
647 virtual void Dismounted() =0;
651 Gets volume information.
653 The only information that the function has to supply is the free space,
654 TVolumeInfo::iFree, since the remaining members have already been set by
655 the calling function.
657 The function should leave, on error detection, with
658 an appropriate error code.
660 @param aVolume On return, a reference to the filled volume
663 virtual void VolumeL(TVolumeInfo& aVolume) const =0;
667 Sets the volume name for the mount, thus writing the new volume name
668 to the corresponding volume.
670 This function should leave on error detection.
672 @param aName A reference to a descriptor containing the new volume name.
674 @leave KErrBadName If the specified volume name is longer than the maximum
675 allowed length for a volume name
677 virtual void SetVolumeL(TDes& aName) =0;
681 Creates a new directory on the mount.
683 The directory to be created is identified through its full name in aName.
684 The full name is in the form:
686 \\dirA\\dirB\\dirC\\dirD
688 where dirD is the new directory to be created in \\dirA\\dirB\\dirC\\.
689 This means that dirC is the leaf directory in which dirD will be created.
691 The function should leave, on error detection, with an appropriate
694 @param aName A reference to a descriptor containing the full name of
695 the directory to be created.
697 @leave KErrPathNotFound Part of the path in aName does not exist.
698 @leave KErrAlreadyExists dirD already exists in \\dirA\\dirB\\dirC\\
699 @leave KErrAccessDenied dirD already exists but is not a directory.
700 @leave KErrDirFull There is no room in \\dirA\\dirB\\dirC\\ for the new entry,
701 which is especially applicable to the root directory.
703 virtual void MkDirL(const TDesC& aName) =0;
707 Removes the directory specified by aName (its full name) from the volume.
709 The directory specified by aName is in the form:
711 \\dirA\\dirB\\dirC\\dirD
713 where dirD is the directory to be removed from \\dirA\\dirB\\dirC\\.
714 This means that dirC is the leaf directory from which dirD should be removed.
716 The function can assume that the directory exists and is not read-only.
718 The function should leave with a suitable error code if it cannot complete
719 successfully for any reason.
721 @param aName A reference to a descriptor containing the full name of
722 the directory to be removed.
724 @leave KErrInUse dirD contains entries other than the parent (..)
725 and current (.) entries.
727 virtual void RmDirL(const TDesC& aName) =0;
731 Deletes the specified file from the mount.
733 The function can assume that the file is closed.
735 The file name specified by aName is of the form:
737 \\dirA\\dirB\\dirC\\file.ext
740 The extension is optional.
742 The function should leave on error detection, with
743 an appropriate error code.
745 @param aName A reference to a descriptor containing the full path name
746 of the file that will be removed.
748 @leave KErrAccessDenied aName specifies a file whose attributes state that
749 the file is read-only or aName specifies a directory.
751 virtual void DeleteL(const TDesC& aName) =0;
755 Renames or moves a single file or directory on the mount.
757 It can be used to move a file or directory since both
758 anOldName and anNewName specify the respective entries with full names;
761 \\dirA\\dirB\\dirC\\oldEntryName
767 \\dirE\\dirF\\dirG\\newEntryName
770 If oldEntryName is a file, it can be assumed that it is closed.
771 If oldEntryName is a directory, it can be assumed that there are no
772 open files in this directory. Furthermore, if newEntryName specifies
773 a directory, it can be assumed that it is not a subdirectory of oldEntryName.
775 The function should leave with an appropriate error code if it cannot
776 complete successfully for any reason.
778 @param anOldName A reference to a descriptor containing the full entry
779 name of the entry to be renamed.
781 @param anNewName A reference to a descriptor containing the new full entry
782 name for the entry to be renamed.
784 @leave KErrAlreadyExists The new entry already exists.
786 virtual void RenameL(const TDesC& anOldName,const TDesC& anNewName) =0;
790 Replaces one file on the mount with another.
792 The function can assume that both anOldName and, if it exists, anNewName
793 contain the full file names of files, and that these files are not open.
795 If the file aNewName does not exist it should be created.
797 The file anOldName should have its contents, attributes, and the universal
798 date and time of its last modification, copied to the file aNewName,
799 overwriting any existing contents and attribute details.
800 Finally anOldName should be deleted.
802 The function should leave with an appropriate error code if it cannot
803 complete successfully for any reason.
805 @param anOldName A reference to a descriptor containing the full file name
806 of the file to replace the file specified by anNewName
807 @param anNewName A reference to a descriptor containing the new full file
808 name for the entry to be replaced.
810 virtual void ReplaceL(const TDesC& anOldName,const TDesC& anNewName) =0;
814 Gets the entry details for the specified file or directory.
816 anEntry should be filled with details from the file or directory with the
817 full name aName. aName is of the form
819 \\dirA\\dirB\\dirC\\entry.
822 Note that anEntry.iType (the entry UID) should only be set for a file whose
823 size is greater than or equal to sizeof(TCheckedUid).
825 The function should leave with an appropriate error code if it cannot
826 complete successfully for any reason.
828 @param aName A reference to a descriptor containing the full name of
829 the entry whose details are required.
830 @param anEntry On return, a reference to the filled entry object.
832 @leave KErrPathNotFound The entry, aName, cannot be found.
834 virtual void EntryL(const TDesC& aName,TEntry& anEntry) const =0;
838 Sets entry details for a specified file or directory.
840 The entry identfied by the full name descriptor aName should have
841 its modification time and its attributes mask updated as required.
843 The entry receives a new universal modified time from aTime.
844 The entry attributes are set with aSetAttMask and cleared
846 the bits that are set in aSetAttMask should be set
847 in the entry attribute mask;
848 the bits that are set in aClearAttMask
849 should be cleared from the entry attribute mask.
851 The function can assume that aSetAttMask and aClearAttMask do not change
852 the type of attribute (i.e. volume or directory). Furthermore, if aName
853 specifies a file, it can be assumed that this file is closed.
855 The function should leave with an appropriate error code on error detection.
857 @param aName A reference to a descriptor containing the full name of
858 the entry to be updated.
859 @param aTime A reference to the time object holding the new universal
860 modified time for aName.
861 @param aSetAttMask Attribute mask for setting the entry's attributes.
862 @param aClearAttMask Attribute mask for clearing the entry's attributes.
864 virtual void SetEntryL(const TDesC& aName,const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask) =0;
868 Customises the opening of a new or existing file on the mount.
870 The function is called internally (via TDrive::FileOpen()) as a result of
871 a call by the client, and the file is created, if necessary, and opened by
872 the calling function. However this function implements any replacement
873 functionality, as well as any other behaviour particular to the file system.
875 If anOpen specifies EFileReplace (rather than EFileCreate or EFileOpen) then,
876 if replacement functionality is required, the data contained in the file
877 should be discarded, the archive attribute should be set, and the size of
878 the file should be set to zero. Note that it can be assumed that if anOpen
879 specifies EFileReplace then the file already exists.
881 After successful completion of the function, the file control block pointer
882 will be added to the file server's global files container.
884 The function should leave with a suitable error code if it cannot be completed
887 @param aName The full name of the file that will be opened.
888 @param aMode The file share mode. The following share modes are available:
890 EFileShareReadersOnly;
892 EFileShareReadersOrWriters;
897 @param anOpen IndicatES how the file will be opened. It can be one of
902 @param aFile Pointer to the file control block which will, on success,
903 represent the open file.
905 @leave KErrAccessDenied aName may specify a directory, or the function may
906 be attempting to open a file on a ROM drive.
908 virtual void FileOpenL(const TDesC& aName,TUint aMode,TFileOpen anOpen,CFileCB* aFile) =0;
912 Customises the opening of a directory on the mount.
914 The function is called internally, and the directory will have been created
915 and initialised by the calling function. Any customisation specific to
916 a file system should be implemented in this function.
918 Note that aName is of the form
920 \\dirA\\dirB\\dirC\\file.ext
923 where \\dirA\\dirB\\dirC\\ is the directory to be opened and file.ext is
924 an optional entry name and extension.
926 After successful completion of the function, the directory control block
927 pointer will be added to the file server global directories container.
929 The function should leave with a suitable error code if it cannot complete
930 successfully for any reason.
932 @param aName A reference to a descriptor containing the full name of
933 the directory that will be opened.
934 @param aDir Points to a directory control block which will, on success,
935 represent the open directory.
937 virtual void DirOpenL(const TDesC& aName,CDirCB* aDir) =0;
941 Reads the specified length of data from the specified position on
942 the volume directly into the client thread.
944 It can be assumed that if this function is called,
945 then there has been a successful mount.
947 This function should leave with an appropriate error code when
948 an error is detected.
950 @param aPos Start position in the volume for the read operation,
952 @param aLength The number of bytes to be read.
953 @param aTrg A pointer to the buffer into which data is to be read.
954 @param anOffset The offset at which to start adding data to the read buffer.
957 virtual void RawReadL(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt anOffset,const RMessagePtr2& aMessage) const = 0;
961 Writes a specified length of data from the client thread to the volume
962 at the specified position.
964 It can be assumed that if this function is called, then there has been
967 This function should leave with an appropriate error code when
968 an error is detected.
970 @param aPos Start position in the volume for the write operation,
972 @param aLength The number of bytes to be written.
973 @param aSrc Pointer to the buffer from which data will be written.
974 @param anOffset The offset in the buffer at which to start writing data.
977 virtual void RawWriteL(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt anOffset,const RMessagePtr2& aMessage) = 0;
981 Gets the short name of the file or directory with the given full name.
983 This function is used in circumstances where a file system mangles
984 Symbian OS natural names, in order to be able to store them on
985 a file system that is not entirely compatible.
987 The function should leave with a suitable error code if it cannot complete
988 successfully for any reason.
990 @param aLongName A reference to a descriptor containing the full name
992 @param aShortName On return, a reference to a descriptor containing
993 the short name of the entry.
995 @leave KErrNotFound The entry specified by its long name cannot be found.
997 virtual void GetShortNameL(const TDesC& aLongName,TDes& aShortName) = 0;
1001 Gets the long name of the file or directory associated with
1002 the given short name.
1004 This function is used in circumstances where a file system mangles
1005 Symbian OS natural names in order to be able to store them on
1006 a file system that is not entirely compatible.
1008 The function should leave with a suitable error code if it cannot complete
1009 successfully for any reason.
1011 @param aShorName A reference to a descriptor containing the short name
1014 @param aLongName On return, a reference to a descriptor containing
1015 the long name of the entry.
1017 @leave KErrNotFound The entry specified by its short name cannot be found.
1019 virtual void GetLongNameL(const TDesC& aShorName,TDes& aLongName) = 0;
1023 Reads a specified section of the file, regardless of the file's lock state.
1025 The function should leave with a suitable error code if it cannot complete
1026 successfully for any reason.
1028 @param aName A reference to a descriptor containing the full name of
1029 the file to be read from
1030 @param aPos The byte position to start reading from.
1031 @param aTrg A pointer to the buffer into which data is to be read.
1032 @param aLength The length of data to be read, in bytes.
1035 @leave KErrEof aPos is past the end of the file.
1037 virtual void ReadSectionL(const TDesC& aName,TInt aPos,TAny* aTrg,TInt aLength,const RMessagePtr2& aMessage)=0;
1041 Checks the integrity of the file system on the volume and returns an appropriate error value.
1042 The default implementation must be overridden by a derived class.
1044 @return KErrNone if the file system is stable; otherwise one of the other system wide error codes.
1045 The default implementation returns KErrNotSupported.
1047 virtual TInt CheckDisk() {return(KErrNotSupported);}
1050 The same as original CheckDisk(), but with some parameters.
1053 virtual TInt CheckDisk(TInt aOperation, TAny* aParam1=NULL, TAny* aParam2=NULL);
1057 Scans through and corrects errors found in the volume.
1059 The default implementation must be overridden by a derived class.
1061 @return KErrNone if no errors are found or all errors are corrected; otherwise one of the other system wide error codes.
1062 The default implementation returns KErrNotSupported.
1064 virtual TInt ScanDrive() {return(KErrNotSupported);}
1067 The same as original ScanDrive(), but with some parameters.
1070 virtual TInt ScanDrive(TInt aOperation, TAny* aParam1=NULL, TAny* aParam2=NULL);
1072 IMPORT_C virtual void IsFileInRom(const TDesC& aFileName,TUint8*& aFileStart);
1076 Low-level control IO
1078 virtual TInt ControlIO( const RMessagePtr2& /*aMessage*/,TInt /*aCommand*/,TAny* /*aParam1*/,TAny* /*aParam2*/) {return(KErrNotSupported);}
1082 Locks a media which supports password protection and replaces
1083 the old password with a new one.
1085 If aStore is set to ETrue, then the new password should be saved to
1086 the password store file, KMediaPWrdFile, using the exported file server
1087 function WriteToDisk().
1089 The password file is used to initialise the password store on boot up,
1090 so the user does not need to be prompted for the password again if
1093 The default implementation must be overridden in a derived class.
1095 @param aOld A reference to the old password.
1096 @param aNew A reference to the new password.
1097 @param aStore ETrue if the new password is to be saved to
1098 the password file store; EFalse if not.
1100 @return KErrNone if successful; otherwise another of the system wide
1101 error codes. The default implementation returns KErrNotSupported.
1103 virtual TInt Lock(TMediaPassword& /*aOld*/,TMediaPassword& /*aNew*/,TBool /*aStore*/) {return(KErrNotSupported);}
1107 Unlocks a media which supports password protection.
1109 If aStore is set to ETrue then the password should be saved to
1110 the password store file specified by KMediaPWrdFile using the exported file
1111 server function WriteToDisk().
1113 The password file is used to initialise the password store on boot up,
1114 so the user does not need to be prompted for the password again if
1117 The default implementation must be overridden in a derived class.
1119 @param aPassword A reference to the password.
1120 @param aStore ETrue if the password is to be saved to
1121 the password store file; EFalse otherwise.
1123 @return KErrNone if successful; otherwise another of the system wide
1124 error codes. The default implementation returns KErrNotSupported.
1126 virtual TInt Unlock(TMediaPassword& /*aPassword*/,TBool /*aStore*/) {return(KErrNotSupported);}
1130 Clears a password from a media that supports write protection.
1132 The default implementation must be overridden in a derived class.
1134 @param aPassword A reference to the password to be cleared.
1136 @return KErrNone if successful; otherwise another of the system wide
1137 error codes. The default implementation returns KErrNotSupported.
1139 virtual TInt ClearPassword(TMediaPassword& /*aPassword*/) {return(KErrNotSupported);}
1144 virtual TInt ForceRemountDrive(const TDesC8* /*aMountInfo*/,TInt /*aMountInfoMessageHandle*/,TUint /*aFlags*/) {return(KErrNotSupported);}
1148 Legacy method: finalise the mount and put it to the consistent state.
1150 virtual void FinaliseMountL() {return;}
1153 finalise the mount and put it to the consistent state.
1155 @param aOperation describes finalisation operation, see RFs::TFinaliseDrvMode
1156 @param aParam1 not used, for future expansion
1157 @param aParam2 not used, for future expansion
1159 virtual void FinaliseMountL(TInt aOperation, TAny* aParam1=NULL, TAny* aParam2=NULL);
1163 /** Mount Control levels or operations to perform */
1166 //-- reserved generic mount (CMountCB) control codes
1168 EMountStateQuery, ///< query mount state, see TMntCtlOption, ESQ_IsMountFinalised
1169 EMountVolParamQuery, ///< mount-specific queries for volume parameters. See ESQ_RequestFreeSpace, ESQ_GetCurrentFreeSpace
1172 //-- starting from the next code someone may define some specific mount type control codes, like ESpecificMountCtl+17
1173 ESpecificMountCtl = 0x40000000,
1177 /** Mount Control options that makes sense only for certain control codes, see TMntCtlLevel */
1180 //-- reserved generic mount (CMountCB) control options codes
1183 query if the mount is finalised, corresponds to the EMountStateQuery control code only.
1184 aParam must be a pointer to TBool that will on return be ETrue if the mount is finalised.
1186 ESQ_IsMountFinalised,
1189 //-----------------------------------------------------------------------------------------------------------------------------
1191 //-- starting from the next code someone may define some specific mount type control options
1192 ESpecificMountCtlOpt = 0x40000000,
1195 Corresponds to EMountVolParamQuery. Request a certain amount of free space on the volume.
1196 If _current_ amount of free space is >= than required or it is not being updated in background by the mount, returns immediately;
1197 If mount is still counting free space and If _current_ amount of free space is < than required, the caller will be blocked
1198 until mount finds enough free space or reports that the _final_ amount of free space is less than required.
1200 aParam must be TUint64* in: number of free bytes on the volume required, out: resulted amount of free space. It can be less than
1201 required if there isn't enough free space on the volume at all.
1203 ESQ_RequestFreeSpace,
1207 Corresponds to EMountVolParamQuery. A request to obtain the _current_ amount of free space on the volume asynchronously, without blocking.
1208 Some mounts implementations can count volume free space in the background.
1210 aParam must be TUint64* in: none; out: _current_ amount of free space on the volume.
1212 ESQ_GetCurrentFreeSpace,
1215 Corresponds to EMountVolParamQuery. A request to obtain size of the mounted volume without blocking (CMountCB::VolumeL() can block).
1216 aParam must be TUint64* in: none; out: mounted volume size, same as TVolumeInfo::iSize
1218 ESQ_MountedVolumeSize,
1223 Generic mount control method.
1224 @param aLevel specifies the operation to perfrom on the mount
1225 @param aOption specific option for the given operation
1226 @param aParam pointer to generic parameter, its meaning depends on aLevel and aOption
1228 @return standard error code. Default imlementation returns KErrNotSupported
1230 virtual TInt MountControl(TInt aLevel, TInt aOption, TAny* aParam);
1234 Erase a password from a media that supports write protection.
1236 The default implementation must be overridden in a derived class.
1238 @return KErrNone if successful; otherwise another of the system wide
1239 error codes. The default implementation returns KErrNotSupported.
1241 virtual TInt ErasePassword() {return(KErrNotSupported);}
1244 An interface class which may optionally be returned by a file system
1245 by calling GetInterface(EFileClamp, ...)
1250 virtual TInt ClampFile(const TInt aDriveNo,const TDesC& aName,TAny* aHandle) = 0;
1251 virtual TInt UnclampFile(RFileClamp* aHandle) = 0;
1252 IMPORT_C virtual TInt IsFileClamped(const TInt64 aUniqueId) = 0;
1253 virtual TInt NoOfClamps() = 0;
1254 virtual TInt SetCallbackRequired(TInt (*aFunc)(TAny*), TAny* aParamList) = 0;
1255 virtual TInt GetCallbackInfo(TInt (**aFunc)(TAny*), TAny*& aParamList) = 0;
1256 virtual TInt ClearCallbackInfo() = 0;
1260 An interface class which may optionally be returned by a file system
1261 by calling GetInterface(EFileAccessor, ...)
1266 virtual TInt GetFileUniqueId(const TDesC& aName, TInt64& aUniqueId) = 0;
1267 virtual TInt Spare3(TInt aVal, TAny* aPtr1, TAny* aPtr2) = 0;
1268 virtual TInt Spare2(TInt aVal, TAny* aPtr1, TAny* aPtr2) = 0;
1269 virtual TInt Spare1(TInt aVal, TAny* aPtr1, TAny* aPtr2) = 0;
1274 Enumeration of the aInterfaceIDs used in GetInterface.
1278 EAddFsToCompositeMount = 0,
1281 EGetFileSystemSubType = 3,
1282 EGetClusterSize = 4,
1283 ELocalBufferSupport = 5,
1284 EAddToCompositeMount = 6
1287 // File clamping support
1288 TInt ClampFile(const TInt aDriveNo,const TDesC& aName,TAny* aHandle);
1289 TInt UnclampFile(RFileClamp* aHandle);
1290 IMPORT_C TInt IsFileClamped(const TInt64 aUniqueId);
1292 TInt SetCallbackRequired(TInt (*aFunc)(TAny*), TAny* aParamList);
1293 TInt GetCallbackInfo(TInt (**aFunc)(TAny*), TAny*& aParamList);
1294 TInt ClearCallbackInfo();
1296 // File accessor support
1297 TInt GetFileUniqueId(const TDesC& aName, TInt64& aUniqueId);
1298 TInt Spare3(TInt aVal, TAny* aPtr1, TAny* aPtr2);
1299 TInt Spare2(TInt aVal, TAny* aPtr1, TAny* aPtr2);
1300 TInt Spare1(TInt aVal, TAny* aPtr1, TAny* aPtr2);
1302 // Extensions of interface
1303 TInt FileSystemSubType(TDes& aName);
1304 TInt FileSystemClusterSize();
1307 inline void SetMountNumber(TInt aMountNumber);
1308 inline void SetDismounted(TBool aDismounted=ETrue);
1309 inline TInt MountNumber() const;
1310 inline TBool IsDismounted() const;
1312 void InitL(TInt aDrvNumber);
1316 Return a pointer to a specified interface extension - to allow future extension of this class without breaking
1317 binary compatibility.
1318 @param aInterfaceId Interface identifier of the interface to be retrieved.
1319 @param aInterface A reference to a pointer that retrieves the specified interface.
1320 @param aInput An arbitrary input argument.
1321 @return KErrNone If the interface is supported, KErrNotSupported otherwise.
1323 IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
1328 Unique mount number set by the TDrive object representing the drive on
1329 which the object resides.
1335 Unique ID from the volume. Set in MountL().
1337 @see CMountCB::MountL
1343 Size of the volume. First set in MountL().
1345 @see CMountCB::MountL
1351 A list of all open files on that mount.
1352 Set by the TDrive object representing the drive of which the mount resides.
1354 TDblQue<CFileCB> iMountQ;
1355 friend class TDrive;
1356 friend class TFsAddCompositeMount;
1370 MFileSystemSubType interface provides extended interface for CMountCB to retrieve sub type
1371 of mounted file systems.
1373 The interface could be retrieved by calling CMountCB::GetInterface() with EGetFileSystemSubType
1376 If the file system does not support sub types, MFileSystemSubType cannot be retieved.
1377 Sub classes of CMountCB who does support sub types will need to multiple-inherit with
1378 this class and implement the interface. The implementation of the interface will be
1379 retrieved via GetInterface() and provided to user by non-virtual APIs to avoid breaking
1380 binary compatibility.
1382 NOTE: Do not try to delete MFileSystemSubType interface pointer!
1384 @see CMountCB::GetInterface()
1386 class MFileSystemSubType
1390 Retrieves file system's sub type name (E.g. FAT16), if the file system does not have sub
1391 types (E.g. Rofs), return the file system's name.
1392 @param aName Returned descriptor contains file system name or sub type name.
1393 @return KErrNone if successful.
1395 virtual TInt SubType(TDes& aName) const = 0;
1401 MFileSystemClusterSize interface provides extended interface for CMountCB to retrieve cluster size
1402 of mounted file systems.
1404 The interface could be retrieved by calling CMountCB::GetInterface() with EGetClusterSize
1407 If the file system does not support clustering, MFileSystemClusterSize cannot be retieved.
1408 Sub classes of CMountCB who does support clustering will need to multiple-inherit with
1409 this class and implement the interface. The implementation of the interface will be
1410 retrieved via GetInterface() and provided to user by non-virtual APIs to avoid breaking
1411 binary compatibility.
1413 NOTE: Do not try to delete MFileSystemSubType interface pointer!
1415 @see CMountCB::GetInterface()
1417 class MFileSystemClusterSize
1421 Retrieves file system's cluster size
1422 @return None-zero cluster size if successful.
1424 virtual TInt ClusterSize() const = 0;
1436 The lock specifies the lowest and highest position in the file to be locked.
1438 Note that files may have many locks on it, but overlapping sections cannot
1441 This is used by a file control block, a CFileCB object.
1445 struct SFileShareLock
1448 The owning file share object.
1454 The start of the section of the file to be locked.
1460 The end of the section of the file to be locked.
1469 class TAsyncReadRequest
1472 TAsyncReadRequest(TInt aEndPos, CFileShare* aOwningShareP, CFsRequest* aRequestP);
1473 TBool CompleteIfMatching(CFileShare* aOwningShareP, TRequestStatus* aStatusP, TInt aError);
1475 TAsyncReadRequest();
1477 TInt iEndPos; // The request is completed file length >= iEndPos.
1478 CFileShare* iOwningShareP; // The share that owns this outstanding request.
1479 const TRequestStatus* iStatusP; // Used to identify the request when cancelling.
1480 CSessionFs* iSessionP; // The owning session of the original request.
1481 RMessage2 iMessage; // The message to be completed when data is available.
1488 A file server interface class representing an open file.
1490 An instance of this object is referred to as a file control block.
1492 A file control block needs to be created for a specific file to be able to
1493 access that file within a directory.
1495 A plug-in file system implements this class.
1497 class CFileCB : public CFsDispatchObject
1501 IMPORT_C ~CFileCB();
1502 IMPORT_C void InitL(TDrive* aDrive,TDrive* aCreatedDrive,HBufC* aName,RArray<SFileShareLock>* aLock);
1503 inline void SetMount(CMountCB * aMount);
1504 inline TDrive& Drive() const;
1505 inline TDrive& CreatedDrive() const;
1506 inline CMountCB& Mount() const;
1507 inline HBufC& FileName() const;
1508 inline HBufC& FileNameF() const;
1509 inline RArray<SFileShareLock>& Lock();
1510 inline TInt UniqueID() const;
1511 TInt FindLock(TInt aPosLow,TInt aPosHigh);
1512 TInt AddLock(CFileShare* aFileShare,TInt aPos,TInt aLength);
1513 TInt RemoveLock(CFileShare* aFileShare,TInt aPos,TInt aLength);
1514 TInt CheckLock(CFileShare* aFileShare,TInt aPos,TInt aLength);
1515 void RemoveLocks(CFileShare* aFileShare);
1516 inline TShare Share() const;
1517 inline void SetShare(TShare aShare);
1518 inline TInt Size() const;
1519 inline void SetSize(TInt aSize);
1520 inline TInt Att() const;
1521 inline void SetAtt(TInt aAtt);
1522 inline TTime Modified() const;
1523 inline void SetModified(TTime aModified);
1524 inline TBool FileCorrupt() const;
1525 inline void SetFileCorrupt(TBool aFileCorrupt);
1526 inline TBool BadPower() const;
1527 inline void SetBadPower(TBool aBadPower);
1528 inline TUint32 NameHash() const;
1530 inline TInt BlockMap(SBlockMapInfo& aInfo, TInt64& aStartPos, TInt64 aEndPos=-1);
1531 inline TInt LocalDrive(TBusLocalDrive*& aLocalDrive);
1533 TBool LocalBufferSupport() const;
1534 void SetLocalBufferSupport(TBool aEnabled);
1536 /** File caching support methods */
1538 CFileCache* FileCache() const;
1539 TInt FairSchedulingLen() const;
1540 TInt CachedSize() const;
1541 void SetCachedSize(TInt aSize);
1542 void ResetReadAhead();
1544 void SetNotifyAsyncReadersPending(TBool aNotifyAsyncReadersPending);
1545 TBool NotifyAsyncReadersPending() const;
1546 TInt CancelAsyncReadRequest(CFileShare* aShareP, TRequestStatus* aStatusP);
1548 /** Extended API support methods */
1550 TBool ExtendedFileInterfaceSupported();
1551 void ReadL(TInt64 aPos,TInt& aLength,TDes8* aDes,const RMessagePtr2& aMessage, TInt aOffset);
1552 void WriteL(TInt64 aPos,TInt& aLength,const TDesC8* aDes,const RMessagePtr2& aMessage, TInt aOffset);
1553 void SetSizeL(TInt64 aSize);
1556 Renames the file with the full file name provided.
1558 Because the full name of the file includes the path, the function can
1559 also be used to move the file.
1561 It can be assumed that no other sub-session has access to the file:
1562 i.e. the file has not been opened in EFileShareAny share mode.
1563 It can also be assumed that the file has been opened for writing.
1565 The function should leave with KErrAlreadyExists if aNewName already exists.
1566 An appropriate error code should also be generated if the function leaves
1567 before completion for any other reason.
1569 @param aNewName The new full name of the file.
1571 @see CFileCB::iFileName
1573 virtual void RenameL(const TDesC& aNewName) =0;
1577 Reads a specified number of bytes from the open file starting at
1578 the specified postition, and writes the result into a descriptor.
1580 It can be assumed that aPos is inside the file and aLength > 0.
1581 The file should only be read up to its end regardless of
1582 the value of aPos + aLength. The number of bytes read should be stored
1583 in aLength on return.
1585 If the function leaves before completion for any reason it should generate
1586 an appropriate error code, and in this situation,
1587 the arguments are not valid on return.
1589 @param aPos Represents a position relative to the start of the file
1590 where ReadL() should start to read.
1591 @param aLength On entry, specifies the number of bytes to be read
1592 from the file. On return, this should contain the number
1593 of bytes read, but this is not valid if the function leaves.
1594 @param aDes Pointer to a descriptor into which the data should be written.
1597 virtual void ReadL(TInt aPos,TInt& aLength,const TAny* aDes,const RMessagePtr2& aMessage) =0;
1601 Writes data to the open file.
1603 iModified and iSize are set by the file server after this function
1604 has completed successfully.
1606 It can be assumed that aPos is within the file range and aLength > 0.
1607 When aPos + aLength is greater than the file size then the file should
1608 be enlarged using SetSizeL(). The number of bytes written should be
1609 returned through the argument aLength.
1611 If the function leaves before completion for any reason it should generate
1612 an appropriate error code, and in this situation the arguments are
1613 not valid on return.
1615 @param aPos Represents a position relative to the start of the file
1616 where WriteL() should start to write.
1617 @param aLength Specifies the number of bytes to be written to the file.
1618 On return, the number of bytes written, but this is not
1619 valid if the function leaves.
1620 @param aDes Pointer to a descriptor containing the data to be written
1624 @see CFileCB::iModified
1626 @see CFileCB::SetSizeL
1628 @leave KErrDiskFull The operation cannot be completed because the disk is full.
1630 virtual void WriteL(TInt aPos,TInt& aLength,const TAny* aDes,const RMessagePtr2& aMessage) =0;
1634 Extends or truncates the file by re-setting the file size.
1636 The function should not change iModified and iSize attributes of
1637 the file object: this is done by the file server.
1638 If the file is extended, nothing should be written in the extended area.
1640 The function should leave with a suitable error code on error detection.
1642 @param aSize The new file size in number of bytes.
1644 @leave KErrDiskFull The operation cannot be completed because the disk is full.
1646 @see CFileCB::iModified
1649 virtual void SetSizeL(TInt aSize) =0;
1653 Sets the attribute mask, iAtt, and the modified time of the file, iModified.
1655 If aMask|aVal does not equal zero, then aMask should be OR'ed with iAtt,
1656 whilst the inverse of aVal should be AND'ed with iAtt.
1657 If the modified flag is set in aMask then iModified should be set to aTime.
1659 The function should leave with a suitable error code on error detection.
1661 @param aTime The new modified time, if the modified flag is set in aMask.
1662 @param aMask Bit mask containing bits set (to 1) that are to be set (to 1)
1664 @param aVal Bitmask containing bits set (to 1) that are to be unset (to 0)
1667 @see CFileCB::iModified
1670 virtual void SetEntryL(const TTime& aTime,TUint aMask,TUint aVal) =0;
1674 Flushes, to disk, the cached information necessary for the integrity
1675 of recently written data, such as the file size.
1677 The function should leave with a suitable error code on error detection.
1679 virtual void FlushDataL() =0;
1683 Flushes, to disk, all cached file data (e.g. attributes, modification time,
1686 The modified bit in the file attributes mask should be cleared if
1687 the flush was successful.
1689 The function should leave with a suitable error code on error detection.
1691 virtual void FlushAllL() =0;
1692 IMPORT_C virtual TInt Address(TInt& aPos) const;
1693 IMPORT_C void SetArchiveAttribute();
1696 Block Map API interface
1698 class MBlockMapInterface
1701 virtual TInt BlockMap(SBlockMapInfo& aInfo, TInt64& aStartPos, TInt64 aEndPos)=0;
1705 An interface class which may optionally be returned by a file system
1706 by calling GetInterface(EExtendedFileInterface, ...)
1707 The purpose of this interface is twofold:
1708 - to support fair scheduling (by use of the aOffset parameter)
1709 - to enable large file support
1711 class MExtendedFileInterface
1715 Functionally equivalent to CFileCB::ReadL(), but supports large files and fair scheduling
1717 Reads a specified number of bytes from the open file starting at
1718 the specified postition, and writes the result into a descriptor.
1720 @param aPos Represents a position relative to the start of the file
1721 where ReadL() should start to read.
1722 Note that the filesystem may not support positions above KMaxTInt,
1723 in which case it leaves with KErrNotSupported.
1724 @param aLength On entry, specifies the number of bytes to be read
1725 from the file. On return, this contains the number
1726 of bytes read, this value is not valid if the function leaves.
1727 @param aDes Pointer to a descriptor into which the data is written.
1728 @param aMessage A reference to a client message or an RLocalMessage.
1729 @param aOffset The offset into the descriptor where the data is to be written.
1730 This is non-zero if the read was fair-scheduled
1735 virtual void ReadL(TInt64 aPos,TInt& aLength,TDes8* aDes,const RMessagePtr2& aMessage, TInt aOffset) = 0;
1738 Functionally equivalent to CFileCB::WriteL(), but supports large files and fair scheduling
1740 Writes data to the open file.
1742 @param aPos Represents a position relative to the start of the file
1743 where WriteL() starts to write.
1744 Note that the filesystem may not support positions above KMaxTInt,
1745 in which case it leaves with KErrNotSupported.
1746 @param aLength Specifies the number of bytes to be written to the file.
1747 On return this is the number of bytes written, this value is not
1748 valid if the function leaves.
1749 @param aDes Pointer to a descriptor containing the data to be written
1751 @param aMessage A reference to a client message or an RLocalMessage
1752 @param aOffset The offset into the descriptor where the data is to be read from.
1753 This is non-zero if the read was fair-scheduled
1755 @see CFileCB::WriteL
1758 virtual void WriteL(TInt64 aPos,TInt& aLength,const TDesC8* aDes,const RMessagePtr2& aMessage, TInt aOffset) = 0;
1761 Functionally equivalent to CFileCB::SetSizeL(), but supports large files
1763 Extends or truncates the file by re-setting the file size.
1765 The function does not change the iModified and iSize attributes of
1766 the file object: this is done by the file server.
1767 If the file is extended, nothing is written in the extended area.
1769 The function leaves with a suitable error code when an error is to detected.
1771 @param aSize The new file size in bytes.
1773 @leave KErrDiskFull The operation cannot be completed because the disk is full.
1775 @see CFileCB::SetSizeL
1776 @see CFileCB::iModified
1779 virtual void SetSizeL(TInt64 aSize) = 0;
1786 Return a pointer to a specified interface extension - to allow future extension of this class without breaking
1787 binary compatibility.
1788 @param aInterfaceId Interface identifier of the interface to be retrieved.
1789 @param aInterface A reference to a pointer that retrieves the specified interface.
1790 @param aInput An arbitrary input argument.
1791 @return KErrNone If the interface is supported, KErrNotSupported otherwise.
1793 IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
1797 EBlockMapInterface = 0,
1799 EExtendedFileInterface = 2
1804 void DemoteShare(CFileShare* aFileShare);
1805 void PromoteShare(CFileShare* aFileShare);
1807 RArray<TAsyncReadRequest>& AsyncReadRequests();
1808 TInt AddAsyncReadRequest(CFileShare* aFileShareP, TInt aPos, TInt aLength, CFsRequest* aRequestP);
1809 void NotifyAsyncReaders();
1814 Inititally, the mode that the file was opened with, which defines the level
1815 of access allowed to the file. Set by the TDrive object
1816 (representing the drive on which the file resides) when the file
1817 control block is created.
1823 The size of the file.
1829 The attributes of the file.
1835 The universal time at which the file was last modified.
1841 Indicates whether the file that the object represents is corrupt:
1842 true if it is corrupt, false otherwise.
1848 Indicates whether a recent access to the file that the object represents
1849 failed due to KErrBadPower.
1856 The full name of the file, including drive and extensions.
1861 The full name of the file, including drive and extensions - Folded.
1867 TDrive* iCreatedDrive;
1870 RArray<SFileShareLock>* iLock;
1871 TDblQueLink iMountLink;
1876 friend class TDrive;
1877 friend class CMountCB;
1878 friend class CFileShare;
1879 friend class TFsFileRead;
1880 friend class TFsFileWrite;
1881 friend class TFsFileSetSize;
1882 friend class TFsFileReadCancel;
1883 friend class TFsFileDuplicate;
1884 friend class CCompFileCB;
1885 friend class CFileCache;
1890 Helper class to construct a dummy RMessage2 object. This allows the file server to
1891 read and write local buffers to a file system's CFileCB-derived interface.
1895 class RLocalMessage : public RMessage2
1898 inline RLocalMessage();
1906 A file server interface class representing an open file that is being shared.
1907 For example multiple reading of the same file.
1912 NONSHARABLE_CLASS(CFileShare) : public CFsDispatchObject
1915 CFileShare(CFileCB* aFileCB);
1919 inline CFileCB& File();
1921 // For serialising aync requests
1922 TBool RequestStart(CFsMessageRequest* aRequest);
1923 void RequestEnd(CFsMessageRequest* aRequest);
1924 TBool RequestInProgress() const;
1929 File share mode. The mode in which the file was opened first.
1934 Current file position. This is the position at which reading and writing takes place.
1938 Error condition due to flush.
1944 // A pointer to the current request. Used for serializing client
1945 // async read/write requests which might otherwise be processed out
1946 // of order due to fair scheduling
1947 CFsMessageRequest* iCurrentRequest;
1957 A file server interface class representing an open directory
1959 An instance of this object is referred to as a directory control block.
1961 A directory control block must be created for a specific directory to access
1962 that directory within a volume.
1964 A plug-in file system implements this class.
1966 class CDirCB : public CFsDispatchObject
1972 IMPORT_C void InitL(TDrive* aDrive);
1973 inline void SetMount(CMountCB * aMount){iMount=aMount;};
1974 inline TDrive& Drive() const;
1975 inline CMountCB& Mount() const;
1976 inline TBool Pending() const;
1977 inline void SetPending(TBool aPending);
1981 Gets information from the first suitable entry in the directory,
1982 starting from the current read position.
1984 The function should read successive entries until a suitable entry is found.
1985 An entry is suitable if the entry attributes match the criteria set by this
1986 object's attributes, which are set on initialisation.
1987 For example, if the directory control block has the attribute
1988 KEntryAttMaskSupported, and the file has the attribute KEntryAttVolume,
1989 then the entry will be deemed unsuitable and the next entry will be read.
1991 This function is called by the file server.
1993 If, on return, the entry's full file name, TEntry::iName, is longer than
1994 the maximum buffer size, then the entry cannot be returned to the client.
1995 In this case the file server will set iPending to true and will call
1996 StoreLongEntryName() before calling this function again.
1997 In this case (when iPending is true), the function should re-read
1998 the last entry to be read; it should also set iPending to false and
1999 should not advance the current read position.
2001 The time stored in the iModified member of anEntry should not be converted,
2002 but left as UTC time.
2004 When storing the iName member of anEntry, the current (.),
2005 or parent marker (..) in the directory should not be returned.
2007 If the KEntryAttAllowUid flag is set in the iAtt member of anEntry, then
2008 the entry UID type of an entry will be read. If, on reading the UID from
2009 a file, KErrCorrupt is generated, because the file is corrupt,
2010 ReadL() should not leave with this error message, but should return
2012 If any other errors are raised the function should leave.
2014 All of the properties of a TEntry, other than the UID types, are always read.
2016 ReadL() should leave with a suitable error code if it cannot complete
2017 successfully for any reason.
2019 @param anEntry Entry information object.
2021 virtual void ReadL(TEntry& anEntry) =0;
2024 IMPORT_C virtual void StoreLongEntryNameL(const TDesC& aName);
2028 Return a pointer to a specified interface extension - to allow future extension of this class without breaking
2029 binary compatibility.
2030 @param aInterfaceId Interface identifier of the interface to be retrieved.
2031 @param aInterface A reference to a pointer that retrieves the specified interface.
2032 @param aInput An arbitrary input argument.
2033 @return KErrNone If the interface is supported, KErrNotSupported otherwise.
2035 IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
2039 Bitmask of the attributes of interest.
2041 Set using the the TDrive friend class instance representing
2042 the directory's drive after the object is made.
2048 Set after construction using the TDrive friend class instance representing
2049 the directory's drive.
2055 Flag to indicate whether preceding entry details should be returned when
2056 multiple entries are being read.
2059 friend class TDrive;
2063 TUint32 iReserved; // Reserved for future expansion
2073 A file server interface class representing a format operation on a disk.
2075 An instance of this object is referred to as a format control block.
2077 The type of format operation to be applied depends on the type of disk,
2078 and is stored in iMode. Each format operation has a number of steps and
2079 is kept track of using iCurrentStep.
2081 A format control block needs to be created for a specific mount control block
2082 for the disk controlled via that mount to be formatted.
2084 A plug-in file system provides an implementation of this class.
2086 class CFormatCB : public CFsDispatchObject
2089 IMPORT_C CFormatCB();
2090 IMPORT_C ~CFormatCB();
2091 IMPORT_C TInt CheckMount();
2092 void InitL(TDrive* aDrive,TFormatMode aMode);
2093 void SetSpecialInfo(const TDesC8& aInfo);
2094 inline TDrive& Drive() const;
2095 inline CMountCB& Mount() const;
2096 inline TFormatMode Mode() const;
2097 inline TInt& CurrentStep();
2100 Performs a formatting step on the drive.
2102 The step performed should depend on the values of iMode and iCurrentStep.
2104 It can be assumed that there are no resources open on the mount,
2105 that the media is formattable, and that the media is not write protected.
2107 If iMode == EQuickFormat, then only meta data is to be written.
2108 This should be carried out in a single step, with iCurrentStep set
2109 to zero on completion.
2111 If iMode != EQuickFormat, then the format step performed by
2112 this function should depend on iCurrentStep. When the function
2113 returns with iCurrentStep set to zero, the formatting of the drive is complete.
2115 On error detection, the function should leave with an appropriate error code.
2117 @see CFormatCB::iMode
2118 @see CFormatCB::iCurrentStep
2120 virtual void DoFormatStepL() =0;
2124 Return a pointer to a specified interface extension - to allow future extension of this class without breaking
2125 binary compatibility.
2126 @param aInterfaceId Interface identifier of the interface to be retrieved.
2127 @param aInterface A reference to a pointer that retrieves the specified interface.
2128 @param aInput An arbitrary input argument.
2129 @return KErrNone If the interface is supported, KErrNotSupported otherwise.
2131 IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
2136 The stage the current format operation has reached.
2142 The mode of the format operation.
2144 This is set by the file server when the format control block is created.
2149 Buffer containing user-specified format parameters.
2151 TSpecialFormatInfoBuf iSpecialInfo;
2155 TUint32 iReserved; // Reserved for future expansion
2165 A file server interface class representing a raw disk.
2167 An instance of this object is referred to as a raw disk control block.
2169 This is not an abstract base class and does not need to be derived from
2170 when implementing a file system. This is because direct disk access is
2171 implemented by the file server directly calling RawReadL() and RawWriteL()
2172 from the derived CMountCB object of the file system.
2174 NONSHARABLE_CLASS(CRawDiskCB) : public CFsDispatchObject
2179 void InitL(CMountCB* aMount,TBool aIsWriteProtected);
2180 inline CMountCB& Mount();
2181 inline TDrive& Drive();
2182 inline TBool IsWriteProtected() const;
2183 inline void SetChanged();
2185 enum { EWriteProtected = 1, EChanged = 2 };
2186 inline void SetWriteProtected();
2187 inline TBool IsChanged() const;
2200 A file server interface class, representing the factory class for a file system.
2202 A plug-in file system implements this class.
2204 Creates objects derived from CMountCB, CFileCB, CDirCB and CFormatCB.
2211 class CFileSystem : public CFsObject
2214 IMPORT_C CFileSystem();
2215 IMPORT_C ~CFileSystem();
2216 IMPORT_C virtual TInt Remove();
2217 IMPORT_C virtual TBool QueryVersionSupported(const TVersion& aVer) const;
2218 IMPORT_C virtual TBool IsExtensionSupported() const;
2219 IMPORT_C void SetLibrary(RLibrary aLib);
2220 IMPORT_C RLibrary Library() const;
2225 Installs the file system.
2227 The function should set the name of the file system object through a call
2228 to CObject::SetName(), thus making it accessible, internally,
2229 using FileSystems->FindByFullName(). This enables the file server
2230 to find and handle installed file systems.
2231 The function should also set the file system version.
2232 The version is determined by the file system implementation.
2233 It is used in calls to CFileSystem::QueryVersionSupported().
2235 This function is called as a result of a call to RFs::AddFileSystem().
2237 @return KErrNone if succesful; otherwise one of the other system-wide error
2240 @see RFs::AddFileSystem
2241 @see CObject::SetName
2245 virtual TInt Install() =0;
2249 Creates a new mount control block, a CMountCB derived object.
2251 On success, a pointer to the new mount object should be returned,
2252 otherwise the function should leave.
2254 @return A pointer to the new mount object.
2258 virtual CMountCB* NewMountL() const =0;
2262 Creates a new file control block, i.e. a CFileCB derived object.
2264 On success, a pointer to the new file object should be returned,
2265 otherwise the function should leave.
2267 @return A pointer to the new file object.
2271 virtual CFileCB* NewFileL() const =0;
2275 Creates a new directory control block, i.e. a CDirCB derived object.
2277 On success, a pointer to the new directory control block should be returned,
2278 otherwise the function should leave.
2280 @return A pointer to the new directory object.
2284 virtual CDirCB* NewDirL() const =0;
2288 Creates a new volume format control block, i.e. a CFormatCB derived object.
2290 On success, a pointer to the new volume format control block should be returned,
2291 otherwise the function should leave.
2293 @return A pointer to the new volume format object.
2297 virtual CFormatCB* NewFormatL() const =0;
2301 Retrieves drive information.
2303 The function should set anInfo.iMediaAtt and anInfo.iType according to
2304 the specified drive number.
2306 Note that anInfo.iDriveAtt and anInfo.iBatteryState will already have been
2307 set by the calling function.
2309 The function can obtain the necessary information by calling
2310 the appropriate TBusLocalDrive::Caps() function using the argument aDriveNumber.
2312 @param anInfo On return, contains the drive information.
2313 @param aDriveNumber The drive number.
2315 virtual void DriveInfo(TDriveInfo& anInfo,TInt aDriveNumber) const =0;
2317 //#ifndef __DATA_CAGING__
2318 virtual TInt DefaultPath(TDes& aPath) const;
2323 Return a pointer to a specified interface extension - to allow future extension of this class without breaking
2324 binary compatibility.
2325 @param aInterfaceId Interface identifier of the interface to be retrieved.
2326 @param aInterface A reference to a pointer that retrieves the specified interface.
2327 @param aInput An arbitrary input argument.
2328 @return KErrNone If the interface is supported, KErrNotSupported otherwise.
2330 IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
2336 TUint32 iReserved; // Reserved for future expansion
2346 Base abstract class.
2347 Interface between a local plugin file system and a media subsystem.
2349 @see CLocalProxyDrive
2350 @see CBaseExtProxyDrive
2352 class CProxyDrive : public CBase
2355 CProxyDrive(CMountCB* aMount);
2357 inline CMountCB* Mount() const;
2359 IMPORT_C virtual TInt ControlIO(const RMessagePtr2& aMessage,TInt aCommand,TAny* aParam1,TAny* aParam2);
2360 IMPORT_C virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt aOffset,TInt aFlags);
2361 IMPORT_C virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt anOffset,TInt aFlags);
2362 IMPORT_C virtual TInt DeleteNotify(TInt64 aPos, TInt aLength);
2363 IMPORT_C virtual TInt GetLastErrorInfo(TDes8& aErrorInfo);
2364 inline TInt LocalBufferSupport();
2369 Initialise the proxy drive.
2371 Derived class must provide an implementation for it.
2373 @return KErrNone if successful, otherwise one of the system-wide error codes.
2375 virtual TInt Initialise()=0;
2378 It invokes Dismounted() on the proxy drive.
2380 Derived class must provide an implementation for it.
2382 @return KErrNone if successful, otherwise one of the system-wide error codes.
2384 virtual TInt Dismounted()=0;
2387 Increase the size of the proxy drive by the specified length (in bytes).
2389 Derived class must provide an implementation for it.
2391 @param aLength The length (in bytes) of which the drive is to be increased by.
2393 @return KErrNone if successful, otherwise one of the system-wide error codes.
2395 virtual TInt Enlarge(TInt aLength)=0;
2398 Reduce the size of the proxy drive by removing the specified length
2399 (in bytes) starting at the specified position.
2401 Derived class must provide an implementation for it.
2403 @param aPos The start position of area to be removed.
2404 @param aLength The length/size (in bytes) by which the drive is to be reduced.
2406 @return System-wide error codes based on the status of the operation.
2408 virtual TInt ReduceSize(TInt aPos, TInt aLength)=0;
2411 Read from the proxy drive.
2413 Derived class must provide an implementation for it.
2415 @param aPos The address from where the read begins.
2416 @param aLength The length of the read.
2417 @param aTrg A descriptor of the memory buffer from which to read.
2418 @param aThreadHandle The handle-number representing the drive thread.
2419 @param aOffset Offset into aTrg to read the data from.
2421 @return System-wide error codes based on the status of the operation.
2423 virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt anOffset)=0;
2426 Read from the proxy drive.
2428 Derived class must provide an implementation for it.
2430 @param aPos The address from where the read begins.
2431 @param aLength The length of the read.
2432 @param aTrg A descriptor of the memory buffer from which to read.
2434 @return System-wide error codes based on the status of the operation.
2436 virtual TInt Read(TInt64 aPos,TInt aLength,TDes8& aTrg)=0;
2439 Write to the proxy drive.
2441 Derived class must provide an implementation for it.
2443 @param aPos The address from where the write begins.
2444 @param aLength The length of the write.
2445 @param aSrc A descriptor of the memory buffer from which to write.
2446 @param aThreadHandle The handle-number representing the drive thread.
2447 @param aOffset Offset into aSrc to write the data to.
2449 @return System-wide error codes based on the status of the operation.
2451 virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt anOffset)=0;
2454 Write to the proxy drive.
2456 Derived class must provide an implementation for it.
2458 @param aPos The address from where the write begins.
2459 @param aSrc A descriptor of the memory buffer from which to write.
2461 @return System-wide error codes based on the status of the operation.
2463 virtual TInt Write(TInt64 aPos,const TDesC8& aSrc)=0;
2466 Get the proxy drive's capabilities information.
2468 Derived class must provide an implementation for it.
2470 @param anInfo A descriptor of the connected drives capabilities.
2472 @return System-wide error codes based on the status of the operation.
2474 virtual TInt Caps(TDes8& anInfo)=0;
2477 Format the connected drive.
2479 Derived class must provide an implementation for it.
2481 @param anInfo Device specific format information.
2483 @return System-wide error codes based on the status of the operation.
2485 virtual TInt Format(TFormatInfo& anInfo)=0;
2488 Format the proxy drive.
2490 Derived class must provide an implementation for it.
2492 @param aPos The position of the data which is being formatted.
2493 @param aLength The length of the data which is being formatted.
2495 @return System-wide error codes based on the status of the operation.
2497 virtual TInt Format(TInt64 aPos,TInt aLength)=0;
2500 Set the mount information on the proxy drive.
2502 Derived class must provide an implementation for it.
2504 @param aMountInfo Information passed down to the media driver.
2505 The meaning of this information depends on the media driver.
2506 @param aMountInfoThreadHandle Message thread handle number.
2508 @return System-wide error codes based on the status of the operation.
2510 virtual TInt SetMountInfo(const TDesC8* aMountInfo,TInt aMountInfoThreadHandle=KCurrentThreadHandle)=0;
2513 Forces a remount on the proxy drive
2515 Derived class must provide an implementation for it.
2517 @param aFlags Flags to be passed into the driver.
2519 @return System-wide error codes based on the status of the operation.
2521 virtual TInt ForceRemount(TUint aFlags=0)=0;
2524 Unlocks a password-enabled proxy drive.
2526 Derived class must provide an implementation for it.
2528 @param aPassword A descriptor containing the existing password.
2529 @param aStorePassword If ETrue, the password is added to the password store.
2531 @return System-wide error codes based on the status of the operation.
2533 virtual TInt Unlock(TMediaPassword &aPassword, TBool aStorePassword)=0;
2536 Locks a password-enabled proxy drive with the new password.
2538 Derived class must provide an implementation for it.
2540 @param aOldPassword A descriptor containing the existing password.
2541 @param aNewPassword A descriptor containing the new password.
2542 @param aStorePassword If ETrue, the password is added to the password store.
2544 @return System-wide error codes based on the status of the operation.
2546 virtual TInt Lock(TMediaPassword &aOldPassword, TMediaPassword &aNewPassword, TBool aStorePassword)=0;
2549 Clears a password from a proxy drive - controller sets password to null.
2551 Derived class must provide an implementation for it.
2553 @param aPassword A descriptor containing the password.
2555 @return System-wide error codes based on the status of the operation.
2557 virtual TInt Clear(TMediaPassword &aPassword)=0;
2560 Forcibly unlock a password-enabled proxy drive.
2562 Derived class must provide an implementation for it.
2564 @return System-wide error codes based on the status of the operation.
2566 virtual TInt ErasePassword()=0;
2568 // implementation using GetInterface(..)
2576 Retrieves TBusLocalDrive object associated with the file.
2578 @return System-wide error codes based on the status of the operation.
2580 IMPORT_C TInt GetLocalDrive(TBusLocalDrive*& aLocDrv);
2584 Return a pointer to a specified interface extension - to allow future extension of this class without breaking
2585 binary compatibility.
2587 @param aInterfaceId Interface identifier of the interface to be retrieved.
2588 @param aInterface A reference to a pointer that retrieves the specified interface.
2589 @param aInput An arbitrary input argument.
2591 @return KErrNone If the interface is supported, KErrNotSupported otherwise.
2593 IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
2597 TUint32 iReserved; // Reserved for future expansion
2607 Local drive specific mount control block.
2609 class CLocDrvMountCB : public CMountCB
2612 IMPORT_C CLocDrvMountCB();
2613 IMPORT_C ~CLocDrvMountCB();
2614 IMPORT_C TInt CreateLocalDrive(TBusLocalDrive& aLocDrv);
2615 IMPORT_C TInt InitLocalDrive();
2616 IMPORT_C void DismountedLocalDrive();
2617 inline CProxyDrive* LocalDrive() const;
2620 CProxyDrive* iProxyDrive;
2631 Local drive specific proxy drive interface.
2632 Class passes commands directly to TBusLocalDrive.
2636 NONSHARABLE_CLASS(CLocalProxyDrive) : public CProxyDrive
2639 static CLocalProxyDrive* New(CMountCB* aMount,TBusLocalDrive& aLocDrv);
2641 virtual TInt Initialise();
2642 virtual TInt Dismounted();
2643 virtual TInt Enlarge(TInt aLength);
2644 virtual TInt ReduceSize(TInt aPos, TInt aLength);
2645 virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt aOffset, TInt aFlags);
2646 virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt anOffset);
2647 virtual TInt Read(TInt64 aPos,TInt aLength,TDes8& aTrg);
2648 virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt aOffset,TInt aFlags);
2649 virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt anOffset);
2650 virtual TInt Write(TInt64 aPos,const TDesC8& aSrc);
2651 virtual TInt Caps(TDes8& anInfo);
2652 virtual TInt Format(TFormatInfo& anInfo);
2653 virtual TInt Format(TInt64 aPos,TInt aLength);
2654 virtual TInt SetMountInfo(const TDesC8* aMountInfo,TInt aMountInfoThreadHandle=KCurrentThreadHandle);
2655 virtual TInt ForceRemount(TUint aFlags=0);
2656 virtual TInt ControlIO(const RMessagePtr2& aMessage,TInt aCommand,TAny* aParam1,TAny* aParam2);
2657 virtual TInt Unlock(TMediaPassword &aPassword, TBool aStorePassword);
2658 virtual TInt Lock(TMediaPassword &aOldPassword, TMediaPassword &aNewPassword, TBool aStorePassword);
2659 virtual TInt Clear(TMediaPassword &aPassword);
2660 virtual TInt ErasePassword();
2661 virtual TInt DeleteNotify(TInt64 aPos, TInt aLength);
2662 virtual TInt GetLastErrorInfo(TDes8& aErrorInfo);
2664 virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
2666 CLocalProxyDrive(CMountCB* aMount,TBusLocalDrive& aLocDrv);
2668 TBusLocalDrive& iLocDrv;
2678 Media subsystem extensions must be derived from this specific class interface.
2679 Objects of this type should be created through use of a derived CProxyDriveFactory class.
2681 Class passes commands directly to CProxyDrive.
2684 @see CProxyDriveFactory
2686 class CBaseExtProxyDrive : public CProxyDrive
2689 IMPORT_C CBaseExtProxyDrive(CProxyDrive* aProxyDrive, CMountCB* aMount);
2690 IMPORT_C ~CBaseExtProxyDrive();
2691 IMPORT_C virtual TInt Initialise();
2692 IMPORT_C virtual TInt Dismounted();
2693 IMPORT_C virtual TInt Enlarge(TInt aLength);
2694 IMPORT_C virtual TInt ReduceSize(TInt aPos, TInt aLength);
2695 IMPORT_C virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt aOffset,TInt aFlags);
2696 IMPORT_C virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt anOffset);
2697 IMPORT_C virtual TInt Read(TInt64 aPos,TInt aLength,TDes8& aTrg);
2698 IMPORT_C virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt aOffset,TInt aFlags);
2699 IMPORT_C virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt anOffset);
2700 IMPORT_C virtual TInt Write(TInt64 aPos,const TDesC8& aSrc);
2701 IMPORT_C virtual TInt Caps(TDes8& anInfo);
2702 IMPORT_C virtual TInt Format(TFormatInfo& anInfo);
2703 IMPORT_C virtual TInt Format(TInt64 aPos,TInt aLength);
2704 IMPORT_C virtual TInt SetMountInfo(const TDesC8* aMountInfo,TInt aMountInfoThreadHandle=KCurrentThreadHandle);
2705 IMPORT_C virtual TInt ForceRemount(TUint aFlags=0);
2706 IMPORT_C virtual TInt Unlock(TMediaPassword &aPassword, TBool aStorePassword);
2707 IMPORT_C virtual TInt Lock(TMediaPassword &aOldPassword, TMediaPassword &aNewPassword, TBool aStorePassword);
2708 IMPORT_C virtual TInt Clear(TMediaPassword &aPassword);
2709 IMPORT_C virtual TInt ControlIO(const RMessagePtr2& aMessage,TInt aCommand,TAny* aParam1,TAny* aParam2);
2710 IMPORT_C virtual TInt ErasePassword();
2711 IMPORT_C virtual TInt GetLastErrorInfo(TDes8& aErrorInfo);
2712 IMPORT_C virtual TInt DeleteNotify(TInt64 aPos, TInt aLength);
2713 inline TInt LocalBufferSupport();
2717 Return a pointer to a specified interface extension - to allow future extension of this class without breaking
2718 binary compatibility.
2719 @param aInterfaceId Interface identifier of the interface to be retrieved.
2720 @param aInterface A reference to a pointer that retrieves the specified interface.
2721 @param aInput An arbitrary input argument.
2722 @return KErrNone If the interface is supported, KErrNotSupported otherwise.
2724 IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
2726 CProxyDrive* iProxy;
2736 Abstract base class for Proxy drive factory classes.
2738 Class is used for the creation of media subsystem extensions CBaseExtProxyDrive.
2740 @see CBaseExtProxyDrive
2742 class CProxyDriveFactory : public CFsObject
2745 IMPORT_C CProxyDriveFactory();
2746 IMPORT_C virtual TInt Remove();
2747 inline void SetLibrary(RLibrary aLib);
2748 inline RLibrary Library() const;
2751 Installation of the factory object.
2752 @return system wide error code
2754 virtual TInt Install() =0;
2756 Instantiates a CProxyDrive object.
2757 @param aProxy Proxy drive to be used.
2758 @param aMount Mount control block.
2760 @return pointer to Instantiated CProxyDrive object.
2762 virtual CProxyDrive* NewProxyDriveL(CProxyDrive* aProxy,CMountCB* aMount)=0;
2774 Gets the local bus drive.
2776 @param aLocalDrive The local drive number.
2778 @return The local bus drive.
2780 IMPORT_C TBusLocalDrive& GetLocalDrive(TInt aLocalDrive);
2789 Checks a given drive number is mapped to a local drive.
2791 @param aDrive The local drive number.
2793 @return specified drive number is mapped to a local drive.
2795 IMPORT_C TBool IsValidLocalDriveMapping(TInt aDrive);
2804 Returns the local drive number for a given drive number.
2806 @param aDrive The drive number.
2808 @return KDriveInvalid if drive is not mapped to a local drive.
2809 otherwise the local drive number.
2811 IMPORT_C TInt DriveNumberToLocalDriveNumber(TInt aDrive);
2815 IMPORT_C TInt GetLocalDriveNumber(TBusLocalDrive* aLocDrv);
2818 struct TFatUtilityFunctions;
2822 IMPORT_C const TFatUtilityFunctions* GetFatUtilityFunctions();
2831 Copies data to a buffer.
2833 If necessary, the buffer, a heap descriptor, is allocated or re-allocated
2834 before copying takes place.
2836 @param aBuf A reference to a pointer to heap descriptor forming the buffer.
2837 This will be allocated if it does not already exist,
2838 or re-allocated if the existing buffer is not large enough.
2839 @param aDes The data to be copied.
2841 IMPORT_C void AllocBufferL(HBufC*& aBuf,const TDesC& aDes);
2851 Notifies sessions of a debug event if aFunction has the KDebugNotifyMask set.
2853 This function can only be used in debug builds or if _DEBUG
2854 or _DEBUG_RELEASE is defined.
2856 @param aFunction A function.
2857 @param aDrive A drive.
2859 IMPORT_C void DebugNotifySessions(TInt aFunction,TInt aDrive);
2868 Writes data from a buffer to a file.
2870 Called by the mount control block lock and the unlock functions.
2872 @param aFileName The file to be written to.
2873 @param aBuf The data to be written.
2875 IMPORT_C void WriteToDisk(const TDesC& aFileName,const TDesC8& aBuf);
2881 Create a proxy drive using the local proxy drive passed in
2882 and any extensions that have been added to the drive.
2884 @param aConcreteDrive local proxy drive
2885 @param aMount local proxy drive mount control block
2887 @return pointer to instantiated CProxyDrive object.
2889 IMPORT_C CProxyDrive* CreateProxyDriveL(CProxyDrive* aConcreteDrive,CMountCB* aMount);
2892 class TDismountParams
2895 inline TDismountParams(TInt aDriveNumber, TDrive* aDrivePointer, TBool aForcedDismount, RMessage2* aForcedMessage);
2898 TDrive* iDrivePointer;
2899 TBool iForcedDismount;
2900 RMessage2* iForcedMessage;
2907 IMPORT_C TInt CompareFilenames(const TDesC& aFileName1,const TDesC& aFileName2);
2910 Lookup a file system by name.
2912 @param aName file system name.
2914 @return pointer to instantiated CFileSystem object.
2916 IMPORT_C CFileSystem* GetFileSystem(const TDesC& aName);
2923 A static class for retrieving F32 properties
2930 IMPORT_C static TBool Initialise(TInt aRomAddress, TInt aLength);
2931 IMPORT_C static TBool GetString(const TDesC8& aSection, const TDesC8& aProperty, TDes8& aPropVal);
2932 IMPORT_C static TBool GetInt(const TDesC8& aSection, const TDesC8& aProperty, TInt32& aPropVal);
2933 IMPORT_C static TBool GetBool(const TDesC8& aSection, const TDesC8& aProperty, TBool& aPropVal);
2935 static TBool iInitialised;
2936 static TInt iRomAddress;
2937 static TInt iRomLength;
2940 #include <f32fsys.inl>