0
|
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".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// f32\sfsrv\cl_dir.cpp
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
#include "cl_std.h"
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
EFSRV_EXPORT_C TInt RDir::Open(RFs& aFs,const TDesC& aName,const TUidType& aUidType)
|
|
24 |
/**
|
|
25 |
Opens a directory using the specified UID type to filter the
|
|
26 |
directory entry types that will subsequently be read.
|
|
27 |
|
|
28 |
This function, or its overload, must be called before reading the entries in
|
|
29 |
the directory.
|
|
30 |
|
|
31 |
Note: to close the directory, use Close()
|
|
32 |
|
|
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
|
|
39 |
Symbian OS Library.
|
|
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.
|
|
43 |
|
|
44 |
@return KErrNone, if successful, otherwise one of the other system-wide error
|
|
45 |
codes.
|
|
46 |
|
|
47 |
@capability AllFiles
|
|
48 |
|
|
49 |
*/
|
|
50 |
{
|
|
51 |
TRACEMULT5(UTF::EBorder, UTraceModuleEfsrv::EDirOpen1, MODULEUID,
|
|
52 |
Session().Handle(), aName, aUidType[0].iUid, aUidType[1].iUid, aUidType[2].iUid);
|
|
53 |
|
|
54 |
TPckgC<TUidType> pckgUid(aUidType);
|
|
55 |
TInt r = CreateSubSession(aFs,EFsDirOpen,TIpcArgs(&aName,KEntryAttAllowUid,&pckgUid));
|
|
56 |
|
|
57 |
TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EDirOpen1Return, MODULEUID, r, SubSessionHandle());
|
|
58 |
return r;
|
|
59 |
}
|
|
60 |
|
|
61 |
|
|
62 |
|
|
63 |
|
|
64 |
EFSRV_EXPORT_C TInt RDir::Open(RFs& aFs,const TDesC& aName,TUint anAttMask)
|
|
65 |
/**
|
|
66 |
Opens a directory using an attribute bitmask to filter the directory entry
|
|
67 |
types that will subsequently be read.
|
|
68 |
|
|
69 |
This function, or its overload, must be called before reading the entries in
|
|
70 |
the directory.
|
|
71 |
|
|
72 |
Note: to close the directory, use Close()
|
|
73 |
|
|
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
|
|
80 |
Symbian OS Library.
|
|
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.
|
|
85 |
|
|
86 |
@return KErrNone, if successful, otherwise one of the other system-wide error
|
|
87 |
codes.
|
|
88 |
|
|
89 |
@see KEntryAttNormal
|
|
90 |
|
|
91 |
@capability AllFiles
|
|
92 |
|
|
93 |
*/
|
|
94 |
{
|
|
95 |
TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EDirOpen2, MODULEUID, Session().Handle(), aName, anAttMask);
|
|
96 |
|
|
97 |
TUidType uidType(TUid::Null(),TUid::Null(),TUid::Null());
|
|
98 |
TPckgC<TUidType> pckgUid(uidType);
|
|
99 |
TInt r = CreateSubSession(aFs,EFsDirOpen,TIpcArgs(&aName,anAttMask,&pckgUid));
|
|
100 |
|
|
101 |
TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EDirOpen2Return, MODULEUID, r, SubSessionHandle());
|
|
102 |
return r;
|
|
103 |
}
|
|
104 |
|
|
105 |
EFSRV_EXPORT_C void RDir::Close()
|
|
106 |
/**
|
|
107 |
Closes the directory.
|
|
108 |
|
|
109 |
Any open files are closed when the file server session is closed.
|
|
110 |
|
|
111 |
Close() is guaranteed to return, and provides no indication whether
|
|
112 |
it completed successfully or not.
|
|
113 |
*/
|
|
114 |
{
|
|
115 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EDirClose, MODULEUID, Session().Handle(), SubSessionHandle());
|
|
116 |
|
|
117 |
CloseSubSession(EFsDirSubClose);
|
|
118 |
|
|
119 |
TRACE0(UTF::EBorder, UTraceModuleEfsrv::EDirCloseReturn, MODULEUID);
|
|
120 |
}
|
|
121 |
|
|
122 |
|
|
123 |
|
|
124 |
EFSRV_EXPORT_C TInt RDir::Read(TEntryArray& anArray) const
|
|
125 |
/**
|
|
126 |
Reads all filtered directory entries into the specified array.
|
|
127 |
|
|
128 |
This is a synchronous function that returns when the operation is complete.
|
|
129 |
|
|
130 |
@param anArray On successful return, contains filtered entries from
|
|
131 |
the directory.
|
|
132 |
|
|
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
|
|
135 |
to be read;
|
|
136 |
KErrEof, if the read operation is successful - all the entries
|
|
137 |
in the directory have been read, and anArray contains the final
|
|
138 |
set of entries;
|
|
139 |
otherwise one of the other system-wide error codes
|
|
140 |
(e.g. KErrCorrupt, KErrNoMemory etc).
|
|
141 |
*/
|
|
142 |
{
|
|
143 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EDirRead1, MODULEUID, Session().Handle(), SubSessionHandle());
|
|
144 |
|
|
145 |
anArray.iCount=KCountNeeded;
|
|
146 |
TInt r = SendReceive(EFsDirReadPacked,TIpcArgs(&anArray.iBuf));
|
|
147 |
|
|
148 |
TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EDirRead1Return, MODULEUID, r, anArray.Count());
|
|
149 |
return r;
|
|
150 |
}
|
|
151 |
|
|
152 |
|
|
153 |
|
|
154 |
|
|
155 |
EFSRV_EXPORT_C void RDir::Read(TEntryArray& anArray,TRequestStatus& aStatus) const
|
|
156 |
/**
|
|
157 |
Reads all filtered directory entries into the specified array.
|
|
158 |
|
|
159 |
This is an asynchronous function.
|
|
160 |
|
|
161 |
@param anArray On request completion, contains filtered entries from
|
|
162 |
the directory.
|
|
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
|
|
166 |
entries to be read;
|
|
167 |
KErrEof, if the read operation is successful - all the entries
|
|
168 |
in the directory have been read, and anArray contains the final
|
|
169 |
set of entries;
|
|
170 |
otherwise one of the other system-wide error codes
|
|
171 |
(e.g. KErrCorrupt, KErrNoMemory etc).
|
|
172 |
*/
|
|
173 |
{
|
|
174 |
TRACE3(UTF::EBorder, UTraceModuleEfsrv::EDirRead2, MODULEUID, Session().Handle(), SubSessionHandle(), &aStatus);
|
|
175 |
|
|
176 |
anArray.iCount=KCountNeeded;
|
|
177 |
RSubSessionBase::SendReceive(EFsDirReadPacked,TIpcArgs(&anArray.iBuf),aStatus);
|
|
178 |
|
|
179 |
TRACE0(UTF::EBorder, UTraceModuleEfsrv::EDirRead2Return, MODULEUID);
|
|
180 |
}
|
|
181 |
|
|
182 |
|
|
183 |
|
|
184 |
|
|
185 |
EFSRV_EXPORT_C TInt RDir::Read(TEntry& anEntry) const
|
|
186 |
/**
|
|
187 |
Reads a single directory entry.
|
|
188 |
|
|
189 |
This is a synchronous function that returns when the operation is complete.
|
|
190 |
|
|
191 |
@param anEntry On successful return, contains a directory entry.
|
|
192 |
|
|
193 |
@return KErrNone, if successful, otherwise one of the other system-wide error
|
|
194 |
codes.
|
|
195 |
*/
|
|
196 |
{
|
|
197 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EDirRead3, MODULEUID, Session().Handle(), SubSessionHandle());
|
|
198 |
|
|
199 |
TPckg<TEntry> e(anEntry);
|
|
200 |
TInt r = SendReceive(EFsDirReadOne,TIpcArgs(&e));
|
|
201 |
|
|
202 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EDirRead3Return, MODULEUID, r);
|
|
203 |
return r;
|
|
204 |
}
|
|
205 |
|
|
206 |
|
|
207 |
|
|
208 |
|
|
209 |
EFSRV_EXPORT_C void RDir::Read(TPckg<TEntry>& anEntry,TRequestStatus& aStatus) const
|
|
210 |
/**
|
|
211 |
Reads a single directory entry.
|
|
212 |
|
|
213 |
This is an asynchronous function.
|
|
214 |
|
|
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
|
|
218 |
error codes.
|
|
219 |
*/
|
|
220 |
{
|
|
221 |
TRACE3(UTF::EBorder, UTraceModuleEfsrv::EDirRead4, MODULEUID, Session().Handle(), SubSessionHandle(), &aStatus);
|
|
222 |
|
|
223 |
RSubSessionBase::SendReceive(EFsDirReadOne,TIpcArgs(&anEntry),aStatus);
|
|
224 |
|
|
225 |
TRACE0(UTF::EBorder, UTraceModuleEfsrv::EDirRead4Return, MODULEUID);
|
|
226 |
}
|