Update contrib.
1 // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // f32\sfsrv\cl_dir.cpp
23 EFSRV_EXPORT_C TInt RDir::Open(RFs& aFs,const TDesC& aName,const TUidType& aUidType)
25 Opens a directory using the specified UID type to filter the
26 directory entry types that will subsequently be read.
28 This function, or its overload, must be called before reading the entries in
31 Note: to close the directory, use Close()
33 @param aFs The file server session.
34 @param aName Name of the directory to be opened. Any path components that
35 are not specified here are taken from the session path.
36 Note that the wildcard characters ? and * can be used.
37 As with all directory paths aName must be terminated with '\',
38 Please refer to "Structure of paths and filenames" section in the
40 @param aUidType UID type used by the Read() functions to filter the
41 entry types required. Only those entries with the UID type
42 specified here will be read.
44 @return KErrNone, if successful, otherwise one of the other system-wide error
51 TRACEMULT5(UTF::EBorder, UTraceModuleEfsrv::EDirOpen1, MODULEUID,
52 Session().Handle(), aName, aUidType[0].iUid, aUidType[1].iUid, aUidType[2].iUid);
54 TPckgC<TUidType> pckgUid(aUidType);
55 TInt r = CreateSubSession(aFs,EFsDirOpen,TIpcArgs(&aName,KEntryAttAllowUid,&pckgUid));
57 TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EDirOpen1Return, MODULEUID, r, SubSessionHandle());
64 EFSRV_EXPORT_C TInt RDir::Open(RFs& aFs,const TDesC& aName,TUint anAttMask)
66 Opens a directory using an attribute bitmask to filter the directory entry
67 types that will subsequently be read.
69 This function, or its overload, must be called before reading the entries in
72 Note: to close the directory, use Close()
74 @param aFs The file server session.
75 @param aName Name of the directory to be opened. Any path components that
76 are not specified here are taken from the session path.
77 Note that the wildcard characters ? and * can be used.
78 As with all directory paths aName must be terminated with '\',
79 Please refer to "Structure of paths and filenames" section in the
81 @param anAttMask An attribute mask used by the Read() functions to filter
82 the entry types required. Only those entries with the
83 attributes specified here will be read. See KEntryAttNormal,
84 and the other file or directory attributes.
86 @return KErrNone, if successful, otherwise one of the other system-wide error
95 TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EDirOpen2, MODULEUID, Session().Handle(), aName, anAttMask);
97 TUidType uidType(TUid::Null(),TUid::Null(),TUid::Null());
98 TPckgC<TUidType> pckgUid(uidType);
99 TInt r = CreateSubSession(aFs,EFsDirOpen,TIpcArgs(&aName,anAttMask,&pckgUid));
101 TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EDirOpen2Return, MODULEUID, r, SubSessionHandle());
105 EFSRV_EXPORT_C void RDir::Close()
107 Closes the directory.
109 Any open files are closed when the file server session is closed.
111 Close() is guaranteed to return, and provides no indication whether
112 it completed successfully or not.
115 TRACE2(UTF::EBorder, UTraceModuleEfsrv::EDirClose, MODULEUID, Session().Handle(), SubSessionHandle());
117 CloseSubSession(EFsDirSubClose);
119 TRACE0(UTF::EBorder, UTraceModuleEfsrv::EDirCloseReturn, MODULEUID);
124 EFSRV_EXPORT_C TInt RDir::Read(TEntryArray& anArray) const
126 Reads all filtered directory entries into the specified array.
128 This is a synchronous function that returns when the operation is complete.
130 @param anArray On successful return, contains filtered entries from
133 @return KErrNone, if the read operation is successful - the end of
134 the directory has not yet been reached, and there may be more entries
136 KErrEof, if the read operation is successful - all the entries
137 in the directory have been read, and anArray contains the final
139 otherwise one of the other system-wide error codes
140 (e.g. KErrCorrupt, KErrNoMemory etc).
143 TRACE2(UTF::EBorder, UTraceModuleEfsrv::EDirRead1, MODULEUID, Session().Handle(), SubSessionHandle());
145 anArray.iCount=KCountNeeded;
146 TInt r = SendReceive(EFsDirReadPacked,TIpcArgs(&anArray.iBuf));
148 TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EDirRead1Return, MODULEUID, r, anArray.Count());
155 EFSRV_EXPORT_C void RDir::Read(TEntryArray& anArray,TRequestStatus& aStatus) const
157 Reads all filtered directory entries into the specified array.
159 This is an asynchronous function.
161 @param anArray On request completion, contains filtered entries from
163 @param aStatus The request status object. On completion, this will contain:
164 KErrNone, if the read operation is successful - the end of
165 the directory has not yet been reached, and there may be more
167 KErrEof, if the read operation is successful - all the entries
168 in the directory have been read, and anArray contains the final
170 otherwise one of the other system-wide error codes
171 (e.g. KErrCorrupt, KErrNoMemory etc).
174 TRACE3(UTF::EBorder, UTraceModuleEfsrv::EDirRead2, MODULEUID, Session().Handle(), SubSessionHandle(), &aStatus);
176 anArray.iCount=KCountNeeded;
177 RSubSessionBase::SendReceive(EFsDirReadPacked,TIpcArgs(&anArray.iBuf),aStatus);
179 TRACE0(UTF::EBorder, UTraceModuleEfsrv::EDirRead2Return, MODULEUID);
185 EFSRV_EXPORT_C TInt RDir::Read(TEntry& anEntry) const
187 Reads a single directory entry.
189 This is a synchronous function that returns when the operation is complete.
191 @param anEntry On successful return, contains a directory entry.
193 @return KErrNone, if successful, otherwise one of the other system-wide error
197 TRACE2(UTF::EBorder, UTraceModuleEfsrv::EDirRead3, MODULEUID, Session().Handle(), SubSessionHandle());
199 TPckg<TEntry> e(anEntry);
200 TInt r = SendReceive(EFsDirReadOne,TIpcArgs(&e));
202 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EDirRead3Return, MODULEUID, r);
209 EFSRV_EXPORT_C void RDir::Read(TPckg<TEntry>& anEntry,TRequestStatus& aStatus) const
211 Reads a single directory entry.
213 This is an asynchronous function.
215 @param anEntry On request completion, contains a directory entry.
216 @param aStatus The request status object. On request completion, contains:
217 KErrNone, if successful; otherwise one of the other system-wide
221 TRACE3(UTF::EBorder, UTraceModuleEfsrv::EDirRead4, MODULEUID, Session().Handle(), SubSessionHandle(), &aStatus);
223 RSubSessionBase::SendReceive(EFsDirReadOne,TIpcArgs(&anEntry),aStatus);
225 TRACE0(UTF::EBorder, UTraceModuleEfsrv::EDirRead4Return, MODULEUID);