Describes the changes to existing file system interface APIs.
64-bit versions of some functions have been added to the plugin framework to allow you to handle large files. Other functions have been modified that they may now handle larger files. Changes you may need to make to existing code are detailed here.
This is a list of 32-bit functions that have been replaced with 64-bit equivalents to enable large files to be handled:
use CFileCB::Sze64() instead of CFileCB::Size()
use CFileCB::SetSize64(TInt64 aSize, TBool aDriveLocked) instead of CFileCB::SetSize(TInt aSize).
The 32-bit versions of these functions are used widely by the file server and the file system. Alter calls to the 32-bit versions of these functions to handle large files.
If you use the ReadL(), WriteL() and SetSize() functions, you must modify the implementation to replace them with their 64-bit versions:
ReadL(TInt64 aPos, TInt& aLength, TDes8* aDes, const RMessagePtr2& aMessage, TInt aOffset)
WriteL(TInt64 aPos, TInt& aLength, const TDesC8* aDes, const RMessagePtr2& aMessage, TInt aOffset)
The file server retrieves the extended interface by calling CFileCB::GetInterface() with EExtendedFileInterface as an argument. Sub-classes of CFileCB that support large file access will need to inherit this class and implement the interface.
Derive CYourFileSystemFileCB from the classes CFileCB and CFileCB::MExtendedFileInterface.
class CYourFileSystemFileCB : public CFileCB, ... public CFileCB::MExtendedFileInterface { public: // Implement this function to return the CFileCB::MExtendedFileInterface // interface pointer to the file server. virtual TInt GetInterface(TInt aInterfaceId, TAny*& aInterface, TAny* aInput); public: // Implement the CFileCB::MExtendedFileInterface interface extension functions // for 64-bit Read, Write and SetSize. virtual void ReadL(TInt64 aPos, TInt& aLength, TDes8* aDes, const RMessagePtr2& aMessage, TInt aOffset); virtual void WriteL(TInt64 aPos, TInt& aLength, const TDesC8* aDes, const RMessagePtr2& aMessage, TInt aOffset); virtual void SetSizeL(TInt64 aSize); ... }
In the function CYourFileSystemFileCB::GetInterface(), return the pointer to a CYourFileSystemFileCB object through the aInterface output parameter when the input parameter aInterfaceId is CFileCB::TInterfaceId::EExtendedFileInterface. This enables the file server to invoke the 64-bit functions for file access.
TInt CYourFileSystemFileCB::GetInterface(TInt aInterfaceId, TAny*& aInterface, TAny* aInput) { switch(aInterfaceId) { // For supporting large file ReadFileSection case CFileCB::EExtendedFileInterface: aInterface = (CFileCB::MExtendedFileInterface*) (this); return KErrNone; ... default: return(CFileCB::GetInterface(aInterfaceId, aInterface, aInput)); } }
Implement the CFileCB::MExtendedFileInterface functions ReadL(), WriteL() and SetSizeL() in CYourFileSystemFileCB class to provide the 64-bit file access functionality.
void CYourFileSystemFileCB::ReadL(TInt64 aPos, TInt& aLength, TDes8* aDes, const RMessagePtr2& aMessage, TInt aOffset) { // 64-bit Read implementation. ... } void CYourFileSystemFileCB::WriteL(TInt64 aPos, TInt& aLength, const TDesC8* aDes, const RMessagePtr2& aMessage, TInt aOffset) { // 64-bit Write implementation. ... } void CYourFileSystemFileCB::SetSizeL(TInt64 aSize) { // 64-bit Set Size implementation. ... }
The CFileCB::MExtendedFileInterface also supports fair scheduling. Implementations of the functions CFileCB::MExtendedFileInterface::ReadL() and CFileCB::MExtendedFileInterface::WriteL() should also support Fair scheduling.
To enable large files access, calls to the 32-bit CMountCB::ReadSectionL() function should be replaced by calls to the 64-bit CMountCB::ReadSection64L() function.
ReadSection64L(const TDesC& aName, TInt64 aPos, TAny* aTrg, TInt aLength, const RMessagePtr2& aMessage)
To enable 64-bit file access, you must implement the extended interface class CMountCB::MFileExtendedInterface.
The file server retrieves the interface by calling CMountCB::GetInterface() with EFileExtendedInterface as an argument. Sub-classes of CMountCB that support large file accesses need to inherit this class and implement the interface.
Derive CYourFileSystemMountCB from the classes CMountCB::MFileAccessor and CMountCB.
class CYourFileSystemMountCB : public CMountCB, public CMountCB::MFileAccessor { ... public: // Implement this function to return the CMountCB::MFileExtendedInterface // interface pointer to file server. virtual TInt GetInterface(TInt aInterfaceId, TAny*& aInterface, TAny* aInput); ... public: // The CMountCB::MFileExtendedInterface interface extension function // for 64-bit read file section implementation virtual void ReadSection64L(const TDesC& aName, TInt64 aPos, TAny* aTrg, TInt aLength, const RMessagePtr2& aMessage); ... }
When your implementation of GetInterface() is passed TInterfaceIds::EFileAccessor through the aInterfaceId parameter, return a pointer to the CYourFileSystemMountCB object through the aInterface output parameter.
Implement CYourFileSystemMountCB::ReadSection64L() to perform a 64-bit read from a file.
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.