CFileCB Class Reference

class CFileCB : public CFsDispatchObject

A file server interface class representing an open file.

An instance of this object is referred to as a file control block.

A file control block needs to be created for a specific file to be able to access that file within a directory.

A plug-in file system implements this class.

Public Member Functions
CFileCB()
~CFileCB()
TInt AddLock(CFileShare *, TInt, TInt)
TInt AddLock64(CFileShare *, TInt64, TInt64)
IMPORT_C TIntAddress(TInt &)
TInt Att()
TBool BadPower()
TInt BlockMap(SBlockMapInfo &, TInt64 &, TInt64)
TInt64 CachedSize64()
TInt CancelAsyncReadRequest(CFileShare *, TRequestStatus *)
TInt CheckLock(CFileShare *, TInt, TInt)
TInt CheckLock64(CFileShare *, TInt64, TInt64)
TInt CheckMount()
TDrive &CreatedDrive()
TBool DeleteOnClose()
TDrive &Drive()
TBool ExtendedFileInterfaceSupported()
TInt FairSchedulingLen()
CFileCache *FileCache()
TBool FileCorrupt()
HBufC &FileName()
HBufC &FileNameF()
TInt FindLock(TInt, TInt)
TInt FindLock64(TInt64, TInt64)
voidFlushAllL()
voidFlushDataL()
IMPORT_C voidInitL(TDrive *, TDrive *, HBufC *)
TBool LocalBufferSupport()
TInt LocalDrive(TBusLocalDrive *&)
TTime Modified()
CMountCB &Mount()
TUint32 NameHash()
TBool NotifyAsyncReadersPending()
voidReadL(TInt64, TInt &, TDes8 *, const RMessagePtr2 &, TInt)
voidReadL(TInt, TInt &, const TAny *, const RMessagePtr2 &)
TInt RemoveLock(CFileShare *, TInt, TInt)
TInt RemoveLock64(CFileShare *, TInt64, TInt64)
voidRemoveLocks(CFileShare *)
voidRenameL(const TDesC &)
voidResetReadAhead()
IMPORT_C voidSetArchiveAttribute()
voidSetAtt(TInt)
voidSetBadPower(TBool)
voidSetCachedSize64(TInt64)
voidSetDeleteOnClose()
voidSetEntryL(const TTime &, TUint, TUint)
voidSetFileCorrupt(TBool)
voidSetLocalBufferSupport(TBool)
IMPORT_C voidSetMaxSupportedSize(TUint64)
voidSetModified(TTime)
voidSetMount(CMountCB *)
voidSetNotifyAsyncReadersPending(TBool)
voidSetShare(TShare)
voidSetSize(TInt)
IMPORT_C voidSetSize64(TInt64, TBool)
voidSetSizeL(TInt64)
voidSetSizeL(TInt)
TShare Share()
TInt Size()
IMPORT_C TInt64Size64()
TInt UniqueID()
voidWriteL(TInt64, TInt &, const TDesC8 *, const RMessagePtr2 &, TInt)
voidWriteL(TInt, TInt &, const TAny *, const RMessagePtr2 &)
Protected Member Functions
TFileLocksArray &FileLocks()
IMPORT_C TIntGetInterface(TInt, TAny *&, TAny *)
TInt GetInterfaceTraced(TInt, TAny *&, TAny *)
TUint64 MaxSupportedSize(void)
Private Member Functions
TInt AddAsyncReadRequest(CFileShare *, TInt64, TInt, CFsRequest *)
RArray< TAsyncReadRequest > &AsyncReadRequests()
voidDemoteShare(CFileShare *)
voidNotifyAsyncReaders()
voidPromoteShare(CFileShare *)
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
CFsDispatchObject::CFsDispatchObject()
CFsDispatchObject::Close()
CFsDispatchObject::Dispatch()
CFsDispatchObject::DoInitL(TInt)
CFsDispatchObject::DriveNumber()const
CFsDispatchObject::IsCorrectThread()
CFsDispatchObject::~CFsDispatchObject()
CFsObject::CFsObject()
CFsObject::Container()const
CFsObject::Dec()
CFsObject::DoClose()
CFsObject::Inc()
CFsObject::Name()const
CFsObject::Open()
CFsObject::SetName(const TDesC *)
CFsObject::~CFsObject()
Protected Member Enumerations
enumTInterfaceIds { EBlockMapInterface = 0, EGetLocalDrive = 1, EExtendedFileInterface }
Public Attributes
HBufC *iFileName
HBufC *iFileNameF
Protected Attributes
TInt iAtt
TBool iBadPower
TBool iFileCorrupt
TTime iModified
TShare iShare
TInt iSize
Private Attributes
CFileBody *iBody
TDrive *iCreatedDrive
TDrive *iDrive
TFileLocksArray *iFileLocks
CMountCB *iMount
TDblQueLink iMountLink
TUint32 iNameHash

