sl@0
|
1 |
// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// f32\sfsrv\cl_dir.cpp
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
#include "cl_std.h"
|
sl@0
|
19 |
|
sl@0
|
20 |
|
sl@0
|
21 |
|
sl@0
|
22 |
|
sl@0
|
23 |
EFSRV_EXPORT_C TInt RDir::Open(RFs& aFs,const TDesC& aName,const TUidType& aUidType)
|
sl@0
|
24 |
/**
|
sl@0
|
25 |
Opens a directory using the specified UID type to filter the
|
sl@0
|
26 |
directory entry types that will subsequently be read.
|
sl@0
|
27 |
|
sl@0
|
28 |
This function, or its overload, must be called before reading the entries in
|
sl@0
|
29 |
the directory.
|
sl@0
|
30 |
|
sl@0
|
31 |
Note: to close the directory, use Close()
|
sl@0
|
32 |
|
sl@0
|
33 |
@param aFs The file server session.
|
sl@0
|
34 |
@param aName Name of the directory to be opened. Any path components that
|
sl@0
|
35 |
are not specified here are taken from the session path.
|
sl@0
|
36 |
Note that the wildcard characters ? and * can be used.
|
sl@0
|
37 |
As with all directory paths aName must be terminated with '\',
|
sl@0
|
38 |
Please refer to "Structure of paths and filenames" section in the
|
sl@0
|
39 |
Symbian OS Library.
|
sl@0
|
40 |
@param aUidType UID type used by the Read() functions to filter the
|
sl@0
|
41 |
entry types required. Only those entries with the UID type
|
sl@0
|
42 |
specified here will be read.
|
sl@0
|
43 |
|
sl@0
|
44 |
@return KErrNone, if successful, otherwise one of the other system-wide error
|
sl@0
|
45 |
codes.
|
sl@0
|
46 |
|
sl@0
|
47 |
@capability AllFiles
|
sl@0
|
48 |
|
sl@0
|
49 |
*/
|
sl@0
|
50 |
{
|
sl@0
|
51 |
TRACEMULT5(UTF::EBorder, UTraceModuleEfsrv::EDirOpen1, MODULEUID,
|
sl@0
|
52 |
Session().Handle(), aName, aUidType[0].iUid, aUidType[1].iUid, aUidType[2].iUid);
|
sl@0
|
53 |
|
sl@0
|
54 |
TPckgC<TUidType> pckgUid(aUidType);
|
sl@0
|
55 |
TInt r = CreateSubSession(aFs,EFsDirOpen,TIpcArgs(&aName,KEntryAttAllowUid,&pckgUid));
|
sl@0
|
56 |
|
sl@0
|
57 |
TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EDirOpen1Return, MODULEUID, r, SubSessionHandle());
|
sl@0
|
58 |
return r;
|
sl@0
|
59 |
}
|
sl@0
|
60 |
|
sl@0
|
61 |
|
sl@0
|
62 |
|
sl@0
|
63 |
|
sl@0
|
64 |
EFSRV_EXPORT_C TInt RDir::Open(RFs& aFs,const TDesC& aName,TUint anAttMask)
|
sl@0
|
65 |
/**
|
sl@0
|
66 |
Opens a directory using an attribute bitmask to filter the directory entry
|
sl@0
|
67 |
types that will subsequently be read.
|
sl@0
|
68 |
|
sl@0
|
69 |
This function, or its overload, must be called before reading the entries in
|
sl@0
|
70 |
the directory.
|
sl@0
|
71 |
|
sl@0
|
72 |
Note: to close the directory, use Close()
|
sl@0
|
73 |
|
sl@0
|
74 |
@param aFs The file server session.
|
sl@0
|
75 |
@param aName Name of the directory to be opened. Any path components that
|
sl@0
|
76 |
are not specified here are taken from the session path.
|
sl@0
|
77 |
Note that the wildcard characters ? and * can be used.
|
sl@0
|
78 |
As with all directory paths aName must be terminated with '\',
|
sl@0
|
79 |
Please refer to "Structure of paths and filenames" section in the
|
sl@0
|
80 |
Symbian OS Library.
|
sl@0
|
81 |
@param anAttMask An attribute mask used by the Read() functions to filter
|
sl@0
|
82 |
the entry types required. Only those entries with the
|
sl@0
|
83 |
attributes specified here will be read. See KEntryAttNormal,
|
sl@0
|
84 |
and the other file or directory attributes.
|
sl@0
|
85 |
|
sl@0
|
86 |
@return KErrNone, if successful, otherwise one of the other system-wide error
|
sl@0
|
87 |
codes.
|
sl@0
|
88 |
|
sl@0
|
89 |
@see KEntryAttNormal
|
sl@0
|
90 |
|
sl@0
|
91 |
@capability AllFiles
|
sl@0
|
92 |
|
sl@0
|
93 |
*/
|
sl@0
|
94 |
{
|
sl@0
|
95 |
TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EDirOpen2, MODULEUID, Session().Handle(), aName, anAttMask);
|
sl@0
|
96 |
|
sl@0
|
97 |
TUidType uidType(TUid::Null(),TUid::Null(),TUid::Null());
|
sl@0
|
98 |
TPckgC<TUidType> pckgUid(uidType);
|
sl@0
|
99 |
TInt r = CreateSubSession(aFs,EFsDirOpen,TIpcArgs(&aName,anAttMask,&pckgUid));
|
sl@0
|
100 |
|
sl@0
|
101 |
TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EDirOpen2Return, MODULEUID, r, SubSessionHandle());
|
sl@0
|
102 |
return r;
|
sl@0
|
103 |
}
|
sl@0
|
104 |
|
sl@0
|
105 |
EFSRV_EXPORT_C void RDir::Close()
|
sl@0
|
106 |
/**
|
sl@0
|
107 |
Closes the directory.
|
sl@0
|
108 |
|
sl@0
|
109 |
Any open files are closed when the file server session is closed.
|
sl@0
|
110 |
|
sl@0
|
111 |
Close() is guaranteed to return, and provides no indication whether
|
sl@0
|
112 |
it completed successfully or not.
|
sl@0
|
113 |
*/
|
sl@0
|
114 |
{
|
sl@0
|
115 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EDirClose, MODULEUID, Session().Handle(), SubSessionHandle());
|
sl@0
|
116 |
|
sl@0
|
117 |
CloseSubSession(EFsDirSubClose);
|
sl@0
|
118 |
|
sl@0
|
119 |
TRACE0(UTF::EBorder, UTraceModuleEfsrv::EDirCloseReturn, MODULEUID);
|
sl@0
|
120 |
}
|
sl@0
|
121 |
|
sl@0
|
122 |
|
sl@0
|
123 |
|
sl@0
|
124 |
EFSRV_EXPORT_C TInt RDir::Read(TEntryArray& anArray) const
|
sl@0
|
125 |
/**
|
sl@0
|
126 |
Reads all filtered directory entries into the specified array.
|
sl@0
|
127 |
|
sl@0
|
128 |
This is a synchronous function that returns when the operation is complete.
|
sl@0
|
129 |
|
sl@0
|
130 |
@param anArray On successful return, contains filtered entries from
|
sl@0
|
131 |
the directory.
|
sl@0
|
132 |
|
sl@0
|
133 |
@return KErrNone, if the read operation is successful - the end of
|
sl@0
|
134 |
the directory has not yet been reached, and there may be more entries
|
sl@0
|
135 |
to be read;
|
sl@0
|
136 |
KErrEof, if the read operation is successful - all the entries
|
sl@0
|
137 |
in the directory have been read, and anArray contains the final
|
sl@0
|
138 |
set of entries;
|
sl@0
|
139 |
otherwise one of the other system-wide error codes
|
sl@0
|
140 |
(e.g. KErrCorrupt, KErrNoMemory etc).
|
sl@0
|
141 |
*/
|
sl@0
|
142 |
{
|
sl@0
|
143 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EDirRead1, MODULEUID, Session().Handle(), SubSessionHandle());
|
sl@0
|
144 |
|
sl@0
|
145 |
anArray.iCount=KCountNeeded;
|
sl@0
|
146 |
TInt r = SendReceive(EFsDirReadPacked,TIpcArgs(&anArray.iBuf));
|
sl@0
|
147 |
|
sl@0
|
148 |
TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EDirRead1Return, MODULEUID, r, anArray.Count());
|
sl@0
|
149 |
return r;
|
sl@0
|
150 |
}
|
sl@0
|
151 |
|
sl@0
|
152 |
|
sl@0
|
153 |
|
sl@0
|
154 |
|
sl@0
|
155 |
EFSRV_EXPORT_C void RDir::Read(TEntryArray& anArray,TRequestStatus& aStatus) const
|
sl@0
|
156 |
/**
|
sl@0
|
157 |
Reads all filtered directory entries into the specified array.
|
sl@0
|
158 |
|
sl@0
|
159 |
This is an asynchronous function.
|
sl@0
|
160 |
|
sl@0
|
161 |
@param anArray On request completion, contains filtered entries from
|
sl@0
|
162 |
the directory.
|
sl@0
|
163 |
@param aStatus The request status object. On completion, this will contain:
|
sl@0
|
164 |
KErrNone, if the read operation is successful - the end of
|
sl@0
|
165 |
the directory has not yet been reached, and there may be more
|
sl@0
|
166 |
entries to be read;
|
sl@0
|
167 |
KErrEof, if the read operation is successful - all the entries
|
sl@0
|
168 |
in the directory have been read, and anArray contains the final
|
sl@0
|
169 |
set of entries;
|
sl@0
|
170 |
otherwise one of the other system-wide error codes
|
sl@0
|
171 |
(e.g. KErrCorrupt, KErrNoMemory etc).
|
sl@0
|
172 |
*/
|
sl@0
|
173 |
{
|
sl@0
|
174 |
TRACE3(UTF::EBorder, UTraceModuleEfsrv::EDirRead2, MODULEUID, Session().Handle(), SubSessionHandle(), &aStatus);
|
sl@0
|
175 |
|
sl@0
|
176 |
anArray.iCount=KCountNeeded;
|
sl@0
|
177 |
RSubSessionBase::SendReceive(EFsDirReadPacked,TIpcArgs(&anArray.iBuf),aStatus);
|
sl@0
|
178 |
|
sl@0
|
179 |
TRACE0(UTF::EBorder, UTraceModuleEfsrv::EDirRead2Return, MODULEUID);
|
sl@0
|
180 |
}
|
sl@0
|
181 |
|
sl@0
|
182 |
|
sl@0
|
183 |
|
sl@0
|
184 |
|
sl@0
|
185 |
EFSRV_EXPORT_C TInt RDir::Read(TEntry& anEntry) const
|
sl@0
|
186 |
/**
|
sl@0
|
187 |
Reads a single directory entry.
|
sl@0
|
188 |
|
sl@0
|
189 |
This is a synchronous function that returns when the operation is complete.
|
sl@0
|
190 |
|
sl@0
|
191 |
@param anEntry On successful return, contains a directory entry.
|
sl@0
|
192 |
|
sl@0
|
193 |
@return KErrNone, if successful, otherwise one of the other system-wide error
|
sl@0
|
194 |
codes.
|
sl@0
|
195 |
*/
|
sl@0
|
196 |
{
|
sl@0
|
197 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EDirRead3, MODULEUID, Session().Handle(), SubSessionHandle());
|
sl@0
|
198 |
|
sl@0
|
199 |
TPckg<TEntry> e(anEntry);
|
sl@0
|
200 |
TInt r = SendReceive(EFsDirReadOne,TIpcArgs(&e));
|
sl@0
|
201 |
|
sl@0
|
202 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EDirRead3Return, MODULEUID, r);
|
sl@0
|
203 |
return r;
|
sl@0
|
204 |
}
|
sl@0
|
205 |
|
sl@0
|
206 |
|
sl@0
|
207 |
|
sl@0
|
208 |
|
sl@0
|
209 |
EFSRV_EXPORT_C void RDir::Read(TPckg<TEntry>& anEntry,TRequestStatus& aStatus) const
|
sl@0
|
210 |
/**
|
sl@0
|
211 |
Reads a single directory entry.
|
sl@0
|
212 |
|
sl@0
|
213 |
This is an asynchronous function.
|
sl@0
|
214 |
|
sl@0
|
215 |
@param anEntry On request completion, contains a directory entry.
|
sl@0
|
216 |
@param aStatus The request status object. On request completion, contains:
|
sl@0
|
217 |
KErrNone, if successful; otherwise one of the other system-wide
|
sl@0
|
218 |
error codes.
|
sl@0
|
219 |
*/
|
sl@0
|
220 |
{
|
sl@0
|
221 |
TRACE3(UTF::EBorder, UTraceModuleEfsrv::EDirRead4, MODULEUID, Session().Handle(), SubSessionHandle(), &aStatus);
|
sl@0
|
222 |
|
sl@0
|
223 |
RSubSessionBase::SendReceive(EFsDirReadOne,TIpcArgs(&anEntry),aStatus);
|
sl@0
|
224 |
|
sl@0
|
225 |
TRACE0(UTF::EBorder, UTraceModuleEfsrv::EDirRead4Return, MODULEUID);
|
sl@0
|
226 |
}
|