RFilePlugin Class Reference

class RFilePlugin : private RFile

Inherits from

Public Member Functions
RFilePlugin ( TFsPluginRequest &, TBool )
~RFilePlugin ()
IMPORT_C TInt AdoptFromClient ()
IMPORT_C TInt Att ( TUint &)
IMPORT_C TInt ChangeMode ( TFileMode )
IMPORT_C void Close ()
IMPORT_C TInt Create (const TDesC &, TUint )
IMPORT_C TInt Flush ()
IMPORT_C TInt Lock ( TInt64 , TInt64 )
IMPORT_C TInt Modified ( TTime &)
IMPORT_C TInt Open (const TDesC &, TUint )
IMPORT_C TInt Read ( TInt64 , TDes8 &)
IMPORT_C TInt Read ( TInt64 , TDes8 &, TInt )
IMPORT_C TInt Rename (const TDesC &)
IMPORT_C TInt Replace (const TDesC &, TUint )
IMPORT_C TInt Seek ( TSeek , TInt64 &)
IMPORT_C TInt Set (const TTime &, TUint , TUint )
IMPORT_C TInt SetAtt ( TUint , TUint )
IMPORT_C TInt SetModified (const TTime &)
IMPORT_C TInt SetSize ( TInt64 )
IMPORT_C TInt Size ( TInt64 &)
IMPORT_C TInt Temp (const TDesC &, TFileName &, TUint )
IMPORT_C TInt TransferToClient ()
IMPORT_C TInt UnLock ( TInt64 , TInt64 )
IMPORT_C TInt Write ( TInt64 , const TDesC8 &)
IMPORT_C TInt Write ( TInt64 , const TDesC8 &, TInt )
Protected Member Functions
void CloseSubSession ( TInt )
TInt CreateSubSession (const RSessionBase &, TInt , const TIpcArgs &)
TInt SendReceive ( TInt , const TIpcArgs &)
Private Member Functions
RFilePlugin ()
RFilePlugin (const RFilePlugin &)
void SetHandle ( TInt )
void SetSubSessionHandle ( TInt )
RFilePlugin & operator= (const RFilePlugin &)
Inherited Functions
RFile::Adopt(RFs &,TInt)
RFile::AdoptFromClient(const RMessage2 &,TInt,TInt)
RFile::AdoptFromCreator(TInt,TInt)
RFile::AdoptFromServer(TInt,TInt)
RFile::BlockMap(SBlockMapInfo &,TInt64 &,TInt64,TInt)const
RFile::Clamp(RFileClamp &)
RFile::Create(RFs &,const TDesC &,TUint)
RFile::Drive(TInt &,TDriveInfo &)const
RFile::Duplicate(const RFile &,TOwnerType)
RFile::DuplicateHandle(TInt &)const
RFile::Flush(TRequestStatus &)
RFile::FullName(TDes &)const
RFile::Lock(TInt,TInt)const
RFile::Name(TDes &)const
RFile::Open(RFs &,const TDesC &,TUint)
RFile::Read(TDes8 &)const
RFile::Read(TDes8 &,TInt)const
RFile::Read(TDes8 &,TInt,TRequestStatus &)const
RFile::Read(TDes8 &,TRequestStatus &)const
RFile::Read(TInt,TDes8 &)const
RFile::Read(TInt,TDes8 &,TInt)const
RFile::Read(TInt,TDes8 &,TInt,TRequestStatus &)const
RFile::Read(TInt,TDes8 &,TRequestStatus &)const
RFile::ReadCancel()const
RFile::ReadCancel(TRequestStatus &)const
RFile::Replace(RFs &,const TDesC &,TUint)
RFile::Seek(TSeek,TInt &)const
RFile::SetSize(TInt)
RFile::Size(TInt &)const
RFile::Temp(RFs &,const TDesC &,TFileName &,TUint)
RFile::TransferToClient(const RMessage2 &,TInt)const
RFile::TransferToProcess(RProcess &,TInt,TInt)const
RFile::TransferToServer(TIpcArgs &,TInt,TInt)const
RFile::UnLock(TInt,TInt)const
RFile::Write(TInt,const TDesC8 &)
RFile::Write(TInt,const TDesC8 &,TInt)
RFile::Write(TInt,const TDesC8 &,TInt,TRequestStatus &)
RFile::Write(TInt,const TDesC8 &,TRequestStatus &)
RFile::Write(const TDesC8 &)
RFile::Write(const TDesC8 &,TInt)
RFile::Write(const TDesC8 &,TInt,TRequestStatus &)
RFile::Write(const TDesC8 &,TRequestStatus &)
RSubSessionBase::CreateAutoCloseSubSession(RSessionBase &,TInt,const TIpcArgs &)
RSubSessionBase::CreateSubSession(const RSessionBase &,TInt)
RSubSessionBase::RSubSessionBase()
RSubSessionBase::Send(TInt)const
RSubSessionBase::Send(TInt,const TIpcArgs &)const
RSubSessionBase::SendReceive(TInt)const
RSubSessionBase::SendReceive(TInt,TRequestStatus &)const
RSubSessionBase::SendReceive(TInt,const TIpcArgs &,TRequestStatus &)const
RSubSessionBase::Session()const
RSubSessionBase::SubSessionHandle()const
Private Attributes
TPluginSessionHelper iSessionHelper