Constructor & Destructor Documentation

CFileCB()

IMPORT_CCFileCB()

~CFileCB()

IMPORT_C~CFileCB()

Member Functions Documentation

AddAsyncReadRequest(CFileShare *, TInt64, TInt, CFsRequest *)

TInt AddAsyncReadRequest(CFileShare *aFileShareP,
TInt64aPos,
TIntaLength,
CFsRequest *aRequestP
)[private]

Parameters

CFileShare * aFileShareP
TInt64 aPos
TInt aLength
CFsRequest * aRequestP

AddLock(CFileShare *, TInt, TInt)

TInt AddLock(CFileShare *aFileShare,
TIntaPos,
TIntaLength
)

Parameters

CFileShare * aFileShare
TInt aPos
TInt aLength

AddLock64(CFileShare *, TInt64, TInt64)

TInt AddLock64(CFileShare *aFileShare,
TInt64aPos,
TInt64aLength
)

Parameters

CFileShare * aFileShare
TInt64 aPos
TInt64 aLength

Address(TInt &)

IMPORT_C TIntAddress(TInt &aPos)const [virtual]

Parameters

TInt & aPos

AsyncReadRequests()

RArray< TAsyncReadRequest > &AsyncReadRequests()[private]

Att()

TInt Att()const [inline]

Gets the file's attributes.

BadPower()

TBool BadPower()const [inline]

Gets the iBadPower value.

CFileCB::iBadPower

BlockMap(SBlockMapInfo &, TInt64 &, TInt64)

TInt BlockMap(SBlockMapInfo &aInfo,
TInt64 &aStartPos,
TInt64aEndPos = -1
)[inline]

Retrieves the BlockMap of a file.

Parameters

SBlockMapInfo & aInfo
TInt64 & aStartPos
TInt64 aEndPos = -1

CachedSize64()

TInt64 CachedSize64()const

CancelAsyncReadRequest(CFileShare *, TRequestStatus *)

TInt CancelAsyncReadRequest(CFileShare *aShareP,
TRequestStatus *aStatusP
)

Parameters

CFileShare * aShareP
TRequestStatus * aStatusP

CheckLock(CFileShare *, TInt, TInt)

TInt CheckLock(CFileShare *aFileShare,
TIntaPos,
TIntaLength
)

Parameters

CFileShare * aFileShare
TInt aPos
TInt aLength

CheckLock64(CFileShare *, TInt64, TInt64)

TInt CheckLock64(CFileShare *aFileShare,
TInt64aPos,
TInt64aLength
)

Parameters

CFileShare * aFileShare
TInt64 aPos
TInt64 aLength

CheckMount()

TInt CheckMount()

CreatedDrive()

TDrive &CreatedDrive()const [inline]

Gets a reference to the object representing the drive on which the file was created.

The 'created drive' is only different from the 'drive', as returned by Drive(), if the 'drive' was a substitute for the 'created drive' in the file server session.

DeleteOnClose()

TBool DeleteOnClose()const

DemoteShare(CFileShare *)

voidDemoteShare(CFileShare *aFileShare)[private]

Parameters

CFileShare * aFileShare

Drive()

TDrive &Drive()const [inline]

Gets a reference to the object representing the drive on which the file resides.

ExtendedFileInterfaceSupported()

TBool ExtendedFileInterfaceSupported()

Extended API support methods

FairSchedulingLen()

TInt FairSchedulingLen()const

FileCache()

CFileCache *FileCache()const

File caching support methods

FileCorrupt()

TBool FileCorrupt()const [inline]

Tests whether the file is corrupt.

FileLocks()

TFileLocksArray &FileLocks()[protected, inline]

Gets a reference to the file share locks array being used by the file.

FileName()

HBufC &FileName()const [inline]

Gets a reference to a heap descriptor containing the full file name.

FileNameF()

HBufC &FileNameF()const [inline]

