author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Sat, 20 Feb 2010 00:10:51 +0200 | |
branch | RCL_3 |
changeset 19 | 4a8fed1c0ef6 |
parent 8 | 538db54a451d |
child 22 | 2f92ad2dc5db |
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_cli.cpp |
|
15 |
// |
|
16 |
// |
|
17 |
||
18 |
#include "cl_std.h" |
|
19 |
#include <f32fsys.h> |
|
20 |
||
21 |
||
22 |
||
23 |
||
24 |
||
25 |
||
26 |
||
27 |
EFSRV_EXPORT_C TBool RFs::IsValidDrive(TInt aDrive) |
|
28 |
/** |
|
29 |
Tests whether the specified drive number is valid. |
|
30 |
||
31 |
A valid drive number is any number between 0 and (KMaxDrives-1) inclusive, |
|
32 |
or the specific value KDefaultDrive (implying the session default drive). |
|
33 |
||
34 |
@param aDrive The drive number. |
|
35 |
||
36 |
@return True if the drive is valid; false if not. |
|
37 |
||
38 |
@see TDriveNumber |
|
39 |
*/ |
|
40 |
{ |
|
41 |
||
42 |
return((aDrive>=0 && aDrive<KMaxDrives) || aDrive==KDefaultDrive); |
|
43 |
} |
|
44 |
||
45 |
||
46 |
||
47 |
||
48 |
EFSRV_EXPORT_C TInt RFs::CharToDrive(TChar aChar,TInt& aDrive) |
|
49 |
/** |
|
50 |
Maps a drive character to a drive number. |
|
51 |
||
52 |
The drive character must be in the range A to Z or a to z. For example, drive A (or a) |
|
53 |
corresponds to zero, drive B (or b) corresponds to 1 etc. For the drive number |
|
54 |
enumeration, see TDriveNumber. |
|
55 |
||
56 |
@param aChar The drive character. |
|
57 |
@param aDrive On return, contains the drive number. |
|
58 |
||
59 |
@return KErrNone, if successful; |
|
60 |
KErrArgument, if the drive character is not in the range A to Z or a to z. |
|
61 |
||
62 |
@see TDriveNumber |
|
63 |
*/ |
|
64 |
{ |
|
65 |
||
66 |
aChar.UpperCase(); |
|
67 |
if (aChar>='A' && aChar<='Z') |
|
68 |
{ |
|
69 |
aDrive=(TInt)aChar-'A'; |
|
70 |
return(KErrNone); |
|
71 |
} |
|
72 |
return(KErrArgument); |
|
73 |
} |
|
74 |
||
75 |
||
76 |
||
77 |
||
78 |
EFSRV_EXPORT_C TInt RFs::DriveToChar(TInt aDrive,TChar& aChar) |
|
79 |
/** |
|
80 |
Maps a drive number to the corresponding character. |
|
81 |
||
82 |
The drive number must be in the range 0 to (KMaxDrives-1). For example, drive |
|
83 |
number zero (EDriveA) corresponds to drive A, one (EDriveB) |
|
84 |
corresponds to drive B. For the drive number enumeration, see TDriveNumber. |
|
85 |
||
86 |
The drive number can also be KDefaultDrive, implying the default drive. In this |
|
87 |
case the current drive is taken and converted. |
|
88 |
||
89 |
@param aDrive The drive number. |
|
90 |
@param aChar On return, contains the drive character. |
|
91 |
||
92 |
@return KErrNone, if successful; |
|
93 |
KErrArgument, if the drive number is invalid; |
|
94 |
otherwise one of the other system-wide error codes. |
|
95 |
*/ |
|
96 |
{ |
|
97 |
||
98 |
if (aDrive==KDefaultDrive) |
|
99 |
{ |
|
100 |
TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsDriveToChar, MODULEUID, aDrive); |
|
101 |
RFs fs; |
|
102 |
TFileName path; |
|
103 |
TInt r=fs.Connect(); |
|
104 |
if (r!=KErrNone) |
|
105 |
return(r); |
|
106 |
r=fs.SessionPath(path); |
|
107 |
fs.Close(); |
|
108 |
if (r!=KErrNone) |
|
109 |
return(r); |
|
110 |
aChar=path[0]; |
|
111 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsDriveToCharReturn, MODULEUID, KErrNone, aChar); |
|
112 |
return(KErrNone); |
|
113 |
} |
|
114 |
if (!IsValidDrive(aDrive)) |
|
115 |
return(KErrArgument); |
|
116 |
aChar=aDrive+'A'; |
|
117 |
return(KErrNone); |
|
118 |
} |
|
119 |
||
120 |
||
121 |
||
122 |
||
123 |
EFSRV_EXPORT_C TBool RFs::IsRomAddress(TAny *aPtr) |
|
124 |
/** |
|
125 |
Tests whether the specified address is in ROM. |
|
126 |
||
127 |
@param aPtr The address. |
|
128 |
||
129 |
@return True, if the address is in ROM; false, if not. |
|
130 |
*/ |
|
131 |
{ |
|
132 |
TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsIsRomAddress, MODULEUID, aPtr); |
|
133 |
||
134 |
TBool res; |
|
135 |
TInt r=User::IsRomAddress(res,aPtr); // Only returns error on WINS |
|
136 |
if (r!=KErrNone) |
|
137 |
res=EFalse; |
|
138 |
||
139 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsIsRomAddressReturn, MODULEUID, res); |
|
140 |
return(res); |
|
141 |
} |
|
142 |
||
143 |
||
144 |
||
145 |
/** |
|
146 |
Obtain the system drive number. |
|
147 |
||
148 |
The System Drive is a defined drive on the device which is: |
|
149 |
- Read/Writeable |
|
150 |
- Internal: Always available and not removable from the device |
|
151 |
- Non-Volatile (e.g. Flash memory, battery-backed RAM) |
|
152 |
- Only Accessible via Rfs (e.g. not available via USB mass storage) |
|
153 |
||
154 |
The System drive is utilised as: |
|
155 |
- Storage for Persistent settings from system and application software |
|
156 |
- Storage for Localisation resources |
|
157 |
- A Default Drive for user data |
|
158 |
- A Target Drive for Software installations |
|
159 |
||
160 |
It the system drive is not set previously (see RFs::SetSystemDrive) EDriveC is returned by default. |
|
161 |
||
162 |
@see RFs::GetSystemDriveChar |
|
163 |
@see RFs::SetSystemDrive |
|
164 |
@see TDriveNumber |
|
165 |
@return TDriveNumber contains the drive number of the system drive. |
|
166 |
*/ |
|
167 |
EFSRV_EXPORT_C TDriveNumber RFs::GetSystemDrive() |
|
168 |
{ |
|
169 |
TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsGetSystemDrive, MODULEUID); |
|
170 |
TInt drive; |
|
171 |
TInt err = RProperty::Get(TSecureId(KFileServerUidValue), KSystemDriveKey, drive); |
|
172 |
if(err==KErrNone) |
|
173 |
{ |
|
174 |
if((drive>=EDriveA) && (drive<=EDriveZ)) |
|
175 |
{ |
|
176 |
TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsGetSystemDriveReturn, MODULEUID, drive); |
|
177 |
return static_cast<TDriveNumber>(drive); |
|
178 |
} |
|
179 |
} |
|
180 |
||
181 |
TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsGetSystemDriveReturn, MODULEUID, EDriveC); |
|
182 |
return EDriveC; |
|
183 |
} |
|
184 |
||
185 |
||
186 |
||
187 |
/** |
|
188 |
This is a wrapper around GetSystemDrive() function. It returns the character corresponding to the system drive. |
|
189 |
||
190 |
@parameter aDriveChar On return, contains the system drive character |
|
191 |
@return KErrNone if successful, otherwise one of the other system-wide error codes |
|
192 |
@see RFs::GetSystemDrive |
|
193 |
*/ |
|
194 |
EFSRV_EXPORT_C TChar RFs::GetSystemDriveChar() |
|
195 |
{ |
|
196 |
TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsGetSystemDriveChar, MODULEUID); |
|
197 |
||
198 |
TInt r = 'A' + GetSystemDrive(); |
|
199 |
||
200 |
TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsGetSystemDriveCharReturn, MODULEUID, r); |
|
201 |
return r; |
|
202 |
} |
|
203 |
||
204 |
||
205 |
||
206 |
/** |
|
207 |
Set a specified drive as a "System Drive", see RFs::GetSystemDrive(). |
|
208 |
The "System Drive" can be set only once, any subsequent calls will result in the error 'KErrAlreadyExists'. |
|
209 |
||
210 |
The media type for the system drive shall be one of the: EMediaHardDisk, EMediaFlash, EMediaNANDFlash, EMediaRam |
|
211 |
Required drive attributes: KDriveAttLocal, KDriveAttInternal |
|
212 |
Prohibited drive attributes: KDriveAttRom,KDriveAttRedirected,KDriveAttSubsted,KDriveAttRemovable |
|
213 |
||
214 |
@param aSystemDrive specifies the drive number to be set as System Drive |
|
215 |
@return KErrNone if successful, otherwise one of the other system-wide error codes |
|
216 |
@capability TCB |
|
217 |
*/ |
|
218 |
EFSRV_EXPORT_C TInt RFs::SetSystemDrive(TDriveNumber aSystemDrive) |
|
219 |
{ |
|
220 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsSetSystemDrive, MODULEUID, Handle(), aSystemDrive); |
|
221 |
TInt r = SendReceive(EFsSetSystemDrive, TIpcArgs(aSystemDrive)); |
|
222 |
||
223 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSetSystemDriveReturn, MODULEUID, r); |
|
224 |
return r; |
|
225 |
} |
|
226 |
||
227 |
||
228 |
||
229 |
EFSRV_EXPORT_C TInt RFs::Connect(TInt aMessageSlots) |
|
230 |
/** |
|
231 |
Connects a client to the file server. |
|
232 |
||
233 |
To end the file server session, use Close(). |
|
234 |
||
235 |
@param aMessageSlots The number of message slots required. The default value of |
|
236 |
KFileServerDefaultMessageSlots indicates that message |
|
237 |
slots will be acquired dynamically from the system |
|
238 |
wide pool. Override this value with a fixed number, if |
|
239 |
a fixed number of slots are to be allocated to the session. |
|
240 |
If overriding, note that the number of message slots |
|
241 |
represents the number of operations, such as reads |
|
242 |
and writes, that can be outstanding at once; |
|
243 |
always remember to provide a spare slot for |
|
244 |
the cancel operation. |
|
245 |
||
246 |
@return KErrNone, if successful, otherwise one of the other system-wide |
|
247 |
error codes. |
|
248 |
*/ |
|
249 |
{ |
|
250 |
TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsConnect, MODULEUID, aMessageSlots); |
|
251 |
_LIT(KFileServerName,"!FileServer"); |
|
252 |
TInt r = CreateSession(KFileServerName,Version(),aMessageSlots); |
|
253 |
||
254 |
TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFsConnectReturn, MODULEUID, r, Handle()); |
|
255 |
return r; |
|
256 |
} |
|
257 |
||
258 |
||
259 |
||
260 |
||
261 |
EFSRV_EXPORT_C TInt RFs::SetSessionToPrivate(TInt aDrive) |
|
262 |
/** |
|
263 |
Sets the session path to point to the private path on the specified drive. |
|
264 |
||
265 |
The private directory does not need to exist at this point. |
|
266 |
||
267 |
The private path for a process has the form: \\Private\\13579BDF\\ |
|
268 |
where 13579BDF is the identity of the process. |
|
269 |
||
270 |
@param aDrive The drive for which information is requested. |
|
271 |
Specify a drive in the range EDriveA to EDriveZ for drives |
|
272 |
A to Z respectively. |
|
273 |
||
274 |
@return KErrNone, if successful, otherwise one of the other system-wide |
|
275 |
error codes. |
|
276 |
*/ |
|
277 |
{ |
|
278 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsSetSessionToPrivate, MODULEUID, Handle(), aDrive); |
|
279 |
TInt r = SendReceive(EFsSessionToPrivate,TIpcArgs(aDrive)); |
|
280 |
||
281 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSetSessionToPrivateReturn, MODULEUID, r); |
|
282 |
return r; |
|
283 |
} |
|
284 |
||
285 |
||
286 |
||
287 |
EFSRV_EXPORT_C TInt RFs::PrivatePath(TDes& aPath) |
|
288 |
/** |
|
289 |
Creates the text defining the private path for a process. |
|
290 |
||
291 |
The private path for a process has the form: \\Private\\13579BDF\\ |
|
292 |
where 13579BDF is the identity of the process. |
|
293 |
||
294 |
@param aPath On successful return, contains the private path for a process. |
|
295 |
*/ |
|
296 |
{ |
|
297 |
TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsPrivatePath, MODULEUID, Handle()); |
|
298 |
TInt r = SendReceive(EFsPrivatePath,TIpcArgs(&aPath)); |
|
299 |
||
300 |
TRACERETMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsPrivatePathReturn, MODULEUID, r, aPath); |
|
301 |
return r; |
|
302 |
} |
|
303 |
||
304 |
||
305 |
||
306 |
EFSRV_EXPORT_C TInt RFs::CreatePrivatePath(TInt aDrive) |
|
307 |
/** |
|
308 |
Creates the private path for a process on the specified drive. |
|
309 |
||
310 |
The private path for a process has the form: \\Private\\13579BDF\\ |
|
311 |
where 13579BDF is the identity of the process. |
|
312 |
||
313 |
@param aDrive The drive for which the private path is to be created. |
|
314 |
Specify a drive in the range EDriveA to EDriveZ for drives |
|
315 |
A to Z respectively. |
|
316 |
||
317 |
@return KErrNone, if successful, otherwise one of the other system-wide |
|
318 |
error codes. |
|
319 |
*/ |
|
320 |
{ |
|
321 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsCreatePrivatePath, MODULEUID, Handle(), aDrive); |
|
322 |
TInt r = SendReceive(EFsCreatePrivatePath,TIpcArgs(aDrive)); |
|
323 |
||
324 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsCreatePrivatePathReturn, MODULEUID, r); |
|
325 |
return r; |
|
326 |
} |
|
327 |
||
328 |
||
329 |
||
330 |
||
331 |
EFSRV_EXPORT_C TVersion RFs::Version() const |
|
332 |
/** |
|
333 |
Gets the client side version number. |
|
334 |
||
335 |
@return The client side version number. |
|
336 |
*/ |
|
337 |
{ |
|
338 |
TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsVersion, MODULEUID, Handle()); |
|
339 |
||
340 |
TVersion r = TVersion(KF32MajorVersionNumber,KF32MinorVersionNumber,KF32BuildVersionNumber); |
|
341 |
||
342 |
TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFsVersionReturn, MODULEUID, r.iMajor, r.iMinor, r.iBuild); |
|
343 |
return r; |
|
344 |
} |
|
345 |
||
346 |
||
347 |
||
348 |
||
349 |
EFSRV_EXPORT_C TInt RFs::AddFileSystem(const TDesC& aFileName) const |
|
350 |
/** |
|
351 |
Adds a file system to the file server. |
|
352 |
||
353 |
After calling this function, use MountFileSystem() to mount the file system |
|
354 |
on a drive. |
|
355 |
||
356 |
@param aFileName The name of the file system .FSY to install. Its full path can |
|
357 |
be specified. |
|
358 |
||
359 |
@return KErrNone, if successful, otherwise one of the other system-wide |
|
360 |
error codes. |
|
361 |
||
362 |
@capability DiskAdmin |
|
363 |
||
364 |
@see RFs::MountFileSystem |
|
365 |
*/ |
|
366 |
{ |
|
367 |
TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsAddFileSystem, MODULEUID, Handle(), aFileName); |
|
368 |
RLoader loader; |
|
369 |
TInt r = loader.Connect(); |
|
370 |
if (r==KErrNone) |
|
371 |
{ |
|
372 |
r = loader.SendReceive(ELoadFileSystem, TIpcArgs(0, &aFileName, 0)); |
|
373 |
loader.Close(); |
|
374 |
} |
|
375 |
||
376 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsAddFileSystemReturn, MODULEUID, r); |
|
377 |
return r; |
|
378 |
} |
|
379 |
||
380 |
||
381 |
||
382 |
||
383 |
EFSRV_EXPORT_C TInt RFs::RemoveFileSystem(const TDesC& aFileSystemName) const |
|
384 |
/** |
|
385 |
Removes the specified file system. |
|
386 |
||
387 |
@param aFileSystemName The fullname of the file system, as returned from |
|
388 |
a call to FileSystemName(), to be removed. |
|
389 |
||
390 |
@return KErrNone, if successful; |
|
391 |
KErrNotFound, if aFileSystemName is not found; |
|
392 |
otrherwise one of the other system-wide error codes. |
|
393 |
||
394 |
@capability DiskAdmin |
|
395 |
||
396 |
*/ |
|
397 |
{ |
|
398 |
TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsRemoveFileSystem, MODULEUID, Handle(), aFileSystemName); |
|
399 |
TInt r = SendReceive(EFsRemoveFileSystem,TIpcArgs(&aFileSystemName)); |
|
400 |
||
401 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsRemoveFileSystemReturn, MODULEUID, r); |
|
402 |
return r; |
|
403 |
} |
|
404 |
||
405 |
||
406 |
||
407 |
||
408 |
EFSRV_EXPORT_C TInt RFs::MountFileSystem(const TDesC& aFileSystemName,TInt aDrive) const |
|
409 |
/** |
|
410 |
Mounts a file system on a drive. |
|
411 |
||
412 |
The file system must first have been added to the file server using AddFileSystem(). |
|
413 |
The drive is mounted as asynchronous, i.e operations on it don't block the file server and other drives; |
|
414 |
||
415 |
@param aFileSystemName The fullname of the file system, as returned from a call to FileSystemName(). |
|
416 |
@param aDrive The drive on which the file system is to be mounted; this can be one of the values defined by TDriveNumber. |
|
417 |
||
418 |
@return KErrNone if successful, otherwise one of the other system-wide error codes. |
|
419 |
||
420 |
@capability DiskAdmin |
|
421 |
||
422 |
@see RFs::AddFileSystem |
|
423 |
@see RFs::FileSystemName |
|
424 |
*/ |
|
425 |
{ |
|
426 |
TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsMountFileSystem1, MODULEUID, Handle(), aFileSystemName, aDrive); |
|
427 |
TInt r = SendReceive(EFsMountFileSystem,TIpcArgs(&aFileSystemName,aDrive,NULL,EFalse)); |
|
428 |
||
429 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsMountFileSystem1Return, MODULEUID, r); |
|
430 |
return r; |
|
431 |
} |
|
432 |
||
433 |
||
434 |
||
435 |
||
436 |
||
437 |
EFSRV_EXPORT_C TInt RFs::MountFileSystem(const TDesC& aFileSystemName,TInt aDrive, TBool aIsSync) const |
|
438 |
/** |
|
439 |
Mounts a file system on a specified drive. |
|
440 |
||
441 |
The file system must first have been added to the file server using AddFileSystem(). |
|
442 |
Depending on the aIsSync parameter, the drive can be mounted as synchronous or asynchronous. |
|
443 |
||
444 |
Asynchronous drive has its own processing thread, i.e operations on it don't block the file server and other drives; |
|
445 |
Synchronous drives' requests are being processed by the main file server thread and there is a possibility to block it along with |
|
446 |
all operations on other drives. Mounting a drive as synch. makes a sense if the operations on such drive are very fast e.g. this is an |
|
447 |
internal RAM or ROFS drive. |
|
448 |
||
449 |
@param aFileSystemName The fullname of the file system, as returned from a call to FileSystemName(). |
|
450 |
@param aDrive The drive number on which the file system is to be mounted; this can be one of the values defined by TDriveNumber. |
|
451 |
||
452 |
@param aIsSync if ETrue the drive will be mounted as synchronous one; |
|
453 |
if EFalse the drive will be mounted as Asynchronous. |
|
454 |
||
455 |
@return KErrNone if successful, otherwise one of the other system-wide error codes. |
|
456 |
@capability DiskAdmin |
|
457 |
||
458 |
@see RFs::AddFileSystem |
|
459 |
@see RFs::FileSystemName |
|
460 |
*/ |
|
461 |
{ |
|
462 |
TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::EFsMountFileSystem2, MODULEUID, Handle(), aFileSystemName, aDrive, aIsSync); |
|
463 |
||
464 |
TInt r = SendReceive(EFsMountFileSystem,TIpcArgs(&aFileSystemName,aDrive,NULL,aIsSync)); |
|
465 |
||
466 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsMountFileSystem2Return, MODULEUID, r); |
|
467 |
return r; |
|
468 |
} |
|
469 |
||
470 |
||
471 |
||
472 |
||
473 |
EFSRV_EXPORT_C TInt RFs::MountFileSystem(const TDesC& aFileSystemName,const TDesC& aExtensionName,TInt aDrive) |
|
474 |
/** |
|
475 |
Mounts a file system on a drive, and the specified extension. |
|
476 |
||
477 |
The file system must first have been added to the file server using AddFileSystem(). |
|
478 |
The drive is mounted as asynchronous, i.e operations on it don't block the file server and other drives; |
|
479 |
||
480 |
@param aFileSystemName The fullname of the file system, as returned from a call to FileSystemName(). |
|
481 |
@param aExtensionName The filename of the extension. |
|
482 |
@param aDrive The drive on which the file system is to be mounted; this can be one of the values defined by TDriveNumber. |
|
483 |
||
484 |
@return KErrNone if successful, otherwise one of the other system-wide error codes. |
|
485 |
||
486 |
@capability DiskAdmin |
|
487 |
||
488 |
@see RFs::AddFileSystem |
|
489 |
@see RFs::FileSystemName |
|
490 |
*/ |
|
491 |
{ |
|
492 |
TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::EFsMountFileSystem3, MODULEUID, Handle(), aFileSystemName, aExtensionName, aDrive); |
|
493 |
||
494 |
TInt r = SendReceive(EFsMountFileSystem,TIpcArgs(&aFileSystemName,aDrive,&aExtensionName,EFalse)); |
|
495 |
||
496 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsMountFileSystem3Return, MODULEUID, r); |
|
497 |
return r; |
|
498 |
} |
|
499 |
||
500 |
||
501 |
||
502 |
||
503 |
EFSRV_EXPORT_C TInt RFs::MountFileSystem(const TDesC& aFileSystemName,const TDesC& aExtensionName,TInt aDrive, TBool aIsSync) |
|
504 |
/** |
|
505 |
Mounts a file system on a drive, and the specified extension. |
|
506 |
||
507 |
The file system must first have been added to the file server using AddFileSystem(). |
|
508 |
||
509 |
Depending on the aIsSync parameter, the drive can be mounted as synchronous or asynchronous. |
|
510 |
||
511 |
Asynchronous drive has its own processing thread, i.e operations on it don't block the file server and other drives; |
|
512 |
Synchronous drives' requests are being processed by the main file server thread and there is a possibility to block it along with |
|
513 |
all operations on other drives. Mounting a drive as synch. makes sense if the operations on such drive are very fast e.g. this is an |
|
514 |
internal RAM or ROFS drive. |
|
515 |
||
516 |
@param aFileSystemName The fullname of the file system, as returned from a call to FileSystemName(). |
|
517 |
@param aExtensionName The filename of the extension. |
|
518 |
@param aDrive The drive on which the file system is to be mounted; this can be one of the values defined by TDriveNumber. |
|
519 |
||
520 |
@param aIsSync if ETrue the drive will be mounted as synchronous one; |
|
521 |
if EFalse the drive will be mounted as Asynchronous. |
|
522 |
||
523 |
@return KErrNone if successful, otherwise one of the other system-wide error codes. |
|
524 |
||
525 |
@capability DiskAdmin |
|
526 |
||
527 |
@see RFs::AddFileSystem |
|
528 |
@see RFs::FileSystemName |
|
529 |
*/ |
|
530 |
{ |
|
531 |
TRACEMULT5(UTF::EBorder, UTraceModuleEfsrv::EFsMountFileSystem4, MODULEUID, Handle(), aFileSystemName, aExtensionName, aDrive, aIsSync); |
|
532 |
TInt r = SendReceive(EFsMountFileSystem,TIpcArgs(&aFileSystemName,aDrive,&aExtensionName,aIsSync)); |
|
533 |
||
534 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsMountFileSystem4Return, MODULEUID, r); |
|
535 |
return r; |
|
536 |
} |
|
537 |
||
538 |
||
539 |
||
540 |
||
541 |
EFSRV_EXPORT_C TInt RFs::MountFileSystemAndScan(const TDesC& aFileSystemName,TInt aDrive,TBool& aIsMountSuccess) const |
|
542 |
/** |
|
543 |
Mounts a file system on a drive, and performs a scan on that drive. |
|
544 |
The file system must first have been added to the file server using AddFileSystem(). |
|
545 |
||
546 |
Note that the scan is done only if the mount is successful. |
|
547 |
||
548 |
The drive is mounted as asynchronous, i.e operations on it don't block the file server and other drives; |
|
549 |
||
550 |
@param aFileSystemName The fullname of the file system, as returned from a call to FileSystemName(). |
|
551 |
@param aDrive The drive on which the file system is to be mounted; this can be one of the values defined by TDriveNumber. |
|
552 |
@param aIsMountSuccess On return, set to: ETrue, if the if the mount is successful, set to EFalse otherwise. |
|
553 |
||
554 |
@return KErrNone if successful, otherwise one of the other system-wide error codes, reflecting the failure of the mount operation. |
|
555 |
||
556 |
@capability DiskAdmin |
|
557 |
||
558 |
@see RFs::TDriveNumber |
|
559 |
@see RFs::AddFileSystem |
|
560 |
@see RFs::FileSystemName |
|
561 |
*/ |
|
562 |
{ |
|
563 |
TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsMountFileSystemAndScan1, MODULEUID, Handle(), aFileSystemName, aDrive); |
|
564 |
aIsMountSuccess=EFalse; |
|
565 |
TPckg<TInt> pckg(aIsMountSuccess); |
|
566 |
TInt r = SendReceive(EFsMountFileSystemScan,TIpcArgs(&aFileSystemName,aDrive,NULL,&pckg)); |
|
567 |
||
568 |
TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFsMountFileSystemAndScan1Return, MODULEUID, r, aIsMountSuccess); |
|
569 |
return r; |
|
570 |
} |
|
571 |
||
572 |
EFSRV_EXPORT_C TInt RFs::MountFileSystemAndScan(const TDesC& aFileSystemName,const TDesC& aExtensionName,TInt aDrive,TBool& aIsMountSuccess) const |
|
573 |
/** |
|
574 |
Mounts a file system on a drive, and the specified extension and performs a scan on that drive. |
|
575 |
||
576 |
The file system must first have been added to the file server, |
|
577 |
using AddFileSystem(). |
|
578 |
||
579 |
Note that the scan is done only if the mount is successful. |
|
580 |
||
581 |
The operation is asynchronous, i.e other concurrent file server operations can continue. |
|
582 |
||
583 |
@param aFileSystemName The fullname of the file system, as returned from |
|
584 |
a call to FileSystemName(). |
|
585 |
@param aExtensionName The filename of the extension. |
|
586 |
@param aDrive The drive on which the file system is to be mounted; |
|
587 |
this can be one of the values defined by TDriveNumber. |
|
588 |
@param aIsMountSuccess On return, set to: ETrue, if the if the mount |
|
589 |
is successful, set to EFalse otherwise. |
|
590 |
||
591 |
@return KErrNone if successful, otherwise one of the other system-wide |
|
592 |
error codes, reflecting the failure of the mount operation. |
|
593 |
||
594 |
@capability DiskAdmin |
|
595 |
||
596 |
@see RFs::TDriveNumber |
|
597 |
@see RFs::AddFileSystem |
|
598 |
@see RFs::FileSystemName |
|
599 |
*/ |
|
600 |
{ |
|
601 |
TRACEMULT5(UTF::EBorder, UTraceModuleEfsrv::EFsMountFileSystemAndScan2, MODULEUID, |
|
602 |
Handle(), aFileSystemName, aExtensionName, aDrive, aIsMountSuccess); |
|
603 |
||
604 |
aIsMountSuccess=EFalse; |
|
605 |
TPckg<TInt> pckg(aIsMountSuccess); |
|
606 |
TInt r = SendReceive(EFsMountFileSystemScan,TIpcArgs(&aFileSystemName,aDrive,&aExtensionName,&pckg)); |
|
607 |
||
608 |
TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFsMountFileSystemAndScan2Return, MODULEUID, r, aIsMountSuccess); |
|
609 |
return r; |
|
610 |
} |
|
611 |
||
612 |
EFSRV_EXPORT_C TInt RFs::DismountFileSystem(const TDesC& aFileSystemName,TInt aDrive) const |
|
613 |
/** |
|
614 |
Dismounts the file system from the specified drive. |
|
615 |
||
616 |
@param aFileSystemName The fullname of the file system, as returned from |
|
617 |
a call to FileSystemName(). |
|
618 |
@param aDrive The drive from which the file system is to be dismounted. |
|
619 |
||
620 |
@return KErrNone, if successful; |
|
621 |
KErrNotFound, if aFileSystemName is not found; |
|
622 |
KErrNotReady, if the drive does not have a file system mounted on it; |
|
623 |
KErrInUse, if the drive has a resource open on it; |
|
624 |
KErrAccessDenied, if there is an attempt to dismount a ROM file system, |
|
625 |
a substituted drive, or the drive which is the default drive; |
|
626 |
KErrArgument, if the specified drive value is outsdide of the valid range. |
|
627 |
KErrPermissionDenied, if the client does not have the necessary capabilities |
|
628 |
to dismount the file system. |
|
629 |
||
630 |
@capability DiskAdmin |
|
631 |
||
632 |
@see RFs::FileSystemName |
|
633 |
*/ |
|
634 |
{ |
|
635 |
TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsDismountFileSystem, MODULEUID, Handle(), aFileSystemName, aDrive); |
|
636 |
TInt r = SendReceive(EFsDismountFileSystem,TIpcArgs(&aFileSystemName,aDrive)); |
|
637 |
||
638 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsDismountFileSystemReturn, MODULEUID, r); |
|
639 |
return r; |
|
640 |
} |
|
641 |
||
642 |
||
643 |
||
644 |
||
645 |
/** |
|
646 |
Gets the name of the file system mounted on the specified drive. |
|
647 |
The function can be called before calling DismountFileSystem(). |
|
648 |
||
649 |
@param aName On successful return, contains the name of the file system. |
|
650 |
@param aDrive The drive for which the file system name is required. |
|
651 |
||
6
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
652 |
Note that the file system name, returned in the aName descriptor shall be threated as case-insensitive string. I.e. |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
653 |
"fileSystem" and "FILESYSTEM" mean absolutely the same. Therefore, case-insensitive string methods (like TDesC::FindF(), TDesC::CompareF()) |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
654 |
shall be used to deal with the names. |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
655 |
|
0 | 656 |
@return KErrNone, if successful; |
657 |
KErrNotFound if aFileSystemName is not found, or the drive does not have a file system mounted on it; |
|
658 |
KErrArgument, if the drive value is outside the valid range, i.e. zero to KMaxDrives-1 inclusive. |
|
659 |
||
660 |
@see RFs::DismountFileSystem |
|
661 |
*/ |
|
662 |
EFSRV_EXPORT_C TInt RFs::FileSystemName(TDes& aName,TInt aDrive) const |
|
663 |
{ |
|
664 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsFileSystemName, MODULEUID, Handle(), aDrive); |
|
665 |
||
666 |
//-- ipc argument "-1" here is to indicate legacy FileSystemName() API |
|
667 |
TInt r = SendReceive(EFsFileSystemName,TIpcArgs(&aName, aDrive, -1)); |
|
668 |
||
669 |
TRACERETMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsFileSystemNameReturn, MODULEUID, r, aName); |
|
670 |
return r; |
|
671 |
} |
|
672 |
||
673 |
||
674 |
/** |
|
675 |
Get one of the supported file system names on a specified drive. This API can be used for enumerating |
|
676 |
file systems that can be recognised and mounted automatically, without user's interaction. |
|
677 |
If the automatic recognition and mountng some known file systems is supported on the specified drive, there |
|
678 |
shall be at least 2 names in the list. For example "FAT" and "exFAT". |
|
679 |
If "automatic file system recognising" feature is not supported, the list will consist of just one name, and |
|
680 |
this will be the name returned by RFs::FileSystemName() API. |
|
681 |
||
6
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
682 |
Note that the file system name, returned in the aName descriptor shall be threated as case-insensitive string. I.e. |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
683 |
"fileSystem" and "FILESYSTEM" mean absolutely the same. Therefore, case-insensitive string methods (like TDesC::FindF(), TDesC::CompareF()) |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
684 |
shall be used to deal with the names. |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
685 |
|
0 | 686 |
@param aName On successful return, contains the name of the file system that correspond to the aFsEnumerator value. |
687 |
m@param aDrive The drive number |
|
688 |
@param aFsEnumerator The supported file system enumerator. can be: |
|
689 |
KRootFileSystem a special value; in this case the returned name will be the same as obtained by FileSystemName() |
|
690 |
0,1,2... integer values specifying the sequential number of supported filesystem. See the return error code. |
|
691 |
||
692 |
@return KErrNone success, aName contains a valid name for the supported file system number "aFsEnumerator" on this drive. |
|
693 |
KErrNotFound the end of the supported file names list; "aFsEnumerator-1" was the last correct value |
|
694 |
KErrArgument incorrect arguments |
|
695 |
||
696 |
||
697 |
@see FileSystemName() |
|
698 |
@see KRootFileSystem |
|
699 |
*/ |
|
700 |
EFSRV_EXPORT_C TInt RFs::SupportedFileSystemName(TDes& aName, TInt aDrive, TInt aFsEnumerator) const |
|
701 |
{ |
|
702 |
if(aFsEnumerator < 0) |
|
703 |
return KErrArgument; //-- see RFs::FileSystemName(). "-1" is a reserved value |
|
704 |
||
705 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsFileSystemName, MODULEUID, Handle(), aDrive); |
|
706 |
||
707 |
TInt r = SendReceive(EFsFileSystemName,TIpcArgs(&aName, aDrive, aFsEnumerator)); |
|
708 |
||
709 |
TRACERETMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsFileSystemNameReturn, MODULEUID, r, aName); |
|
710 |
return r; |
|
711 |
} |
|
712 |
||
713 |
||
714 |
||
715 |
||
716 |
||
717 |
EFSRV_EXPORT_C TInt RFs::AddExtension(const TDesC& aFileName) |
|
718 |
/** |
|
719 |
Loads the specified extension. |
|
720 |
||
721 |
@param aFileName The file name of the extension |
|
722 |
||
723 |
@return KErrNone, if successful; otherwise one of the other system wide error codes. |
|
724 |
*/ |
|
725 |
{ |
|
726 |
TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsAddExtension, MODULEUID, Handle(), aFileName); |
|
727 |
RLoader loader; |
|
728 |
TInt r = loader.Connect(); |
|
729 |
if (r==KErrNone) |
|
730 |
{ |
|
731 |
r = loader.SendReceive(ELoadFSExtension, TIpcArgs(0, &aFileName, 0)); |
|
732 |
loader.Close(); |
|
733 |
} |
|
734 |
||
735 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsAddExtensionReturn, MODULEUID, r); |
|
736 |
return r; |
|
737 |
} |
|
738 |
||
739 |
||
740 |
||
741 |
||
742 |
EFSRV_EXPORT_C TInt RFs::MountExtension(const TDesC& aExtensionName,TInt aDrive) |
|
743 |
/** |
|
744 |
Mounts the the specified extension. |
|
745 |
||
746 |
The extension must first have been loaded using AddExtension(). |
|
747 |
||
748 |
@param aExtensionName The fullname of the extension, as returned from |
|
749 |
a call to ExtensionName(). |
|
750 |
@param aDrive The drive on which the extension is to be mounted; |
|
751 |
||
752 |
@return KErrNone if successful; |
|
753 |
KErrNotFound, if the extension cannot be found; |
|
754 |
otherwise one of the other system-wide error codes. |
|
755 |
||
756 |
@see RFs::ExtensionName |
|
757 |
*/ |
|
758 |
{ |
|
759 |
TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsMountExtension, MODULEUID, Handle(), aExtensionName, aDrive); |
|
760 |
TInt r = SendReceive(EFsMountExtension,TIpcArgs(&aExtensionName,aDrive)); |
|
761 |
||
762 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsMountExtensionReturn, MODULEUID, r); |
|
763 |
return r; |
|
764 |
} |
|
765 |
||
766 |
||
767 |
||
768 |
||
769 |
/** |
|
770 |
Dismounts the specified extension. |
|
771 |
||
772 |
@param aExtensionName The fullname of the extension, as returned from a call to ExtensionName(). |
|
773 |
@param aDrive The drive this extension is to be dismounted from. |
|
774 |
||
775 |
@return KErrNone if successful; |
|
776 |
KErrNotFound if the extension cannot be found; |
|
777 |
otherwise one of the other system-wide error codes. |
|
778 |
||
779 |
@see RFs::ExtensionName |
|
780 |
*/ |
|
781 |
EFSRV_EXPORT_C TInt RFs::DismountExtension(const TDesC& aExtensionName,TInt aDrive) |
|
782 |
{ |
|
783 |
TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsDismountExtension, MODULEUID, Handle(), aExtensionName, aDrive); |
|
784 |
TInt r = SendReceive(EFsDismountExtension,TIpcArgs(&aExtensionName,aDrive)); |
|
785 |
||
786 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsDismountExtensionReturn, MODULEUID, r); |
|
787 |
return r; |
|
788 |
} |
|
789 |
||
790 |
||
791 |
EFSRV_EXPORT_C TInt RFs::RemoveExtension(const TDesC& aExtensionName) |
|
792 |
/** |
|
793 |
Removes the specified extension. |
|
794 |
||
795 |
@param aExtensionName The fullname of the extension, as returned from |
|
796 |
a call to ExtensionName(). |
|
797 |
||
798 |
@return KErrNone, if successful; |
|
799 |
KErrNotFound, if aExtensionName is not found; |
|
800 |
otrherwise one of the other system-wide error codes. |
|
801 |
*/ |
|
802 |
{ |
|
803 |
TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsRemoveExtension, MODULEUID, Handle(), aExtensionName); |
|
804 |
TInt r = SendReceive(EFsRemoveExtension,TIpcArgs(&aExtensionName)); |
|
805 |
||
806 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsRemoveExtensionReturn, MODULEUID, r); |
|
807 |
return r; |
|
808 |
} |
|
809 |
||
810 |
||
811 |
||
812 |
||
813 |
EFSRV_EXPORT_C TInt RFs::ExtensionName(TDes& aExtensionName,TInt aDrive,TInt aPos) |
|
814 |
/** |
|
815 |
Gets the name of the extension on the specified drive at the specified position |
|
816 |
in the extension hierarchy. |
|
817 |
||
818 |
@param aExtensionName On successful return, contains the name of the extension. |
|
819 |
@param aDrive The drive for which the extension name is required. |
|
820 |
@param aPos The position of the extension in the extension hierarchy. |
|
821 |
||
822 |
@return KErrNone, if successful; |
|
823 |
KErrNotFound if the extension name is not found; |
|
824 |
*/ |
|
825 |
{ |
|
826 |
TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::EFsExtensionName, MODULEUID, Handle(), aExtensionName, aDrive, aPos); |
|
827 |
TInt r = SendReceive(EFsExtensionName,TIpcArgs(&aExtensionName,aDrive,aPos)); |
|
828 |
||
829 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsExtensionNameReturn, MODULEUID, r); |
|
830 |
return r; |
|
831 |
} |
|
832 |
||
833 |
||
834 |
||
835 |
||
836 |
EFSRV_EXPORT_C TInt RFs::RemountDrive(TInt aDrive,const TDesC8* aMountInfo,TUint aFlags) |
|
837 |
/** |
|
838 |
Forces a remount of the specified drive. |
|
839 |
||
840 |
@param aDrive The drive for which a remount is to be forced. |
|
841 |
@param aMountInfo Information passed down to the media driver. The meaning of |
|
842 |
this information depends on the media driver, for example, |
|
843 |
keys for secure areas. |
|
844 |
@param aFlags When the flag is set to |
|
845 |
0x00000001 - Used to simulate ejecting and re-inserting the media. |
|
846 |
0x80000000 - used to force the media driver for the specified logical |
|
847 |
drive to be closed and reopened. |
|
848 |
||
849 |
@return KErrNone if successful, otherwise one of |
|
850 |
the other system wide error codes. |
|
851 |
*/ |
|
852 |
{ |
|
853 |
TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFsRemountDrive, MODULEUID, Handle(), aDrive, aMountInfo, aFlags); |
|
854 |
TInt r = SendReceive(EFsRemountDrive,TIpcArgs(aDrive,aMountInfo,aFlags)); |
|
855 |
||
856 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsRemountDriveReturn, MODULEUID, r); |
|
857 |
return r; |
|
858 |
} |
|
859 |
||
860 |
||
861 |
||
862 |
EFSRV_EXPORT_C void RFs::NotifyChange(TNotifyType aType,TRequestStatus& aStat) |
|
863 |
/** |
|
864 |
Requests a notification of change to files or directories. |
|
865 |
||
866 |
Changes are notified either: |
|
867 |
||
868 |
1. following any change in the file system |
|
869 |
||
870 |
or |
|
871 |
||
872 |
2. only following the addition or deletion of a directory entry, or after |
|
873 |
a disk has been formatted or changed. |
|
874 |
||
875 |
Such notification is useful for programs that maintain displays |
|
876 |
of file lists which must be dynamically updated. The alternative is to do |
|
877 |
no updating, or to perform periodic monitoring for change, which |
|
878 |
is inefficient. |
|
879 |
||
880 |
This is an asynchronous request and, as such, results in precisely one signal |
|
881 |
to the request status passed as a parameter. To avoid missing any change, this |
|
882 |
request should be issued before the first file list is constructed. When |
|
883 |
the request completes, a new request should be issued before the next file |
|
884 |
list is constructed. When the file server session is |
|
885 |
closed, this request is implicitly cancelled. |
|
886 |
||
887 |
Call NotifyChangeCancel() to explicitly cancel a notification request. |
|
888 |
||
889 |
@param aType Indicates the kind of change that should result in notification. |
|
890 |
For example: |
|
891 |
ENotifyEntry causes notification only when an entry is added or |
|
892 |
deleted, or when a disk is formatted or changed; |
|
893 |
ENotifyAll causes notification following any type of change, such |
|
894 |
as when a file is written to, or when a file's attributes |
|
895 |
are changed. |
|
896 |
@param aStat The request status. |
|
897 |
This is set to KErrNone on completion, otherwise one of the other |
|
898 |
system-wide error codes. |
|
899 |
||
900 |
*/ |
|
901 |
{ |
|
902 |
TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyChange1, MODULEUID, Handle(), aType, &aStat); |
|
903 |
aStat=KRequestPending; |
|
904 |
// for backward compatibility |
|
905 |
TNotifyType type = (aType == 0 ? ENotifyEntry : aType); |
|
906 |
RSessionBase::SendReceive(EFsNotifyChange, TIpcArgs(type,&aStat) , aStat ); |
|
907 |
//This call is to synchronise with the file server when this functions stack varibles can go out of scope |
|
908 |
SendReceive(EFsSynchroniseDriveThread, TIpcArgs(-1)); |
|
909 |
||
910 |
TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyChange1Return, MODULEUID); |
|
911 |
} |
|
912 |
||
913 |
||
914 |
||
915 |
||
916 |
EFSRV_EXPORT_C void RFs::NotifyChange(TNotifyType aType,TRequestStatus& aStat,const TDesC& aPathName) |
|
917 |
/** |
|
918 |
Requests a notification of change to files or directories, allowing |
|
919 |
a directory/file path to be specified. |
|
920 |
||
921 |
Changes are notified either: |
|
922 |
||
923 |
1. following any change in the file system |
|
924 |
||
925 |
or |
|
926 |
||
927 |
2. only following the addition or deletion of a directory entry, or after |
|
928 |
a disk has been formatted or changed. |
|
929 |
||
930 |
Such notification is useful for programs that maintain displays |
|
931 |
of file lists which must be dynamically updated. The alternative is to do |
|
932 |
no updating, or to perform periodic monitoring for change, which |
|
933 |
is inefficient. |
|
934 |
||
935 |
This is an asynchronous request and, as such, results in precisely one signal |
|
936 |
to the request status passed as a parameter. To avoid missing any change, this |
|
937 |
request should be issued before the first file list is constructed. When |
|
938 |
the request completes, a new request should be issued before the next file |
|
939 |
list is constructed. When the file server session is |
|
940 |
closed, this request is implicitly cancelled. |
|
941 |
||
942 |
Call NotifyChangeCancel() to explicitly cancel a notification request. |
|
943 |
||
944 |
@param aType Indicates the kind of change that should result in |
|
945 |
notification. For example: |
|
946 |
ENotifyEntry causes notification only when an entry is added |
|
947 |
or deleted, or when a disk is formatted or changed; |
|
948 |
ENotifyAll causes notification following any type of change, |
|
949 |
such as when a file is written to, or when a file's attributes |
|
950 |
are changed. |
|
951 |
@param aStat The request status. |
|
952 |
This is set to KErrNone on completion, otherwise one of |
|
953 |
the other system-wide error codes. |
|
954 |
@param aPathName The directory or file for which notification is required. By |
|
955 |
specifying a drive as a wildcard, for example |
|
956 |
"?:\\Resource\\apps\\", or |
|
957 |
"*:\\Resource\\apps\\", a client can ask to be notified of changes |
|
958 |
to a given directory on any drive. |
|
959 |
As with all directory paths aPathName must be terminated with '\\', |
|
960 |
Please refer to "Structure of paths and filenames" section in the |
|
961 |
Symbian OS Library. |
|
962 |
||
963 |
@capability Dependent If aName is /Sys then AllFiles capability is required. |
|
964 |
@capability Dependent If aName begins with /Private and does not match this process' SID |
|
965 |
then AllFiles capability is required. |
|
966 |
||
967 |
*/ |
|
968 |
{ |
|
969 |
TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyChange2, MODULEUID, Handle(), (TUint) aType, (TUint) &aStat, aPathName); |
|
970 |
aStat=KRequestPending; |
|
971 |
// for backward compatibility |
|
972 |
TNotifyType type = (aType == 0 ? ENotifyEntry : aType); |
|
973 |
RSessionBase::SendReceive(EFsNotifyChangeEx,TIpcArgs(type,&aPathName,&aStat),aStat); |
|
974 |
//This call is to synchronise with the file server when this functions stack varibles can go out of scope |
|
975 |
SendReceive(EFsSynchroniseDriveThread, TIpcArgs(-1)); |
|
976 |
||
977 |
TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyChange2Return, MODULEUID); |
|
978 |
} |
|
979 |
||
980 |
||
981 |
||
982 |
||
983 |
EFSRV_EXPORT_C void RFs::NotifyChangeCancel() |
|
984 |
/** |
|
985 |
Cancels all outstanding requests for notification of change |
|
986 |
to files or directories. |
|
987 |
||
988 |
All outstanding requests complete with KErrCancel. |
|
989 |
||
990 |
Note that this is a synchronous function. |
|
991 |
||
992 |
*/ |
|
993 |
{ |
|
994 |
TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyChangeCancel1, MODULEUID, Handle()); |
|
995 |
RSessionBase::SendReceive(EFsNotifyChangeCancel); |
|
996 |
||
997 |
TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyChangeCancel1Return, MODULEUID); |
|
998 |
} |
|
999 |
||
1000 |
||
1001 |
||
1002 |
||
1003 |
EFSRV_EXPORT_C void RFs::NotifyChangeCancel(TRequestStatus& aStat) |
|
1004 |
/** |
|
1005 |
Cancels the specific request for notification of change |
|
1006 |
to files or directories. |
|
1007 |
||
1008 |
The outstanding request completes with KErrCancel. |
|
1009 |
||
1010 |
Note that this is an asynchronous function. |
|
1011 |
||
1012 |
@param aStat The request status object associated with the request |
|
1013 |
to be cancelled. Note that the function does not change |
|
1014 |
this parameter. |
|
1015 |
||
1016 |
*/ |
|
1017 |
{ |
|
1018 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyChangeCancel2, MODULEUID, Handle(), &aStat); |
|
1019 |
if (aStat==KRequestPending) // May be better to ASSERT this? |
|
1020 |
SendReceive(EFsNotifyChangeCancelEx,TIpcArgs(&aStat)); |
|
1021 |
||
1022 |
TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyChangeCancel2Return, MODULEUID); |
|
1023 |
} |
|
1024 |
||
1025 |
||
1026 |
||
1027 |
||
1028 |
EFSRV_EXPORT_C void RFs::NotifyDiskSpace(TInt64 aThreshold,TInt aDrive,TRequestStatus& aStat) |
|
1029 |
/** |
|
1030 |
Requests notification when the free disk space on the specified |
|
1031 |
drive crosses the specified threshold value. |
|
1032 |
||
1033 |
The threshold is crossed if free disk space increases to a value above |
|
1034 |
the threshold value or decreases to a value below the threshold value. |
|
1035 |
||
1036 |
This is an asynchronous request that completes if any of the |
|
1037 |
following events occur: |
|
1038 |
||
1039 |
1. the threshold is crossed |
|
1040 |
||
1041 |
2. any drive is formatted |
|
1042 |
||
1043 |
3. there is a media change on any socket |
|
1044 |
||
1045 |
4. power up |
|
1046 |
||
1047 |
5. the scandrive utility is run on any drive |
|
1048 |
||
1049 |
5. the specified threshold value is outside its limits |
|
1050 |
||
1051 |
7. the outstanding request is cancelled. |
|
1052 |
||
1053 |
Note that free disk space notification is not supported for |
|
1054 |
drives using remote file systems. |
|
1055 |
||
1056 |
@param aThreshold The threshold value. This must be greater than zero and less |
|
1057 |
than the total size of the disk. |
|
1058 |
@param aDrive The drive number. This is an explicit drive defined by one of |
|
1059 |
the TDriveNumber enum values or the value |
|
1060 |
KDefaultDrive. If KDefaultDrive is specified, then |
|
1061 |
the drive monitored is the session path drive. |
|
1062 |
@param aStat The request status object. On request completion, contains: |
|
1063 |
KErrNone, if the threshold value is crossed, if any drive is |
|
1064 |
formatted, if there is a media change on any socket, if there is a power up or |
|
1065 |
if the scandrive utility is run on any drive; |
|
1066 |
KErrCancel, if the outstanding request is cancelled by a call to |
|
1067 |
NotifyDiskSpaceCancel(); |
|
1068 |
KErrArgument, if the threshold value is outside its limits. |
|
1069 |
||
1070 |
@see TDriveNumber |
|
1071 |
*/ |
|
1072 |
{ |
|
1073 |
TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyDiskSpace, MODULEUID, |
|
1074 |
Handle(), I64LOW(aThreshold),I64HIGH(aThreshold), aDrive,(TUint) &aStat); |
|
1075 |
aStat=KRequestPending; |
|
1076 |
TPtrC8 tBuf((TUint8*)&aThreshold,sizeof(TInt64)); |
|
1077 |
RSessionBase::SendReceive(EFsNotifyDiskSpace,TIpcArgs(&tBuf,aDrive,&aStat), aStat); |
|
1078 |
//This call is to synchronise with the driver thread as corresponding cancel function (NotifyDiskSpaceCancel) |
|
1079 |
//is synchronous, so it can complete before this notify request has even been added to TDiskSpaceQue. |
|
1080 |
//This call guarantees that the notify request has been added to queue. |
|
1081 |
SendReceive(EFsSynchroniseDriveThread, TIpcArgs(aDrive)); |
|
1082 |
||
1083 |
||
1084 |
TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyDiskSpaceReturn, MODULEUID); |
|
1085 |
} |
|
1086 |
||
1087 |
||
1088 |
||
1089 |
||
1090 |
EFSRV_EXPORT_C void RFs::NotifyDiskSpaceCancel(TRequestStatus& aStat) |
|
1091 |
/** |
|
1092 |
Cancels a specific outstanding request for free disk space |
|
1093 |
notification. |
|
1094 |
||
1095 |
The outstanding request completes with KErrCancel. |
|
1096 |
||
1097 |
@param aStat The request status object identified with the original |
|
1098 |
notification request. |
|
1099 |
*/ |
|
1100 |
{ |
|
1101 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyDiskSpaceCancel1, MODULEUID, Handle(), &aStat); |
|
1102 |
||
1103 |
if(aStat==KRequestPending) |
|
1104 |
SendReceive(EFsNotifyDiskSpaceCancel,TIpcArgs(&aStat)); |
|
1105 |
||
1106 |
TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyDiskSpaceCancel1Return, MODULEUID); |
|
1107 |
} |
|
1108 |
||
1109 |
||
1110 |
||
1111 |
||
1112 |
EFSRV_EXPORT_C void RFs::NotifyDiskSpaceCancel() |
|
1113 |
/** |
|
1114 |
Cancels all outstanding requests for free disk space |
|
1115 |
notification. |
|
1116 |
||
1117 |
Outstanding requests complete with KErrCancel. |
|
1118 |
*/ |
|
1119 |
{ |
|
1120 |
TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyDiskSpaceCancel2, MODULEUID, Handle()); |
|
1121 |
SendReceive(EFsNotifyDiskSpaceCancel,TIpcArgs(NULL)); |
|
1122 |
||
1123 |
TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyDiskSpaceCancel2Return, MODULEUID); |
|
1124 |
} |
|
1125 |
||
1126 |
||
1127 |
||
1128 |
||
1129 |
EFSRV_EXPORT_C TInt RFs::DriveList(TDriveList& aList) const |
|
1130 |
/** |
|
1131 |
Gets a list of the available (not remote and non hidden) drives. |
|
1132 |
||
1133 |
The drive list consists of an array of 26 bytes. Array index zero corresponds |
|
1134 |
to drive A, index one equals B etc. |
|
1135 |
||
1136 |
Each byte with a non zero value signifies that the corresponding drive is available |
|
1137 |
to the system. In the case of removable media, RFs::Drive should be used to determine |
|
1138 |
whether the media is inserted or not. |
|
1139 |
||
1140 |
The local file system always reserves drive letters A through I. |
|
1141 |
Drive letter Z is always used for the ROM which means that letters J through Y |
|
1142 |
are available to be used by SetSubst() or for redirecting. |
|
1143 |
||
1144 |
@param aList On return, contains a list of drive attributes (only the first 8 bits) for the available non-remote and non-hidden drives. |
|
1145 |
||
1146 |
@return KErrNone, successful, otherwise one of the other system-wide error codes. |
|
1147 |
*/ |
|
1148 |
{ |
|
1149 |
TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsDriveList1, MODULEUID, Handle()); |
|
1150 |
TInt r = SendReceive(EFsDriveList,TIpcArgs(&aList, KDriveAttExclude|KDriveAttRemote|KDriveAttHidden)); |
|
1151 |
||
1152 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsDriveList1Return, MODULEUID, r); |
|
1153 |
return r; |
|
1154 |
} |
|
1155 |
||
1156 |
||
1157 |
||
1158 |
EFSRV_EXPORT_C TInt RFs::DriveList(TDriveList& aList, TUint aFlags) const |
|
1159 |
/** |
|
1160 |
Gets a list of the available drives that match a combination of drive attributes,specified in aFlags. |
|
1161 |
This combination may include,exclude or exclusively specify the attributes that that drives to be returned |
|
1162 |
should match. |
|
1163 |
||
1164 |
The drive list consists of an array of 26 bytes. Array index zero corresponds |
|
1165 |
to drive A, index one equals B etc. |
|
1166 |
||
1167 |
Each byte with a non zero value signifies that the corresponding drive is available |
|
1168 |
to the system. In the case of removable media, RFs::Drive should be used to determine |
|
1169 |
whether the media is inserted or not. |
|
1170 |
||
1171 |
The local file system always reserves drive letters A through I. |
|
1172 |
Drive letter Z is always used for the ROM which means that letters J through Y |
|
1173 |
are available to be used by SetSubst() or for redirecting. |
|
1174 |
||
1175 |
@param aList On return, contains a list of available drives that qualify aFlags. |
|
1176 |
||
1177 |
@param aFlags A combination of drive attributes that drives to be returned must qualify. |
|
1178 |
||
1179 |
@return KErrNone, successful, otherwise one of the other system-wide error codes; |
|
1180 |
KErrArgument, If aFlags contains an invalid attribute combination. |
|
1181 |
*/ |
|
1182 |
{ |
|
1183 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsDriveList2, MODULEUID, Handle(), aFlags); |
|
1184 |
TInt r = SendReceive(EFsDriveList,TIpcArgs(&aList,aFlags)); |
|
1185 |
||
1186 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsDriveList2Return, MODULEUID, r); |
|
1187 |
return r; |
|
1188 |
} |
|
1189 |
||
1190 |
||
1191 |
||
1192 |
||
1193 |
EFSRV_EXPORT_C TInt RFs::Drive(TDriveInfo& anInfo,TInt aDrive) const |
|
1194 |
/** |
|
1195 |
Gets information about a drive and the medium mounted on it. |
|
1196 |
||
1197 |
Note that Volume() can also be used to give information about the drive and |
|
1198 |
the volume mounted on it. These two functions are separate because, while |
|
1199 |
the characteristics of a drive cannot change, those of a |
|
1200 |
volume can, by mounting different media, reformatting etc. |
|
1201 |
||
1202 |
@param anInfo On return, contains information describing the drive |
|
1203 |
and the medium mounted on it. The value of TDriveInfo::iType |
|
1204 |
shows whether the drive contains media. |
|
1205 |
@param aDrive The drive for which information is requested. |
|
1206 |
Specify KDefaultDrive for the session default drive. |
|
1207 |
Specify a drive in the range EDriveA to EDriveZ for drives |
|
1208 |
A to Z respectively. |
|
1209 |
||
1210 |
@return KErrNone, if successful, otherwise one of the other |
|
1211 |
system-wide error codes. |
|
1212 |
||
1213 |
@see RFs::Volume |
|
1214 |
*/ |
|
1215 |
{ |
|
1216 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsDrive, MODULEUID, Handle(), aDrive); |
|
1217 |
||
1218 |
TPckg<TDriveInfo> m(anInfo); |
|
1219 |
TInt r = SendReceive(EFsDrive,TIpcArgs(&m,aDrive)); |
|
1220 |
||
1221 |
TRACERET4(UTF::EBorder, UTraceModuleEfsrv::EFsDriveReturn, MODULEUID, r, anInfo.iDriveAtt, anInfo.iMediaAtt, anInfo.iType); |
|
1222 |
return r; |
|
1223 |
} |
|
1224 |
||
1225 |
||
1226 |
||
1227 |
||
1228 |
EFSRV_EXPORT_C TInt RFs::Volume(TVolumeInfo& aVol,TInt aDrive) const |
|
1229 |
/** |
|
1230 |
Gets volume information for a formatted device. |
|
1231 |
||
1232 |
This function provides additional information to that given by Drive(), |
|
1233 |
including the volume label, if set, and the amount of free space on the |
|
1234 |
disk. |
|
1235 |
||
1236 |
Note, use Drive() to get information about the drive without reference to |
|
1237 |
a volume. These two functions are separate because, while the characteristics |
|
1238 |
of a drive cannot change, those of a volume can, by mounting different media, |
|
1239 |
reformatting etc. A volume may not even be present if the media is removable. |
|
1240 |
||
1241 |
@param aVol On return, contains the volume information. |
|
1242 |
@param aDrive The drive which contains the media for which volume information is to be displayed. |
|
1243 |
Specify a drive in the range EDriveA to EDriveZ for drives A to Z respectively. |
|
1244 |
The default drive is the session default drive KDefaultDrive. |
|
1245 |
||
1246 |
@return KErrNone, if successful; |
|
1247 |
KErrNotReady, if the drive contains no media; |
|
1248 |
otherwise one of the other system-wide error codes. |
|
1249 |
||
1250 |
@see RFs::Drive |
|
1251 |
*/ |
|
1252 |
{ |
|
1253 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsVolume1, MODULEUID, Handle(), aDrive); |
|
1254 |
TPckg<TVolumeInfo> v(aVol); |
|
1255 |
TInt r = SendReceive(EFsVolume,TIpcArgs(&v,aDrive,NULL)); |
|
1256 |
||
1257 |
TRACE7(UTF::EBorder, UTraceModuleEfsrv::EFsVolume1Return, MODULEUID, |
|
1258 |
r, aVol.iUniqueID, I64LOW(aVol.iSize), I64HIGH(aVol.iSize), |
|
1259 |
I64LOW(aVol.iFree), I64HIGH(aVol.iFree), aVol.iFileCacheFlags); |
|
1260 |
return r; |
|
1261 |
} |
|
1262 |
||
1263 |
/** |
|
1264 |
Gets volume information for a formatted device asynchronously. |
|
1265 |
@see TInt RFs::Volume(TVolumeInfo& aVol,TInt aDrive) for the synchronous version. |
|
1266 |
||
1267 |
"Asynchronously" corresponds to the amount of free space on the volume in TVolumeInfo::iFree. |
|
1268 |
I.e. this function returns the _current_ amount of free space on the volume, which can be changing due to some |
|
1269 |
filesystems' activities. For example, some filesystems can be performing free space calculations in the background. |
|
1270 |
Comparing to the RFs::Volume(TVolumeInfo& aVol,TInt aDrive), this method doesn't block the client until background filesystem |
|
1271 |
activity finishes, which can be useful in some situations. |
|
1272 |
||
1273 |
@param aVol On return, contains the volume information with the _current_ value in the TVolumeInfo::iFree. |
|
1274 |
@param aDrive Drive number to query. Specify a drive in the range EDriveA to EDriveZ for drives A to Z respectively. |
|
1275 |
@param aStat request status. At present is used just for indication of the asynchronous version and gets immediately completed, so there is no reason to analyse its value. |
|
1276 |
||
1277 |
@publishedPartner |
|
1278 |
@prototype |
|
1279 |
*/ |
|
1280 |
EFSRV_EXPORT_C void RFs::Volume(TVolumeInfo& aVol,TInt aDrive, TRequestStatus& aStat) const |
|
1281 |
{ |
|
1282 |
TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFsVolume2, MODULEUID, Handle(), aDrive, &aStat); |
|
1283 |
TPckg<TVolumeInfo> v(aVol); |
|
1284 |
aStat=KRequestPending; |
|
1285 |
RSessionBase::SendReceive(EFsVolume,TIpcArgs(&v,aDrive,&aStat), aStat); |
|
1286 |
||
1287 |
TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsVolume2Return, MODULEUID); |
|
1288 |
} |
|
1289 |
||
1290 |
||
1291 |
EFSRV_EXPORT_C TInt RFs::SetVolumeLabel(const TDesC& aName,TInt aDrive) |
|
1292 |
/** |
|
1293 |
Sets the label for a volume. |
|
1294 |
||
1295 |
Note that similar to file names, volume labels can be set with unicode characters. |
|
1296 |
However it may not be recognized properly if correct code page is not |
|
1297 |
loaded or it is mounted onto a system that does not support DBCS volume |
|
1298 |
labels |
|
1299 |
||
1300 |
@param aName The volume label. |
|
1301 |
@param aDrive The drive containing the media whose label is to be set. |
|
1302 |
Specify a drive in the range EDriveA to EDriveZ for |
|
1303 |
drives A to Z. |
|
1304 |
The default drive is the session default drive KDefaultDrive. |
|
1305 |
||
1306 |
@return KErrNone, if successful; |
|
1307 |
KErrNotReady, if the drive contains no media; |
|
1308 |
otherwise one of the other system-wide error codes. |
|
1309 |
||
1310 |
@capability DiskAdmin |
|
1311 |
||
1312 |
@see TDriveNumber |
|
1313 |
@see TVolumeInfo::iName |
|
1314 |
@see RFs::Volume |
|
1315 |
*/ |
|
1316 |
{ |
|
1317 |
TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsSetVolumeLabel, MODULEUID, |
|
1318 |
Handle(), aName, aDrive); |
|
1319 |
||
1320 |
TInt r = SendReceive(EFsSetVolume,TIpcArgs(&aName,aDrive)); |
|
1321 |
||
1322 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSetVolumeLabelReturn, MODULEUID, r); |
|
1323 |
return r; |
|
1324 |
} |
|
1325 |
||
1326 |
||
1327 |
||
1328 |
||
1329 |
EFSRV_EXPORT_C TInt RFs::Subst(TDes& aPath,TInt aDrive) const |
|
1330 |
/** |
|
1331 |
Gets the path assigned to a drive letter by an earlier call to SetSubst(). |
|
1332 |
||
1333 |
To find out whether a drive letter has been substituted, first get the drive |
|
1334 |
information, using Drive(), and then test the value of the KDriveAttSubsted bit |
|
1335 |
provided by TDriveInfo::iDriveAtt. |
|
1336 |
||
1337 |
@param aPath On return, contains the path which has been assigned to the |
|
1338 |
drive. If the drive letter has not been substituted, this argument |
|
1339 |
returns an empty descriptor. |
|
1340 |
@param aDrive The drive which is the subject of the enquiry. Specify a number |
|
1341 |
in the range 0 (EDriveA) to 25 (>EDriveZ) for drives |
|
1342 |
A to Z. The default drive is the session default |
|
1343 |
drive KDefaultDrive. |
|
1344 |
||
1345 |
@return KErrNone, if successful, otherwise one of the other |
|
1346 |
system-wide error codes. |
|
1347 |
||
1348 |
@see RFs::SetSubst |
|
1349 |
@see TDriveInfo |
|
1350 |
@see RFs::Drive |
|
1351 |
*/ |
|
1352 |
{ |
|
1353 |
TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsSubst, MODULEUID, Handle(), aPath, aDrive); |
|
1354 |
TInt r = SendReceive(EFsSubst,TIpcArgs(&aPath,aDrive)); |
|
1355 |
||
1356 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSubstReturn, MODULEUID, r); |
|
1357 |
return r; |
|
1358 |
} |
|
1359 |
||
1360 |
||
1361 |
||
1362 |
||
1363 |
EFSRV_EXPORT_C TInt RFs::SetSubst(const TDesC& aPath,TInt aDrive) |
|
1364 |
/** |
|
1365 |
Assigns a path to a drive letter. |
|
1366 |
||
1367 |
Whenever that drive letter is used, it will be translated into a reference |
|
1368 |
to the path specified here. To clear a drive substitution, specify an empty |
|
1369 |
descriptor for aPath. |
|
1370 |
||
1371 |
Note that the substituted path is text-only. Its components need not |
|
1372 |
be syntactically correct, nor must they be valid at the time the substitution |
|
1373 |
is set. Any component may be deleted, removed or unmounted while the |
|
1374 |
substitution is set. |
|
1375 |
||
1376 |
@param aPath The path to be assigned to the drive letter. If a drive letter |
|
1377 |
is specified in the path, it must not itself be substituted or |
|
1378 |
redirected, or the function will return an error. If no drive is |
|
1379 |
specified, the drive contained in the default session path is |
|
1380 |
used, and if no path is specified, the default session path is |
|
1381 |
used. If a filename or extension is included in the path, |
|
1382 |
the function will return an error. Therefore, the final component |
|
1383 |
in the path must have a trailing backslash to indicate that it is |
|
1384 |
a directory. |
|
1385 |
||
1386 |
@param aDrive The drive to which a path is to be assigned. Specify a number |
|
1387 |
in the range 0 (EDriveA) to 25 (EDriveZ) for drives |
|
1388 |
A to Z. Must not be local, ROM, or redirected, otherwise an |
|
1389 |
error is returned. May be substituted, but only if the function |
|
1390 |
is being used to clear the substitution. If the same drive is |
|
1391 |
specified in the path, the function will return an error. |
|
1392 |
The default drive is the session default drive |
|
1393 |
KDefaultDrive. |
|
1394 |
||
1395 |
@return KErrNone, if successful; otherwise one of the other system-wide |
|
1396 |
error codes. |
|
1397 |
||
1398 |
@capability DiskAdmin |
|
1399 |
@capability Dependent If aPath is /Sys then Tcb capability is required. |
|
1400 |
@capability Dependent If aPath begins with /Private and does not match this process' SID |
|
1401 |
then AllFiles capability is required. |
|
1402 |
@capability Dependent If aPath is /Resource then Tcb capability is required. |
|
1403 |
*/ |
|
1404 |
{ |
|
1405 |
TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsSetSubst, MODULEUID, Handle(), aPath, aDrive); |
|
1406 |
TInt r = SendReceive(EFsSetSubst,TIpcArgs(&aPath,aDrive)); |
|
1407 |
||
1408 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSetSubstReturn, MODULEUID, r); |
|
1409 |
return r; |
|
1410 |
} |
|
1411 |
||
1412 |
||
1413 |
||
1414 |
||
1415 |
EFSRV_EXPORT_C TInt RFs::RealName(const TDesC& aName,TDes& aResult) const |
|
1416 |
/** |
|
1417 |
Gets the real name of a file. |
|
1418 |
||
1419 |
This is used in circumstances where a file system needs to |
|
1420 |
mangle Symbian OS natural names so that it can store them on that file |
|
1421 |
system. |
|
1422 |
||
1423 |
@param aName Contains the name by which the file is normally referred. |
|
1424 |
@param aResult On return, contains the real name of the file, comprising the |
|
1425 |
full path, including the drive letter. |
|
1426 |
||
1427 |
@return KErrNone if successful, otherwise one of the other |
|
1428 |
system-wide error codes. |
|
1429 |
||
1430 |
@capability Dependent If aName is /Sys then AllFiles capability is required. |
|
1431 |
@capability Dependent If aName begins with /Private and does not match this process' SID |
|
1432 |
then AllFiles capability is required. |
|
1433 |
||
1434 |
*/ |
|
1435 |
{ |
|
1436 |
TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsRealName, MODULEUID, Handle(), aName); |
|
1437 |
TInt r = SendReceive(EFsRealName,TIpcArgs(&aName,&aResult)); |
|
1438 |
||
1439 |
TRACERETMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsRealNameReturn, MODULEUID, r, aResult); |
|
1440 |
return r; |
|
1441 |
} |
|
1442 |
||
1443 |
||
1444 |
||
1445 |
||
1446 |
/** |
|
1447 |
Gets the serial number of media. |
|
1448 |
||
1449 |
Only local drive is allowed. Substed drive number will return KErrNotSupported. |
|
1450 |
||
1451 |
@param aSerialNum Contains serial number on successful return. |
|
1452 |
@param aDrive Drive number. |
|
1453 |
||
1454 |
@return KErrNone if successful; |
|
1455 |
KErrNotSupported if media doesn't support serial number (e.g. substed drives); |
|
1456 |
KErrBadName if drive number is invalid; |
|
1457 |
otherwise one of system-wide error codes. |
|
1458 |
||
1459 |
@see TMediaSerialNumber |
|
1460 |
*/ |
|
1461 |
EFSRV_EXPORT_C TInt RFs::GetMediaSerialNumber(TMediaSerialNumber& aSerialNum, TInt aDrive) |
|
1462 |
{ |
|
1463 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsGetMediaSerialNumber, MODULEUID, Handle(), aDrive); |
|
1464 |
TInt r = SendReceive(EFsGetMediaSerialNumber, TIpcArgs(&aSerialNum, aDrive)); |
|
1465 |
||
1466 |
TRACERETMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsGetMediaSerialNumberReturn, MODULEUID, r, aSerialNum); |
|
1467 |
return r; |
|
1468 |
} |
|
1469 |
||
1470 |
||
1471 |
||
1472 |
||
1473 |
EFSRV_EXPORT_C TInt RFs::SessionPath(TDes& aPath) const |
|
1474 |
/** |
|
1475 |
Gets the session path. |
|
1476 |
||
1477 |
When a client connects to the file server, its session path is initialised to |
|
1478 |
the system default path. The session path of an existing client can only be |
|
1479 |
changed by this function. |
|
1480 |
||
1481 |
@param aPath On return, contains the session path, including a trailing |
|
1482 |
backslash. |
|
1483 |
||
1484 |
@return KErrNone if successful, otherwise one of the other |
|
1485 |
system-wide error codes. |
|
1486 |
*/ |
|
1487 |
{ |
|
1488 |
TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsSessionPath, MODULEUID, Handle()); |
|
1489 |
TInt r = SendReceive(EFsSessionPath,TIpcArgs(&aPath)); |
|
1490 |
||
1491 |
TRACERETMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsSessionPathReturn, MODULEUID, r, aPath); |
|
1492 |
return r; |
|
1493 |
} |
|
1494 |
||
1495 |
||
1496 |
||
1497 |
||
1498 |
EFSRV_EXPORT_C TInt RFs::SetSessionPath(const TDesC& aPath) |
|
1499 |
/** |
|
1500 |
Sets the session path for the current file server client. |
|
1501 |
||
1502 |
When the client first connects to the file server, its session path |
|
1503 |
is initialised to the system default path. |
|
1504 |
||
1505 |
Note that the session path is text-only. It does not cause any locking. |
|
1506 |
Thus, although the path must be syntactically correct, its components |
|
1507 |
do not need to be valid at the time the path is set, and any component may be |
|
1508 |
deleted, removed or unmounted while the path is set. |
|
1509 |
||
1510 |
@param aPath The new session path. Consists of a drive and path. Normally, a |
|
1511 |
drive should be specified, but if not, the drive specified in |
|
1512 |
the existing session path is preserved. If a file is specified, |
|
1513 |
then the function fails and returns an error code. Therefore, |
|
1514 |
the final component in the path must have a trailing backslash |
|
1515 |
to indicate that it is a directory. All components of the |
|
1516 |
path must be syntactically correct, for example, wildcard |
|
1517 |
characters and double backslashes are not allowed in any |
|
1518 |
part of it. |
|
1519 |
||
1520 |
@return KErrNone if successful, otherwise one of the other |
|
1521 |
system-wide error codes. |
|
1522 |
||
1523 |
@capability Dependent If aPath is /Sys then AllFiles capability is required. |
|
1524 |
@capability Dependent If aPath begins with /Private and does not match this process' SID |
|
1525 |
then AllFiles capability is required. |
|
1526 |
||
1527 |
*/ |
|
1528 |
{ |
|
1529 |
TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsSetSessionPath, MODULEUID, Handle(), aPath); |
|
1530 |
TInt r = SendReceive(EFsSetSessionPath,TIpcArgs(&aPath)); |
|
1531 |
||
1532 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSetSessionPathReturn, MODULEUID, r); |
|
1533 |
return r; |
|
1534 |
} |
|
1535 |
||
1536 |
||
1537 |
||
1538 |
||
1539 |
||
1540 |
/** |
|
1541 |
Makes a directory. |
|
1542 |
||
1543 |
It should be a sub-directory of an existing directory and its name should be |
|
1544 |
unique within its parent directory, otherwise the function returns error code KErrAlreadyExists. |
|
1545 |
||
1546 |
Note that if a filename is specified in the argument, it is ignored. |
|
1547 |
Therefore, there should be a trailing backslash after the final |
|
1548 |
directory name in the argument to indicate that it is a directory, not a filename. |
|
1549 |
||
1550 |
For example, following code will create directory "C:\\DIR1\\" |
|
1551 |
||
1552 |
@code |
|
1553 |
fs.MkDir(_L("C:\\DIR1\\")); |
|
1554 |
@endcode |
|
1555 |
||
1556 |
The last line in the following example will result in KErrAlreadyExists because "DIR2" doesn't have a trailing backslash, |
|
1557 |
therefore is considered as a file name and discarded. Directory "C:\\DIR1\\" has already been created. |
|
1558 |
||
1559 |
@code |
|
1560 |
fs.MkDir(_L("C:\\DIR1\\")); // shall create DIR1 in the root directory |
|
1561 |
fs.MkDir(_L("C:\\DIR1\\DIR2")); // No trailing backslash, fails with KErrAlreadyExists |
|
1562 |
@endcode |
|
1563 |
||
1564 |
This example will always fail because "DIR1" doesn't have a trailing backslash and discarded while the root |
|
1565 |
directory always exists. |
|
1566 |
||
1567 |
@code |
|
1568 |
fs.MkDir(_L("C:\\DIR1")); // No trailing backslash, will always fail with KErrAlreadyExists |
|
1569 |
@endcode |
|
1570 |
||
1571 |
Note, the following case |
|
1572 |
||
1573 |
@code |
|
1574 |
fs.MkDir(_L("C:\\example.txt\\")); // would normally create a directory "c:\\example.txt\\" with KErrNone |
|
1575 |
@endcode |
|
1576 |
||
1577 |
But if there is a file named "example.txt", which exists at the same location, KErrAccessDenied is returned. |
|
1578 |
||
1579 |
Note also that because this method can return an error code (eg. because |
|
1580 |
the disk is full) before checking whether the path already exists, it |
|
1581 |
is not appropriate to use it just to work out whether a path exists or not. |
|
1582 |
||
1583 |
See MkDirAll(), which may also create intermediate directories. |
|
1584 |
||
1585 |
@param aPath The name of the new directory. Any path components which are |
|
1586 |
not specified here will be taken from the session path. |
|
1587 |
The directory name shall not contain wild cards ('?' or '*' characters) |
|
1588 |
and illegal characters like '<', '>', ':', '"', '/', '|' and '\000'. |
|
1589 |
The directory name containing only whilte space characters |
|
1590 |
(See TChar::IsSpace()) is also illegal. |
|
1591 |
||
1592 |
@return KErrNone if successful, otherwise one of the other |
|
1593 |
system-wide error codes. Even if another error code is returned, |
|
1594 |
(for example, if the disk is full) it is still possible that the |
|
1595 |
path may already exist. |
|
1596 |
||
1597 |
@capability Dependent If aPath is /Sys then Tcb capability is required. |
|
1598 |
@capability Dependent If aPath begins with /Private and does not match this process' SID |
|
1599 |
then AllFiles capability is required. |
|
1600 |
@capability Dependent If aPath is /Resource then Tcb capability is required. |
|
1601 |
||
1602 |
@see RFs::MkDirAll |
|
1603 |
*/ |
|
1604 |
EFSRV_EXPORT_C TInt RFs::MkDir(const TDesC& aPath) |
|
1605 |
{ |
|
1606 |
TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsMkDir, MODULEUID, Handle(), aPath); |
|
1607 |
TInt r = SendReceive(EFsMkDir,TIpcArgs(&aPath,NULL)); |
|
1608 |
||
1609 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsMkDirReturn, MODULEUID, r); |
|
1610 |
return r; |
|
1611 |
} |
|
1612 |
||
1613 |
||
1614 |
||
1615 |
||
1616 |
||
1617 |
/** |
|
1618 |
Makes one or more directories. |
|
1619 |
||
1620 |
Any valid path component specified in aPath which does not already exist is |
|
1621 |
created as a directory. |
|
1622 |
||
1623 |
Note that if a filename is specified in the argument, it is ignored. |
|
1624 |
Therefore, there should be a trailing backslash after the final |
|
1625 |
directory name in the argument to indicate that it is a directory, not a |
|
1626 |
filename. |
|
1627 |
||
1628 |
See also notes on RFs::MkDir() about trailing backslashes in directory names. |
|
1629 |
||
1630 |
Note also that because this method can return an error code (eg. because |
|
1631 |
the disk is full) before checking whether the path already exists, it |
|
1632 |
is not appropriate to use it just to work out whether a path exists or not. |
|
1633 |
||
1634 |
See MkDir(), which creates only a single new directory. |
|
1635 |
||
1636 |
@param aPath The path name specifiying the directory or directories to |
|
1637 |
create. If the function completes successfully, this path |
|
1638 |
identifies a valid directory. Any path components which are not |
|
1639 |
specified here are taken from the session path. |
|
1640 |
||
1641 |
@return KErrNone if successful, otherwise one of the other |
|
1642 |
system-wide error codes. Even if another error code is returned, |
|
1643 |
(for example, if the disk is full) it is still possible that the |
|
1644 |
path may already exist. |
|
1645 |
||
1646 |
||
1647 |
@capability Dependent If aPath is /Sys then Tcb capability is required. |
|
1648 |
@capability Dependent If aPath begins with /Private and does not match this process' SID |
|
1649 |
then AllFiles capability is required. |
|
1650 |
@capability Dependent If aPath is /Resource then Tcb capability is required. |
|
1651 |
||
1652 |
@see RFs::MkDir |
|
1653 |
*/ |
|
1654 |
EFSRV_EXPORT_C TInt RFs::MkDirAll(const TDesC& aPath) |
|
1655 |
{ |
|
1656 |
TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsMkDirAll, MODULEUID, Handle(), aPath); |
|
1657 |
TInt r = SendReceive(EFsMkDir,TIpcArgs(&aPath,TRUE)); |
|
1658 |
||
1659 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsMkDirAllReturn, MODULEUID, r); |
|
1660 |
return r; |
|
1661 |
} |
|
1662 |
||
1663 |
||
1664 |
||
1665 |
||
1666 |
EFSRV_EXPORT_C TInt RFs::RmDir(const TDesC& aPath) |
|
1667 |
/** |
|
1668 |
Removes a directory. |
|
1669 |
||
1670 |
The directory must be empty and cannot be the root directory. |
|
1671 |
||
1672 |
Note that if a filename is specified in the argument, it is |
|
1673 |
ignored. |
|
1674 |
||
1675 |
For example, following code will result in directory "C:\\SRC\\" being removed as long as |
|
1676 |
it is empty, the existance of "ENTRY" will not be checked: |
|
1677 |
||
1678 |
@code |
|
1679 |
fs.RmDir(_L("C:\\SRC\\ENTRY")); |
|
1680 |
@endcode |
|
1681 |
||
1682 |
Similarly, following code will try to remove "C:\\SRC\\" instead of "C:\\SRC\DIR\\": |
|
1683 |
@code |
|
1684 |
fs.RmDir(_L("C:\\SRC\\DIR")); |
|
1685 |
@endcode |
|
1686 |
||
1687 |
Therefore, there should be a trailing backslash after the final |
|
1688 |
directory name in the argument to indicate that it is a directory, not a |
|
1689 |
filename. |
|
1690 |
||
1691 |
See class CFileMan for information on deleting a |
|
1692 |
non-empty directory and all of its contents. |
|
1693 |
||
1694 |
@param aPath The path name of the directory to be removed. Any path components |
|
1695 |
which are not specified here are taken from the session path. Only |
|
1696 |
the lowest-level directory identified is removed. |
|
1697 |
||
1698 |
@return KErrNone, if successful; |
|
1699 |
KErrInUse, if trying to remove a non-empty directory or root directory; |
|
1700 |
otherwise, one of the other system-wide error codes. |
|
1701 |
||
1702 |
@capability Dependent If aPath is /Sys then Tcb capability is required. |
|
1703 |
@capability Dependent If aPath begins with /Private and does not match this process' SID |
|
1704 |
then AllFiles capability is required. |
|
1705 |
@capability Dependent If aPath is /Resource then Tcb capability is required. |
|
1706 |
||
1707 |
@see CFileMan |
|
1708 |
*/ |
|
1709 |
{ |
|
1710 |
TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsRmDir, MODULEUID, Handle(), aPath); |
|
1711 |
TInt r = SendReceive(EFsRmDir,TIpcArgs(&aPath)); |
|
1712 |
||
1713 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsRmDirReturn, MODULEUID, r); |
|
1714 |
return r; |
|
1715 |
} |
|
1716 |
||
1717 |
||
1718 |
||
1719 |
||
1720 |
void RFs::GetDirL(const TDesC& aName,const TUidType& aUidType,TUint aKey,CDir*& aFileList,RDir& aDir) const |
|
1721 |
// |
|
1722 |
// Create a dir array. Leave on any error. |
|
1723 |
// |
|
1724 |
{ |
|
1725 |
aFileList=NULL; |
|
1726 |
User::LeaveIfError(aDir.Open((RFs& )*this,aName,aUidType)); |
|
1727 |
DoGetDirL(aKey,aFileList,aDir); |
|
1728 |
} |
|
1729 |
||
1730 |
void RFs::GetDirL(const TDesC& aName,TUint anAttMask,TUint aKey,CDir*& aFileList,RDir& aDir) const |
|
1731 |
// |
|
1732 |
// Create a dir array. Leave on any error. |
|
1733 |
// |
|
1734 |
{ |
|
1735 |
||
1736 |
aFileList=NULL; |
|
1737 |
User::LeaveIfError(aDir.Open((RFs& )*this,aName,anAttMask)); |
|
1738 |
DoGetDirL(aKey,aFileList,aDir); |
|
1739 |
} |
|
1740 |
||
1741 |
void RFs::GetDirL(const TDesC& aName,TUint anAttMask,TUint aKey,CDir*& aFileList,CDir*& aDirList,RDir& aDir) const |
|
1742 |
// |
|
1743 |
// Create a dir array. Leave on any error. |
|
1744 |
// |
|
1745 |
{ |
|
1746 |
||
1747 |
aDirList=NULL; |
|
1748 |
GetDirL(aName,anAttMask|KEntryAttDir,aKey,aFileList,aDir); |
|
1749 |
aFileList->ExtractL(!(anAttMask&KEntryAttDir),aDirList); |
|
1750 |
} |
|
1751 |
||
1752 |
void RFs::DoGetDirL(TUint aKey,CDir*& aFileList,RDir& aDir) const |
|
1753 |
// |
|
1754 |
// Create a dir array. Leave on any error. |
|
1755 |
// |
|
1756 |
{ |
|
1757 |
||
1758 |
aFileList=CDir::NewL(); |
|
1759 |
TInt r; |
|
1760 |
TEntryArray* pArray=new(ELeave) TEntryArray; |
|
1761 |
CleanupStack::PushL(pArray); |
|
1762 |
||
1763 |
TEntryArray& array=*pArray; |
|
1764 |
do |
|
1765 |
{ |
|
1766 |
r=aDir.Read(array); |
|
1767 |
if (r==KErrNone || r==KErrEof) |
|
1768 |
{ |
|
1769 |
TInt count=array.Count(); |
|
1770 |
if (count==0) |
|
1771 |
break; |
|
1772 |
TInt i=0; |
|
1773 |
while (i<count) |
|
1774 |
aFileList->AddL(array[i++]); |
|
1775 |
} |
|
1776 |
}while (r==KErrNone); |
|
1777 |
||
1778 |
CleanupStack::PopAndDestroy(); |
|
1779 |
if (!(r==KErrNone || r==KErrEof)) |
|
1780 |
User::Leave(r); |
|
1781 |
aFileList->Compress(); |
|
1782 |
if (aKey==ESortNone) |
|
1783 |
return; |
|
1784 |
||
1785 |
r=aFileList->Sort(aKey); |
|
1786 |
if (r!=KErrNone) |
|
1787 |
User::Leave(r); |
|
1788 |
} |
|
1789 |
||
1790 |
||
1791 |
||
1792 |
||
1793 |
EFSRV_EXPORT_C TInt RFs::GetDir(const TDesC& aName,const TUidType& aUidType,TUint aKey,CDir*& aFileList) const |
|
1794 |
/** |
|
1795 |
Gets a filtered list of a directory's contents by UID type. |
|
1796 |
||
1797 |
The aUidType parameter determines which file entry types should be listed. |
|
1798 |
The sort key determines the order in which they are listed. |
|
1799 |
||
1800 |
Notes: |
|
1801 |
||
1802 |
1. The function sets aFileList to NULL, and then allocates memory for it before |
|
1803 |
appending entries to the list. Therefore, aFileList should have no memory |
|
1804 |
allocated to it before this function is called, otherwise this memory |
|
1805 |
will become orphaned. |
|
1806 |
||
1807 |
2. The caller of this function is responsible for deleting aFileList after |
|
1808 |
the function has returned. |
|
1809 |
||
1810 |
@param aName The name of the directory for which a listing is required. |
|
1811 |
Wildcards may be used to specify particular files. |
|
1812 |
@param aUidType Only those files whose UIDs match those specified within this |
|
1813 |
UID type will be included in the file list. Any, or all, of |
|
1814 |
the three UIDs within the UID type may be omitted. |
|
1815 |
Any UID which is omitted acts in a similar manner to |
|
1816 |
a wildcard character, matching to all UIDs. |
|
1817 |
@param aKey The sort key. This is a set of flags indicating the order in |
|
1818 |
which the entries are to be sorted. These flags are defined |
|
1819 |
by TEntryKey. |
|
1820 |
@param aFileList On return contains a filtered list of directory and file entries. |
|
1821 |
||
1822 |
@return KErrNone if successful, otherwise one of the other |
|
1823 |
system-wide error codes. |
|
1824 |
||
1825 |
@see TEntryKey |
|
1826 |
*/ |
|
1827 |
{ |
|
1828 |
TRACEMULT6(UTF::EBorder, UTraceModuleEfsrv::EFsGetDir1, MODULEUID, |
|
1829 |
Handle(), aName, aUidType[0].iUid, aUidType[1].iUid, aUidType[2].iUid, aKey); |
|
1830 |
||
1831 |
RDir d; |
|
1832 |
TRAPD(r,GetDirL(aName,aUidType,aKey,aFileList,d)) |
|
1833 |
d.Close(); |
|
1834 |
if (r!=KErrNone) |
|
1835 |
{ |
|
1836 |
delete aFileList; |
|
1837 |
aFileList=NULL; |
|
1838 |
} |
|
1839 |
||
1840 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsGetDir1Return, MODULEUID, r); |
|
1841 |
return r; |
|
1842 |
} |
|
1843 |
||
1844 |
||
1845 |
||
1846 |
||
1847 |
EFSRV_EXPORT_C TInt RFs::GetDir(const TDesC& aName,TUint anAttMask,TUint aKey,CDir*& aFileList) const |
|
1848 |
/** |
|
1849 |
Gets a filtered list of a directory's contents. |
|
1850 |
||
1851 |
The bitmask determines which file and directory entry types should be listed. |
|
1852 |
The sort key determines the order in which they are listed. |
|
1853 |
||
1854 |
Notes: |
|
1855 |
||
1856 |
1. If sorting by UID (as indicated when the ESortByUid bit is OR'ed with |
|
1857 |
the sort key), then UID information will be included in the listing |
|
1858 |
whether or not KEntryAttAllowUid is specified in anAttMask. |
|
1859 |
||
1860 |
2. The function sets aFileList to NULL, and then allocates memory for it before |
|
1861 |
appending entries to the list. Therefore, aFileList should have no memory |
|
1862 |
allocated to it before this function is called, otherwise this memory will |
|
1863 |
become orphaned. |
|
1864 |
||
1865 |
3. The caller of this function is responsible for deleting aFileList after |
|
1866 |
the function has returned. |
|
1867 |
||
1868 |
@param aName The name of the directory for which a listing is required. |
|
1869 |
Wildcards may be used to specify particular files. |
|
1870 |
@param anAttMask Bitmask indicating the attributes of interest. Only files and |
|
1871 |
directories whose attributes match those specified here can be |
|
1872 |
included in the listing. For more information, |
|
1873 |
see KEntryAttMatchMask and the other directory entry details. |
|
1874 |
Also see KEntryAttNormal and the other file or directory attributes. |
|
1875 |
@param aKey The sort key. This is a set of flags indicating the order in |
|
1876 |
which the entries are to be sorted. These flags are defined |
|
1877 |
by TEntryKey. |
|
1878 |
@param aFileList On return contains a filtered list of directory and file entries. |
|
1879 |
||
1880 |
@return KErrNone if successful, otherwise one of the other |
|
1881 |
system-wide error codes. |
|
1882 |
||
1883 |
@see TEntryKey |
|
1884 |
*/ |
|
1885 |
{ |
|
1886 |
TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::EFsGetDir2, MODULEUID, Handle(), aName, anAttMask, aKey); |
|
1887 |
||
1888 |
RDir d; |
|
1889 |
if ((aKey&0xff)==ESortByUid) |
|
1890 |
anAttMask|=KEntryAttAllowUid; |
|
1891 |
TRAPD(r,GetDirL(aName,anAttMask,aKey,aFileList,d)) |
|
1892 |
d.Close(); |
|
1893 |
if (r!=KErrNone) |
|
1894 |
{ |
|
1895 |
delete aFileList; |
|
1896 |
aFileList=NULL; |
|
1897 |
} |
|
1898 |
||
1899 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsGetDir2Return, MODULEUID, r); |
|
1900 |
return r; |
|
1901 |
} |
|
1902 |
||
1903 |
||
1904 |
||
1905 |
||
1906 |
EFSRV_EXPORT_C TInt RFs::GetDir(const TDesC& aName,TUint anAttMask,TUint aKey,CDir*& aFileList,CDir*& aDirList) const |
|
1907 |
/** |
|
1908 |
Gets a filtered list of the directory and file entries contained in |
|
1909 |
a directory, and a list of the directory entries only. |
|
1910 |
||
1911 |
The bitmask determines which file and directory entry types should be listed in |
|
1912 |
aFileList. The contents of the second list, aDirList are not affected by the bitmask; it |
|
1913 |
returns all directory entries contained in directory aName. The |
|
1914 |
sort key determines the order in which both lists are sorted. |
|
1915 |
||
1916 |
Notes: |
|
1917 |
||
1918 |
1. If sorting by UID (as indicated when the ESortByUid bit is OR'ed with |
|
1919 |
the sort key), then UID information will be included in the listing |
|
1920 |
whether or not KEntryAttAllowUid is specified in anAttMask. |
|
1921 |
||
1922 |
2. The function sets both aFileList and aDirList to NULL, and then allocates |
|
1923 |
memory to them before appending entries to the lists. Therefore, aFileList |
|
1924 |
and aDirList should have no memory allocated to them before this |
|
1925 |
function is called, otherwise the allocated memory will become orphaned. |
|
1926 |
||
1927 |
3. The caller of this function is responsible for deleting aFileList |
|
1928 |
and aDirList after the function has returned. |
|
1929 |
||
1930 |
@param aName The name of the directory for which a listing is required. |
|
1931 |
Wildcards may be used to specify particular files. |
|
1932 |
@param anAttMask Bitmask indicating the attributes of interest. Only files and |
|
1933 |
directories whose attributes match those specified here can be |
|
1934 |
included in aFileList. aDirList is unaffected by this mask. |
|
1935 |
For more information, see KEntryAttMatchMask and the other |
|
1936 |
directory entry details. |
|
1937 |
Also see KEntryAttNormal and the other file or directory |
|
1938 |
attributes. |
|
1939 |
@param aKey The sort key. This is a set of flags indicating the order in |
|
1940 |
which the entries in both lists are to be sorted. These flags |
|
1941 |
are defined by TEntryKey. |
|
1942 |
@param aFileList On return contains a filtered list of directory and |
|
1943 |
file entries. |
|
1944 |
@param aDirList On return contains a filtered list of directory entries only. |
|
1945 |
||
1946 |
@return KErrNone if successful, otherwise one of the other |
|
1947 |
system-wide error codes. |
|
1948 |
||
1949 |
@see TEntryKey |
|
1950 |
*/ |
|
1951 |
{ |
|
1952 |
TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::EFsGetDir3, MODULEUID, Handle(), aName, anAttMask, aKey); |
|
1953 |
||
1954 |
RDir d; |
|
1955 |
if (aKey&ESortByUid) |
|
1956 |
anAttMask|=KEntryAttAllowUid; |
|
1957 |
TRAPD(r,GetDirL(aName,anAttMask,aKey,aFileList,aDirList,d)) |
|
1958 |
d.Close(); |
|
1959 |
if (r!=KErrNone) |
|
1960 |
{ |
|
1961 |
delete aFileList; |
|
1962 |
aFileList=NULL; |
|
1963 |
delete aDirList; |
|
1964 |
aDirList=NULL; |
|
1965 |
} |
|
1966 |
||
1967 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsGetDir3Return, MODULEUID, r); |
|
1968 |
return r; |
|
1969 |
} |
|
1970 |
||
1971 |
||
1972 |
||
1973 |
||
1974 |
EFSRV_EXPORT_C TInt RFs::Parse(const TDesC& aName,TParse& aParse) const |
|
1975 |
/** |
|
1976 |
Parses a filename specification. |
|
1977 |
||
1978 |
Parsing is done with wildcard resolution, using the session path as |
|
1979 |
the default. You can then use TParse's getter functions to extract individual |
|
1980 |
components of the resulting name. All the path components that are included |
|
1981 |
in aName are put into the resulting filename. Any components that are still |
|
1982 |
missing are taken from the session path. |
|
1983 |
||
1984 |
Specifying: |
|
1985 |
||
1986 |
@code |
|
1987 |
TParse fp; |
|
1988 |
@endcode |
|
1989 |
@code |
|
1990 |
fs.Parse(name,fp); |
|
1991 |
@endcode |
|
1992 |
||
1993 |
is equivalent to |
|
1994 |
||
1995 |
@code |
|
1996 |
TParse fp; |
|
1997 |
@endcode |
|
1998 |
@code |
|
1999 |
fp.Set(name,NULL,&fs.SessionPath()); |
|
2000 |
@endcode |
|
2001 |
||
2002 |
Note that the function does not check for illegal characters, or for |
|
2003 |
illegal path components in either of the paths specified. |
|
2004 |
||
2005 |
@param aName The file name to be parsed, using the session path to provide |
|
2006 |
the missing components. |
|
2007 |
@param aParse A TParse objct that provides functions for |
|
2008 |
extracting individual components of the resulting file name. |
|
2009 |
||
2010 |
@return KErrNone if successful, otherwise one of the other |
|
2011 |
system-wide error codes. |
|
2012 |
*/ |
|
2013 |
{ |
|
2014 |
TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsParse1, MODULEUID, Handle(), aName); |
|
2015 |
TFileName session_path; |
|
2016 |
TInt r = SessionPath(session_path); |
|
2017 |
if (r==KErrNone) |
|
2018 |
r = aParse.Set(aName, NULL, &session_path); |
|
2019 |
||
2020 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsParse1Return, MODULEUID, r); |
|
2021 |
return r; |
|
2022 |
} |
|
2023 |
||
2024 |
||
2025 |
||
2026 |
||
2027 |
EFSRV_EXPORT_C TInt RFs::Parse(const TDesC& aName,const TDesC& aRelated,TParse& aParse) const |
|
2028 |
/** |
|
2029 |
Parses a filename specification, specifying related file path components. |
|
2030 |
||
2031 |
Parsing is done with wildcard resolution, using the session path as |
|
2032 |
the default. You can then use TParse's getter functions to extract individual |
|
2033 |
components of the resulting name. All the path components that are included |
|
2034 |
in aName are put into the resulting filename. Any missing components are taken |
|
2035 |
from the optional aRelated argument, which has the next order of precedence. |
|
2036 |
Finally, any components that are still missing are taken from the session path. |
|
2037 |
||
2038 |
Specifying: |
|
2039 |
||
2040 |
@code |
|
2041 |
TParse fp; |
|
2042 |
@endcode |
|
2043 |
@code |
|
2044 |
fs.Parse(name,related,fp); |
|
2045 |
@endcode |
|
2046 |
||
2047 |
is equivalent to |
|
2048 |
||
2049 |
@code |
|
2050 |
TParse fp; |
|
2051 |
@endcode |
|
2052 |
@code |
|
2053 |
fp.Set(name,related,&fs.SessionPath()); |
|
2054 |
@endcode |
|
2055 |
||
2056 |
Note that the function does not check for illegal characters, or for |
|
2057 |
illegal path components in any of the paths specified. |
|
2058 |
||
2059 |
@param aName The file name to be parsed, using the session path and the |
|
2060 |
related path to provide the missing components. |
|
2061 |
@param aRelated The related file specification. |
|
2062 |
@param aParse A TParse objct that provides functions for |
|
2063 |
extracting individual components of the resulting file name. |
|
2064 |
||
2065 |
@return KErrNone if successful, otherwise one of the other |
|
2066 |
system-wide error codes. |
|
2067 |
*/ |
|
2068 |
{ |
|
2069 |
TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsParse2, MODULEUID, Handle(), aName, aRelated); |
|
2070 |
TFileName session_path; |
|
2071 |
TInt r = SessionPath(session_path); |
|
2072 |
if (r==KErrNone) |
|
2073 |
r = aParse.Set(aName, &aRelated, &session_path); |
|
2074 |
||
2075 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsParse2Return, MODULEUID, r); |
|
2076 |
return r; |
|
2077 |
} |
|
2078 |
||
2079 |
||
2080 |
||
2081 |
||
2082 |
EFSRV_EXPORT_C TInt RFs::Delete(const TDesC& aName) |
|
2083 |
/** |
|
2084 |
Deletes a single file. |
|
2085 |
||
2086 |
Wildcards are not allowed in either the file name or the extension, |
|
2087 |
otherwise an error is returned. |
|
2088 |
||
2089 |
Note that the file must be closed and must not be read-only. |
|
2090 |
Hidden files can be deleted but system files cannot. |
|
2091 |
||
2092 |
See class CFileMan for information on deleting multiple files. |
|
2093 |
||
2094 |
@param aName The name of the file to be deleted. Any path components which |
|
2095 |
are not specified here will be taken from the session path. |
|
2096 |
||
2097 |
@return KErrNone if successful, otherwise one of the other |
|
2098 |
system-wide error codes. |
|
2099 |
||
2100 |
@capability Dependent If aName is /Sys then Tcb capability is required. |
|
2101 |
@capability Dependent If aName begins with /Private and does not match this process' SID |
|
2102 |
then AllFiles capability is required. |
|
2103 |
@capability Dependent If aName is /Resource then Tcb capability is required. |
|
2104 |
||
2105 |
@see CFileMan |
|
2106 |
*/ |
|
2107 |
{ |
|
2108 |
TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsDelete, MODULEUID, Handle(), aName); |
|
2109 |
TInt r = SendReceive(EFsDelete,TIpcArgs(&aName)); |
|
2110 |
||
2111 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsDeleteReturn, MODULEUID, r); |
|
2112 |
return r; |
|
2113 |
} |
|
2114 |
||
2115 |
||
2116 |
||
2117 |
||
2118 |
EFSRV_EXPORT_C TInt RFs::Rename(const TDesC& anOldName,const TDesC& aNewName) |
|
2119 |
/** |
|
2120 |
Renames a single file or directory. |
|
2121 |
||
2122 |
It can also be used to move a file or directory by specifying different |
|
2123 |
destination and source directories. If so, the destination and source |
|
2124 |
directories must be on the same drive. If a directory is moved, then |
|
2125 |
the directory structure beneath it is also moved. |
|
2126 |
||
2127 |
If a directory specified by aNewName is different from one specified |
|
2128 |
by anOldName, then the file or directory is moved to the new directory. |
|
2129 |
The file or directory cannot be moved to another device by this means, |
|
2130 |
either explicitly (by another drive specified in the name) or implicitly |
|
2131 |
(because the directory has been mapped to another device with SetSubst(). |
|
2132 |
||
2133 |
The function fails and returns an error code in the following |
|
2134 |
circumstances: |
|
2135 |
||
2136 |
1. If either the old or new name includes wildcards. |
|
2137 |
||
2138 |
2. If a file or directory with the new name already exists in |
|
2139 |
the target directory. Overwriting is not permitted. |
|
2140 |
||
2141 |
3. If file anOldName does not exist, or is open. |
|
2142 |
||
2143 |
Read-only, system and hidden files may be renamed. The renamed |
|
2144 |
file's attributes are preserved. |
|
2145 |
||
2146 |
Note that when this function is operating on directories, a trailing backslash |
|
2147 |
is not required after the final directory name in either anOldName or aNewName. |
|
2148 |
||
2149 |
See class CFileMan for information on renaming multiple files. |
|
2150 |
||
2151 |
@param anOldName File or directory to be renamed. Any path components which are |
|
2152 |
not specified here will be taken from the session path. |
|
2153 |
@param aNewName Path specifying the new name for the file or directory and/or |
|
2154 |
its new parent directory. All directories specified in this path |
|
2155 |
must exist. |
|
2156 |
Any path components which are not specified here will be taken |
|
2157 |
from the session path. |
|
2158 |
||
2159 |
@return KErrNone if successful, otherwise one of the other |
|
2160 |
system-wide error codes. |
|
2161 |
||
2162 |
@capability Dependent If either anOldName or aNewName is /Sys then Tcb capability is required. |
|
2163 |
@capability Dependent If either anOldName or aNewName begins with /Private and does not match |
|
2164 |
this process' SID then AllFiles capability is required. |
|
2165 |
@capability Dependent If either anOldName or aNewName is /Resource then Tcb capability is required. |
|
2166 |
||
2167 |
@see CFileMan |
|
2168 |
*/ |
|
2169 |
{ |
|
2170 |
TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsRename, MODULEUID, Handle(), anOldName, aNewName); |
|
2171 |
||
2172 |
TInt r; |
|
2173 |
if (anOldName.Length() <= 0 || aNewName.Length() <= 0 ) |
|
2174 |
r = KErrBadName; |
|
2175 |
else |
|
2176 |
r = SendReceive(EFsRename,TIpcArgs(&anOldName,&aNewName)); |
|
2177 |
||
2178 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsRenameReturn, MODULEUID, r); |
|
2179 |
return r; |
|
2180 |
} |
|
2181 |
||
2182 |
||
2183 |
||
2184 |
||
2185 |
EFSRV_EXPORT_C TInt RFs::Replace(const TDesC& anOldName,const TDesC& aNewName) |
|
2186 |
/** |
|
2187 |
Replaces a single file with another. |
|
2188 |
||
2189 |
This function does not support the use of wildcards. Unlike Rename(), it only |
|
2190 |
applies to files. |
|
2191 |
||
2192 |
This function operates as follows: |
|
2193 |
||
2194 |
1. if the aNewName file does not exist, it is created. |
|
2195 |
||
2196 |
2. anOldName's contents, attributes and the date and time of its last |
|
2197 |
modification are copied to file aNewName, overwriting any existing contents |
|
2198 |
and attribute details. |
|
2199 |
||
2200 |
3. anOldName is deleted. |
|
2201 |
||
2202 |
anOldName may be hidden, read-only or a system file. However, |
|
2203 |
neither anOldName, nor, if it exists, aNewName, can be open; |
|
2204 |
aNewName must not be read-only. |
|
2205 |
Both files must be on the same drive. |
|
2206 |
||
2207 |
@param anOldName The file to be replaced. Must exist and must be closed. It is |
|
2208 |
deleted by this function. |
|
2209 |
@param aNewName The file to replace anOldName. Does not need to exist, but if |
|
2210 |
it does exist, it must be closed. If it exists, its name |
|
2211 |
remains unchanged but its contents, attributes and the date |
|
2212 |
and time of its last modification are replaced by those |
|
2213 |
of anOldName. |
|
2214 |
If it does not exist, it will be created and is assigned |
|
2215 |
the contents and attributes of anOldName. Must not be followed |
|
2216 |
by a trailing backslash. |
|
2217 |
||
2218 |
@return KErrNone, if successful; |
|
2219 |
KErrAccessDenied, if an attempt is made to replace a directory; |
|
2220 |
otherwise one of the other system-wide error codes. |
|
2221 |
||
2222 |
@capability Dependent If either anOldName or aNewName is /Sys then Tcb capability is required. |
|
2223 |
@capability Dependent If either anOldName or aNewName begins with /Private and does not match |
|
2224 |
this process' SID then AllFiles capability is required. |
|
2225 |
@capability Dependent If either anOldName or aNewName is /Resource then Tcb capability is required. |
|
2226 |
||
2227 |
*/ |
|
2228 |
{ |
|
2229 |
TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsReplace, MODULEUID, Handle(), anOldName, aNewName); |
|
2230 |
TInt r = SendReceive(EFsReplace,TIpcArgs(&anOldName,&aNewName)); |
|
2231 |
||
2232 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsReplaceReturn, MODULEUID, r); |
|
2233 |
return r; |
|
2234 |
} |
|
2235 |
||
2236 |
||
2237 |
||
2238 |
||
2239 |
EFSRV_EXPORT_C TInt RFs::Att(const TDesC& aName,TUint& aVal) const |
|
2240 |
/** |
|
2241 |
Gets a file's attributes. |
|
2242 |
||
2243 |
@param aName The filename. Any path components which are not specified here |
|
2244 |
will be taken from the session path. |
|
2245 |
@param aVal On return, the individual bits within the byte indicate which |
|
2246 |
attributes have been set. For more information see KEntryAttNormal |
|
2247 |
and the other file/directory attributes. |
|
2248 |
||
2249 |
@return KErrNone if successful, otherwise one of the other |
|
2250 |
system-wide error codes. |
|
2251 |
||
2252 |
@capability Dependent If aName contains /sys/ then AllFiles capability is required. |
|
2253 |
@capability Dependent If aName contains /Private/ and does not match |
|
2254 |
this process' SID then AllFiles capability is required. |
|
2255 |
||
2256 |
@see KEntryAttNormal |
|
2257 |
*/ |
|
2258 |
{ |
|
2259 |
TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsAtt, MODULEUID, Handle(), aName); |
|
2260 |
||
2261 |
TEntry e; |
|
2262 |
TInt r=Entry(aName,e); |
|
2263 |
if (r==KErrNone) |
|
2264 |
aVal=e.iAtt; |
|
2265 |
||
2266 |
TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFsAttReturn, MODULEUID, r, aVal); |
|
2267 |
return r; |
|
2268 |
} |
|
2269 |
||
2270 |
||
2271 |
||
2272 |
||
2273 |
EFSRV_EXPORT_C TInt RFs::SetAtt(const TDesC& aName,TUint aSetAttMask,TUint aClearAttMask) |
|
2274 |
/** |
|
2275 |
Sets or clears the attributes of a single file or directory. |
|
2276 |
||
2277 |
The function uses two bitmasks. The first bitmask specifies the attributes |
|
2278 |
to be set; the second specifies the attributes to be cleared. |
|
2279 |
||
2280 |
An attempt to set or clear the KEntryAttDir, KEntryAttVolume or KEntryAttRemote |
|
2281 |
attributes have no effect. |
|
2282 |
||
2283 |
@param aName File or directory name. Any path components which are not |
|
2284 |
specified here will be taken from the session path. Must |
|
2285 |
not include wildcard characters. The file must be closed. |
|
2286 |
@param aSetAttMask Bitmask indicating the attributes to be set. |
|
2287 |
@param aClearAttMask Bitmask indicating the attributes to be cleared. For more |
|
2288 |
information, see KEntryAttNormal and the other file or |
|
2289 |
directory attributes. |
|
2290 |
||
2291 |
@return KErrNone if successful, otherwise one of the other |
|
2292 |
system-wide error codes. |
|
2293 |
||
2294 |
@panic FSCLIENT 21 if any attribute appears in both bitmasks. |
|
2295 |
||
2296 |
||
2297 |
@capability Dependent If aName is /Sys then Tcb capability is required. |
|
2298 |
@capability Dependent If aName begins with /Private and does not match |
|
2299 |
this process' SID then AllFiles capability is required. |
|
2300 |
@capability Dependent If aName is /Resource then Tcb capability is required. |
|
2301 |
||
2302 |
@see RFs::SetEntry |
|
2303 |
||
2304 |
*/ |
|
2305 |
{ |
|
2306 |
TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::EFsSetAtt, MODULEUID, |
|
2307 |
Handle(), aName, aSetAttMask, aClearAttMask); |
|
2308 |
||
2309 |
TInt r = SetEntry(aName,TTime(0),aSetAttMask,aClearAttMask); |
|
2310 |
||
2311 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSetAttReturn, MODULEUID, r); |
|
2312 |
return r; |
|
2313 |
} |
|
2314 |
||
2315 |
||
2316 |
||
2317 |
||
2318 |
EFSRV_EXPORT_C TInt RFs::Modified(const TDesC& aName,TTime& aTime) const |
|
2319 |
/** |
|
2320 |
Gets the last modification date and time of a file or a directory, |
|
2321 |
in UTC. |
|
2322 |
||
2323 |
If there has been no modification, the function gets the date and |
|
2324 |
time of the file or directory's creation. |
|
2325 |
||
2326 |
@param aName File or directory name. |
|
2327 |
@param aTime On return, contains the date and time of the file or |
|
2328 |
directory's last modification in universal time. |
|
2329 |
||
2330 |
@return KErrNone if successful, otherwise one of the other |
|
2331 |
system-wide error codes. |
|
2332 |
||
2333 |
@capability Dependent If aName contains /sys/ then AllFiles capability is required. |
|
2334 |
@capability Dependent If aName contains /Private/ and does not match |
|
2335 |
this process' SID then AllFiles capability is required. |
|
2336 |
||
2337 |
*/ |
|
2338 |
{ |
|
2339 |
TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsModified, MODULEUID, Handle(), aName); |
|
2340 |
||
2341 |
TEntry e; |
|
2342 |
TInt r=Entry(aName,e); |
|
2343 |
if (r==KErrNone) |
|
2344 |
aTime=e.iModified; |
|
2345 |
||
2346 |
TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFsModifiedReturn, MODULEUID, r, I64LOW(aTime.Int64()), I64HIGH(aTime.Int64())); |
|
2347 |
return r; |
|
2348 |
} |
|
2349 |
||
2350 |
||
2351 |
||
2352 |
||
2353 |
EFSRV_EXPORT_C TInt RFs::SetModified(const TDesC& aName,const TTime& aTime) |
|
2354 |
/** |
|
2355 |
Sets the date and time that the contents of a file or directory |
|
2356 |
were modified, in UTC. |
|
2357 |
||
2358 |
@param aName File or directory name. |
|
2359 |
@param aTime The new date and time that the file or directory was modified |
|
2360 |
in universal time. |
|
2361 |
||
2362 |
@return KErrNone if successful; |
|
2363 |
KErrInUse, if the file is open; |
|
2364 |
otherwise one of the other system-wide error codes. |
|
2365 |
||
2366 |
@capability Dependent If aName is /Sys then Tcb capability is required. |
|
2367 |
@capability Dependent If aName begins with /Private and does not match |
|
2368 |
this process' SID then AllFiles capability is required. |
|
2369 |
@capability Dependent If aName is /Resource then Tcb capability is required. |
|
2370 |
||
2371 |
*/ |
|
2372 |
{ |
|
2373 |
TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::EFsSetModified, MODULEUID, Handle(), aName, I64LOW(aTime.Int64()), I64HIGH(aTime.Int64()) ); |
|
2374 |
||
2375 |
TInt r = SetEntry(aName,aTime,KEntryAttModified,0); |
|
2376 |
||
2377 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSetModifiedReturn, MODULEUID, r); |
|
2378 |
return r; |
|
2379 |
} |
|
2380 |
||
2381 |
||
2382 |
||
2383 |
||
2384 |
EFSRV_EXPORT_C TInt RFs::Entry(const TDesC& aName,TEntry& anEntry) const |
|
2385 |
/** |
|
2386 |
Gets the entry details for a file or directory. |
|
2387 |
||
2388 |
This information includes UID information. |
|
2389 |
||
2390 |
@param aName Name of file or directory. |
|
2391 |
@param anEntry On return, contains the entry details for the file or directory. TEntry::iModified contains UTC date and time. |
|
2392 |
||
2393 |
@return KErrNone if successful, otherwise one of the other |
|
2394 |
system-wide error codes. |
|
2395 |
||
2396 |
@capability Dependent If aName contains "\\Sys\\" and includes an additional file or directory then AllFiles capability |
|
2397 |
is required. For example, the paths "c:\\sys" and "c:\\sys\\" will always be readable, whereas |
|
2398 |
the path "c:\\sys\\abc\\" will only be readable with AllFiles capability. |
|
2399 |
||
2400 |
@capability Dependent If aName contains \\Private\\ and includes an additional file, or a directory which does not match |
|
2401 |
this process' SID, then AllFiles capability is required. For example, the paths "c:\\private" and |
|
2402 |
"c:\\private\\" will always be readable, whereas the path "c:\\private\\<n>\\" will only be |
|
2403 |
readable with AllFiles capability or if <n> matches the process' SID. |
|
2404 |
*/ |
|
2405 |
{ |
|
2406 |
TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsEntry, MODULEUID, Handle(), aName); |
|
2407 |
TPckg<TEntry> e(anEntry); |
|
2408 |
TInt r = SendReceive(EFsEntry,TIpcArgs(&aName,&e)); |
|
2409 |
||
2410 |
TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFsEntryReturn, MODULEUID, |
|
2411 |
r, anEntry.iAtt, |
|
2412 |
I64LOW(anEntry.iModified.Int64()), I64HIGH(anEntry.iModified.Int64()), |
|
2413 |
anEntry.iSize); |
|
2414 |
return r; |
|
2415 |
} |
|
2416 |
||
2417 |
||
2418 |
||
2419 |
||
2420 |
EFSRV_EXPORT_C TInt RFs::SetEntry(const TDesC& aName,const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask) |
|
2421 |
/** |
|
2422 |
Sets both the attributes and the last modified date and time for a file or directory. |
|
2423 |
||
2424 |
The function uses two bitmasks. The first bitmask determines |
|
2425 |
which attributes should be set. The second bitmask determines which should be cleared. |
|
2426 |
||
2427 |
An attempt to set or clear the KEntryAttDir, KEntryAttVolume or KEntryAttRemote |
|
2428 |
attributes have no effect. |
|
2429 |
||
2430 |
@param aName File or directory name. |
|
2431 |
@param aTime New date and time. UTC date and time should be used. |
|
2432 |
@param aSetAttMask Bitmask indicating which attributes are to be set. |
|
2433 |
@param aClearAttMask Bitmask indicating which attributes are cleared. For more |
|
2434 |
information, see KEntryAttNormal, and the other file |
|
2435 |
or directory attributes. |
|
2436 |
||
2437 |
@return KErrNone, if successful; |
|
2438 |
KErrInUse, if the file is open; |
|
2439 |
otherwise one of the other system-wide error codes. |
|
2440 |
||
2441 |
@panic FSCLIENT 21 if any attribute appears in both bitmasks. |
|
2442 |
||
2443 |
@capability Dependent If aName is /Sys then Tcb capability is required. |
|
2444 |
@capability Dependent If aName begins with /Private and does not match |
|
2445 |
this process' SID then AllFiles capability is required. |
|
2446 |
@capability Dependent If aName is /Resource then Tcb capability is required. |
|
2447 |
||
2448 |
@see KEntryAttNormal |
|
2449 |
@see KEntryAttDir |
|
2450 |
@see KEntryAttVolume |
|
2451 |
*/ |
|
2452 |
{ |
|
2453 |
TRACEMULT6(UTF::EBorder, UTraceModuleEfsrv::EFsSetEntry, MODULEUID, |
|
2454 |
Handle(), aName, |
|
2455 |
I64LOW(aTime.Int64()), I64HIGH(aTime.Int64()), |
|
2456 |
aSetAttMask, aClearAttMask); |
|
2457 |
||
2458 |
__ASSERT_ALWAYS((aSetAttMask&aClearAttMask)==0,Panic(EAttributesIllegal)); |
|
2459 |
TPtrC8 timeBuf((TUint8*)&aTime,sizeof(TTime)); |
|
2460 |
TInt r = SendReceive(EFsSetEntry,TIpcArgs(&aName,&timeBuf,aSetAttMask,aClearAttMask)); |
|
2461 |
||
2462 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSetEntryReturn, MODULEUID, r); |
|
2463 |
return r; |
|
2464 |
} |
|
2465 |
||
2466 |
/** |
|
2467 |
Reads data from a file without opening it. |
|
2468 |
||
2469 |
The contents of the file can be accessed regardless of the file's lock state. |
|
2470 |
||
2471 |
The file may be open by any number of other clients for reading or writing. |
|
2472 |
In allowing such access to a file, the fileserver makes no guarantees as to |
|
2473 |
the validity of the data it returns. |
|
2474 |
||
2475 |
@param aName Name of the file to be accessed. |
|
2476 |
@param aPos The offset, in bytes, from the start of the file where |
|
2477 |
reading is to start. |
|
2478 |
@param aDes On return, contains the data read from the file. The length of |
|
2479 |
the descriptor is set to the number of bytes read. If the |
|
2480 |
specified offset lies beyond the end of the file, no data is |
|
2481 |
read and the length of this descriptor is set to zero. |
|
2482 |
@param aLength The number of bytes to be read from the file. |
|
2483 |
||
2484 |
@return KErrNone if successful, |
|
2485 |
KErrArgument if aLength is negative, |
|
2486 |
otherwise one of the other system-wide error codes. |
|
2487 |
||
2488 |
@panic FSCLIENT 19 if aPos negative. |
|
2489 |
@panic FSCLIENT 27 if aLength is greater than the maximum length of |
|
2490 |
the target descriptor. |
|
2491 |
||
2492 |
@capability Dependent If the path for aName starts with /Sys capability AllFiles is required |
|
2493 |
@capability Dependent If the path for aName starts with /Private and this process does not have |
|
2494 |
the relevant SID capability AllFiles is required |
|
2495 |
||
2496 |
*/ |
|
2497 |
EFSRV_EXPORT_C TInt RFs::ReadFileSection(const TDesC& aName,TInt64 aPos,TDes8& aDes,TInt aLength) const |
|
2498 |
{ |
|
2499 |
TRACEMULT5(UTF::EBorder, UTraceModuleEfsrv::EFsReadFileSection, MODULEUID, |
|
2500 |
Handle(), aName, I64LOW(aPos), I64HIGH(aPos), aLength); |
|
2501 |
||
2502 |
__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative)); |
|
2503 |
||
2504 |
#ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
2505 |
if(aPos > KMaxTInt) |
|
2506 |
{ |
|
2507 |
TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsReadFileSectionReturn, MODULEUID, KErrTooBig); |
|
2508 |
return KErrTooBig; |
|
2509 |
} |
|
2510 |
if((aPos + aLength) > KMaxTInt) |
|
2511 |
aLength = KMaxTInt - (TInt)aPos; |
|
2512 |
#endif |
|
2513 |
if (aLength) // Number of characters to read |
|
2514 |
{ |
|
2515 |
__ASSERT_ALWAYS(aDes.MaxLength()>=aLength,Panic(EBadLength)); |
|
2516 |
} |
|
2517 |
else |
|
2518 |
{ |
|
2519 |
aDes.Zero(); |
|
2520 |
TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsReadFileSectionReturn, MODULEUID, KErrNone); |
|
2521 |
return(KErrNone); |
|
2522 |
} |
|
2523 |
||
2524 |
__ASSERT_ALWAYS(aDes.MaxLength()>=aLength,Panic(EBadLength)); |
|
2525 |
||
2526 |
TInt r; |
|
2527 |
if(!(I64HIGH(aPos))) |
|
2528 |
{ |
|
2529 |
r = SendReceive(EFsReadFileSection,TIpcArgs(&aDes,&aName,I64LOW(aPos),aLength)); |
|
2530 |
} |
|
2531 |
else |
|
2532 |
{ |
|
2533 |
TPckgC<TInt64> pkPos(aPos); |
|
2534 |
r = SendReceive(EFsReadFileSection|KIpcArgSlot2Desc,TIpcArgs(&aDes,&aName,&pkPos,aLength)); |
|
2535 |
} |
|
2536 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsReadFileSectionReturn, MODULEUID, r); |
|
2537 |
return r; |
|
2538 |
} |
|
2539 |
/** |
|
2540 |
Maintained for BC |
|
2541 |
||
2542 |
@internalTechnology |
|
2543 |
*/ |
|
2544 |
EFSRV_EXPORT_C TInt RFs::ReadFileSection_RESERVED(const TDesC& aName,TInt aPos,TDes8& aDes,TInt aLength) const |
|
2545 |
{ |
|
2546 |
TRACEMULT5(UTF::EBorder, UTraceModuleEfsrv::EFsReadFileSection, MODULEUID, |
|
2547 |
Handle(), aName, aPos, 0, aLength); |
|
2548 |
||
2549 |
__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative)); |
|
2550 |
||
2551 |
if (aLength) // Number of characters to read |
|
2552 |
{ |
|
2553 |
__ASSERT_ALWAYS(aDes.MaxLength()>=aLength,Panic(EBadLength)); |
|
2554 |
} |
|
2555 |
else |
|
2556 |
{ |
|
2557 |
aDes.Zero(); |
|
2558 |
TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsReadFileSectionReturn, MODULEUID, KErrNone); |
|
2559 |
return(KErrNone); |
|
2560 |
} |
|
2561 |
||
2562 |
__ASSERT_ALWAYS(aDes.MaxLength()>=aLength,Panic(EBadLength)); |
|
2563 |
||
2564 |
TInt r = SendReceive(EFsReadFileSection,TIpcArgs(&aDes,&aName,aPos,aLength)); |
|
2565 |
||
2566 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsReadFileSectionReturn, MODULEUID, r); |
|
2567 |
return r; |
|
2568 |
} |
|
2569 |
||
2570 |
||
2571 |
||
2572 |
||
2573 |
EFSRV_EXPORT_C void RFs::ResourceCountMarkStart() const |
|
2574 |
/** |
|
2575 |
Marks the start of resource count checking. |
|
2576 |
||
2577 |
Typically, this function is called immediately after a client is connected |
|
2578 |
to the file server, and before any resources are opened. |
|
2579 |
*/ |
|
2580 |
{ |
|
2581 |
TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsResourceCountMarkStart, MODULEUID, Handle()); |
|
2582 |
||
2583 |
RSessionBase::SendReceive(EFsResourceCountMarkStart); |
|
2584 |
||
2585 |
TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsResourceCountMarkStartReturn, MODULEUID); |
|
2586 |
} |
|
2587 |
||
2588 |
||
2589 |
||
2590 |
||
2591 |
EFSRV_EXPORT_C void RFs::ResourceCountMarkEnd() const |
|
2592 |
/** |
|
2593 |
Ends resource count checking. Typically, this function is called immediately |
|
2594 |
before closing a session with the file server. |
|
2595 |
||
2596 |
@panic CSessionFs 2 if the number of resources opened since the start of resource |
|
2597 |
count checking is not equal to the number of resources closed. |
|
2598 |
*/ |
|
2599 |
{ |
|
2600 |
TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsResourceCountMarkEnd, MODULEUID, Handle()); |
|
2601 |
||
2602 |
RSessionBase::SendReceive(EFsResourceCountMarkEnd); |
|
2603 |
||
2604 |
TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsResourceCountMarkEndReturn, MODULEUID); |
|
2605 |
} |
|
2606 |
||
2607 |
||
2608 |
||
2609 |
||
2610 |
EFSRV_EXPORT_C TInt RFs::ResourceCount() const |
|
2611 |
/** |
|
2612 |
Gets the number of currently open resources. |
|
2613 |
||
2614 |
The resource count is incremented by one: when a file or directory |
|
2615 |
is opened, when a device is opened in preparation for formatting, when a direct access channel |
|
2616 |
to a disk is opened. |
|
2617 |
||
2618 |
@return The number of resources currently open. |
|
2619 |
*/ |
|
2620 |
{ |
|
2621 |
TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsResourceCount, MODULEUID, Handle()); |
|
2622 |
||
2623 |
TInt count; |
|
2624 |
TPckg<TInt> pckg(count); |
|
2625 |
SendReceive(EFsResourceCount,TIpcArgs(&pckg)); |
|
2626 |
TInt r = *(TInt*)pckg.Ptr(); |
|
2627 |
||
2628 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsResourceCountReturn, MODULEUID, r); |
|
2629 |
return r; |
|
2630 |
} |
|
2631 |
||
2632 |
||
2633 |
||
2634 |
/** |
|
2635 |
Checks the integrity of the disk on the specified drive. |
|
2636 |
On FAT, this checks if a cluster number is invalid, if a cluster is allocated to |
|
2637 |
more than one file entry, if an unallocated cluster is not set free, and if size |
|
2638 |
of an entry is invalid. |
|
2639 |
||
2640 |
@param aDrive Path indicating the drive which contains the disk to be checked. If the drive |
|
2641 |
information is not specified the current session drive is taken by default. |
|
2642 |
Checkdisk is performed on the requested drive irrespective of the correctness or |
|
2643 |
existance of the given path. |
|
2644 |
||
2645 |
@return KErrNone, if successful; |
|
2646 |
1, if successful but a file cluster contains a bad value; |
|
2647 |
2, if successful but two files are linked to the same cluster; |
|
2648 |
3, if successful but an unallocated cluster contains a value; |
|
2649 |
4, if successful but the size of a file is not equal to the number of clusters in chain; |
|
2650 |
KErrNotReady, if the specified drive is empty; |
|
2651 |
KErrNotSupported, if the drive cannot handle this request; |
|
2652 |
KErrPermissionDenied, if the caller doesn't have DiskAdmin capability; |
|
2653 |
Other system wide error codes may also be returned. |
|
2654 |
||
2655 |
@capability DiskAdmin |
|
2656 |
*/ |
|
8
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
2657 |
EFSRV_EXPORT_C TInt RFs::CheckDisk(const TDesC& aDrive) const |
0 | 2658 |
{ |
2659 |
TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsCheckDisk, MODULEUID, Handle(), aDrive); |
|
2660 |
TInt r = SendReceive(EFsCheckDisk,TIpcArgs(&aDrive)); |
|
2661 |
||
2662 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsCheckDiskReturn, MODULEUID, r); |
|
2663 |
return r; |
|
2664 |
} |
|
2665 |
||
2666 |
||
2667 |
||
2668 |
||
2669 |
EFSRV_EXPORT_C TInt RFs::ScanDrive(const TDesC& aDrive) const |
|
2670 |
/** |
|
2671 |
Checks the specified drive for errors and corrects them. Specifically, it |
|
2672 |
checks if long file name entries' IDs are in sequence and short name is valid, |
|
2673 |
and file's allocated clusters are not used by other files. |
|
2674 |
||
2675 |
This does not run on the internal RAM drive, and only applies to a |
|
2676 |
FAT file system. |
|
2677 |
||
2678 |
@param aDrive Path indicating the drive which contains the disk to be checked. If the drive |
|
2679 |
information is not specified the current session drive is taken by default. |
|
2680 |
ScanDrive is performed on the requested drive irrespective of the correctness or |
|
2681 |
existance of the given path. |
|
2682 |
||
2683 |
@return KErrNone if successful, |
|
2684 |
KErrPermissionDenied if caller doesn't have capability DiskAdmin, |
|
2685 |
KErrInUse if drive is in use, |
|
2686 |
otherwise one of the other system-wide error codes |
|
2687 |
||
2688 |
@capability DiskAdmin |
|
2689 |
*/ |
|
2690 |
{ |
|
2691 |
TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsScanDrive, MODULEUID, Handle(), aDrive); |
|
2692 |
TInt r = SendReceive(EFsScanDrive,TIpcArgs(&aDrive)); |
|
2693 |
||
2694 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsScanDriveReturn, MODULEUID, r); |
|
2695 |
return r; |
|
2696 |
} |
|
2697 |
||
2698 |
||
2699 |
||
2700 |
||
2701 |
EFSRV_EXPORT_C TInt RFs::GetShortName(const TDesC& aLongName,TDes& aShortName) const |
|
2702 |
/** |
|
2703 |
Gets the short filename associated with a VFAT long filename. |
|
2704 |
||
2705 |
The short filename has a limit of eight characters for the file name and three |
|
2706 |
characters for the extension. |
|
2707 |
||
2708 |
@param aLongName The long filename. Any path components which are not |
|
2709 |
specified here will be taken from the session path. |
|
2710 |
If the path specifies a directory, it may or may not be |
|
2711 |
followed by a trailing backslash. |
|
2712 |
@param aShortName On return, contains the short filename associated with the file |
|
2713 |
or directory specified in aLongName. |
|
2714 |
||
2715 |
@return KErrNone if successful, otherwise one of the other |
|
2716 |
system-wide error codes. |
|
2717 |
||
2718 |
@capability Dependent If the path for aLongName starts with /Sys capability AllFiles is required |
|
2719 |
@capability Dependent If the path for aLongName starts with /Private and this process does not |
|
2720 |
have the relevant SID capability AllFiles is required |
|
2721 |
*/ |
|
2722 |
{ |
|
2723 |
TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsGetShortName, MODULEUID, Handle(), aLongName); |
|
2724 |
TInt r = SendReceive(EFsGetShortName,TIpcArgs(&aLongName,&aShortName)); |
|
2725 |
||
2726 |
TRACERETMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsGetShortNameReturn, MODULEUID, r, aShortName); |
|
2727 |
return r; |
|
2728 |
} |
|
2729 |
||
2730 |
||
2731 |
||
2732 |
||
2733 |
EFSRV_EXPORT_C TInt RFs::GetLongName(const TDesC& aShortName,TDes& aLongName) const |
|
2734 |
/** |
|
2735 |
Gets the long filename associated with a short (8.3) filename. |
|
2736 |
||
2737 |
A long filename has a limit of 256 characters for each component, as well as a |
|
2738 |
limit of 256 characters for the entire path. |
|
2739 |
||
2740 |
@param aShortName The short file name. Any path components which are not |
|
2741 |
specified here will be taken from the session path. If |
|
2742 |
the path specifies a directory, it may or may not be followed |
|
2743 |
by a trailing backslash. |
|
2744 |
@param aLongName On return, contains the long version of the name. |
|
2745 |
||
2746 |
@return KErrNone if successful, otherwise one of the other |
|
2747 |
system-wide error codes. |
|
2748 |
||
2749 |
@capability Dependent If the path for aShortName starts with /Sys capability AllFiles is required |
|
2750 |
@capability Dependent If the path for aShortName starts with /Private and this process does not |
|
2751 |
have the relevant SID capability AllFiles is required |
|
2752 |
||
2753 |
*/ |
|
2754 |
{ |
|
2755 |
TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsGetLongName, MODULEUID, Handle(), aShortName); |
|
2756 |
TInt r = SendReceive(EFsGetLongName,TIpcArgs(&aShortName,&aLongName)); |
|
2757 |
||
2758 |
TRACERETMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsGetLongNameReturn, MODULEUID, r, aLongName); |
|
2759 |
return r; |
|
2760 |
} |
|
2761 |
||
2762 |
||
2763 |
||
2764 |
||
2765 |
EFSRV_EXPORT_C TInt RFs::IsFileOpen(const TDesC& aFileName,TBool& anAnswer) const |
|
2766 |
/** |
|
2767 |
Tests whether a file is open. |
|
2768 |
||
2769 |
This function is useful because several file based operations provided by |
|
2770 |
the RFs class, for example: Delete(), Replace() and Rename(), require that |
|
2771 |
the file be closed. |
|
2772 |
||
2773 |
@param aFileName The name of the file to test. Any path components which are |
|
2774 |
not specified here will be taken from the session path. If a |
|
2775 |
directory is specified instead of a file then KErrNone will be |
|
2776 |
returned and anAnswer will be set to EFalse. |
|
2777 |
@param anAnswer On return, true if the file is open, false if closed. |
|
2778 |
||
2779 |
@return KErrNone if successful, otherwise one of the other |
|
2780 |
system-wide error codes. |
|
2781 |
||
2782 |
@capability Dependent If the path for aFileName starts with /Sys capability AllFiles is required |
|
2783 |
@capability Dependent If the path for aFileName starts with /Private and this process does not |
|
2784 |
have the relevant SID capability AllFiles is required |
|
2785 |
||
2786 |
@see RFs::Delete |
|
2787 |
@see RFs::Rename |
|
2788 |
@see RFs::Replace |
|
2789 |
*/ |
|
2790 |
{ |
|
2791 |
TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsIsFileOpen, MODULEUID, Handle(), aFileName); |
|
2792 |
TPckg<TBool> b(anAnswer); |
|
2793 |
TInt r = SendReceive(EFsIsFileOpen,TIpcArgs(&aFileName,&b)); |
|
2794 |
||
2795 |
TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFsIsFileOpenReturn, MODULEUID, r, anAnswer); |
|
2796 |
return r; |
|
2797 |
} |
|
2798 |
||
2799 |
||
2800 |
||
2801 |
||
2802 |
TInt RFs::GetOpenFileList(TInt& aSessionNumber,TInt& aLocalPos,TThreadId& aThreadId,TEntryArray& anArray) const |
|
2803 |
// |
|
2804 |
// Private function to get a list of open files |
|
2805 |
// |
|
2806 |
{ |
|
2807 |
TOpenFileListPos s(aSessionNumber,aLocalPos); |
|
2808 |
TPckg<TOpenFileListPos> pS(s); |
|
2809 |
TPckg<TThreadId> threadId(aThreadId); |
|
2810 |
anArray.iCount=KCountNeeded; |
|
2811 |
TInt r=SendReceive(EFsListOpenFiles,TIpcArgs(&pS,&threadId,&anArray.iBuf)); |
|
2812 |
aSessionNumber=s.iSession; |
|
2813 |
aLocalPos=s.iEntryListPos; |
|
2814 |
return r; |
|
2815 |
} |
|
2816 |
||
2817 |
||
2818 |
||
2819 |
||
2820 |
EFSRV_EXPORT_C TBool RFs::GetNotifyUser() |
|
2821 |
/** |
|
2822 |
Tests whether user notification of file read or write failure is in effect. |
|
2823 |
||
2824 |
@return True if notification in effect, false if not. |
|
2825 |
*/ |
|
2826 |
{ |
|
2827 |
TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsGetNotifyUser, MODULEUID, Handle()); |
|
2828 |
||
2829 |
TInt notifyUser; |
|
2830 |
TPckg<TInt> pckgNotify(notifyUser); |
|
2831 |
SendReceive(EFsGetNotifyUser,TIpcArgs(&pckgNotify)); |
|
2832 |
TBool r = notifyUser; |
|
2833 |
||
2834 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsGetNotifyUserReturn, MODULEUID, r); |
|
2835 |
return r; |
|
2836 |
} |
|
2837 |
||
2838 |
||
2839 |
||
2840 |
||
2841 |
EFSRV_EXPORT_C void RFs::SetNotifyUser(TBool aValue) |
|
2842 |
/** |
|
2843 |
Sets whether the user should be notified of file read or write failure. |
|
2844 |
Note that if some drive is mounted as synchronous (see RFs::MountFileSystem), the user won't be |
|
2845 |
notified about read/write failures on it. |
|
2846 |
||
2847 |
@param aValue ETrue, if user is to be notified of read or write failures; |
|
2848 |
EFalse, for no notification. |
|
2849 |
*/ |
|
2850 |
{ |
|
2851 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsSetNotifyUser, MODULEUID, Handle(), aValue); |
|
2852 |
SendReceive(EFsSetNotifyUser,TIpcArgs(aValue)); |
|
2853 |
||
2854 |
TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsSetNotifyUserReturn, MODULEUID); |
|
2855 |
} |
|
2856 |
||
2857 |
||
2858 |
||
2859 |
||
2860 |
EFSRV_EXPORT_C TUint8* RFs::IsFileInRom(const TDesC& aFileName) const |
|
2861 |
/** |
|
2862 |
Gets a pointer to the specified file, if it is in ROM. |
|
2863 |
||
2864 |
Note that this is not a test of whether the file is on the Z: drive, as |
|
2865 |
the Z: drive may consist of a ROM and another file system, using the composite |
|
2866 |
file system. For example, the file system may be ROFS, and the underlying media |
|
2867 |
NAND flash. |
|
2868 |
||
2869 |
@param aFileName The filename whose address is sought. Cannot include wildcards. |
|
2870 |
Any path components which are not specified here will be taken |
|
2871 |
from the session path. |
|
2872 |
||
2873 |
@return Address of the start of the file, if it is in ROM. This is NULL, if |
|
2874 |
the file is not in ROM. Note that for the composite file system, the file |
|
2875 |
might be on the Z: drive but in a non-ROM file system (i.e. ROFS), in |
|
2876 |
which case the function still returns NULL. |
|
2877 |
||
2878 |
@capability Dependent If the path for aFileName starts with /Sys capability AllFiles is required |
|
2879 |
@capability Dependent If the path for aFileName starts with /Private and this process does not |
|
2880 |
have the relevant SID capability AllFiles is required |
|
2881 |
||
2882 |
*/ |
|
2883 |
{ |
|
2884 |
TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsIsFileInRom, MODULEUID, Handle(), aFileName); |
|
2885 |
||
2886 |
TPckgBuf<TUint8*> start; |
|
2887 |
||
2888 |
TUint8* r; |
|
2889 |
if (SendReceive(EFsIsFileInRom,TIpcArgs(&aFileName,&start))!=KErrNone) |
|
2890 |
r = NULL; |
|
2891 |
else |
|
2892 |
r = start(); |
|
2893 |
||
2894 |
TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsIsFileInRomReturn, MODULEUID, r); |
|
2895 |
return r; |
|
2896 |
} |
|
2897 |
||
2898 |
||
2899 |
||
2900 |
||
2901 |
/** |
|
2902 |
Tests whether a filename and path are syntactically correct. |
|
2903 |
||
2904 |
The following restrictions apply to the path and to its components: |
|
2905 |
||
2906 |
1. Wildcards are not allowed in any path component, including the filename and extension. |
|
2907 |
2. Double backslashes are not allowed anywhere in the path |
|
2908 |
3. The following 6 characters cannot appear in the path: < > : " / | |
|
2909 |
4. Either or both of a filename or extension must be present. This means that a valid aFileName can not |
|
2910 |
end with backslash (like "c:\\SomeName\\"), because it will mean that "SomeName" is a directory. |
|
2911 |
||
2912 |
5. The entire component following the final backslash (the filename and extension) cannot consist solely of space characters, |
|
2913 |
or of a single or double dot. |
|
2914 |
||
2915 |
6. Spaces between the drive, if specified, and the first directory in the path are illegal, although there may be |
|
2916 |
spaces between other path components, for example, between directories. |
|
2917 |
||
2918 |
7. If the path in aFileName is not fully specified, i.e. doesn't look like "c:\\Dir1\\File1.bin", all missing |
|
2919 |
parts of the full path will be taken from the session path, @see RFs::SetSessionPath, @see RFs::SessionPath. |
|
2920 |
In this case the session path must be set, otherwise this method will return EFalse. |
|
2921 |
For example: for the case "\\file1.txt" only the drive letter will be taken from the session path; |
|
2922 |
for the case "file1.txt" whole session path will be internally prepended to the "file1.txt" and whole path checked. |
|
2923 |
Note that in this case total length of the name in the aFileName parameter and the session path shall not exceed KMaxFileName characters. |
|
2924 |
||
2925 |
||
2926 |
@param aFileName The path to be checked for validity. |
|
2927 |
May specify a filename alone, or an entire path specification, including drive letter. |
|
2928 |
If a path is specified, all components are checked for validity. |
|
2929 |
||
2930 |
@return ETrue, if the name is valid (conforms to the mentioned above criteria); EFalse otherwise. |
|
2931 |
*/ |
|
2932 |
EFSRV_EXPORT_C TBool RFs::IsValidName(const TDesC& aFileName) const |
|
2933 |
{ |
|
2934 |
TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsIsValidName1, MODULEUID, Handle(), aFileName); |
|
2935 |
TBool returnInvalidChar=EFalse; |
|
2936 |
TPckg<TBool> bPckg(returnInvalidChar); |
|
2937 |
TBool b; |
|
2938 |
if (SendReceive(EFsIsValidName,TIpcArgs(&aFileName,&bPckg,NULL,NULL))!=KErrNone) |
|
2939 |
b = EFalse; |
|
2940 |
else |
|
2941 |
b = ETrue; |
|
2942 |
TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsIsValidName1Return, MODULEUID, b); |
|
2943 |
return b; |
|
2944 |
} |
|
2945 |
||
2946 |
||
2947 |
||
2948 |
||
2949 |
/** |
|
2950 |
The following restrictions apply to the path and to its components: |
|
2951 |
||
2952 |
1. Wildcards are not allowed in any path component, including the filename and extension. |
|
2953 |
2. Double backslashes are not allowed anywhere in the path |
|
2954 |
3. The following 6 characters cannot appear in the path: < > : " / | |
|
2955 |
4. Either or both of a filename or extension must be present. This means that a valid aFileName can not |
|
2956 |
end with backslash (like "c:\\SomeName\\"), because it will mean that "SomeName" is a directory. |
|
2957 |
||
2958 |
5. The entire component following the final backslash (the filename and extension) cannot consist solely of space characters, |
|
2959 |
or of a single or double dot. |
|
2960 |
||
2961 |
6. Spaces between the drive, if specified, and the first directory in the path are illegal, although there may be |
|
2962 |
spaces between other path components, for example, between directories. |
|
2963 |
||
2964 |
7. If the path in aFileName is not fully specified, i.e. doesn't look like "c:\\Dir1\\File1.bin", all missing |
|
2965 |
parts of the full path will be taken from the session path, @see RFs::SetSessionPath, @see RFs::SessionPath. |
|
2966 |
In this case the session path must be set, otherwise this method will return EFalse. |
|
2967 |
For example: for the case "\\file1.txt" only the drive letter will be taken from the session path; |
|
2968 |
for the case "file1.txt" whole session path will be internally prepended to the "file1.txt" and whole path checked. |
|
2969 |
Note that in this case total length of the name in the aFileName parameter and the session path shall not exceed KMaxFileName characters. |
|
2970 |
||
2971 |
@param aFileName The path to be checked for validity. |
|
2972 |
May specify a filename alone, or an entire path specification, including drive letter. |
|
2973 |
If a path is specified, all components are checked for validity. |
|
2974 |
||
2975 |
@param aBadChar reference to the variable that on return can contain illegal character from aFileName. |
|
2976 |
1. if the filename and optional path in aFileName are valid, this method will return ETrue and aBadChar will be set to 0x00. |
|
2977 |
2. if there is an illegal character in aFileName, this method will return EFalse and aBadChar will contain this illegal character. |
|
2978 |
3. if there is no illegal characters in aFileName, but this is still not a valid filename (like "\\SomeName\\") |
|
2979 |
this method will return EFalse and aBadChar will contain space ' ' or code 0x20. |
|
2980 |
||
2981 |
@return ETrue, if the name is valid (conforms to the mentioned above criteria); EFalse otherwise. |
|
2982 |
*/ |
|
2983 |
EFSRV_EXPORT_C TBool RFs::IsValidName(const TDesC& aFileName,TText& aBadChar) const |
|
2984 |
{ |
|
2985 |
TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsIsValidName2, MODULEUID, Handle(), aFileName); |
|
2986 |
TBool returnInvalidChar=ETrue; |
|
2987 |
TPckg<TBool> boolPckg(returnInvalidChar); |
|
2988 |
TPckg<TText> textPckg(aBadChar); |
|
2989 |
TBool b; |
|
2990 |
if (SendReceive(EFsIsValidName,TIpcArgs(&aFileName,&boolPckg,&textPckg,NULL))!=KErrNone) |
|
2991 |
b = EFalse; |
|
2992 |
else |
|
2993 |
b = ETrue; |
|
2994 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsIsValidName2Return, MODULEUID, b, aBadChar); |
|
2995 |
return b; |
|
2996 |
} |
|
2997 |
/** |
|
2998 |
This API can be used to validate both directory and file names. |
|
2999 |
If the name ends with a trailing backslash '\\' then it is considered to be a directory |
|
3000 |
else a filename. |
|
3001 |
For example: "C:\\test\\" would mean a directory, whereas |
|
3002 |
"C:\\test" would mean a file, both of which would be returned as a Valid Name. |
|
3003 |
However a name such as "C:\\test\\\\" would be returned as an Invalid name with error code TError::ErrBadName |
|
3004 |
||
3005 |
The following restrictions apply to the path and to its components: |
|
3006 |
||
3007 |
1. Wildcards are not allowed in any path component, including the name and extension. |
|
3008 |
2. Double backslashes are not allowed anywhere in the path |
|
3009 |
3. The following 6 characters cannot appear in the path: < > : " / | |
|
3010 |
4. The entire component following the final backslash (the filename and extension) cannot consist solely of space characters, |
|
3011 |
or of a single or double dot. |
|
3012 |
5. Spaces between the drive, if specified, and the first directory in the path are illegal, although there may be |
|
3013 |
spaces between other path components, for example, between directories. |
|
3014 |
6. If TNameValidParam::iUseSesssionPath is set to ETrue, and if the path in aName is not fully specified, |
|
3015 |
i.e. doesn't look like "c:\\Dir1\\File1.bin", all missing parts of the full path will be taken from the session path, |
|
3016 |
@see RFs::SetSessionPath, @see RFs::SessionPath. |
|
3017 |
In this case the session path must be set, otherwise this method will return EFalse. |
|
3018 |
For example: for the case "\\file1.txt" only the drive letter will be taken from the session path; |
|
3019 |
for the case "file1.txt" whole session path will be internally prepended to the "file1.txt" and whole path checked. |
|
3020 |
Note that in this case total length of the name in the aName parameter and the session path shall not exceed KMaxFileName characters. |
|
3021 |
7. If TNameValidParam::iUseSesssionPath is set to EFalse, which is the default value, then |
|
3022 |
the session path is not used to fill in the missing parts of the name as stated above. |
|
3023 |
For example: for the case "file1.txt", session path will not be used to check the validity of the name. |
|
3024 |
@param aName The path to be checked for validity. |
|
3025 |
May specify a name alone, or an entire path specification, including drive letter. |
|
3026 |
If a path is specified, all components are checked for validity. |
|
3027 |
||
3028 |
@param aParam reference to the variable that on return can contain details of the error if any. |
|
3029 |
While constructing an object of this type one could specify whether one wants to use the sessionPath for filling up missing parts of aName, |
|
3030 |
or one would want to test aName as it is without prepending the sessionPath. |
|
3031 |
By default the sessionPath is NOT used. |
|
3032 |
1. if the name and optional path in aName are valid, this method will return ETrue and TError::iError will contain ErrNone. |
|
3033 |
2. if there is an illegal character in aName, this method will return EFalse and TError::iError will contain KErrBadCharacter. |
|
3034 |
Also TError::iInvalidCharPos will indicate the position of the rightmost invalid character. |
|
3035 |
3. if there is no illegal characters in aName, but this is still not a valid name (like "") |
|
3036 |
this method will return EFalse and TError::iError will contain KErrBadCharacter, while iInvalidCharPos will be set to 0 |
|
3037 |
4. if length of the name exceeds 256 characters, this method will return EFalse and TError::iError will contain KErrTooLong. |
|
3038 |
if the optional sessionPath is used, then the length of the sessionPath is also used to determine whether the length exceeds 256 characters. |
|
3039 |
@return ETrue, if the name is valid (conforms to the mentioned above criteria); EFalse otherwise. |
|
3040 |
*/ |
|
3041 |
EFSRV_EXPORT_C TBool RFs::IsValidName(const TDesC& aName, TNameValidParam& aParam ) |
|
3042 |
{ |
|
3043 |
TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsIsValidName3, MODULEUID, Handle(), aName); |
|
3044 |
TPckg<TNameValidParam> paramPckg(aParam); |
|
3045 |
TBool b; |
|
3046 |
if (SendReceive(EFsIsValidName,TIpcArgs(&aName,NULL,NULL,¶mPckg))!=KErrNone) |
|
3047 |
b = EFalse; |
|
3048 |
else |
|
3049 |
b = ETrue; |
|
3050 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsIsValidName3Return, MODULEUID, b, aParam.ErrorCode()); |
|
3051 |
return b; |
|
3052 |
} |
|
3053 |
||
3054 |
||
3055 |
||
3056 |
||
3057 |
EFSRV_EXPORT_C TInt RFs::GetDriveName(TInt aDrive,TDes& aDriveName) const |
|
3058 |
/** |
|
3059 |
Gets the name of a drive. |
|
3060 |
||
3061 |
Drive naming is optional. If the drive specified has not been assigned a name, |
|
3062 |
this function returns a descriptor whose length is zero. |
|
3063 |
||
3064 |
@param aDrive The drive number. Specify a drive in the range |
|
3065 |
EDriveA to EDriveZ for drives A to Z, respectively. |
|
3066 |
The default drive is the session default drive represented |
|
3067 |
by KDefaultDrive. |
|
3068 |
@param aDriveName On return, the drive name. |
|
3069 |
||
3070 |
@return KErrNone if successful, otherwise one of the other |
|
3071 |
system-wide error codes. |
|
3072 |
||
3073 |
@see TDriveNumber |
|
3074 |
*/ |
|
3075 |
{ |
|
3076 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsGetDriveName, MODULEUID, Handle(), aDrive); |
|
3077 |
TInt r = SendReceive(EFsGetDriveName,TIpcArgs(aDrive,&aDriveName)); |
|
3078 |
||
3079 |
TRACERETMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsGetDriveNameReturn, MODULEUID, r, aDriveName); |
|
3080 |
return r; |
|
3081 |
} |
|
3082 |
||
3083 |
||
3084 |
||
3085 |
||
3086 |
EFSRV_EXPORT_C TInt RFs::SetDriveName(TInt aDrive,const TDesC& aDriveName) |
|
3087 |
/** |
|
3088 |
Sets the name of a drive. |
|
3089 |
||
3090 |
Drive naming is optional. Any drive can be assigned a name, and more than |
|
3091 |
one drive can share the same name. |
|
3092 |
||
3093 |
@param aDrive The drive number. Specify a drive in the range |
|
3094 |
EDriveA to EDriveZ for drives A to Z, respectively. |
|
3095 |
Specify KDefaultDrive for the session default drive. |
|
3096 |
@param aDriveName The name of the drive, with a maximum of 256 characters. |
|
3097 |
The name cannot contain the 6 characters < > : " / | |
|
3098 |
||
3099 |
@return KErrNone if successful; |
|
3100 |
KErrBadName, if the name contains illegal characters; |
|
3101 |
otherwise one of the other system-wide error codes. |
|
3102 |
||
3103 |
@capability DiskAdmin |
|
3104 |
||
3105 |
*/ |
|
3106 |
{ |
|
3107 |
TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsSetDriveName, MODULEUID, Handle(), aDrive, aDriveName); |
|
3108 |
TInt r = SendReceive(EFsSetDriveName,TIpcArgs(aDrive,&aDriveName)); |
|
3109 |
||
3110 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSetDriveNameReturn, MODULEUID, r); |
|
3111 |
return r; |
|
3112 |
} |
|
3113 |
||
3114 |
||
3115 |
||
3116 |
||
3117 |
EFSRV_EXPORT_C TInt RFs::LockDrive(TInt aDrv, const TMediaPassword &aOld, const TMediaPassword &aNew, TBool aStore) |
|
3118 |
/** |
|
3119 |
Sets the password for the media in the specified drive. |
|
3120 |
||
3121 |
The media is not necessarily locked afterwards. Accessibility is determined |
|
3122 |
by the following rules: |
|
3123 |
||
3124 |
- The media may not become locked until power is removed (such as with MMC cards) |
|
3125 |
- If the password is added to the password store (the aStore parameter is ETrue), the |
|
3126 |
media will be automatically unlocked on the next access. |
|
3127 |
||
3128 |
@param aDrv The drive. |
|
3129 |
@param aOld The existing password. If no password is set, this must be a zero-length descriptor. |
|
3130 |
@param aNew The new password. |
|
3131 |
@param aStore ETrue if the new password is to be saved to the controller password store; |
|
3132 |
EFalse if not. |
|
3133 |
||
3134 |
@return KErrNone if successful; |
|
3135 |
KErrNotSupported if the media does not support password locking. |
|
3136 |
||
3137 |
@capability DiskAdmin |
|
3138 |
||
3139 |
*/ |
|
3140 |
{ |
|
3141 |
TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFsLockDrive, MODULEUID, Handle(), aDrv, aStore); |
|
3142 |
TInt r = SendReceive(EFsLockDrive,TIpcArgs(aDrv,&aOld,&aNew,aStore)); |
|
3143 |
||
3144 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsLockDriveReturn, MODULEUID, r); |
|
3145 |
return r; |
|
3146 |
} |
|
3147 |
||
3148 |
||
3149 |
||
3150 |
||
3151 |
EFSRV_EXPORT_C TInt RFs::UnlockDrive(TInt aDrive, const TMediaPassword &aPassword, TBool aStore) |
|
3152 |
/** |
|
3153 |
Unlocks the media in the specified drive. |
|
3154 |
||
3155 |
The password must be added to the MultiMedia card controller's password store |
|
3156 |
so that the controller can subsequently issue the password without the user |
|
3157 |
having to be prompted for it again. |
|
3158 |
||
3159 |
@param aDrive The drive. |
|
3160 |
@param aPassword The password. |
|
3161 |
@param aStore Specify ETrue to add the password to the |
|
3162 |
controller's password store. |
|
3163 |
||
3164 |
@return KErrNone, if successful; |
|
3165 |
KErrAccessDenied, if the password is incorrect; |
|
3166 |
KErrAlreadyExists, if the card has already been unlocked; |
|
3167 |
KErrNotSupported, if the media does not support password locking. |
|
3168 |
||
3169 |
@capability DiskAdmin |
|
3170 |
||
3171 |
*/ |
|
3172 |
{ |
|
3173 |
TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFsUnlockDrive, MODULEUID, Handle(), aDrive, aStore); |
|
3174 |
TInt r = SendReceive(EFsUnlockDrive,TIpcArgs(aDrive,&aPassword,aStore)); |
|
3175 |
||
3176 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsUnlockDriveReturn, MODULEUID, r); |
|
3177 |
return r; |
|
3178 |
} |
|
3179 |
||
3180 |
||
3181 |
||
3182 |
||
3183 |
EFSRV_EXPORT_C TInt RFs::ClearPassword(TInt aDrv, const TMediaPassword &aPswd) |
|
3184 |
/** |
|
3185 |
Clears the password from the locked MultiMedia card in the specified drive. |
|
3186 |
||
3187 |
Clearing the password causes the MultiMedia card controller to set |
|
3188 |
the password to null. |
|
3189 |
||
3190 |
@param aDrv The drive. |
|
3191 |
@param aPswd The current password, which is required to perform this |
|
3192 |
operation. |
|
3193 |
||
3194 |
@return KErrNone, if successful; |
|
3195 |
KErrAccessDenied, if the password is wrong or the card is still locked; |
|
3196 |
otherwise one of the other system-wide error codes. |
|
3197 |
||
3198 |
@capability DiskAdmin |
|
3199 |
||
3200 |
*/ |
|
3201 |
{ |
|
3202 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsClearPassword, MODULEUID, Handle(), aDrv); |
|
3203 |
TInt r = SendReceive(EFsClearPassword,TIpcArgs(aDrv,&aPswd)); |
|
3204 |
||
3205 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsClearPasswordReturn, MODULEUID, r); |
|
3206 |
return r; |
|
3207 |
} |
|
3208 |
||
3209 |
||
3210 |
||
3211 |
||
3212 |
EFSRV_EXPORT_C TInt RFs::ErasePassword(TInt aDrv) |
|
3213 |
/** |
|
3214 |
Erase the password from the locked MultiMedia card in the specified drive. |
|
3215 |
||
3216 |
Used when the password is unknown, and may result in the media being erased. |
|
3217 |
||
3218 |
Successful execution of this call may result in leaving the media in unformatted state. |
|
3219 |
Hence, it is recommended to format the Multimedia card after calling RFs::ErasePassword(). |
|
3220 |
||
3221 |
@param aDrv The drive. |
|
3222 |
||
3223 |
@return KErrNone, if successful; |
|
3224 |
otherwise one of the other system-wide error codes. |
|
3225 |
||
3226 |
@capability DiskAdmin |
|
3227 |
||
3228 |
*/ |
|
3229 |
{ |
|
3230 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsErasePassword, MODULEUID, Handle(), aDrv); |
|
3231 |
TInt r = SendReceive(EFsErasePassword,TIpcArgs(aDrv)); |
|
3232 |
||
3233 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsErasePasswordReturn, MODULEUID, r); |
|
3234 |
return r; |
|
3235 |
} |
|
3236 |
||
3237 |
||
3238 |
||
3239 |
||
3240 |
EFSRV_EXPORT_C void RFs::StartupInitComplete(TRequestStatus& aStat) |
|
3241 |
/** |
|
3242 |
Noifies the file server that startup initialisation is complete. |
|
3243 |
||
3244 |
@param aStat Request status object. |
|
3245 |
*/ |
|
3246 |
// |
|
3247 |
// Notify file server that startup initialisation has been completed |
|
3248 |
// |
|
3249 |
{ |
|
3250 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsStartupInitComplete, MODULEUID, Handle(), &aStat); |
|
3251 |
aStat=KRequestPending; |
|
3252 |
RSessionBase::SendReceive(EFsStartupInitComplete,aStat); |
|
3253 |
||
3254 |
TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsStartupInitCompleteReturn, MODULEUID); |
|
3255 |
} |
|
3256 |
||
3257 |
||
3258 |
||
3259 |
||
3260 |
EFSRV_EXPORT_C TInt RFs::SetLocalDriveMapping(const TDesC8& aMapping) |
|
3261 |
// |
|
3262 |
// Set the local drive mapping |
|
3263 |
// |
|
3264 |
{ |
|
3265 |
TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsSetLocalDriveMapping, MODULEUID, Handle(), aMapping); |
|
3266 |
||
3267 |
TInt r = SendReceive(EFsSetLocalDriveMapping,TIpcArgs(&aMapping)); |
|
3268 |
||
3269 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSetLocalDriveMappingReturn, MODULEUID, r); |
|
3270 |
return r; |
|
3271 |
} |
|
3272 |
||
3273 |
||
3274 |
/** |
|
3275 |
Finalise the given drive. This operation is intended to put the drive into the consistent state when it is |
|
3276 |
safe to remove it physically or switch the power off. |
|
3277 |
||
3278 |
@param aDriveNo drive number |
|
3279 |
@param aMode describes the finalisation operation, see RFs::TFinaliseDrvMode enum |
|
3280 |
||
3281 |
@return KErrNone on success, |
|
3282 |
KErrArgument if the function arguments are invalid |
|
3283 |
KErrInUse if the drive has opened objects (files, directories etc.) and therefore can not be finalised |
|
3284 |
KErrCorrupt if the drive is corrupt. |
|
3285 |
System wide error codes otherwise. |
|
3286 |
||
3287 |
@capability DiskAdmin |
|
3288 |
*/ |
|
3289 |
EFSRV_EXPORT_C TInt RFs::FinaliseDrive(TInt aDriveNo, TFinaliseDrvMode aMode) const |
|
3290 |
{ |
|
3291 |
TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFsFinaliseDrive, MODULEUID, Handle(), aDriveNo, aMode); |
|
3292 |
TInt r = SendReceive(EFsFinaliseDrive,TIpcArgs(aDriveNo, (TInt)aMode)); |
|
3293 |
||
3294 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsFinaliseDriveReturn, MODULEUID, r); |
|
3295 |
return r; |
|
3296 |
} |
|
3297 |
||
3298 |
||
3299 |
/** |
|
3300 |
Makes the best effort to finalise all drives in the system. |
|
3301 |
Effectively calls RFs::FinaliseDrive(..., EFinal_RW) to all present drives in the system. This makes impossible to |
|
3302 |
analyse the error code if the finalisation of some fails. |
|
3303 |
It is much better to use RFs::FinaliseDrive(...) specifying concrete drive number and desired finalisation mode. |
|
3304 |
||
3305 |
@return KErrNone, if successful; otherwise one of the other system-wide error codes. |
|
3306 |
@capability DiskAdmin |
|
3307 |
*/ |
|
3308 |
EFSRV_EXPORT_C TInt RFs::FinaliseDrives() |
|
3309 |
{ |
|
3310 |
TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsFinaliseDrives, MODULEUID, Handle()); |
|
3311 |
TInt nRes; |
|
3312 |
TDriveList driveList; |
|
3313 |
TDriveInfo driveInfo; |
|
3314 |
||
3315 |
nRes=DriveList(driveList); |
|
3316 |
if(nRes != KErrNone) |
|
3317 |
{ |
|
3318 |
TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsFinaliseDrivesReturn, MODULEUID, nRes); |
|
3319 |
return nRes; //-- unable to obtain drives list |
|
3320 |
} |
|
3321 |
||
3322 |
//-- walk through all drives in the system sending them "Finalise" request |
|
3323 |
for (TInt i=0; i<KMaxDrives; ++i) |
|
3324 |
{ |
|
3325 |
if(!driveList[i]) |
|
3326 |
continue; //-- skip unexisting drive |
|
3327 |
||
3328 |
if(Drive(driveInfo, i) != KErrNone) |
|
3329 |
continue; //-- skip this drive, can't get information about it |
|
3330 |
||
3331 |
const TUint KDrvAttExclude = KDriveAttRom | KDriveAttRedirected; //-- the drive attributes to exlcude from the finalisation |
|
3332 |
||
3333 |
if(driveInfo.iDriveAtt & KDrvAttExclude) |
|
3334 |
continue; |
|
3335 |
||
3336 |
nRes = FinaliseDrive(i, EFinal_RW); |
|
3337 |
} |
|
3338 |
||
3339 |
||
3340 |
TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsFinaliseDrivesReturn, MODULEUID, KErrNone); |
|
3341 |
return KErrNone; |
|
3342 |
} |
|
3343 |
||
3344 |
||
3345 |
||
3346 |
EFSRV_EXPORT_C TInt RFs::SwapFileSystem(const TDesC& aOldFileSystemName,const TDesC& aNewFileSystemName,TInt aDrive) const |
|
3347 |
/** |
|
3348 |
Dismount aOldFileSystemName and mount aNewFileSystemName in an atomic operation |
|
3349 |
||
3350 |
If swapping in the composite filesystem, and no mounts have been added to it, |
|
3351 |
then ROFS is added to it by default. The synchronous state of the composite filesystem |
|
3352 |
will be used in preference to that of the old filesystem when it is mounted. |
|
3353 |
||
3354 |
@param aOldFileSystemName The filesystem name that is currently on the drive. |
|
3355 |
@param aNewFileSystemName The filesystem name that is to be swapped onto the drive. |
|
3356 |
@param aDrive The drive for which the filesystem is to be swapped. |
|
3357 |
||
3358 |
@return KErrNone if successful |
|
3359 |
KErrInUse if a dismount is pending on the drive |
|
3360 |
KErrNotSupported if swapping Z drive with something other then composite or if the drive is asynchronous |
|
3361 |
KErrAlreadyExists if swapping the composite filesystem, and it is already mounted |
|
3362 |
KErrNotFound If the filesystem name provided could not be found. |
|
3363 |
||
3364 |
@capability DiskAdmin |
|
3365 |
*/ |
|
3366 |
{ |
|
3367 |
TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::EFsSwapFileSystem, MODULEUID, Handle(), aOldFileSystemName, aNewFileSystemName, aDrive); |
|
3368 |
TInt r = SendReceive(EFsSwapFileSystem,TIpcArgs(&aNewFileSystemName,aDrive,&aOldFileSystemName)); |
|
3369 |
||
3370 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSwapFileSystemReturn, MODULEUID, r); |
|
3371 |
return r; |
|
3372 |
} |
|
3373 |
||
3374 |
||
3375 |
EFSRV_EXPORT_C TInt RFs::AddCompositeMount(const TDesC& aFileSystemName,TInt aLocalDriveToMount,TInt aCompositeDrive, TBool aSync) const |
|
3376 |
/** |
|
3377 |
Adds a local drive to the composite filesystem. This can only be used before |
|
3378 |
the composite filesystem is mounted. The local drive is mounted with the |
|
3379 |
filesystem provided. If any local drive added is marked to be asynchronous, |
|
3380 |
then the whole composite drive will be treated asynchronous. |
|
3381 |
||
3382 |
@param aFileSystemName The filesystem of the local drive to be added. |
|
3383 |
@param aLocalDriveToMount The local drive to be added. |
|
3384 |
@param aCompositeDrive The drive the composite filesystem will be mounted on. |
|
3385 |
@param aSync If the filesystem added here is preferred to be synchronous. |
|
3386 |
||
3387 |
@return KErrNone if successful |
|
3388 |
KErrNotFound If the filesystem name provided could not be found. |
|
3389 |
KErrNotReady If the composite filesystem has not been initialised. |
|
3390 |
KErrNotSupported If the composite filesystem is already mounted or the parameters passed are unsupported |
|
3391 |
||
3392 |
@capability DiskAdmin |
|
3393 |
*/ |
|
3394 |
{ |
|
3395 |
TRACEMULT5(UTF::EBorder, UTraceModuleEfsrv::EFsAddCompositeMount, MODULEUID, |
|
3396 |
Handle(), aFileSystemName, aLocalDriveToMount, aCompositeDrive, aSync); |
|
3397 |
TInt r = SendReceive(EFsAddCompositeMount,TIpcArgs(&aFileSystemName,aLocalDriveToMount,aCompositeDrive,aSync)); |
|
3398 |
||
3399 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsAddCompositeMountReturn, MODULEUID, r); |
|
3400 |
return r; |
|
3401 |
} |
|
3402 |
||
3403 |
||
3404 |
EFSRV_EXPORT_C TInt RFs::ReserveDriveSpace(TInt aDriveNo, TInt aSpace) |
|
3405 |
/** |
|
3406 |
Reserves an area of a drive. It is intended that sensible (tm) apps will reserve a small |
|
3407 |
area of disk for 'emergency' use in case of later out of disk situations. If the amount of |
|
3408 |
reserved space later needs to be readjusted, this method should be called again with |
|
3409 |
aSpace as the amount of extra space needed. |
|
3410 |
||
3411 |
Once space has been reserved via this method, an application can use RFs::GetReserveAccess |
|
3412 |
to gain access to the reserved area prior to executing disk space critical sections of code. |
|
3413 |
After the section of code is complete, the application should release access to the reserved |
|
3414 |
area. |
|
3415 |
||
3416 |
For internal drives, reserved space will be lost if a reboot occurs. For removeable drives, |
|
3417 |
reserved space may be lost if there is a media change. |
|
3418 |
||
3419 |
Reserved space will be cleaned up automatically when the RFs is closed. |
|
3420 |
||
3421 |
Each drive has a max amount of space available to be reserved, and individual sessions also |
|
3422 |
have a max amount of space. These are defined in f32/sfile/sf_std.h as KMaxTotalDriveReserved |
|
3423 |
and KMaxSessionDriveReserved respectively. Once space is reserved, it is only available to |
|
3424 |
the reserving session until that session releases the reserved space. |
|
3425 |
||
3426 |
@param aDriveNo Which drive to reserve space on |
|
3427 |
||
3428 |
@param aSpace Amount of space to reserve |
|
3429 |
||
3430 |
@return KErrNone if successful |
|
3431 |
KErrInUse if the session already has reserved access |
|
3432 |
KErrArgument if aSpace is invalid (greater than KMaxSessionDriveReserved, negative number, etc.) |
|
3433 |
KErrDiskFull if insufficient space is left on the drive to service the request |
|
3434 |
KErrTooBig if this request would overflow the available reserve (greater than KMaxTotalDriveReserved) |
|
3435 |
any of the possible error return codes from TDrive::Volume() |
|
3436 |
*/ |
|
3437 |
{ |
|
3438 |
TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFsReserveDriveSpace, MODULEUID, Handle(), aDriveNo, aSpace); |
|
3439 |
TInt r = SendReceive(EFsReserveDriveSpace, TIpcArgs(aDriveNo, aSpace)); |
|
3440 |
||
3441 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsReserveDriveSpaceReturn, MODULEUID, r); |
|
3442 |
return r; |
|
3443 |
} |
|
3444 |
||
3445 |
||
3446 |
||
3447 |
||
3448 |
EFSRV_EXPORT_C TInt RFs::GetReserveAccess(TInt aDriveNo) |
|
3449 |
/** |
|
3450 |
Get exclusive access for this session to overwrite a specific disk area, which has previously |
|
3451 |
been reserved via RFs::ReserveDriveSpace |
|
3452 |
||
3453 |
@param aDriveNo drive on which to get reserved access |
|
3454 |
||
3455 |
@return KErrNone if successful |
|
3456 |
KErrPermissionDenied if the drive has no spare reserved space |
|
3457 |
*/ |
|
3458 |
{ |
|
3459 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsGetReserveAccess, MODULEUID, Handle(), aDriveNo); |
|
3460 |
TInt r = SendReceive(EFsGetReserveAccess, TIpcArgs(aDriveNo)); |
|
3461 |
||
3462 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsGetReserveAccessReturn, MODULEUID, r); |
|
3463 |
return r; |
|
3464 |
} |
|
3465 |
||
3466 |
EFSRV_EXPORT_C TInt RFs::ReleaseReserveAccess(TInt aDriveNo) |
|
3467 |
/** |
|
3468 |
Release exclusive access for this session to overwrite a specific disk area. |
|
3469 |
||
3470 |
@param aDriveNo drive on which to release reserved access |
|
3471 |
||
3472 |
@return KErrNone (always returned) |
|
3473 |
||
3474 |
*/ |
|
3475 |
{ |
|
3476 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsReleaseReserveAccess, MODULEUID, Handle(), aDriveNo); |
|
3477 |
TInt r = SendReceive(EFsReleaseReserveAccess, TIpcArgs(aDriveNo)); |
|
3478 |
||
3479 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsReleaseReserveAccessReturn, MODULEUID, r); |
|
3480 |
return r; |
|
3481 |
} |
|
3482 |
||
3483 |
||
3484 |
||
3485 |
||
3486 |
/** |
|
4
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3487 |
Controls file system dismounting on the specified drive, the way of control depends on the parameter TNotifyDismountMode. |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3488 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3489 |
This API allows interested parties to: |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3490 |
1. Subscribe for notification of file system dismounting events. |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3491 |
This allows subscribers to commit their data to the media prior to the file system being dismounted. |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3492 |
See TNotifyDismountMode::EFsDismountRegisterClient |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3493 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3494 |
2. Make a graceful attempt to dismount the file system by notifying the subscribers about a pending file system dismount |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3495 |
and waiting until all subscribers have finished processing the notification and have signaled that they are ready. |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3496 |
If all clients don't respond in a reasonable time, the dismount request may be cancelled, followed by a forced dismount. |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3497 |
If some client does not subscribe for dismounting notification and keeps handles opened, then after the file system dismounting all these |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3498 |
handles will become invalid, any subsequent attempts to use them will result in KErrDismounted, and they should be closed(e.g. RFile::Close()). |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3499 |
See TNotifyDismountMode::EFsDismountNotifyClients |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3500 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3501 |
3. Dismount the file system by force even if there are opened handles (files, directories) on the volume being dismounted. |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3502 |
Any clients that kept handles opened, after forced file system dismounting will have them invalidated. And any further attempts to use |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3503 |
these handles will result in KErrDismounted, and they should be closed(e.g. RFile::Close()). |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3504 |
See TNotifyDismountMode::EFsDismountForceDismount |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3505 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3506 |
* If there are clamped files on the volume, the file system dismounting will not happen until these files are unclamped. |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3507 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3508 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3509 |
The use case scenario: |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3510 |
A 'Master' application that wants to dismount the file system on some drive 'aDrive' |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3511 |
'Client1' and 'Client2' applications interested in file system dismount event notifications, because they need to commit their data before the file system is dismounted. |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3512 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3513 |
1. 'Client1' and 'Client2' subscribe to the FS dismount notification using EFsDismountRegisterClient and start waiting on the request status objects. |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3514 |
2. 'Master' decides to dismount the file system on the drive 'aDrive'. |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3515 |
2.1 Graceful attempt: 'Master' calls RFs::NotifyDismount() with EFsDismountNotifyClients and starts waiting on 'aStat' for some time until all 'Client1' and 'Client2' respond or timeout occurs. |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3516 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3517 |
3. 'Client1' and 'Client2' have their 'aStat' completed as the result of the 'Master' calling EFsDismountNotifyClients. |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3518 |
3.1 'Client1' and 'Client2' flush data and close file handles. |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3519 |
3.2 as soon as 'Client1' and 'Client2' decide that they are ready for the pending FS dismount, they signal the 'Master' that they are ready by calling RFs::AllowDismount() |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3520 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3521 |
4. As soon as _all_ subscribed clients ('Client1' and 'Client2') have called RFs::AllowDismount(), the file system on drive 'aDrive' is |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3522 |
dismounted and 'Master' has 'aStat' completed. |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3523 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3524 |
If, for example, 'Client2' hasn't responded in a reasonable time by calling RFs::AllowDismount(), the 'Master' can cancel the pending 'aStat' and |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3525 |
dismount the file system by force by calling this API with EFsDismountForceDismount. |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3526 |
In this case all subsequent attempts by 'Client2' to use its opened handles will result in KErrDismounted; these handles should be closed. |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3527 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3528 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3529 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3530 |
@param aDriveNo The drive on which to request dismount |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3531 |
@param aMode specifies the behaviour of the notification API |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3532 |
@param aStat Asynchronous request state. |
0 | 3533 |
*/ |
4
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3534 |
EFSRV_EXPORT_C void RFs::NotifyDismount(TInt aDrive, TRequestStatus& aStat, TNotifyDismountMode aMode /*=EFsDismountRegisterClient*/) const |
0 | 3535 |
{ |
3536 |
TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyDismount, MODULEUID, Handle(), aDrive, &aStat, aMode); |
|
3537 |
aStat = KRequestPending; |
|
3538 |
RSessionBase::SendReceive(EFsNotifyDismount, TIpcArgs(aDrive,aMode,&aStat), aStat); |
|
3539 |
// This call is to synchronise with the driver thread as the corresponding cancel function (NotifyDismountCancel) |
|
3540 |
// is synchronous, so it can complete before this notify request has even been added to TDismountNotifyQue. |
|
3541 |
// This call guarantees that the notify request has been added to queue. |
|
3542 |
SendReceive(EFsSynchroniseDriveThread, TIpcArgs(aDrive)); |
|
3543 |
||
3544 |
TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyDismountReturn, MODULEUID); |
|
3545 |
} |
|
3546 |
||
3547 |
||
3548 |
||
3549 |
||
4
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3550 |
/** |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3551 |
Cancels the oustanding dismount notifier, completing with KErrCancel. |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3552 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3553 |
@param aStat The request status object associated with the request to be cancelled. |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3554 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3555 |
@see RFs::NotifyDismount |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3556 |
*/ |
0 | 3557 |
EFSRV_EXPORT_C void RFs::NotifyDismountCancel(TRequestStatus& aStat) const |
3558 |
{ |
|
3559 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyDismountCancel1, MODULEUID, Handle(), &aStat); |
|
3560 |
||
3561 |
if (aStat == KRequestPending) |
|
3562 |
SendReceive(EFsNotifyDismountCancel, TIpcArgs(&aStat)); |
|
3563 |
||
3564 |
TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyDismountCancel1Return, MODULEUID); |
|
3565 |
} |
|
3566 |
||
3567 |
||
3568 |
||
4
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3569 |
/** |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3570 |
Cancels all oustanding dismount notifiers for this session, completing with KErrCancel. |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3571 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3572 |
@see RFs::NotifyDismount |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3573 |
*/ |
0 | 3574 |
EFSRV_EXPORT_C void RFs::NotifyDismountCancel() const |
3575 |
{ |
|
3576 |
TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyDismountCancel2, MODULEUID, Handle()); |
|
3577 |
||
3578 |
SendReceive(EFsNotifyDismountCancel, TIpcArgs(NULL)); |
|
3579 |
||
3580 |
TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyDismountCancel2Return, MODULEUID); |
|
3581 |
} |
|
3582 |
||
3583 |
||
3584 |
||
3585 |
||
4
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3586 |
/** |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3587 |
Used by a client to indicate that it is safe to dismount the file system. This should be called after receiving a pending media removal notification. |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3588 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3589 |
Not calling this does not guarantee that the dismount will not occur as the application requesting the dismount may decide to forcibly dismount |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3590 |
after a given timeout period. |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3591 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3592 |
@param aDriveNo The drive on which to allow the dismount. |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3593 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3594 |
@return KErrNone if successful |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3595 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3596 |
@see RFs::NotifyDismount |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3597 |
*/ |
0 | 3598 |
EFSRV_EXPORT_C TInt RFs::AllowDismount(TInt aDrive) const |
3599 |
{ |
|
3600 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsAllowDismount, MODULEUID, Handle(), aDrive); |
|
3601 |
TInt r = SendReceive(EFsAllowDismount, TIpcArgs(aDrive)); |
|
3602 |
||
3603 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsAllowDismountReturn, MODULEUID, r); |
|
3604 |
return r; |
|
3605 |
} |
|
3606 |
||
3607 |
EFSRV_EXPORT_C TInt RFs::SetStartupConfiguration(TInt aCommand,TAny* aParam1,TAny* aParam2) const |
|
3608 |
/** |
|
3609 |
@publishedPartner |
|
3610 |
@release |
|
3611 |
||
3612 |
Only can be called in estart. Licensees could use this function to configure |
|
3613 |
file server at startup through their own version of estart. |
|
3614 |
||
3615 |
Currently only loader thread priority can be specified. |
|
3616 |
||
3617 |
@param aCommand Command indicating what aspect of file server should be configured. |
|
3618 |
aParam1 Command specific parameter. |
|
3619 |
aParam2 Command specific parameter. |
|
3620 |
||
3621 |
@return KErrNone if successful, KErrPermissionDenied if called outside estart |
|
3622 |
*/ |
|
3623 |
{ |
|
3624 |
TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFsSetStartupConfiguration, MODULEUID, Handle(), aCommand, aParam1, aParam2); |
|
3625 |
TInt r = SendReceive(EFsSetStartupConfiguration, TIpcArgs(aCommand,aParam1,aParam2)); |
|
3626 |
||
3627 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSetStartupConfigurationReturn, MODULEUID, r); |
|
3628 |
return r; |
|
3629 |
} |
|
3630 |
||
3631 |
||
3632 |
EFSRV_EXPORT_C TInt RFs::SetNotifyChange(TBool aNotifyChange) |
|
3633 |
/** |
|
3634 |
Enables/Disables change notification on a per-session basis. Change notification is enabled |
|
3635 |
by default, and can be disabled using this API. Disabling change notification will result in |
|
3636 |
clients of the file server not being notified of events such as directory/file changes. |
|
3637 |
||
3638 |
@param aNotifyChange ETrue to enable change notifications, EFalse to disable. |
|
3639 |
||
3640 |
@return KErrNone if successful. |
|
3641 |
||
3642 |
@capability DiskAdmin |
|
3643 |
||
3644 |
@see RFs::NotifyChange |
|
3645 |
*/ |
|
3646 |
{ |
|
3647 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsSetNotifyChange, MODULEUID, Handle(), aNotifyChange); |
|
3648 |
TInt r = SendReceive(EFsSetSessionFlags, TIpcArgs(aNotifyChange ? EFsSessionNotifyChange: 0, aNotifyChange ? 0 : EFsSessionNotifyChange)); |
|
3649 |
||
3650 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSetNotifyChangeReturn, MODULEUID, r); |
|
3651 |
return r; |
|
3652 |
} |
|
3653 |
||
3654 |
||
3655 |
TInt RFs::Unclamp(const RFileClamp& aHandle) |
|
3656 |
/** |
|
3657 |
Makes available for paging-out the media space occupied by the file identified by |
|
3658 |
the supplied handle. |
|
3659 |
||
3660 |
@param aHandle handle to the file on the media. |
|
3661 |
||
3662 |
@return KErrNone if successful. |
|
3663 |
||
3664 |
@capability ??? |
|
3665 |
||
3666 |
@see RFile::Clamp |
|
3667 |
*/ |
|
3668 |
{ |
|
3669 |
TPckg<RFileClamp> pkHandle(aHandle); |
|
3670 |
return SendReceive(EFsUnclamp, TIpcArgs(& pkHandle)); |
|
3671 |
} |
|
3672 |
||
3673 |
EFSRV_EXPORT_C TInt RFs::InitialisePropertiesFile(const TPtrC8& aPtr) const |
|
3674 |
/** |
|
3675 |
Sets the F32 properties file - Can only be called from the ESTART process |
|
3676 |
||
3677 |
@param aPtr A descriptor pointing to an INI file in ROM. |
|
3678 |
||
3679 |
@return KErrNone if successful. |
|
3680 |
||
3681 |
@capability KDiskAdmin |
|
3682 |
*/ |
|
3683 |
{ |
|
3684 |
TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFsInitialisePropertiesFile, MODULEUID, Handle(), aPtr.Ptr(), aPtr.Length()); |
|
3685 |
TInt r = SendReceive(EFsInitialisePropertiesFile, TIpcArgs(aPtr.Ptr(), aPtr.Length(), ETrue)); |
|
3686 |
||
3687 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsInitialisePropertiesFileReturn, MODULEUID, r); |
|
3688 |
return r; |
|
3689 |
} |
|
3690 |
||
3691 |
EFSRV_EXPORT_C TInt RFs::QueryVolumeInfoExt(TInt aDrive, TQueryVolumeInfoExtCmd aCommand, TDes8& aInfo) const |
|
3692 |
/** |
|
3693 |
@internalTechnology |
|
3694 |
Queries specific information on volumes by commands. Available commands is defined by TQueryVolumeInfoExtCmd. |
|
3695 |
||
3696 |
@param aDriveNo The drive on which to query information. |
|
3697 |
@param aCommand A command to specify which information is under query |
|
3698 |
@param aInfo A TPckgBuf<> to carry returned results. |
|
3699 |
||
3700 |
@return KErrNone if successful; otherwise another system-wide error code is returned. |
|
3701 |
||
3702 |
@see TQueryVolumeInfoExtCmd |
|
3703 |
@see TVolumeIOParamInfo |
|
3704 |
*/ |
|
3705 |
{ |
|
3706 |
TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFsQueryVolumeInfoExt, MODULEUID, Handle(), aDrive, aCommand); |
|
3707 |
TInt r = SendReceive(EFsQueryVolumeInfoExt, TIpcArgs(aDrive, aCommand, &aInfo)); |
|
3708 |
||
3709 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsQueryVolumeInfoExtReturn, MODULEUID, r); |
|
3710 |
return r; |
|
3711 |
} |
|
3712 |
||
3713 |
||
3714 |
EFSRV_EXPORT_C TInt RFs::VolumeIOParam(TInt aDrive, TVolumeIOParamInfo& aParamInfo) const |
|
3715 |
/** |
|
3716 |
This function queries a set of I/O parameters on the specified volume, this includes the block size of underlying media, |
|
3717 |
cluster size of the mounted file system and the recommended read/write buffer sizes. |
|
3718 |
||
3719 |
The volume information is retuned through aParamInfo. Even if VolumeIOParam() returns successful, errors |
|
3720 |
can effect the return value of each field within aParamInfo. |
|
3721 |
||
3722 |
@param aDrive A drive number, specifies which volume to query. |
|
3723 |
@param aParamInfo A TVolumeIOParamInfo containing the volume parameters. |
|
3724 |
||
3725 |
@return KErrNone if successful; otherwise, another system wide error code is returned. |
|
3726 |
*/ |
|
3727 |
{ |
|
3728 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsVolumeIOParam, MODULEUID, Handle(), aDrive); |
|
3729 |
||
3730 |
TInt r = KErrNone; |
|
3731 |
||
3732 |
if (!IsValidDrive(aDrive)) |
|
3733 |
r = KErrArgument; |
|
3734 |
||
3735 |
if (r == KErrNone) |
|
3736 |
{ |
|
3737 |
TPckgBuf<TVolumeIOParamInfo> infoPckg; |
|
3738 |
r = QueryVolumeInfoExt(aDrive, EIOParamInfo, infoPckg); |
|
3739 |
if (r == KErrNone) |
|
3740 |
aParamInfo = infoPckg(); |
|
3741 |
} |
|
3742 |
||
3743 |
TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFsVolumeIOParamReturn, MODULEUID, |
|
3744 |
r, aParamInfo.iBlockSize, aParamInfo.iClusterSize, aParamInfo.iRecReadBufSize, aParamInfo.iRecWriteBufSize); |
|
3745 |
return r; |
|
3746 |
} |
|
3747 |
||
3748 |
||
6
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
3749 |
/** |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
3750 |
This function queries the sub type of the file system mounted on the specified volume. For example, 'FAT16' of the Fat file system. |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
3751 |
TFSName is recommended as the type for aName when using this function. |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
3752 |
|
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
3753 |
NOTE: For the file systems without a sub type (e.g. ROM file system), the the file system name is returned (For example, 'Rom'). |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
3754 |
Examples: |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
3755 |
"FAT" file system; the subtypes can be "fat12", "fat16" or "fat32" |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
3756 |
"ROFS" file system; the subtype will be "ROFS" |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
3757 |
|
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
3758 |
Note also that the file system name, returned in the aName descriptor shall be threated as case-insensitive string. I.e. |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
3759 |
"fileSystem" and "FILESYSTEM" mean absolutely the same. Therefore, case-insensitive string methods (like TDesC::FindF(), TDesC::CompareF()) |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
3760 |
shall be used to deal with the names. |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
3761 |
|
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
3762 |
|
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
3763 |
@param aDrive drive number, specifies which volume to query. |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
3764 |
@param aName descriptor containing the returned sub type name or file system name. |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
3765 |
|
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
3766 |
@return KErrNone if successful; KErrNotSuppoted if sub type is not supported; |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
3767 |
otherwise another system-wide error code is returned. |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
3768 |
|
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
3769 |
@see TFSName |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
3770 |
*/ |
0 | 3771 |
EFSRV_EXPORT_C TInt RFs::FileSystemSubType(TInt aDrive, TDes& aName) const |
3772 |
{ |
|
3773 |
TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsFileSystemSubType, MODULEUID, Handle(), aDrive, aName); |
|
3774 |
||
3775 |
TInt r = KErrNone; |
|
3776 |
||
3777 |
if (!IsValidDrive(aDrive)) |
|
3778 |
r = KErrArgument; |
|
3779 |
||
3780 |
if (r == KErrNone) |
|
3781 |
{ |
|
3782 |
TPckgBuf<TFSName> namePckg; |
|
3783 |
r = QueryVolumeInfoExt(aDrive, EFileSystemSubType, namePckg); |
|
3784 |
if (r == KErrNone || r == KErrNotSupported) |
|
3785 |
aName = namePckg(); |
|
3786 |
} |
|
3787 |
||
3788 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsFileSystemSubTypeReturn, MODULEUID, r); |
|
3789 |
return r; |
|
3790 |
} |
|
3791 |
||
3792 |
EXPORT_C TInt RFs::AddProxyDrive(const TDesC& aFileName) |
|
3793 |
/** |
|
3794 |
Loads the specified extension. |
|
3795 |
||
3796 |
@param aFileName The file name of the extension |
|
3797 |
||
3798 |
@return KErrNone, if successful; otherwise one of the other system wide error codes. |
|
3799 |
*/ |
|
3800 |
{ |
|
3801 |
RLoader loader; |
|
3802 |
TInt r = loader.Connect(); |
|
3803 |
if (r==KErrNone) |
|
3804 |
{ |
|
3805 |
r = loader.SendReceive(ELoadFSProxyDrive, TIpcArgs(0, &aFileName, 0)); |
|
3806 |
loader.Close(); |
|
3807 |
} |
|
3808 |
return r; |
|
3809 |
} |
|
3810 |
||
3811 |
||
3812 |
EXPORT_C TInt RFs::RemoveProxyDrive(const TDesC& aExtensionName) |
|
3813 |
/** |
|
3814 |
Removes the specified extension. |
|
3815 |
||
3816 |
@param aExtensionName The fullname of the extension, as returned from |
|
3817 |
a call to ExtensionName(). |
|
3818 |
||
3819 |
@return KErrNone, if successful; |
|
3820 |
KErrInUse if there are still drives mounted that are using it |
|
3821 |
KErrNotFound, if aExtensionName is not found; |
|
3822 |
otherwise one of the other system-wide error codes. |
|
3823 |
*/ |
|
3824 |
{ |
|
3825 |
return(SendReceive(EFsRemoveProxyDrive,TIpcArgs(&aExtensionName))); |
|
3826 |
} |
|
3827 |
||
3828 |
/** |
|
3829 |
Initialises a proxy drive. |
|
3830 |
||
3831 |
@param aProxyDriveNumber drive number that will be used to mount the proxy drive |
|
3832 |
@param aName name of the proxy drive extension |
|
3833 |
@param anInfo initialisation information to be passed to the proxy drive extension to initialise the drive |
|
3834 |
||
3835 |
@return If succesful the internal drive number used to represent the drive (equivalent to a local drive |
|
3836 |
number for normal drives) This number is obtained dynmically. The number will range between KMaxLocalDrives |
|
3837 |
and KMaxDrives. |
|
3838 |
KErrInUse if aProxyDriveNumber is in use or if there are not proxy drive numbers left |
|
3839 |
KErrArgument if aProxyDriveNumber or aName are invalid |
|
3840 |
Any other system wide error code. |
|
3841 |
||
3842 |
||
3843 |
*/ |
|
3844 |
EXPORT_C TInt RFs::DoMountProxyDrive(const TIpcArgs& ipcArgs) |
|
3845 |
{ |
|
3846 |
return SendReceive(EFsMountProxyDrive, ipcArgs); |
|
3847 |
} |
|
3848 |
||
3849 |
||
3850 |
EXPORT_C TInt RFs::DismountProxyDrive(const TUint aProxyDriveNumber) |
|
3851 |
/** |
|
3852 |
Dismounts a proxy drive. |
|
3853 |
||
3854 |
@param aProxyDriveNumber drive number that will be used to mount the proxy drive |
|
3855 |
@param aName name of the proxy drive extension |
|
3856 |
@param anInfo initialisation information to be passed to the proxy drive extension to initialise the drive |
|
3857 |
||
3858 |
@return If succesful the internal drive number used to represent the drive (equivalent to a local drive |
|
3859 |
number for normal drives) This number is obtained dynmically. The number will range between KMaxLocalDrives |
|
3860 |
and KMaxDrives. |
|
3861 |
KErrInUse if aProxyDriveNumber is in use or if there are not proxy drive numbers left |
|
3862 |
KErrArgument if aProxyDriveNumber or aName are invalid |
|
3863 |
Any other system wide error code. |
|
3864 |
||
3865 |
||
3866 |
*/ |
|
3867 |
{ |
|
3868 |
return SendReceive(EFsDismountProxyDrive,TIpcArgs(aProxyDriveNumber)); |
|
3869 |
} |
|
3870 |
||
3871 |
EFSRV_EXPORT_C void RFs::Close() |
|
3872 |
{ |
|
3873 |
TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsClose, MODULEUID, Handle()); |
|
3874 |
RFTRACE_CLOSE; |
|
3875 |
||
3876 |
RSessionBase::Close(); |
|
3877 |
||
3878 |
TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsCloseReturn, MODULEUID); |
|
3879 |
} |
|
3880 |
||
3881 |