Constructor & Destructor Documentation

RFilePlugin(TFsPluginRequest &, TBool)

IMPORT_C RFilePlugin ( TFsPluginRequest & aRequest,
TBool aDirectToDrive = EFalse
)

Parameters

TFsPluginRequest & aRequest
TBool aDirectToDrive = EFalse

RFilePlugin()

RFilePlugin ( ) [private]

RFilePlugin(const RFilePlugin &)

RFilePlugin ( const RFilePlugin & ) [private]

Parameters

const RFilePlugin &

~RFilePlugin()

IMPORT_C ~RFilePlugin ( )

Member Functions Documentation

AdoptFromClient()

IMPORT_C TInt AdoptFromClient ( )

Att(TUint &)

IMPORT_C TInt Att ( TUint & aAttValue ) const

Gets the file's attributes.

KEntryAttNormal

Parameters

TUint & aAttValue A bitmask which, on return, contains the file s attributes. For more information, see KEntryAttNormal and the other file/directory attributes.

ChangeMode(TFileMode)

IMPORT_C TInt ChangeMode ( TFileMode aNewMode )

Switches an open file's access mode between EFileShareExclusive and EFileShareReadersOnly.

This allows or disallows read-only access without having to close and re-open the file.

capability
Dependent If the path starts with /Resource then capability DiskAdmin is required

Parameters

TFileMode aNewMode The new access mode.

Close()

IMPORT_C void Close ( )

Closes the file.

Any open files are closed when the file server session is closed.

Close() is guaranteed to return, and provides no indication whether it completed successfully or not. When closing a file you have written to, you should ensure that data is committed to the file by invoking RFile::Flush() before closing. If Flush() completes successfully, Close() is essentially a no-operation.

CloseSubSession(TInt)

void CloseSubSession ( TInt aFunction ) [protected]

Parameters

TInt aFunction

Create(const TDesC &, TUint)

IMPORT_C TInt Create ( const TDesC & aName,
TUint aFileMode
)

Parameters

const TDesC & aName
TUint aFileMode

CreateSubSession(const RSessionBase &, TInt, const TIpcArgs &)

TInt CreateSubSession ( const RSessionBase & aSession,
TInt aFunction,
const TIpcArgs & aArgs
) [protected]

Creates a new sub-session within an existing session.

Parameters

const RSessionBase & aSession The session to which this sub-session will belong.
TInt aFunction The opcode specifying the requested service; the server should interpret this as a request to create a sub-session.
const TIpcArgs & aArgs The message arguments.

Flush()

IMPORT_C TInt Flush ( )

Commits data to the storage device and flushes internal buffers without closing the file.

Although RFile::Close() also flushes internal buffers, it is often useful to call Flush() before a file is closed. This is because Close() returns no error information, so there is no way of telling whether the final data was written to the file successfully or not. Once data has been flushed, Close() is effectively a no-operation.

Lock(TInt64, TInt64)

IMPORT_C TInt Lock ( TInt64 aPos,
TInt64 aLength
) const

Parameters

TInt64 aPos
TInt64 aLength

Modified(TTime &)

IMPORT_C TInt Modified ( TTime & aTime ) const

Gets local date and time the file was last modified, in universal time.

Parameters

TTime & aTime On return, contains the date and time the file was last modified in UTC.

Open(const TDesC &, TUint)

IMPORT_C TInt Open ( const TDesC & aName,
TUint aMode
)

Parameters

const TDesC & aName
TUint aMode

Read(TInt64, TDes8 &)

IMPORT_C TInt Read ( TInt64 aPos,
TDes8 & aDes
) const

Parameters

TInt64 aPos
TDes8 & aDes

Read(TInt64, TDes8 &, TInt)

IMPORT_C TInt Read ( TInt64 aPos,
TDes8 & aDes,
TInt aLength
) const

Parameters

TInt64 aPos
TDes8 & aDes
TInt aLength

Rename(const TDesC &)

IMPORT_C TInt Rename ( const TDesC & aNewName )

Renames a file.

If aNewName specifies a different directory to the one in which the file is currently located, then the file is moved.

No other process may have access to the file, that is, the file must have been opened in EFileShareExclusive share mode, or an error is returned. The file must have been opened for writing (using EFileWrite access mode). An error is returned if a file with the new filename already exists in the target directory.

The file or directory may not be moved to another device by this means, either explicitly (by another drive specified in the name) or implicitly (because the directory has been mapped to another device with RFs::SetSubst() ).

Note that the function builds up the new file specification by using all of the path components specified in aNewName (directory path, filename and extension), then adding any missing components from the current file specification, and finally adding any missing components from the session path. A consequence of this is that you cannot rename a file to remove its extension. An alternative to this function is RFs::Rename() which renames the file using the new name as provided.