Gets a reference to a heap descriptor containing the folded full file name.

FindLock(TInt, TInt)

TInt FindLock(TIntaPosLow,
TIntaPosHigh
)

Parameters

TInt aPosLow
TInt aPosHigh

FindLock64(TInt64, TInt64)

TInt FindLock64(TInt64aPosLow,
TInt64aPosHigh
)

Parameters

TInt64 aPosLow
TInt64 aPosHigh

FlushAllL()

voidFlushAllL()[pure virtual]

Flushes, to disk, all cached file data (e.g. attributes, modification time, file size).

The modified bit in the file attributes mask should be cleared if the flush was successful.

The function should leave with a suitable error code on error detection.

FlushDataL()

voidFlushDataL()[pure virtual]

Flushes, to disk, the cached information necessary for the integrity of recently written data, such as the file size.

The function should leave with a suitable error code on error detection.

GetInterface(TInt, TAny *&, TAny *)

IMPORT_C TIntGetInterface(TIntaInterfaceId,
TAny *&aInterface,
TAny *aInput
)[protected, virtual]

Return a pointer to a specified interface extension - to allow future extension of this class without breaking binary compatibility.

Parameters

TInt aInterfaceIdInterface identifier of the interface to be retrieved.
TAny *& aInterfaceA reference to a pointer that retrieves the specified interface.
TAny * aInputAn arbitrary input argument.

GetInterfaceTraced(TInt, TAny *&, TAny *)

TInt GetInterfaceTraced(TIntaInterfaceId,
TAny *&aInterface,
TAny *aInput
)[protected]

Parameters

TInt aInterfaceId
TAny *& aInterface
TAny * aInput

InitL(TDrive *, TDrive *, HBufC *)

IMPORT_C voidInitL(TDrive *aDrive,
TDrive *aCreatedDrive,
HBufC *aName
)

Parameters

TDrive * aDrive
TDrive * aCreatedDrive
HBufC * aName

LocalBufferSupport()

TBool LocalBufferSupport()const

LocalDrive(TBusLocalDrive *&)

TInt LocalDrive(TBusLocalDrive *&aLocalDrive)[inline]

Retrieves TBusLocalDrive object associated with an open file.

Parameters

TBusLocalDrive *& aLocalDrive

MaxSupportedSize(void)

TUint64 MaxSupportedSize(void)const [protected]

Parameters

void

Modified()

TTime Modified()const [inline]

Gets the universal time when the file was last modified.

Mount()

CMountCB &Mount()const [inline]

Gets a reference to the object representing the mount on which the file resides.

NameHash()

TUint32 NameHash()const [inline]

Gets the hash of the folded filename

NotifyAsyncReaders()

voidNotifyAsyncReaders()[private]

NotifyAsyncReadersPending()

TBool NotifyAsyncReadersPending()const

PromoteShare(CFileShare *)

voidPromoteShare(CFileShare *aFileShare)[private]

Parameters

CFileShare * aFileShare

ReadL(TInt64, TInt &, TDes8 *, const RMessagePtr2 &, TInt)

voidReadL(TInt64aPos,
TInt &aLength,
TDes8 *aDes,
const RMessagePtr2 &aMessage,
TIntaOffset
)

Parameters

TInt64 aPos
TInt & aLength
TDes8 * aDes
const RMessagePtr2 & aMessage
TInt aOffset

ReadL(TInt, TInt &, const TAny *, const RMessagePtr2 &)

voidReadL(TIntaPos,
TInt &aLength,
const TAny *aDes,
const RMessagePtr2 &aMessage
)[pure virtual]

Reads a specified number of bytes from the open file starting at the specified postition, and writes the result into a descriptor.

It can be assumed that aPos is inside the file and aLength > 0. The file should only be read up to its end regardless of the value of aPos + aLength. The number of bytes read should be stored in aLength on return.

If the function leaves before completion for any reason it should generate an appropriate error code, and in this situation, the arguments are not valid on return.

Parameters

TInt aPosRepresents a position relative to the start of the file where ReadL() should start to read.
TInt & aLengthOn entry, specifies the number of bytes to be read from the file. On return, this should contain the number of bytes read, but this is not valid if the function leaves.
const TAny * aDesPointer to a descriptor into which the data should be written.
const RMessagePtr2 & aMessage

RemoveLock(CFileShare *, TInt, TInt)

