sl@0: // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // f32\sfsrv\cl_dir.cpp sl@0: // sl@0: // sl@0: sl@0: #include "cl_std.h" sl@0: sl@0: sl@0: sl@0: sl@0: EFSRV_EXPORT_C TInt RDir::Open(RFs& aFs,const TDesC& aName,const TUidType& aUidType) sl@0: /** sl@0: Opens a directory using the specified UID type to filter the sl@0: directory entry types that will subsequently be read. sl@0: sl@0: This function, or its overload, must be called before reading the entries in sl@0: the directory. sl@0: sl@0: Note: to close the directory, use Close() sl@0: sl@0: @param aFs The file server session. sl@0: @param aName Name of the directory to be opened. Any path components that sl@0: are not specified here are taken from the session path. sl@0: Note that the wildcard characters ? and * can be used. sl@0: As with all directory paths aName must be terminated with '\', sl@0: Please refer to "Structure of paths and filenames" section in the sl@0: Symbian OS Library. sl@0: @param aUidType UID type used by the Read() functions to filter the sl@0: entry types required. Only those entries with the UID type sl@0: specified here will be read. sl@0: sl@0: @return KErrNone, if successful, otherwise one of the other system-wide error sl@0: codes. sl@0: sl@0: @capability AllFiles sl@0: sl@0: */ sl@0: { sl@0: TRACEMULT5(UTF::EBorder, UTraceModuleEfsrv::EDirOpen1, MODULEUID, sl@0: Session().Handle(), aName, aUidType[0].iUid, aUidType[1].iUid, aUidType[2].iUid); sl@0: sl@0: TPckgC pckgUid(aUidType); sl@0: TInt r = CreateSubSession(aFs,EFsDirOpen,TIpcArgs(&aName,KEntryAttAllowUid,&pckgUid)); sl@0: sl@0: TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EDirOpen1Return, MODULEUID, r, SubSessionHandle()); sl@0: return r; sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: EFSRV_EXPORT_C TInt RDir::Open(RFs& aFs,const TDesC& aName,TUint anAttMask) sl@0: /** sl@0: Opens a directory using an attribute bitmask to filter the directory entry sl@0: types that will subsequently be read. sl@0: sl@0: This function, or its overload, must be called before reading the entries in sl@0: the directory. sl@0: sl@0: Note: to close the directory, use Close() sl@0: sl@0: @param aFs The file server session. sl@0: @param aName Name of the directory to be opened. Any path components that sl@0: are not specified here are taken from the session path. sl@0: Note that the wildcard characters ? and * can be used. sl@0: As with all directory paths aName must be terminated with '\', sl@0: Please refer to "Structure of paths and filenames" section in the sl@0: Symbian OS Library. sl@0: @param anAttMask An attribute mask used by the Read() functions to filter sl@0: the entry types required. Only those entries with the sl@0: attributes specified here will be read. See KEntryAttNormal, sl@0: and the other file or directory attributes. sl@0: sl@0: @return KErrNone, if successful, otherwise one of the other system-wide error sl@0: codes. sl@0: sl@0: @see KEntryAttNormal sl@0: sl@0: @capability AllFiles sl@0: sl@0: */ sl@0: { sl@0: TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EDirOpen2, MODULEUID, Session().Handle(), aName, anAttMask); sl@0: sl@0: TUidType uidType(TUid::Null(),TUid::Null(),TUid::Null()); sl@0: TPckgC pckgUid(uidType); sl@0: TInt r = CreateSubSession(aFs,EFsDirOpen,TIpcArgs(&aName,anAttMask,&pckgUid)); sl@0: sl@0: TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EDirOpen2Return, MODULEUID, r, SubSessionHandle()); sl@0: return r; sl@0: } sl@0: sl@0: EFSRV_EXPORT_C void RDir::Close() sl@0: /** sl@0: Closes the directory. sl@0: sl@0: Any open files are closed when the file server session is closed. sl@0: sl@0: Close() is guaranteed to return, and provides no indication whether sl@0: it completed successfully or not. sl@0: */ sl@0: { sl@0: TRACE2(UTF::EBorder, UTraceModuleEfsrv::EDirClose, MODULEUID, Session().Handle(), SubSessionHandle()); sl@0: sl@0: CloseSubSession(EFsDirSubClose); sl@0: sl@0: TRACE0(UTF::EBorder, UTraceModuleEfsrv::EDirCloseReturn, MODULEUID); sl@0: } sl@0: sl@0: sl@0: sl@0: EFSRV_EXPORT_C TInt RDir::Read(TEntryArray& anArray) const sl@0: /** sl@0: Reads all filtered directory entries into the specified array. sl@0: sl@0: This is a synchronous function that returns when the operation is complete. sl@0: sl@0: @param anArray On successful return, contains filtered entries from sl@0: the directory. sl@0: sl@0: @return KErrNone, if the read operation is successful - the end of sl@0: the directory has not yet been reached, and there may be more entries sl@0: to be read; sl@0: KErrEof, if the read operation is successful - all the entries sl@0: in the directory have been read, and anArray contains the final sl@0: set of entries; sl@0: otherwise one of the other system-wide error codes sl@0: (e.g. KErrCorrupt, KErrNoMemory etc). sl@0: */ sl@0: { sl@0: TRACE2(UTF::EBorder, UTraceModuleEfsrv::EDirRead1, MODULEUID, Session().Handle(), SubSessionHandle()); sl@0: sl@0: anArray.iCount=KCountNeeded; sl@0: TInt r = SendReceive(EFsDirReadPacked,TIpcArgs(&anArray.iBuf)); sl@0: sl@0: TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EDirRead1Return, MODULEUID, r, anArray.Count()); sl@0: return r; sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: EFSRV_EXPORT_C void RDir::Read(TEntryArray& anArray,TRequestStatus& aStatus) const sl@0: /** sl@0: Reads all filtered directory entries into the specified array. sl@0: sl@0: This is an asynchronous function. sl@0: sl@0: @param anArray On request completion, contains filtered entries from sl@0: the directory. sl@0: @param aStatus The request status object. On completion, this will contain: sl@0: KErrNone, if the read operation is successful - the end of sl@0: the directory has not yet been reached, and there may be more sl@0: entries to be read; sl@0: KErrEof, if the read operation is successful - all the entries sl@0: in the directory have been read, and anArray contains the final sl@0: set of entries; sl@0: otherwise one of the other system-wide error codes sl@0: (e.g. KErrCorrupt, KErrNoMemory etc). sl@0: */ sl@0: { sl@0: TRACE3(UTF::EBorder, UTraceModuleEfsrv::EDirRead2, MODULEUID, Session().Handle(), SubSessionHandle(), &aStatus); sl@0: sl@0: anArray.iCount=KCountNeeded; sl@0: RSubSessionBase::SendReceive(EFsDirReadPacked,TIpcArgs(&anArray.iBuf),aStatus); sl@0: sl@0: TRACE0(UTF::EBorder, UTraceModuleEfsrv::EDirRead2Return, MODULEUID); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: EFSRV_EXPORT_C TInt RDir::Read(TEntry& anEntry) const sl@0: /** sl@0: Reads a single directory entry. sl@0: sl@0: This is a synchronous function that returns when the operation is complete. sl@0: sl@0: @param anEntry On successful return, contains a directory entry. sl@0: sl@0: @return KErrNone, if successful, otherwise one of the other system-wide error sl@0: codes. sl@0: */ sl@0: { sl@0: TRACE2(UTF::EBorder, UTraceModuleEfsrv::EDirRead3, MODULEUID, Session().Handle(), SubSessionHandle()); sl@0: sl@0: TPckg e(anEntry); sl@0: TInt r = SendReceive(EFsDirReadOne,TIpcArgs(&e)); sl@0: sl@0: TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EDirRead3Return, MODULEUID, r); sl@0: return r; sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: EFSRV_EXPORT_C void RDir::Read(TPckg& anEntry,TRequestStatus& aStatus) const sl@0: /** sl@0: Reads a single directory entry. sl@0: sl@0: This is an asynchronous function. sl@0: sl@0: @param anEntry On request completion, contains a directory entry. sl@0: @param aStatus The request status object. On request completion, contains: sl@0: KErrNone, if successful; otherwise one of the other system-wide sl@0: error codes. sl@0: */ sl@0: { sl@0: TRACE3(UTF::EBorder, UTraceModuleEfsrv::EDirRead4, MODULEUID, Session().Handle(), SubSessionHandle(), &aStatus); sl@0: sl@0: RSubSessionBase::SendReceive(EFsDirReadOne,TIpcArgs(&anEntry),aStatus); sl@0: sl@0: TRACE0(UTF::EBorder, UTraceModuleEfsrv::EDirRead4Return, MODULEUID); sl@0: }