author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Fri, 11 Jun 2010 15:02:23 +0300 | |
changeset 152 | 657f875b013e |
parent 0 | a41df078684a |
child 257 | 3e88ff8f41d5 |
permissions | -rw-r--r-- |
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 |
||
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
20 |
#ifdef OST_TRACE_COMPILER_IN_USE |
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
21 |
#include "cl_dirTraces.h" |
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
22 |
#endif |
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
23 |
|
0 | 24 |
|
25 |
||
26 |
||
27 |
EFSRV_EXPORT_C TInt RDir::Open(RFs& aFs,const TDesC& aName,const TUidType& aUidType) |
|
28 |
/** |
|
29 |
Opens a directory using the specified UID type to filter the |
|
30 |
directory entry types that will subsequently be read. |
|
31 |
||
32 |
This function, or its overload, must be called before reading the entries in |
|
33 |
the directory. |
|
34 |
||
35 |
Note: to close the directory, use Close() |
|
36 |
||
37 |
@param aFs The file server session. |
|
38 |
@param aName Name of the directory to be opened. Any path components that |
|
39 |
are not specified here are taken from the session path. |
|
40 |
Note that the wildcard characters ? and * can be used. |
|
41 |
As with all directory paths aName must be terminated with '\', |
|
42 |
Please refer to "Structure of paths and filenames" section in the |
|
43 |
Symbian OS Library. |
|
44 |
@param aUidType UID type used by the Read() functions to filter the |
|
45 |
entry types required. Only those entries with the UID type |
|
46 |
specified here will be read. |
|
47 |
||
48 |
@return KErrNone, if successful, otherwise one of the other system-wide error |
|
49 |
codes. |
|
50 |
||
51 |
@capability AllFiles |
|
52 |
||
53 |
*/ |
|
54 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
55 |
OstTraceExt4(TRACE_BORDER, EFSRV_EDIROPEN1, "sess %x aUidType0 %x aUidType1 %x aUidType2 %x", (TUint) Session().Handle(), (TUint) aUidType[0].iUid, (TUint) aUidType[1].iUid, (TUint) aUidType[2].iUid); |
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
56 |
OstTraceData(TRACE_BORDER, EFSRV_EDIROPEN1_EDIRNAME, "Dir %S", aName.Ptr(), aName.Length()<<1); |
0 | 57 |
|
58 |
TPckgC<TUidType> pckgUid(aUidType); |
|
59 |
TInt r = CreateSubSession(aFs,EFsDirOpen,TIpcArgs(&aName,KEntryAttAllowUid,&pckgUid)); |
|
60 |
||
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
61 |
OstTraceExt2(TRACE_BORDER, EFSRV_EDIROPEN1RETURN, "r %d subs %x", (TUint) r, (TUint) SubSessionHandle()); |
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
62 |
|
0 | 63 |
return r; |
64 |
} |
|
65 |
||
66 |
||
67 |
||
68 |
||
69 |
EFSRV_EXPORT_C TInt RDir::Open(RFs& aFs,const TDesC& aName,TUint anAttMask) |
|
70 |
/** |
|
71 |
Opens a directory using an attribute bitmask to filter the directory entry |
|
72 |
types that will subsequently be read. |
|
73 |
||
74 |
This function, or its overload, must be called before reading the entries in |
|
75 |
the directory. |
|
76 |
||
77 |
Note: to close the directory, use Close() |
|
78 |
||
79 |
@param aFs The file server session. |
|
80 |
@param aName Name of the directory to be opened. Any path components that |
|
81 |
are not specified here are taken from the session path. |
|
82 |
Note that the wildcard characters ? and * can be used. |
|
83 |
As with all directory paths aName must be terminated with '\', |
|
84 |
Please refer to "Structure of paths and filenames" section in the |
|
85 |
Symbian OS Library. |
|
86 |
@param anAttMask An attribute mask used by the Read() functions to filter |
|
87 |
the entry types required. Only those entries with the |
|
88 |
attributes specified here will be read. See KEntryAttNormal, |
|
89 |
and the other file or directory attributes. |
|
90 |
||
91 |
@return KErrNone, if successful, otherwise one of the other system-wide error |
|
92 |
codes. |
|
93 |
||
94 |
@see KEntryAttNormal |
|
95 |
||
96 |
@capability AllFiles |
|
97 |
||
98 |
*/ |
|
99 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
100 |
OstTraceExt2(TRACE_BORDER, EFSRV_EDIROPEN2, "sess %x anAttMask %x", (TUint) Session().Handle(), (TUint) anAttMask); |
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
101 |
OstTraceData(TRACE_BORDER, EFSRV_EDIROPEN2_EDIRNAME, "Dir %S", aName.Ptr(), aName.Length()<<1); |
0 | 102 |
|
103 |
TUidType uidType(TUid::Null(),TUid::Null(),TUid::Null()); |
|
104 |
TPckgC<TUidType> pckgUid(uidType); |
|
105 |
TInt r = CreateSubSession(aFs,EFsDirOpen,TIpcArgs(&aName,anAttMask,&pckgUid)); |
|
106 |
||
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
107 |
OstTraceExt2(TRACE_BORDER, EFSRV_EDIROPEN2RETURN, "r %d subs %x", (TUint) r, (TUint) SubSessionHandle()); |
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
108 |
|
0 | 109 |
return r; |
110 |
} |
|
111 |
||
112 |
EFSRV_EXPORT_C void RDir::Close() |
|
113 |
/** |
|
114 |
Closes the directory. |
|
115 |
||
116 |
Any open files are closed when the file server session is closed. |
|
117 |
||
118 |
Close() is guaranteed to return, and provides no indication whether |
|
119 |
it completed successfully or not. |
|
120 |
*/ |
|
121 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
122 |
OstTraceExt2(TRACE_BORDER, EFSRV_EDIRCLOSE, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle()); |
0 | 123 |
|
124 |
CloseSubSession(EFsDirSubClose); |
|
125 |
||
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
126 |
OstTrace0(TRACE_BORDER, EFSRV_EDIRCLOSERETURN, ""); |
0 | 127 |
} |
128 |
||
129 |
||
130 |
||
131 |
EFSRV_EXPORT_C TInt RDir::Read(TEntryArray& anArray) const |
|
132 |
/** |
|
133 |
Reads all filtered directory entries into the specified array. |
|
134 |
||
135 |
This is a synchronous function that returns when the operation is complete. |
|
136 |
||
137 |
@param anArray On successful return, contains filtered entries from |
|
138 |
the directory. |
|
139 |
||
140 |
@return KErrNone, if the read operation is successful - the end of |
|
141 |
the directory has not yet been reached, and there may be more entries |
|
142 |
to be read; |
|
143 |
KErrEof, if the read operation is successful - all the entries |
|
144 |
in the directory have been read, and anArray contains the final |
|
145 |
set of entries; |
|
146 |
otherwise one of the other system-wide error codes |
|
147 |
(e.g. KErrCorrupt, KErrNoMemory etc). |
|
148 |
*/ |
|
149 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
150 |
OstTraceExt2(TRACE_BORDER, EFSRV_EDIRREAD1, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle()); |
0 | 151 |
|
152 |
anArray.iCount=KCountNeeded; |
|
153 |
TInt r = SendReceive(EFsDirReadPacked,TIpcArgs(&anArray.iBuf)); |
|
154 |
||
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
155 |
OstTraceExt2(TRACE_BORDER, EFSRV_EDIRREAD1RETURN, "r %d count %d", (TUint) r, (TUint) anArray.Count()); |
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
156 |
|
0 | 157 |
return r; |
158 |
} |
|
159 |
||
160 |
||
161 |
||
162 |
||
163 |
EFSRV_EXPORT_C void RDir::Read(TEntryArray& anArray,TRequestStatus& aStatus) const |
|
164 |
/** |
|
165 |
Reads all filtered directory entries into the specified array. |
|
166 |
||
167 |
This is an asynchronous function. |
|
168 |
||
169 |
@param anArray On request completion, contains filtered entries from |
|
170 |
the directory. |
|
171 |
@param aStatus The request status object. On completion, this will contain: |
|
172 |
KErrNone, if the read operation is successful - the end of |
|
173 |
the directory has not yet been reached, and there may be more |
|
174 |
entries to be read; |
|
175 |
KErrEof, if the read operation is successful - all the entries |
|
176 |
in the directory have been read, and anArray contains the final |
|
177 |
set of entries; |
|
178 |
otherwise one of the other system-wide error codes |
|
179 |
(e.g. KErrCorrupt, KErrNoMemory etc). |
|
180 |
*/ |
|
181 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
182 |
OstTraceExt3(TRACE_BORDER, EFSRV_EDIRREAD2, "sess %x subs %x status %x", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) &aStatus); |
0 | 183 |
|
184 |
anArray.iCount=KCountNeeded; |
|
185 |
RSubSessionBase::SendReceive(EFsDirReadPacked,TIpcArgs(&anArray.iBuf),aStatus); |
|
186 |
||
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
187 |
OstTrace0(TRACE_BORDER, EFSRV_EDIRREAD2RETURN, ""); |
0 | 188 |
} |
189 |
||
190 |
||
191 |
||
192 |
||
193 |
EFSRV_EXPORT_C TInt RDir::Read(TEntry& anEntry) const |
|
194 |
/** |
|
195 |
Reads a single directory entry. |
|
196 |
||
197 |
This is a synchronous function that returns when the operation is complete. |
|
198 |
||
199 |
@param anEntry On successful return, contains a directory entry. |
|
200 |
||
201 |
@return KErrNone, if successful, otherwise one of the other system-wide error |
|
202 |
codes. |
|
203 |
*/ |
|
204 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
205 |
OstTraceExt2(TRACE_BORDER, EFSRV_EDIRREAD3, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle()); |
0 | 206 |
|
207 |
TPckg<TEntry> e(anEntry); |
|
208 |
TInt r = SendReceive(EFsDirReadOne,TIpcArgs(&e)); |
|
209 |
||
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
210 |
OstTrace1(TRACE_BORDER, EFSRV_EDIRREAD3RETURN, "r %d", r); |
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
211 |
|
0 | 212 |
return r; |
213 |
} |
|
214 |
||
215 |
||
216 |
||
217 |
||
218 |
EFSRV_EXPORT_C void RDir::Read(TPckg<TEntry>& anEntry,TRequestStatus& aStatus) const |
|
219 |
/** |
|
220 |
Reads a single directory entry. |
|
221 |
||
222 |
This is an asynchronous function. |
|
223 |
||
224 |
@param anEntry On request completion, contains a directory entry. |
|
225 |
@param aStatus The request status object. On request completion, contains: |
|
226 |
KErrNone, if successful; otherwise one of the other system-wide |
|
227 |
error codes. |
|
228 |
*/ |
|
229 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
230 |
OstTraceExt3(TRACE_BORDER, EFSRV_EDIRREAD4, "sess %x subs %x status %x", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) &aStatus); |
0 | 231 |
|
232 |
RSubSessionBase::SendReceive(EFsDirReadOne,TIpcArgs(&anEntry),aStatus); |
|
233 |
||
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
234 |
OstTrace0(TRACE_BORDER, EFSRV_EDIRREAD4RETURN, ""); |
0 | 235 |
} |