TInt RemoveLock(CFileShare *aFileShare,
TIntaPos,
TIntaLength
)

Parameters

CFileShare * aFileShare
TInt aPos
TInt aLength

RemoveLock64(CFileShare *, TInt64, TInt64)

TInt RemoveLock64(CFileShare *aFileShare,
TInt64aPos,
TInt64aLength
)

Parameters

CFileShare * aFileShare
TInt64 aPos
TInt64 aLength

RemoveLocks(CFileShare *)

voidRemoveLocks(CFileShare *aFileShare)

Parameters

CFileShare * aFileShare

RenameL(const TDesC &)

voidRenameL(const TDesC &aNewName)[pure virtual]

Renames the file with the full file name provided.

Because the full name of the file includes the path, the function can also be used to move the file.

It can be assumed that no other sub-session has access to the file: i.e. the file has not been opened in EFileShareAny share mode. It can also be assumed that the file has been opened for writing.

The function should leave with KErrAlreadyExists if aNewName already exists. An appropriate error code should also be generated if the function leaves before completion for any other reason.

CFileCB::iFileName

Parameters

const TDesC & aNewNameThe new full name of the file.

ResetReadAhead()

voidResetReadAhead()

SetArchiveAttribute()

IMPORT_C voidSetArchiveAttribute()

SetAtt(TInt)

voidSetAtt(TIntaAtt)[inline]

Sets the file's attributes.

Parameters

TInt aAttThe file attribute bit mask.

SetBadPower(TBool)

voidSetBadPower(TBoolaBadPower)[inline]

Sets the iBadPower value.

CFileCB::iBadPower

Parameters

TBool aBadPowerETrue, if an operation on the file has failed due to bad power; EFalse if power has been found to be good.

SetCachedSize64(TInt64)

voidSetCachedSize64(TInt64aSize)

Parameters

TInt64 aSize

SetDeleteOnClose()

voidSetDeleteOnClose()

SetEntryL(const TTime &, TUint, TUint)

voidSetEntryL(const TTime &aTime,
TUintaMask,
TUintaVal
)[pure virtual]

Sets the attribute mask, iAtt, and the modified time of the file, iModified.

If aMask|aVal does not equal zero, then aMask should be OR'ed with iAtt, whilst the inverse of aVal should be AND'ed with iAtt. If the modified flag is set in aMask then iModified should be set to aTime.

The function should leave with a suitable error code on error detection.

CFileCB::iModified CFileCB::iAtt

Parameters

const TTime & aTimeThe new modified time, if the modified flag is set in aMask.
TUint aMaskBit mask containing bits set (to 1) that are to be set (to 1) in iAtt.
TUint aValBitmask containing bits set (to 1) that are to be unset (to 0) in iAtt.

SetFileCorrupt(TBool)

voidSetFileCorrupt(TBoolaFileCorrupt)[inline]

Sets whether the file is corrupt.

Parameters

TBool aFileCorruptETrue, if the file is corrupt; EFalse, otherwise.

SetLocalBufferSupport(TBool)

voidSetLocalBufferSupport(TBoolaEnabled)

Parameters

TBool aEnabled

SetMaxSupportedSize(TUint64)

IMPORT_C voidSetMaxSupportedSize(TUint64aMaxFileSize)

Parameters

TUint64 aMaxFileSize

SetModified(TTime)

voidSetModified(TTimeaModified)[inline]

Sets the universal time when the file was last modified.

Parameters

TTime aModifiedThe universal time when the file was last modified.

SetMount(CMountCB *)

voidSetMount(CMountCB *aMount)[inline]

Sets the mount associated with the file.

Parameters

CMountCB * aMountThe mount.

SetNotifyAsyncReadersPending(TBool)

voidSetNotifyAsyncReadersPending(TBoolaNotifyAsyncReadersPending)

Parameters

TBool aNotifyAsyncReadersPending

SetShare(TShare)

voidSetShare(TShareaShare)[inline]

Sets the iShare value, which defines the level of access allowed to the file.

CFileCB::iShare

Parameters

TShare aShareThe new value.

SetSize(TInt)

voidSetSize(TIntaSize)[inline]

Sets the size of the file.

Parameters

TInt aSizeThe size of the file.

SetSize64(TInt64, TBool)

IMPORT_C voidSetSize64(TInt64aSize,
TBoolaDriveLocked
)

Parameters