capability
Dependent If aNewName starts with /Sys then capability Tcb is required
capability
Dependent If aNewName starts with /Resource then capability Tcb is required
capability
Dependent If aNewName starts with /Private and does not match this process' SID then AllFiles capability is required.

Parameters

const TDesC & aNewName The new file name and/or directory path. No part may contain wildcard characters or an error is returned.

Replace(const TDesC &, TUint)

IMPORT_C TInt Replace ( const TDesC & aName,
TUint aFileMode
)

Parameters

const TDesC & aName
TUint aFileMode

Seek(TSeek, TInt64 &)

IMPORT_C TInt Seek ( TSeek aMode,
TInt64 & aPos
) const

Parameters

TSeek aMode
TInt64 & aPos

SendReceive(TInt, const TIpcArgs &)

TInt SendReceive ( TInt aFunction,
const TIpcArgs & aArgs
) const [protected]

Sends a message to the server and waits synchronously for a reply.

An opcode specifies the service required. A set of message arguments is passed that can be used to specify client addresses, which the server can use to read from and write to the client address space.

Note that this function will only fail if the server itself fails or environmental errors occur in the server. All requests made using this function are guaranteed to reach the server. This means that all synchronous client requests (typically those that return void) should be routed through this synchronous variant of SendReceive() .

Parameters

TInt aFunction The opcode specifying the requested service.
const TIpcArgs & aArgs The message arguments.

Set(const TTime &, TUint, TUint)

IMPORT_C TInt Set ( const TTime & aTime,
TUint aSetAttMask,
TUint aClearAttMask
)

Sets the file s attributes, and the date and time it was last modified.

It combines the functionality of SetAtt() and SetModified()

An attempt to set or clear the KEntryAttDir, KEntryAttVolume or KEntryAttRemote attributes have no effect.

panic
FSCLIENT 21 if the same attribute bit is set in both bitmasks.
RFile::SetModified RFile::SetAtt

Parameters

const TTime & aTime The new date and time the file was last modified. UTC date and time should be used.
TUint aSetAttMask A bitmask indicating the file attributes to be set
TUint aClearAttMask A bitmask indicating the attributes to be cleared. For more information see KEntryAttNormal, and the other file/directory attributes.

SetAtt(TUint, TUint)

IMPORT_C TInt SetAtt ( TUint aSetAttMask,
TUint aClearAttMask
)

Sets or clears file attributes using two bitmasks.

The first mask controls which attributes are set. The second controls which attributes are cleared.

Notes:

1. The file must have been opened for writing, or an error is returned.

2. A panic is raised if any attribute is specified in both bitmasks.

3. An attempt to set or clear the KEntryAttDir, KEntryAttVolume or KEntryAttRemote attributes have no effect.

4. The new attribute values take effect when the file is flushed or closed (which implies a flush).

panic
FSCLIENT 21 if the same attribute bit is set in both bitmasks.

Parameters

TUint aSetAttMask A bitmask indicating the file attributes to be set
TUint aClearAttMask A bitmask indicating the attributes to be cleared. For more information see KEntryAttNormal, and the other file/directory attributes.

SetHandle(TInt)

void SetHandle ( TInt aHandle ) [private]

Parameters

TInt aHandle

SetModified(const TTime &)

IMPORT_C TInt SetModified ( const TTime & aTime )

Sets the date and time the file was last modified. UTC date and time should be used.

Notes:

1. The file must have been opened for writing, or an error is returned.

2. The new modified time takes effect when the file is flushed or closed (which implies a flush).

Parameters

const TTime & aTime The new date and time the file was last modified, in universal time.

SetSize(TInt64)

IMPORT_C TInt SetSize ( TInt64 aSize )

Parameters

TInt64 aSize

SetSubSessionHandle(TInt)

void SetSubSessionHandle ( TInt aHandle ) [private]

Parameters

TInt aHandle

Size(TInt64 &)

IMPORT_C TInt Size ( TInt64 & aSize ) const

Parameters

TInt64 & aSize

Temp(const TDesC &, TFileName &, TUint)

IMPORT_C TInt Temp ( const TDesC & aPath,
TFileName & aName,
TUint aFileMode
)

Parameters

const TDesC & aPath
TFileName & aName
TUint aFileMode

TransferToClient()

IMPORT_C TInt TransferToClient ( )

UnLock(TInt64, TInt64)

IMPORT_C TInt UnLock ( TInt64 aPos,
TInt64 aLength
) const

Parameters

TInt64 aPos
TInt64 aLength

Write(TInt64, const TDesC8 &)

IMPORT_C TInt Write ( TInt64 aPos,
const TDesC8 & aDes
)

Parameters

TInt64 aPos
const TDesC8 & aDes

Write(TInt64, const TDesC8 &, TInt)

IMPORT_C TInt Write ( TInt64 aPos,
const TDesC8 & aDes,
TInt aLength
)

Parameters

TInt64 aPos
const TDesC8 & aDes
TInt aLength

operator=(const RFilePlugin &)

RFilePlugin & operator= ( const RFilePlugin & ) [private]

Parameters

const RFilePlugin &

Member Data Documentation

TPluginSessionHelper iSessionHelper

TPluginSessionHelper iSessionHelper [private]