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.
Nested Classes and Structures
Public Member Functions
|
|
CFileCB
()
|
|
~CFileCB
()
|
TInt
|
AddLock
(
CFileShare
*,
TInt
,
TInt
)
|
TInt
|
AddLock64
(
CFileShare
*,
TInt64
,
TInt64
)
|
IMPORT_C
TInt
|
Address
(
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
)
|
void
|
FlushAllL
()
|
void
|
FlushDataL
()
|
IMPORT_C void
|
InitL
(
TDrive
*,
TDrive
*,
HBufC
*)
|
TBool
|
LocalBufferSupport
()
|
TInt
|
LocalDrive
(
TBusLocalDrive
*&)
|
TTime
|
Modified
()
|
CMountCB
&
|
Mount
()
|
TUint32
|
NameHash
()
|
TBool
|
NotifyAsyncReadersPending
()
|
void
|
ReadL
(
TInt64
,
TInt
&,
TDes8
*, const
RMessagePtr2
&,
TInt
)
|
void
|
ReadL
(
TInt
,
TInt
&, const
TAny
*, const
RMessagePtr2
&)
|
TInt
|
RemoveLock
(
CFileShare
*,
TInt
,
TInt
)
|
TInt
|
RemoveLock64
(
CFileShare
*,
TInt64
,
TInt64
)
|
void
|
RemoveLocks
(
CFileShare
*)
|
void
|
RenameL
(const
TDesC
&)
|
void
|
ResetReadAhead
()
|
IMPORT_C void
|
SetArchiveAttribute
()
|
void
|
SetAtt
(
TInt
)
|
void
|
SetBadPower
(
TBool
)
|
void
|
SetCachedSize64
(
TInt64
)
|
void
|
SetDeleteOnClose
()
|
void
|
SetEntryL
(const
TTime
&,
TUint
,
TUint
)
|
void
|
SetFileCorrupt
(
TBool
)
|
void
|
SetLocalBufferSupport
(
TBool
)
|
IMPORT_C void
|
SetMaxSupportedSize
(
TUint64
)
|
void
|
SetModified
(
TTime
)
|
void
|
SetMount
(
CMountCB
*)
|
void
|
SetNotifyAsyncReadersPending
(
TBool
)
|
void
|
SetShare
(
TShare
)
|
void
|
SetSize
(
TInt
)
|
IMPORT_C void
|
SetSize64
(
TInt64
,
TBool
)
|
void
|
SetSizeL
(
TInt64
)
|
void
|
SetSizeL
(
TInt
)
|
TShare
|
Share
()
|
TInt
|
Size
()
|
IMPORT_C
TInt64
|
Size64
()
|
TInt
|
UniqueID
()
|
void
|
WriteL
(
TInt64
,
TInt
&, const
TDesC8
*, const
RMessagePtr2
&,
TInt
)
|
void
|
WriteL
(
TInt
,
TInt
&, const
TAny
*, const
RMessagePtr2
&)
|
Constructor & Destructor Documentation
Member Functions Documentation
AddAsyncReadRequest(CFileShare *, TInt64, TInt, CFsRequest *)
AddLock(CFileShare *, TInt, TInt)
AddLock64(CFileShare *, TInt64, TInt64)
Address(TInt &)
IMPORT_C
TInt
|
Address
|
(
|
TInt
&
|
aPos
|
)
|
const [virtual]
|
Att()
TInt
|
Att
|
(
|
)
|
const [inline]
|
Gets the file's attributes.
BadPower()
TBool
|
BadPower
|
(
|
)
|
const [inline]
|
BlockMap(SBlockMapInfo &, TInt64 &, TInt64)
Retrieves the BlockMap of a file.
CancelAsyncReadRequest(CFileShare *, TRequestStatus *)
CheckLock(CFileShare *, TInt, TInt)
CheckLock64(CFileShare *, TInt64, TInt64)
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 *)
void
|
DemoteShare
|
(
|
CFileShare
*
|
aFileShare
|
)
|
[private]
|
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()
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.
FindLock64(TInt64, TInt64)
FlushAllL()
void
|
FlushAllL
|
(
|
)
|
[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()
void
|
FlushDataL
|
(
|
)
|
[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
TInt
|
GetInterface
|
(
|
TInt
|
aInterfaceId,
|
|
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
aInterfaceId
|
Interface identifier of the interface to be retrieved.
|
TAny
*& aInterface
|
A reference to a pointer that retrieves the specified interface.
|
TAny
* aInput
|
An arbitrary input argument.
|
GetInterfaceTraced(TInt, TAny *&, TAny *)
TInt
|
GetInterfaceTraced
|
(
|
TInt
|
aInterfaceId,
|
|
TAny
*&
|
aInterface,
|
|
TAny
*
|
aInput
|
|
)
|
[protected]
|
InitL(TDrive *, TDrive *, HBufC *)
LocalBufferSupport()
TBool
|
LocalBufferSupport
|
(
|
)
|
const
|
LocalDrive(TBusLocalDrive *&)
MaxSupportedSize(void)
TUint64
|
MaxSupportedSize
|
(
|
void
|
|
)
|
const [protected]
|
Modified()
TTime
|
Modified
|
(
|
)
|
const [inline]
|
Gets the universal time when the file was last modified.
Mount()
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()
void
|
NotifyAsyncReaders
|
(
|
)
|
[private]
|
NotifyAsyncReadersPending()
TBool
|
NotifyAsyncReadersPending
|
(
|
)
|
const
|
PromoteShare(CFileShare *)
void
|
PromoteShare
|
(
|
CFileShare
*
|
aFileShare
|
)
|
[private]
|
ReadL(TInt64, TInt &, TDes8 *, const RMessagePtr2 &, TInt)
ReadL(TInt, TInt &, const TAny *, const RMessagePtr2 &)
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
aPos
|
Represents a position relative to the start of the file where ReadL() should start to read.
|
TInt
& aLength
|
On 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
* aDes
|
Pointer to a descriptor into which the data should be written.
|
const
RMessagePtr2
& aMessage
|
|
RemoveLock(CFileShare *, TInt, TInt)
RemoveLock64(CFileShare *, TInt64, TInt64)
RemoveLocks(CFileShare *)
RenameL(const TDesC &)
void
|
RenameL
|
(
|
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
& aNewName
|
The new full name of the file.
|
SetArchiveAttribute()
IMPORT_C void
|
SetArchiveAttribute
|
(
|
)
|
|
SetAtt(TInt)
void
|
SetAtt
|
(
|
TInt
|
aAtt
|
)
|
[inline]
|
Sets the file's attributes.
Parameters
TInt
aAtt
|
The file attribute bit mask.
|
SetBadPower(TBool)
void
|
SetBadPower
|
(
|
TBool
|
aBadPower
|
)
|
[inline]
|
Parameters
TBool
aBadPower
|
ETrue, if an operation on the file has failed due to bad power; EFalse if power has been found to be good.
|
SetCachedSize64(TInt64)
void
|
SetCachedSize64
|
(
|
TInt64
|
aSize
|
)
|
|
SetDeleteOnClose()
void
|
SetDeleteOnClose
|
(
|
)
|
|
SetEntryL(const TTime &, TUint, TUint)
void
|
SetEntryL
|
(
|
const
TTime
&
|
aTime,
|
|
TUint
|
aMask,
|
|
TUint
|
aVal
|
|
)
|
[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
& aTime
|
The new modified time, if the modified flag is set in aMask.
|
TUint
aMask
|
Bit mask containing bits set (to 1) that are to be set (to 1) in iAtt.
|
TUint
aVal
|
Bitmask containing bits set (to 1) that are to be unset (to 0) in iAtt.
|
SetFileCorrupt(TBool)
void
|
SetFileCorrupt
|
(
|
TBool
|
aFileCorrupt
|
)
|
[inline]
|
Sets whether the file is corrupt.
Parameters
TBool
aFileCorrupt
|
ETrue, if the file is corrupt; EFalse, otherwise.
|
SetLocalBufferSupport(TBool)
void
|
SetLocalBufferSupport
|
(
|
TBool
|
aEnabled
|
)
|
|
SetMaxSupportedSize(TUint64)
IMPORT_C void
|
SetMaxSupportedSize
|
(
|
TUint64
|
aMaxFileSize
|
)
|
|
SetModified(TTime)
void
|
SetModified
|
(
|
TTime
|
aModified
|
)
|
[inline]
|
Sets the universal time when the file was last modified.
Parameters
TTime
aModified
|
The universal time when the file was last modified.
|
SetMount(CMountCB *)
void
|
SetMount
|
(
|
CMountCB
*
|
aMount
|
)
|
[inline]
|
Sets the mount associated with the file.
SetNotifyAsyncReadersPending(TBool)
void
|
SetNotifyAsyncReadersPending
|
(
|
TBool
|
aNotifyAsyncReadersPending
|
)
|
|
Parameters
TBool
aNotifyAsyncReadersPending
|
|
SetShare(TShare)
void
|
SetShare
|
(
|
TShare
|
aShare
|
)
|
[inline]
|
Sets the iShare value, which defines the level of access allowed to the file.
CFileCB::iShare
SetSize(TInt)
void
|
SetSize
|
(
|
TInt
|
aSize
|
)
|
[inline]
|
Sets the size of the file.
Parameters
TInt
aSize
|
The size of the file.
|
SetSize64(TInt64, TBool)
IMPORT_C void
|
SetSize64
|
(
|
TInt64
|
aSize,
|
|
TBool
|
aDriveLocked
|
|
)
|
|
SetSizeL(TInt64)
void
|
SetSizeL
|
(
|
TInt64
|
aSize
|
)
|
|
SetSizeL(TInt)
void
|
SetSizeL
|
(
|
TInt
|
aSize
|
)
|
[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.
Parameters
TInt
aSize
|
The 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
TInt64
|
Size64
|
(
|
)
|
const
|
UniqueID()
TInt
|
UniqueID
|
(
|
)
|
const [inline]
|
WriteL(TInt64, TInt &, const TDesC8 *, const RMessagePtr2 &, TInt)
WriteL(TInt, TInt &, const TAny *, const RMessagePtr2 &)
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.
Parameters
TInt
aPos
|
Represents a position relative to the start of the file where WriteL() should start to write.
|
TInt
& aLength
|
Specifies 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
* aDes
|
Pointer 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
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]
|
TBool
iFileCorrupt
TBool
|
iFileCorrupt
|
[protected]
|
Indicates whether the file that the object represents is corrupt: true if it is corrupt, false otherwise.
TFileLocksArray * iFileLocks
HBufC * iFileName
The full name of the file, including drive and extensions.
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.
TShare
iShare
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
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.
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.