TInt64 aSize
TBool aDriveLocked

SetSizeL(TInt64)

voidSetSizeL(TInt64aSize)

Parameters

TInt64 aSize

SetSizeL(TInt)

voidSetSizeL(TIntaSize)[pure virtual]

Extends or truncates the file by re-setting the file size.

The function should not change iModified and iSize attributes of the file object: this is done by the file server. If the file is extended, nothing should be written in the extended area.

The function should leave with a suitable error code on error detection.

leave
KErrDiskFull The operation cannot be completed because the disk is full.
CFileCB::iModified CFileCB::iSize

Parameters

TInt aSizeThe new file size in number of bytes.

Share()

TShare Share()const [inline]

Gets the iShare value, which defines the level of access allowed to the file.

CFileCB::iShare

Size()

TInt Size()const [inline]

Gets the size of the file.

Size64()

IMPORT_C TInt64Size64()const

UniqueID()

TInt UniqueID()const [inline]

Gets the file object's unique ID, as returned by CObject::UniqueID().

CObject

WriteL(TInt64, TInt &, const TDesC8 *, const RMessagePtr2 &, TInt)

voidWriteL(TInt64aPos,
TInt &aLength,
const TDesC8 *aDes,
const RMessagePtr2 &aMessage,
TIntaOffset
)

Parameters

TInt64 aPos
TInt & aLength
const TDesC8 * aDes
const RMessagePtr2 & aMessage
TInt aOffset

WriteL(TInt, TInt &, const TAny *, const RMessagePtr2 &)

voidWriteL(TIntaPos,
TInt &aLength,
const TAny *aDes,
const RMessagePtr2 &aMessage
)[pure virtual]

Writes data to the open file.

iModified and iSize are set by the file server after this function has completed successfully.

It can be assumed that aPos is within the file range and aLength > 0. When aPos + aLength is greater than the file size then the file should be enlarged using SetSizeL(). The number of bytes written should be returned through the argument aLength.

If the function leaves before completion for any reason it should generate an appropriate error code, and in this situation the arguments are not valid on return.

CFileCB::iModified CFileCB::iSize CFileCB::SetSizeL
leave
KErrDiskFull The operation cannot be completed because the disk is full.

Parameters

TInt aPosRepresents a position relative to the start of the file where WriteL() should start to write.
TInt & aLengthSpecifies the number of bytes to be written to the file. On return, the number of bytes written, but this is not valid if the function leaves.
const TAny * aDesPointer to a descriptor containing the data to be written to the file.
const RMessagePtr2 & aMessage

Member Enumerations Documentation

Enum TInterfaceIds

Enumerators

EBlockMapInterface = 0
EGetLocalDrive = 1
EExtendedFileInterface

Member Data Documentation

TInt iAtt

TInt iAtt[protected]

The attributes of the file.

TBool iBadPower

TBool iBadPower[protected]

Indicates whether a recent access to the file that the object represents failed due to KErrBadPower.

CFileBody * iBody

CFileBody *iBody[private]

TDrive * iCreatedDrive

TDrive *iCreatedDrive[private]

TDrive * iDrive

TDrive *iDrive[private]

TBool iFileCorrupt

TBool iFileCorrupt[protected]

Indicates whether the file that the object represents is corrupt: true if it is corrupt, false otherwise.

TFileLocksArray * iFileLocks

TFileLocksArray *iFileLocks[private]

HBufC * iFileName

HBufC *iFileName

The full name of the file, including drive and extensions.

HBufC * iFileNameF

HBufC *iFileNameF

The full name of the file, including drive and extensions - Folded.

TTime iModified

TTime iModified[protected]

The universal time at which the file was last modified.

CMountCB * iMount

CMountCB *iMount[private]

TDblQueLink iMountLink

TDblQueLink iMountLink[private]

TUint32 iNameHash

TUint32 iNameHash[private]

TShare iShare

TShare iShare[protected]

Inititally, the mode that the file was opened with, which defines the level of access allowed to the file. Set by the TDrive object (representing the drive on which the file resides) when the file control block is created.

TInt iSize

TInt iSize[protected]

The size of the file. This is the low 32 bit part of the file size. The upper 32 bit part of the file size is saved on the file server side for File Systems supporting file size > 4GB - 1. File Systems supporting file size > 4GB - 1 shall use CFileCB::Size64() to query the file size and CFileCB::SetSize64() to set file size.