author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 25 May 2010 14:09:55 +0300 | |
branch | RCL_3 |
changeset 28 | 5b5d147c7838 |
parent 22 | 2f92ad2dc5db |
child 43 | c1f20ce4abcf |
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 |
/** |
|
22
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2634 |
Checks the integrity of the File System mounted on the specified drive. |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2635 |
The behaviour of this API and return codes are File System specific, |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2636 |
dependent on how the File System implements its CheckDisk functionality. |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2637 |
Note that CheckDisk does not fix any errors that may be found, |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2638 |
it just reports the first problem it has found. |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2639 |
|
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2640 |
@param aDrive Path containing the drive to be checked. |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2641 |
If the drive letter is not specified, the current session drive is taken by default. |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2642 |
|
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2643 |
@return KErrNone If CheckDisk has not found any errors it knows about. |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2644 |
KErrNotReady If the specified drive is not ready. |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2645 |
KErrNotSupported If this functionality is not supported. |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2646 |
KErrPermissionDenied If the caller does not have DiskAdmin capability. |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2647 |
Other system-wide error codes. |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2648 |
|
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2649 |
@capability DiskAdmin |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2650 |
|
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2651 |
FAT File System specific information: |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2652 |
|
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2653 |
CheckDisk checks for a limited amount of possible corruption cases such as |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2654 |
invalid cluster numbers in the FAT table, lost and cross-linked cluster chains, |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2655 |
various errors within the directory entry etc. |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2656 |
|
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2657 |
If CheckDisk returns KErrNone, this means that there are no errors that CheckDisk on FAT is aware of. |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2658 |
|
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2659 |
Error codes returned by the FAT version of CheckDisk include: |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2660 |
1 Bad cluster value in FAT table detected. |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2661 |
2 Cross-linked cluster chain detected. |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2662 |
3 Lost cluster chain detected. |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2663 |
4 File size does not correspond to the number of clusters reported in the FAT table. |
0 | 2664 |
*/ |
8
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
2665 |
EFSRV_EXPORT_C TInt RFs::CheckDisk(const TDesC& aDrive) const |
0 | 2666 |
{ |
2667 |
TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsCheckDisk, MODULEUID, Handle(), aDrive); |
|
2668 |
TInt r = SendReceive(EFsCheckDisk,TIpcArgs(&aDrive)); |
|
2669 |
||
2670 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsCheckDiskReturn, MODULEUID, r); |
|
2671 |
return r; |
|
2672 |
} |
|
2673 |
||
2674 |
||
2675 |
||
2676 |
||
2677 |
EFSRV_EXPORT_C TInt RFs::ScanDrive(const TDesC& aDrive) const |
|
2678 |
/** |
|
22
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2679 |
Checks the integrity of the File System mounted on the specified drive |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2680 |
and attempts to correct some known File System errors. |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2681 |
The behaviour of this API and return codes are File System specific, |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2682 |
dependent on how the File System implements its ScanDrive functionality. |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2683 |
|
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2684 |
ScanDrive will not run on drives that have files or directories opened. |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2685 |
|
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2686 |
@param aDrive Path indicating the drive which contains the disk to be checked. |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2687 |
If the drive letter is not specified, the current session drive is taken by default. |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2688 |
|
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2689 |
@return KErrNone On success. |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2690 |
KErrInUse If drive is in use (i.e. if there are files and/or directories opened in the drive). |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2691 |
KErrCorrupt If ScanDrive has detected a file system corruption that it cannot fix. |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2692 |
KErrNotSupported If this functionality is not supported. |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2693 |
KErrPermissionDenied If the caller does not have DiskAdmin capability. |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2694 |
Other system-wide error codes. |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2695 |
|
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2696 |
@capability DiskAdmin |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2697 |
|
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2698 |
FAT File System specific information: |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2699 |
|
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2700 |
ScanDrive is intended to be run ONLY on "Rugged-FAT" file system |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2701 |
which is applicable to internal non-removable drives. |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2702 |
Internal RAM drives are not supported. |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2703 |
|
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2704 |
The "Rugged FAT" file system is designed in such a way that only a limited number |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2705 |
of known cases of corruption can be caused by sudden power loss. |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2706 |
All of these known cases can be corrected by ScanDrive. |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2707 |
Hence, running ScanDrive on "Rugged FAT" file system will result in: |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2708 |
KErrNone If there was no File System corruption or ScanDrive has successfully repaired the File System. |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2709 |
KErrCorrupt If ScanDrive has found a File System error that it cannot repair. |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2710 |
Other system-wide error codes, see above. |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2711 |
|
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2712 |
Running ScanDrive on removable media or media that has FAT file system not in |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2713 |
"Rugged FAT" mode is not practical, because ScanDrive is not designed for this. |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
2714 |
Therefore, do not treat ScanDrive on removable media as a generic "disk repair utility". |
0 | 2715 |
*/ |
2716 |
{ |
|
2717 |
TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsScanDrive, MODULEUID, Handle(), aDrive); |
|
2718 |
TInt r = SendReceive(EFsScanDrive,TIpcArgs(&aDrive)); |
|
2719 |
||
2720 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsScanDriveReturn, MODULEUID, r); |
|
2721 |
return r; |
|
2722 |
} |
|
2723 |
||
2724 |
||
2725 |
||
2726 |
||
2727 |
EFSRV_EXPORT_C TInt RFs::GetShortName(const TDesC& aLongName,TDes& aShortName) const |
|
2728 |
/** |
|
2729 |
Gets the short filename associated with a VFAT long filename. |
|
2730 |
||
2731 |
The short filename has a limit of eight characters for the file name and three |
|
2732 |
characters for the extension. |
|
2733 |
||
2734 |
@param aLongName The long filename. Any path components which are not |
|
2735 |
specified here will be taken from the session path. |
|
2736 |
If the path specifies a directory, it may or may not be |
|
2737 |
followed by a trailing backslash. |
|
2738 |
@param aShortName On return, contains the short filename associated with the file |
|
2739 |
or directory specified in aLongName. |
|
2740 |
||
2741 |
@return KErrNone if successful, otherwise one of the other |
|
2742 |
system-wide error codes. |
|
2743 |
||
2744 |
@capability Dependent If the path for aLongName starts with /Sys capability AllFiles is required |
|
2745 |
@capability Dependent If the path for aLongName starts with /Private and this process does not |
|
2746 |
have the relevant SID capability AllFiles is required |
|
2747 |
*/ |
|
2748 |
{ |
|
2749 |
TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsGetShortName, MODULEUID, Handle(), aLongName); |
|
2750 |
TInt r = SendReceive(EFsGetShortName,TIpcArgs(&aLongName,&aShortName)); |
|
2751 |
||
2752 |
TRACERETMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsGetShortNameReturn, MODULEUID, r, aShortName); |
|
2753 |
return r; |
|
2754 |
} |
|
2755 |
||
2756 |
||
2757 |
||
2758 |
||
2759 |
EFSRV_EXPORT_C TInt RFs::GetLongName(const TDesC& aShortName,TDes& aLongName) const |
|
2760 |
/** |
|
2761 |
Gets the long filename associated with a short (8.3) filename. |
|
2762 |
||
2763 |
A long filename has a limit of 256 characters for each component, as well as a |
|
2764 |
limit of 256 characters for the entire path. |
|
2765 |
||
2766 |
@param aShortName The short file name. Any path components which are not |
|
2767 |
specified here will be taken from the session path. If |
|
2768 |
the path specifies a directory, it may or may not be followed |
|
2769 |
by a trailing backslash. |
|
2770 |
@param aLongName On return, contains the long version of the name. |
|
2771 |
||
2772 |
@return KErrNone if successful, otherwise one of the other |
|
2773 |
system-wide error codes. |
|
2774 |
||
2775 |
@capability Dependent If the path for aShortName starts with /Sys capability AllFiles is required |
|
2776 |
@capability Dependent If the path for aShortName starts with /Private and this process does not |
|
2777 |
have the relevant SID capability AllFiles is required |
|
2778 |
||
2779 |
*/ |
|
2780 |
{ |
|
2781 |
TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsGetLongName, MODULEUID, Handle(), aShortName); |
|
2782 |
TInt r = SendReceive(EFsGetLongName,TIpcArgs(&aShortName,&aLongName)); |
|
2783 |
||
2784 |
TRACERETMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsGetLongNameReturn, MODULEUID, r, aLongName); |
|
2785 |
return r; |
|
2786 |
} |
|
2787 |
||
2788 |
||
2789 |
||
2790 |
||
2791 |
EFSRV_EXPORT_C TInt RFs::IsFileOpen(const TDesC& aFileName,TBool& anAnswer) const |
|
2792 |
/** |
|
2793 |
Tests whether a file is open. |
|
2794 |
||
2795 |
This function is useful because several file based operations provided by |
|
2796 |
the RFs class, for example: Delete(), Replace() and Rename(), require that |
|
2797 |
the file be closed. |
|
2798 |
||
2799 |
@param aFileName The name of the file to test. Any path components which are |
|
2800 |
not specified here will be taken from the session path. If a |
|
2801 |
directory is specified instead of a file then KErrNone will be |
|
2802 |
returned and anAnswer will be set to EFalse. |
|
2803 |
@param anAnswer On return, true if the file is open, false if closed. |
|
2804 |
||
2805 |
@return KErrNone if successful, otherwise one of the other |
|
2806 |
system-wide error codes. |
|
2807 |
||
2808 |
@capability Dependent If the path for aFileName starts with /Sys capability AllFiles is required |
|
2809 |
@capability Dependent If the path for aFileName starts with /Private and this process does not |
|
2810 |
have the relevant SID capability AllFiles is required |
|
2811 |
||
2812 |
@see RFs::Delete |
|
2813 |
@see RFs::Rename |
|
2814 |
@see RFs::Replace |
|
2815 |
*/ |
|
2816 |
{ |
|
2817 |
TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsIsFileOpen, MODULEUID, Handle(), aFileName); |
|
2818 |
TPckg<TBool> b(anAnswer); |
|
2819 |
TInt r = SendReceive(EFsIsFileOpen,TIpcArgs(&aFileName,&b)); |
|
2820 |
||
2821 |
TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFsIsFileOpenReturn, MODULEUID, r, anAnswer); |
|
2822 |
return r; |
|
2823 |
} |
|
2824 |
||
2825 |
||
2826 |
||
2827 |
||
2828 |
TInt RFs::GetOpenFileList(TInt& aSessionNumber,TInt& aLocalPos,TThreadId& aThreadId,TEntryArray& anArray) const |
|
2829 |
// |
|
2830 |
// Private function to get a list of open files |
|
2831 |
// |
|
2832 |
{ |
|
2833 |
TOpenFileListPos s(aSessionNumber,aLocalPos); |
|
2834 |
TPckg<TOpenFileListPos> pS(s); |
|
2835 |
TPckg<TThreadId> threadId(aThreadId); |
|
2836 |
anArray.iCount=KCountNeeded; |
|
2837 |
TInt r=SendReceive(EFsListOpenFiles,TIpcArgs(&pS,&threadId,&anArray.iBuf)); |
|
2838 |
aSessionNumber=s.iSession; |
|
2839 |
aLocalPos=s.iEntryListPos; |
|
2840 |
return r; |
|
2841 |
} |
|
2842 |
||
2843 |
||
2844 |
||
2845 |
||
2846 |
EFSRV_EXPORT_C TBool RFs::GetNotifyUser() |
|
2847 |
/** |
|
2848 |
Tests whether user notification of file read or write failure is in effect. |
|
2849 |
||
2850 |
@return True if notification in effect, false if not. |
|
2851 |
*/ |
|
2852 |
{ |
|
2853 |
TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsGetNotifyUser, MODULEUID, Handle()); |
|
2854 |
||
2855 |
TInt notifyUser; |
|
2856 |
TPckg<TInt> pckgNotify(notifyUser); |
|
2857 |
SendReceive(EFsGetNotifyUser,TIpcArgs(&pckgNotify)); |
|
2858 |
TBool r = notifyUser; |
|
2859 |
||
2860 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsGetNotifyUserReturn, MODULEUID, r); |
|
2861 |
return r; |
|
2862 |
} |
|
2863 |
||
2864 |
||
2865 |
||
2866 |
||
2867 |
EFSRV_EXPORT_C void RFs::SetNotifyUser(TBool aValue) |
|
2868 |
/** |
|
2869 |
Sets whether the user should be notified of file read or write failure. |
|
2870 |
Note that if some drive is mounted as synchronous (see RFs::MountFileSystem), the user won't be |
|
2871 |
notified about read/write failures on it. |
|
2872 |
||
2873 |
@param aValue ETrue, if user is to be notified of read or write failures; |
|
2874 |
EFalse, for no notification. |
|
2875 |
*/ |
|
2876 |
{ |
|
2877 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsSetNotifyUser, MODULEUID, Handle(), aValue); |
|
2878 |
SendReceive(EFsSetNotifyUser,TIpcArgs(aValue)); |
|
2879 |
||
2880 |
TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsSetNotifyUserReturn, MODULEUID); |
|
2881 |
} |
|
2882 |
||
2883 |
||
2884 |
||
2885 |
||
2886 |
EFSRV_EXPORT_C TUint8* RFs::IsFileInRom(const TDesC& aFileName) const |
|
2887 |
/** |
|
2888 |
Gets a pointer to the specified file, if it is in ROM. |
|
2889 |
||
2890 |
Note that this is not a test of whether the file is on the Z: drive, as |
|
2891 |
the Z: drive may consist of a ROM and another file system, using the composite |
|
2892 |
file system. For example, the file system may be ROFS, and the underlying media |
|
2893 |
NAND flash. |
|
2894 |
||
2895 |
@param aFileName The filename whose address is sought. Cannot include wildcards. |
|
2896 |
Any path components which are not specified here will be taken |
|
2897 |
from the session path. |
|
2898 |
||
2899 |
@return Address of the start of the file, if it is in ROM. This is NULL, if |
|
2900 |
the file is not in ROM. Note that for the composite file system, the file |
|
2901 |
might be on the Z: drive but in a non-ROM file system (i.e. ROFS), in |
|
2902 |
which case the function still returns NULL. |
|
2903 |
||
2904 |
@capability Dependent If the path for aFileName starts with /Sys capability AllFiles is required |
|
2905 |
@capability Dependent If the path for aFileName starts with /Private and this process does not |
|
2906 |
have the relevant SID capability AllFiles is required |
|
2907 |
||
2908 |
*/ |
|
2909 |
{ |
|
2910 |
TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsIsFileInRom, MODULEUID, Handle(), aFileName); |
|
2911 |
||
2912 |
TPckgBuf<TUint8*> start; |
|
2913 |
||
2914 |
TUint8* r; |
|
2915 |
if (SendReceive(EFsIsFileInRom,TIpcArgs(&aFileName,&start))!=KErrNone) |
|
2916 |
r = NULL; |
|
2917 |
else |
|
2918 |
r = start(); |
|
2919 |
||
2920 |
TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsIsFileInRomReturn, MODULEUID, r); |
|
2921 |
return r; |
|
2922 |
} |
|
2923 |
||
2924 |
||
2925 |
||
2926 |
||
2927 |
/** |
|
2928 |
Tests whether a filename and path are syntactically correct. |
|
2929 |
||
2930 |
The following restrictions apply to the path and to its components: |
|
2931 |
||
2932 |
1. Wildcards are not allowed in any path component, including the filename and extension. |
|
2933 |
2. Double backslashes are not allowed anywhere in the path |
|
2934 |
3. The following 6 characters cannot appear in the path: < > : " / | |
|
2935 |
4. Either or both of a filename or extension must be present. This means that a valid aFileName can not |
|
2936 |
end with backslash (like "c:\\SomeName\\"), because it will mean that "SomeName" is a directory. |
|
2937 |
||
2938 |
5. The entire component following the final backslash (the filename and extension) cannot consist solely of space characters, |
|
2939 |
or of a single or double dot. |
|
2940 |
||
2941 |
6. Spaces between the drive, if specified, and the first directory in the path are illegal, although there may be |
|
2942 |
spaces between other path components, for example, between directories. |
|
2943 |
||
2944 |
7. If the path in aFileName is not fully specified, i.e. doesn't look like "c:\\Dir1\\File1.bin", all missing |
|
2945 |
parts of the full path will be taken from the session path, @see RFs::SetSessionPath, @see RFs::SessionPath. |
|
2946 |
In this case the session path must be set, otherwise this method will return EFalse. |
|
2947 |
For example: for the case "\\file1.txt" only the drive letter will be taken from the session path; |
|
2948 |
for the case "file1.txt" whole session path will be internally prepended to the "file1.txt" and whole path checked. |
|
2949 |
Note that in this case total length of the name in the aFileName parameter and the session path shall not exceed KMaxFileName characters. |
|
2950 |
||
2951 |
||
2952 |
@param aFileName The path to be checked for validity. |
|
2953 |
May specify a filename alone, or an entire path specification, including drive letter. |
|
2954 |
If a path is specified, all components are checked for validity. |
|
2955 |
||
2956 |
@return ETrue, if the name is valid (conforms to the mentioned above criteria); EFalse otherwise. |
|
2957 |
*/ |
|
2958 |
EFSRV_EXPORT_C TBool RFs::IsValidName(const TDesC& aFileName) const |
|
2959 |
{ |
|
2960 |
TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsIsValidName1, MODULEUID, Handle(), aFileName); |
|
2961 |
TBool returnInvalidChar=EFalse; |
|
2962 |
TPckg<TBool> bPckg(returnInvalidChar); |
|
2963 |
TBool b; |
|
2964 |
if (SendReceive(EFsIsValidName,TIpcArgs(&aFileName,&bPckg,NULL,NULL))!=KErrNone) |
|
2965 |
b = EFalse; |
|
2966 |
else |
|
2967 |
b = ETrue; |
|
2968 |
TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsIsValidName1Return, MODULEUID, b); |
|
2969 |
return b; |
|
2970 |
} |
|
2971 |
||
2972 |
||
2973 |
||
2974 |
||
2975 |
/** |
|
2976 |
The following restrictions apply to the path and to its components: |
|
2977 |
||
2978 |
1. Wildcards are not allowed in any path component, including the filename and extension. |
|
2979 |
2. Double backslashes are not allowed anywhere in the path |
|
2980 |
3. The following 6 characters cannot appear in the path: < > : " / | |
|
2981 |
4. Either or both of a filename or extension must be present. This means that a valid aFileName can not |
|
2982 |
end with backslash (like "c:\\SomeName\\"), because it will mean that "SomeName" is a directory. |
|
2983 |
||
2984 |
5. The entire component following the final backslash (the filename and extension) cannot consist solely of space characters, |
|
2985 |
or of a single or double dot. |
|
2986 |
||
2987 |
6. Spaces between the drive, if specified, and the first directory in the path are illegal, although there may be |
|
2988 |
spaces between other path components, for example, between directories. |
|
2989 |
||
2990 |
7. If the path in aFileName is not fully specified, i.e. doesn't look like "c:\\Dir1\\File1.bin", all missing |
|
2991 |
parts of the full path will be taken from the session path, @see RFs::SetSessionPath, @see RFs::SessionPath. |
|
2992 |
In this case the session path must be set, otherwise this method will return EFalse. |
|
2993 |
For example: for the case "\\file1.txt" only the drive letter will be taken from the session path; |
|
2994 |
for the case "file1.txt" whole session path will be internally prepended to the "file1.txt" and whole path checked. |
|
2995 |
Note that in this case total length of the name in the aFileName parameter and the session path shall not exceed KMaxFileName characters. |
|
2996 |
||
2997 |
@param aFileName The path to be checked for validity. |
|
2998 |
May specify a filename alone, or an entire path specification, including drive letter. |
|
2999 |
If a path is specified, all components are checked for validity. |
|
3000 |
||
3001 |
@param aBadChar reference to the variable that on return can contain illegal character from aFileName. |
|
3002 |
1. if the filename and optional path in aFileName are valid, this method will return ETrue and aBadChar will be set to 0x00. |
|
3003 |
2. if there is an illegal character in aFileName, this method will return EFalse and aBadChar will contain this illegal character. |
|
3004 |
3. if there is no illegal characters in aFileName, but this is still not a valid filename (like "\\SomeName\\") |
|
3005 |
this method will return EFalse and aBadChar will contain space ' ' or code 0x20. |
|
3006 |
||
3007 |
@return ETrue, if the name is valid (conforms to the mentioned above criteria); EFalse otherwise. |
|
3008 |
*/ |
|
3009 |
EFSRV_EXPORT_C TBool RFs::IsValidName(const TDesC& aFileName,TText& aBadChar) const |
|
3010 |
{ |
|
3011 |
TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsIsValidName2, MODULEUID, Handle(), aFileName); |
|
3012 |
TBool returnInvalidChar=ETrue; |
|
3013 |
TPckg<TBool> boolPckg(returnInvalidChar); |
|
3014 |
TPckg<TText> textPckg(aBadChar); |
|
3015 |
TBool b; |
|
3016 |
if (SendReceive(EFsIsValidName,TIpcArgs(&aFileName,&boolPckg,&textPckg,NULL))!=KErrNone) |
|
3017 |
b = EFalse; |
|
3018 |
else |
|
3019 |
b = ETrue; |
|
3020 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsIsValidName2Return, MODULEUID, b, aBadChar); |
|
3021 |
return b; |
|
3022 |
} |
|
3023 |
/** |
|
3024 |
This API can be used to validate both directory and file names. |
|
3025 |
If the name ends with a trailing backslash '\\' then it is considered to be a directory |
|
3026 |
else a filename. |
|
3027 |
For example: "C:\\test\\" would mean a directory, whereas |
|
3028 |
"C:\\test" would mean a file, both of which would be returned as a Valid Name. |
|
3029 |
However a name such as "C:\\test\\\\" would be returned as an Invalid name with error code TError::ErrBadName |
|
3030 |
||
3031 |
The following restrictions apply to the path and to its components: |
|
3032 |
||
3033 |
1. Wildcards are not allowed in any path component, including the name and extension. |
|
3034 |
2. Double backslashes are not allowed anywhere in the path |
|
3035 |
3. The following 6 characters cannot appear in the path: < > : " / | |
|
3036 |
4. The entire component following the final backslash (the filename and extension) cannot consist solely of space characters, |
|
3037 |
or of a single or double dot. |
|
3038 |
5. Spaces between the drive, if specified, and the first directory in the path are illegal, although there may be |
|
3039 |
spaces between other path components, for example, between directories. |
|
3040 |
6. If TNameValidParam::iUseSesssionPath is set to ETrue, and if the path in aName is not fully specified, |
|
3041 |
i.e. doesn't look like "c:\\Dir1\\File1.bin", all missing parts of the full path will be taken from the session path, |
|
3042 |
@see RFs::SetSessionPath, @see RFs::SessionPath. |
|
3043 |
In this case the session path must be set, otherwise this method will return EFalse. |
|
3044 |
For example: for the case "\\file1.txt" only the drive letter will be taken from the session path; |
|
3045 |
for the case "file1.txt" whole session path will be internally prepended to the "file1.txt" and whole path checked. |
|
3046 |
Note that in this case total length of the name in the aName parameter and the session path shall not exceed KMaxFileName characters. |
|
3047 |
7. If TNameValidParam::iUseSesssionPath is set to EFalse, which is the default value, then |
|
3048 |
the session path is not used to fill in the missing parts of the name as stated above. |
|
3049 |
For example: for the case "file1.txt", session path will not be used to check the validity of the name. |
|
3050 |
@param aName The path to be checked for validity. |
|
3051 |
May specify a name alone, or an entire path specification, including drive letter. |
|
3052 |
If a path is specified, all components are checked for validity. |
|
3053 |
||
3054 |
@param aParam reference to the variable that on return can contain details of the error if any. |
|
3055 |
While constructing an object of this type one could specify whether one wants to use the sessionPath for filling up missing parts of aName, |
|
3056 |
or one would want to test aName as it is without prepending the sessionPath. |
|
3057 |
By default the sessionPath is NOT used. |
|
3058 |
1. if the name and optional path in aName are valid, this method will return ETrue and TError::iError will contain ErrNone. |
|
3059 |
2. if there is an illegal character in aName, this method will return EFalse and TError::iError will contain KErrBadCharacter. |
|
3060 |
Also TError::iInvalidCharPos will indicate the position of the rightmost invalid character. |
|
3061 |
3. if there is no illegal characters in aName, but this is still not a valid name (like "") |
|
3062 |
this method will return EFalse and TError::iError will contain KErrBadCharacter, while iInvalidCharPos will be set to 0 |
|
3063 |
4. if length of the name exceeds 256 characters, this method will return EFalse and TError::iError will contain KErrTooLong. |
|
3064 |
if the optional sessionPath is used, then the length of the sessionPath is also used to determine whether the length exceeds 256 characters. |
|
3065 |
@return ETrue, if the name is valid (conforms to the mentioned above criteria); EFalse otherwise. |
|
3066 |
*/ |
|
3067 |
EFSRV_EXPORT_C TBool RFs::IsValidName(const TDesC& aName, TNameValidParam& aParam ) |
|
3068 |
{ |
|
3069 |
TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsIsValidName3, MODULEUID, Handle(), aName); |
|
3070 |
TPckg<TNameValidParam> paramPckg(aParam); |
|
3071 |
TBool b; |
|
3072 |
if (SendReceive(EFsIsValidName,TIpcArgs(&aName,NULL,NULL,¶mPckg))!=KErrNone) |
|
3073 |
b = EFalse; |
|
3074 |
else |
|
3075 |
b = ETrue; |
|
3076 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsIsValidName3Return, MODULEUID, b, aParam.ErrorCode()); |
|
3077 |
return b; |
|
3078 |
} |
|
3079 |
||
3080 |
||
3081 |
||
3082 |
||
3083 |
EFSRV_EXPORT_C TInt RFs::GetDriveName(TInt aDrive,TDes& aDriveName) const |
|
3084 |
/** |
|
3085 |
Gets the name of a drive. |
|
3086 |
||
3087 |
Drive naming is optional. If the drive specified has not been assigned a name, |
|
3088 |
this function returns a descriptor whose length is zero. |
|
3089 |
||
3090 |
@param aDrive The drive number. Specify a drive in the range |
|
3091 |
EDriveA to EDriveZ for drives A to Z, respectively. |
|
3092 |
The default drive is the session default drive represented |
|
3093 |
by KDefaultDrive. |
|
3094 |
@param aDriveName On return, the drive name. |
|
3095 |
||
3096 |
@return KErrNone if successful, otherwise one of the other |
|
3097 |
system-wide error codes. |
|
3098 |
||
3099 |
@see TDriveNumber |
|
3100 |
*/ |
|
3101 |
{ |
|
3102 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsGetDriveName, MODULEUID, Handle(), aDrive); |
|
3103 |
TInt r = SendReceive(EFsGetDriveName,TIpcArgs(aDrive,&aDriveName)); |
|
3104 |
||
3105 |
TRACERETMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsGetDriveNameReturn, MODULEUID, r, aDriveName); |
|
3106 |
return r; |
|
3107 |
} |
|
3108 |
||
3109 |
||
3110 |
||
3111 |
||
3112 |
EFSRV_EXPORT_C TInt RFs::SetDriveName(TInt aDrive,const TDesC& aDriveName) |
|
3113 |
/** |
|
3114 |
Sets the name of a drive. |
|
3115 |
||
3116 |
Drive naming is optional. Any drive can be assigned a name, and more than |
|
3117 |
one drive can share the same name. |
|
3118 |
||
3119 |
@param aDrive The drive number. Specify a drive in the range |
|
3120 |
EDriveA to EDriveZ for drives A to Z, respectively. |
|
3121 |
Specify KDefaultDrive for the session default drive. |
|
3122 |
@param aDriveName The name of the drive, with a maximum of 256 characters. |
|
3123 |
The name cannot contain the 6 characters < > : " / | |
|
3124 |
||
3125 |
@return KErrNone if successful; |
|
3126 |
KErrBadName, if the name contains illegal characters; |
|
3127 |
otherwise one of the other system-wide error codes. |
|
3128 |
||
3129 |
@capability DiskAdmin |
|
3130 |
||
3131 |
*/ |
|
3132 |
{ |
|
3133 |
TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsSetDriveName, MODULEUID, Handle(), aDrive, aDriveName); |
|
3134 |
TInt r = SendReceive(EFsSetDriveName,TIpcArgs(aDrive,&aDriveName)); |
|
3135 |
||
3136 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSetDriveNameReturn, MODULEUID, r); |
|
3137 |
return r; |
|
3138 |
} |
|
3139 |
||
3140 |
||
3141 |
||
3142 |
||
3143 |
EFSRV_EXPORT_C TInt RFs::LockDrive(TInt aDrv, const TMediaPassword &aOld, const TMediaPassword &aNew, TBool aStore) |
|
3144 |
/** |
|
3145 |
Sets the password for the media in the specified drive. |
|
3146 |
||
3147 |
The media is not necessarily locked afterwards. Accessibility is determined |
|
3148 |
by the following rules: |
|
3149 |
||
3150 |
- The media may not become locked until power is removed (such as with MMC cards) |
|
3151 |
- If the password is added to the password store (the aStore parameter is ETrue), the |
|
3152 |
media will be automatically unlocked on the next access. |
|
3153 |
||
3154 |
@param aDrv The drive. |
|
3155 |
@param aOld The existing password. If no password is set, this must be a zero-length descriptor. |
|
3156 |
@param aNew The new password. |
|
3157 |
@param aStore ETrue if the new password is to be saved to the controller password store; |
|
3158 |
EFalse if not. |
|
3159 |
||
3160 |
@return KErrNone if successful; |
|
3161 |
KErrNotSupported if the media does not support password locking. |
|
3162 |
||
3163 |
@capability DiskAdmin |
|
3164 |
||
3165 |
*/ |
|
3166 |
{ |
|
3167 |
TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFsLockDrive, MODULEUID, Handle(), aDrv, aStore); |
|
3168 |
TInt r = SendReceive(EFsLockDrive,TIpcArgs(aDrv,&aOld,&aNew,aStore)); |
|
3169 |
||
3170 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsLockDriveReturn, MODULEUID, r); |
|
3171 |
return r; |
|
3172 |
} |
|
3173 |
||
3174 |
||
3175 |
||
3176 |
||
3177 |
EFSRV_EXPORT_C TInt RFs::UnlockDrive(TInt aDrive, const TMediaPassword &aPassword, TBool aStore) |
|
3178 |
/** |
|
3179 |
Unlocks the media in the specified drive. |
|
3180 |
||
3181 |
The password must be added to the MultiMedia card controller's password store |
|
3182 |
so that the controller can subsequently issue the password without the user |
|
3183 |
having to be prompted for it again. |
|
3184 |
||
3185 |
@param aDrive The drive. |
|
3186 |
@param aPassword The password. |
|
3187 |
@param aStore Specify ETrue to add the password to the |
|
3188 |
controller's password store. |
|
3189 |
||
3190 |
@return KErrNone, if successful; |
|
3191 |
KErrAccessDenied, if the password is incorrect; |
|
3192 |
KErrAlreadyExists, if the card has already been unlocked; |
|
3193 |
KErrNotSupported, if the media does not support password locking. |
|
3194 |
||
3195 |
@capability DiskAdmin |
|
3196 |
||
3197 |
*/ |
|
3198 |
{ |
|
3199 |
TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFsUnlockDrive, MODULEUID, Handle(), aDrive, aStore); |
|
3200 |
TInt r = SendReceive(EFsUnlockDrive,TIpcArgs(aDrive,&aPassword,aStore)); |
|
3201 |
||
3202 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsUnlockDriveReturn, MODULEUID, r); |
|
3203 |
return r; |
|
3204 |
} |
|
3205 |
||
3206 |
||
3207 |
||
3208 |
||
3209 |
EFSRV_EXPORT_C TInt RFs::ClearPassword(TInt aDrv, const TMediaPassword &aPswd) |
|
3210 |
/** |
|
3211 |
Clears the password from the locked MultiMedia card in the specified drive. |
|
3212 |
||
3213 |
Clearing the password causes the MultiMedia card controller to set |
|
3214 |
the password to null. |
|
3215 |
||
3216 |
@param aDrv The drive. |
|
3217 |
@param aPswd The current password, which is required to perform this |
|
3218 |
operation. |
|
3219 |
||
3220 |
@return KErrNone, if successful; |
|
3221 |
KErrAccessDenied, if the password is wrong or the card is still locked; |
|
3222 |
otherwise one of the other system-wide error codes. |
|
3223 |
||
3224 |
@capability DiskAdmin |
|
3225 |
||
3226 |
*/ |
|
3227 |
{ |
|
3228 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsClearPassword, MODULEUID, Handle(), aDrv); |
|
3229 |
TInt r = SendReceive(EFsClearPassword,TIpcArgs(aDrv,&aPswd)); |
|
3230 |
||
3231 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsClearPasswordReturn, MODULEUID, r); |
|
3232 |
return r; |
|
3233 |
} |
|
3234 |
||
3235 |
||
3236 |
||
3237 |
||
3238 |
EFSRV_EXPORT_C TInt RFs::ErasePassword(TInt aDrv) |
|
3239 |
/** |
|
3240 |
Erase the password from the locked MultiMedia card in the specified drive. |
|
3241 |
||
3242 |
Used when the password is unknown, and may result in the media being erased. |
|
3243 |
||
3244 |
Successful execution of this call may result in leaving the media in unformatted state. |
|
3245 |
Hence, it is recommended to format the Multimedia card after calling RFs::ErasePassword(). |
|
3246 |
||
3247 |
@param aDrv The drive. |
|
3248 |
||
3249 |
@return KErrNone, if successful; |
|
3250 |
otherwise one of the other system-wide error codes. |
|
3251 |
||
3252 |
@capability DiskAdmin |
|
3253 |
||
3254 |
*/ |
|
3255 |
{ |
|
3256 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsErasePassword, MODULEUID, Handle(), aDrv); |
|
3257 |
TInt r = SendReceive(EFsErasePassword,TIpcArgs(aDrv)); |
|
3258 |
||
3259 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsErasePasswordReturn, MODULEUID, r); |
|
3260 |
return r; |
|
3261 |
} |
|
3262 |
||
3263 |
||
3264 |
||
3265 |
||
3266 |
EFSRV_EXPORT_C void RFs::StartupInitComplete(TRequestStatus& aStat) |
|
3267 |
/** |
|
3268 |
Noifies the file server that startup initialisation is complete. |
|
3269 |
||
3270 |
@param aStat Request status object. |
|
3271 |
*/ |
|
3272 |
// |
|
3273 |
// Notify file server that startup initialisation has been completed |
|
3274 |
// |
|
3275 |
{ |
|
3276 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsStartupInitComplete, MODULEUID, Handle(), &aStat); |
|
3277 |
aStat=KRequestPending; |
|
3278 |
RSessionBase::SendReceive(EFsStartupInitComplete,aStat); |
|
3279 |
||
3280 |
TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsStartupInitCompleteReturn, MODULEUID); |
|
3281 |
} |
|
3282 |
||
3283 |
||
3284 |
||
3285 |
||
3286 |
EFSRV_EXPORT_C TInt RFs::SetLocalDriveMapping(const TDesC8& aMapping) |
|
3287 |
// |
|
3288 |
// Set the local drive mapping |
|
3289 |
// |
|
3290 |
{ |
|
3291 |
TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsSetLocalDriveMapping, MODULEUID, Handle(), aMapping); |
|
3292 |
||
3293 |
TInt r = SendReceive(EFsSetLocalDriveMapping,TIpcArgs(&aMapping)); |
|
3294 |
||
3295 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSetLocalDriveMappingReturn, MODULEUID, r); |
|
3296 |
return r; |
|
3297 |
} |
|
3298 |
||
3299 |
||
3300 |
/** |
|
3301 |
Finalise the given drive. This operation is intended to put the drive into the consistent state when it is |
|
3302 |
safe to remove it physically or switch the power off. |
|
3303 |
||
3304 |
@param aDriveNo drive number |
|
3305 |
@param aMode describes the finalisation operation, see RFs::TFinaliseDrvMode enum |
|
3306 |
||
3307 |
@return KErrNone on success, |
|
3308 |
KErrArgument if the function arguments are invalid |
|
3309 |
KErrInUse if the drive has opened objects (files, directories etc.) and therefore can not be finalised |
|
3310 |
KErrCorrupt if the drive is corrupt. |
|
3311 |
System wide error codes otherwise. |
|
3312 |
||
3313 |
@capability DiskAdmin |
|
3314 |
*/ |
|
3315 |
EFSRV_EXPORT_C TInt RFs::FinaliseDrive(TInt aDriveNo, TFinaliseDrvMode aMode) const |
|
3316 |
{ |
|
3317 |
TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFsFinaliseDrive, MODULEUID, Handle(), aDriveNo, aMode); |
|
3318 |
TInt r = SendReceive(EFsFinaliseDrive,TIpcArgs(aDriveNo, (TInt)aMode)); |
|
3319 |
||
3320 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsFinaliseDriveReturn, MODULEUID, r); |
|
3321 |
return r; |
|
3322 |
} |
|
3323 |
||
3324 |
||
3325 |
/** |
|
3326 |
Makes the best effort to finalise all drives in the system. |
|
3327 |
Effectively calls RFs::FinaliseDrive(..., EFinal_RW) to all present drives in the system. This makes impossible to |
|
3328 |
analyse the error code if the finalisation of some fails. |
|
3329 |
It is much better to use RFs::FinaliseDrive(...) specifying concrete drive number and desired finalisation mode. |
|
3330 |
||
3331 |
@return KErrNone, if successful; otherwise one of the other system-wide error codes. |
|
3332 |
@capability DiskAdmin |
|
3333 |
*/ |
|
3334 |
EFSRV_EXPORT_C TInt RFs::FinaliseDrives() |
|
3335 |
{ |
|
3336 |
TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsFinaliseDrives, MODULEUID, Handle()); |
|
3337 |
TInt nRes; |
|
3338 |
TDriveList driveList; |
|
3339 |
TDriveInfo driveInfo; |
|
3340 |
||
3341 |
nRes=DriveList(driveList); |
|
3342 |
if(nRes != KErrNone) |
|
3343 |
{ |
|
3344 |
TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsFinaliseDrivesReturn, MODULEUID, nRes); |
|
3345 |
return nRes; //-- unable to obtain drives list |
|
3346 |
} |
|
3347 |
||
3348 |
//-- walk through all drives in the system sending them "Finalise" request |
|
3349 |
for (TInt i=0; i<KMaxDrives; ++i) |
|
3350 |
{ |
|
3351 |
if(!driveList[i]) |
|
3352 |
continue; //-- skip unexisting drive |
|
3353 |
||
3354 |
if(Drive(driveInfo, i) != KErrNone) |
|
3355 |
continue; //-- skip this drive, can't get information about it |
|
3356 |
||
3357 |
const TUint KDrvAttExclude = KDriveAttRom | KDriveAttRedirected; //-- the drive attributes to exlcude from the finalisation |
|
3358 |
||
3359 |
if(driveInfo.iDriveAtt & KDrvAttExclude) |
|
3360 |
continue; |
|
3361 |
||
3362 |
nRes = FinaliseDrive(i, EFinal_RW); |
|
3363 |
} |
|
3364 |
||
3365 |
||
3366 |
TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsFinaliseDrivesReturn, MODULEUID, KErrNone); |
|
3367 |
return KErrNone; |
|
3368 |
} |
|
3369 |
||
3370 |
||
3371 |
||
3372 |
EFSRV_EXPORT_C TInt RFs::SwapFileSystem(const TDesC& aOldFileSystemName,const TDesC& aNewFileSystemName,TInt aDrive) const |
|
3373 |
/** |
|
3374 |
Dismount aOldFileSystemName and mount aNewFileSystemName in an atomic operation |
|
3375 |
||
3376 |
If swapping in the composite filesystem, and no mounts have been added to it, |
|
3377 |
then ROFS is added to it by default. The synchronous state of the composite filesystem |
|
3378 |
will be used in preference to that of the old filesystem when it is mounted. |
|
3379 |
||
3380 |
@param aOldFileSystemName The filesystem name that is currently on the drive. |
|
3381 |
@param aNewFileSystemName The filesystem name that is to be swapped onto the drive. |
|
3382 |
@param aDrive The drive for which the filesystem is to be swapped. |
|
3383 |
||
3384 |
@return KErrNone if successful |
|
3385 |
KErrInUse if a dismount is pending on the drive |
|
3386 |
KErrNotSupported if swapping Z drive with something other then composite or if the drive is asynchronous |
|
3387 |
KErrAlreadyExists if swapping the composite filesystem, and it is already mounted |
|
3388 |
KErrNotFound If the filesystem name provided could not be found. |
|
3389 |
||
3390 |
@capability DiskAdmin |
|
3391 |
*/ |
|
3392 |
{ |
|
3393 |
TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::EFsSwapFileSystem, MODULEUID, Handle(), aOldFileSystemName, aNewFileSystemName, aDrive); |
|
3394 |
TInt r = SendReceive(EFsSwapFileSystem,TIpcArgs(&aNewFileSystemName,aDrive,&aOldFileSystemName)); |
|
3395 |
||
3396 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSwapFileSystemReturn, MODULEUID, r); |
|
3397 |
return r; |
|
3398 |
} |
|
3399 |
||
3400 |
||
3401 |
EFSRV_EXPORT_C TInt RFs::AddCompositeMount(const TDesC& aFileSystemName,TInt aLocalDriveToMount,TInt aCompositeDrive, TBool aSync) const |
|
3402 |
/** |
|
3403 |
Adds a local drive to the composite filesystem. This can only be used before |
|
3404 |
the composite filesystem is mounted. The local drive is mounted with the |
|
3405 |
filesystem provided. If any local drive added is marked to be asynchronous, |
|
3406 |
then the whole composite drive will be treated asynchronous. |
|
3407 |
||
3408 |
@param aFileSystemName The filesystem of the local drive to be added. |
|
3409 |
@param aLocalDriveToMount The local drive to be added. |
|
3410 |
@param aCompositeDrive The drive the composite filesystem will be mounted on. |
|
3411 |
@param aSync If the filesystem added here is preferred to be synchronous. |
|
3412 |
||
3413 |
@return KErrNone if successful |
|
3414 |
KErrNotFound If the filesystem name provided could not be found. |
|
3415 |
KErrNotReady If the composite filesystem has not been initialised. |
|
3416 |
KErrNotSupported If the composite filesystem is already mounted or the parameters passed are unsupported |
|
3417 |
||
3418 |
@capability DiskAdmin |
|
3419 |
*/ |
|
3420 |
{ |
|
3421 |
TRACEMULT5(UTF::EBorder, UTraceModuleEfsrv::EFsAddCompositeMount, MODULEUID, |
|
3422 |
Handle(), aFileSystemName, aLocalDriveToMount, aCompositeDrive, aSync); |
|
3423 |
TInt r = SendReceive(EFsAddCompositeMount,TIpcArgs(&aFileSystemName,aLocalDriveToMount,aCompositeDrive,aSync)); |
|
3424 |
||
3425 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsAddCompositeMountReturn, MODULEUID, r); |
|
3426 |
return r; |
|
3427 |
} |
|
3428 |
||
3429 |
||
3430 |
EFSRV_EXPORT_C TInt RFs::ReserveDriveSpace(TInt aDriveNo, TInt aSpace) |
|
3431 |
/** |
|
3432 |
Reserves an area of a drive. It is intended that sensible (tm) apps will reserve a small |
|
3433 |
area of disk for 'emergency' use in case of later out of disk situations. If the amount of |
|
3434 |
reserved space later needs to be readjusted, this method should be called again with |
|
3435 |
aSpace as the amount of extra space needed. |
|
3436 |
||
3437 |
Once space has been reserved via this method, an application can use RFs::GetReserveAccess |
|
3438 |
to gain access to the reserved area prior to executing disk space critical sections of code. |
|
3439 |
After the section of code is complete, the application should release access to the reserved |
|
3440 |
area. |
|
3441 |
||
3442 |
For internal drives, reserved space will be lost if a reboot occurs. For removeable drives, |
|
3443 |
reserved space may be lost if there is a media change. |
|
3444 |
||
3445 |
Reserved space will be cleaned up automatically when the RFs is closed. |
|
3446 |
||
3447 |
Each drive has a max amount of space available to be reserved, and individual sessions also |
|
3448 |
have a max amount of space. These are defined in f32/sfile/sf_std.h as KMaxTotalDriveReserved |
|
3449 |
and KMaxSessionDriveReserved respectively. Once space is reserved, it is only available to |
|
3450 |
the reserving session until that session releases the reserved space. |
|
3451 |
||
3452 |
@param aDriveNo Which drive to reserve space on |
|
3453 |
||
3454 |
@param aSpace Amount of space to reserve |
|
3455 |
||
3456 |
@return KErrNone if successful |
|
3457 |
KErrInUse if the session already has reserved access |
|
3458 |
KErrArgument if aSpace is invalid (greater than KMaxSessionDriveReserved, negative number, etc.) |
|
3459 |
KErrDiskFull if insufficient space is left on the drive to service the request |
|
3460 |
KErrTooBig if this request would overflow the available reserve (greater than KMaxTotalDriveReserved) |
|
3461 |
any of the possible error return codes from TDrive::Volume() |
|
3462 |
*/ |
|
3463 |
{ |
|
3464 |
TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFsReserveDriveSpace, MODULEUID, Handle(), aDriveNo, aSpace); |
|
3465 |
TInt r = SendReceive(EFsReserveDriveSpace, TIpcArgs(aDriveNo, aSpace)); |
|
3466 |
||
3467 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsReserveDriveSpaceReturn, MODULEUID, r); |
|
3468 |
return r; |
|
3469 |
} |
|
3470 |
||
3471 |
||
3472 |
||
3473 |
||
3474 |
EFSRV_EXPORT_C TInt RFs::GetReserveAccess(TInt aDriveNo) |
|
3475 |
/** |
|
3476 |
Get exclusive access for this session to overwrite a specific disk area, which has previously |
|
3477 |
been reserved via RFs::ReserveDriveSpace |
|
3478 |
||
3479 |
@param aDriveNo drive on which to get reserved access |
|
3480 |
||
3481 |
@return KErrNone if successful |
|
3482 |
KErrPermissionDenied if the drive has no spare reserved space |
|
3483 |
*/ |
|
3484 |
{ |
|
3485 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsGetReserveAccess, MODULEUID, Handle(), aDriveNo); |
|
3486 |
TInt r = SendReceive(EFsGetReserveAccess, TIpcArgs(aDriveNo)); |
|
3487 |
||
3488 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsGetReserveAccessReturn, MODULEUID, r); |
|
3489 |
return r; |
|
3490 |
} |
|
3491 |
||
3492 |
EFSRV_EXPORT_C TInt RFs::ReleaseReserveAccess(TInt aDriveNo) |
|
3493 |
/** |
|
3494 |
Release exclusive access for this session to overwrite a specific disk area. |
|
3495 |
||
3496 |
@param aDriveNo drive on which to release reserved access |
|
3497 |
||
3498 |
@return KErrNone (always returned) |
|
3499 |
||
3500 |
*/ |
|
3501 |
{ |
|
3502 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsReleaseReserveAccess, MODULEUID, Handle(), aDriveNo); |
|
3503 |
TInt r = SendReceive(EFsReleaseReserveAccess, TIpcArgs(aDriveNo)); |
|
3504 |
||
3505 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsReleaseReserveAccessReturn, MODULEUID, r); |
|
3506 |
return r; |
|
3507 |
} |
|
3508 |
||
3509 |
||
3510 |
||
3511 |
||
3512 |
/** |
|
4
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3513 |
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
|
3514 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3515 |
This API allows interested parties to: |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3516 |
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
|
3517 |
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
|
3518 |
See TNotifyDismountMode::EFsDismountRegisterClient |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3519 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3520 |
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
|
3521 |
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
|
3522 |
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
|
3523 |
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
|
3524 |
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
|
3525 |
See TNotifyDismountMode::EFsDismountNotifyClients |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3526 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3527 |
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
|
3528 |
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
|
3529 |
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
|
3530 |
See TNotifyDismountMode::EFsDismountForceDismount |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3531 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3532 |
* 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
|
3533 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3534 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3535 |
The use case scenario: |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3536 |
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
|
3537 |
'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
|
3538 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3539 |
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
|
3540 |
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
|
3541 |
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
|
3542 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3543 |
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
|
3544 |
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
|
3545 |
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
|
3546 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3547 |
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
|
3548 |
dismounted and 'Master' has 'aStat' completed. |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3549 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3550 |
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
|
3551 |
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
|
3552 |
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
|
3553 |
|
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 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3556 |
@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
|
3557 |
@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
|
3558 |
@param aStat Asynchronous request state. |
0 | 3559 |
*/ |
4
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3560 |
EFSRV_EXPORT_C void RFs::NotifyDismount(TInt aDrive, TRequestStatus& aStat, TNotifyDismountMode aMode /*=EFsDismountRegisterClient*/) const |
0 | 3561 |
{ |
3562 |
TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyDismount, MODULEUID, Handle(), aDrive, &aStat, aMode); |
|
3563 |
aStat = KRequestPending; |
|
3564 |
RSessionBase::SendReceive(EFsNotifyDismount, TIpcArgs(aDrive,aMode,&aStat), aStat); |
|
3565 |
// This call is to synchronise with the driver thread as the corresponding cancel function (NotifyDismountCancel) |
|
3566 |
// is synchronous, so it can complete before this notify request has even been added to TDismountNotifyQue. |
|
3567 |
// This call guarantees that the notify request has been added to queue. |
|
3568 |
SendReceive(EFsSynchroniseDriveThread, TIpcArgs(aDrive)); |
|
3569 |
||
3570 |
TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyDismountReturn, MODULEUID); |
|
3571 |
} |
|
3572 |
||
3573 |
||
3574 |
||
3575 |
||
4
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3576 |
/** |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3577 |
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
|
3578 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3579 |
@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
|
3580 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3581 |
@see RFs::NotifyDismount |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3582 |
*/ |
0 | 3583 |
EFSRV_EXPORT_C void RFs::NotifyDismountCancel(TRequestStatus& aStat) const |
3584 |
{ |
|
3585 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyDismountCancel1, MODULEUID, Handle(), &aStat); |
|
3586 |
||
3587 |
if (aStat == KRequestPending) |
|
3588 |
SendReceive(EFsNotifyDismountCancel, TIpcArgs(&aStat)); |
|
3589 |
||
3590 |
TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyDismountCancel1Return, MODULEUID); |
|
3591 |
} |
|
3592 |
||
3593 |
||
3594 |
||
4
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 |
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
|
3597 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3598 |
@see RFs::NotifyDismount |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3599 |
*/ |
0 | 3600 |
EFSRV_EXPORT_C void RFs::NotifyDismountCancel() const |
3601 |
{ |
|
3602 |
TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyDismountCancel2, MODULEUID, Handle()); |
|
3603 |
||
3604 |
SendReceive(EFsNotifyDismountCancel, TIpcArgs(NULL)); |
|
3605 |
||
3606 |
TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyDismountCancel2Return, MODULEUID); |
|
3607 |
} |
|
3608 |
||
3609 |
||
3610 |
||
3611 |
||
4
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3612 |
/** |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3613 |
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
|
3614 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3615 |
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
|
3616 |
after a given timeout period. |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3617 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3618 |
@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
|
3619 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3620 |
@return KErrNone if successful |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3621 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3622 |
@see RFs::NotifyDismount |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3623 |
*/ |
0 | 3624 |
EFSRV_EXPORT_C TInt RFs::AllowDismount(TInt aDrive) const |
3625 |
{ |
|
3626 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsAllowDismount, MODULEUID, Handle(), aDrive); |
|
3627 |
TInt r = SendReceive(EFsAllowDismount, TIpcArgs(aDrive)); |
|
3628 |
||
3629 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsAllowDismountReturn, MODULEUID, r); |
|
3630 |
return r; |
|
3631 |
} |
|
3632 |
||
3633 |
EFSRV_EXPORT_C TInt RFs::SetStartupConfiguration(TInt aCommand,TAny* aParam1,TAny* aParam2) const |
|
3634 |
/** |
|
3635 |
@publishedPartner |
|
3636 |
@release |
|
3637 |
||
3638 |
Only can be called in estart. Licensees could use this function to configure |
|
3639 |
file server at startup through their own version of estart. |
|
3640 |
||
3641 |
Currently only loader thread priority can be specified. |
|
3642 |
||
3643 |
@param aCommand Command indicating what aspect of file server should be configured. |
|
3644 |
aParam1 Command specific parameter. |
|
3645 |
aParam2 Command specific parameter. |
|
3646 |
||
3647 |
@return KErrNone if successful, KErrPermissionDenied if called outside estart |
|
3648 |
*/ |
|
3649 |
{ |
|
3650 |
TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFsSetStartupConfiguration, MODULEUID, Handle(), aCommand, aParam1, aParam2); |
|
3651 |
TInt r = SendReceive(EFsSetStartupConfiguration, TIpcArgs(aCommand,aParam1,aParam2)); |
|
3652 |
||
3653 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSetStartupConfigurationReturn, MODULEUID, r); |
|
3654 |
return r; |
|
3655 |
} |
|
3656 |
||
3657 |
||
3658 |
EFSRV_EXPORT_C TInt RFs::SetNotifyChange(TBool aNotifyChange) |
|
3659 |
/** |
|
3660 |
Enables/Disables change notification on a per-session basis. Change notification is enabled |
|
3661 |
by default, and can be disabled using this API. Disabling change notification will result in |
|
3662 |
clients of the file server not being notified of events such as directory/file changes. |
|
3663 |
||
3664 |
@param aNotifyChange ETrue to enable change notifications, EFalse to disable. |
|
3665 |
||
3666 |
@return KErrNone if successful. |
|
3667 |
||
3668 |
@capability DiskAdmin |
|
3669 |
||
3670 |
@see RFs::NotifyChange |
|
3671 |
*/ |
|
3672 |
{ |
|
3673 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsSetNotifyChange, MODULEUID, Handle(), aNotifyChange); |
|
3674 |
TInt r = SendReceive(EFsSetSessionFlags, TIpcArgs(aNotifyChange ? EFsSessionNotifyChange: 0, aNotifyChange ? 0 : EFsSessionNotifyChange)); |
|
3675 |
||
3676 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSetNotifyChangeReturn, MODULEUID, r); |
|
3677 |
return r; |
|
3678 |
} |
|
3679 |
||
3680 |
||
3681 |
TInt RFs::Unclamp(const RFileClamp& aHandle) |
|
3682 |
/** |
|
3683 |
Makes available for paging-out the media space occupied by the file identified by |
|
3684 |
the supplied handle. |
|
3685 |
||
3686 |
@param aHandle handle to the file on the media. |
|
3687 |
||
3688 |
@return KErrNone if successful. |
|
3689 |
||
3690 |
@capability ??? |
|
3691 |
||
3692 |
@see RFile::Clamp |
|
3693 |
*/ |
|
3694 |
{ |
|
3695 |
TPckg<RFileClamp> pkHandle(aHandle); |
|
3696 |
return SendReceive(EFsUnclamp, TIpcArgs(& pkHandle)); |
|
3697 |
} |
|
3698 |
||
3699 |
EFSRV_EXPORT_C TInt RFs::InitialisePropertiesFile(const TPtrC8& aPtr) const |
|
3700 |
/** |
|
3701 |
Sets the F32 properties file - Can only be called from the ESTART process |
|
3702 |
||
3703 |
@param aPtr A descriptor pointing to an INI file in ROM. |
|
3704 |
||
3705 |
@return KErrNone if successful. |
|
3706 |
||
3707 |
@capability KDiskAdmin |
|
3708 |
*/ |
|
3709 |
{ |
|
3710 |
TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFsInitialisePropertiesFile, MODULEUID, Handle(), aPtr.Ptr(), aPtr.Length()); |
|
3711 |
TInt r = SendReceive(EFsInitialisePropertiesFile, TIpcArgs(aPtr.Ptr(), aPtr.Length(), ETrue)); |
|
3712 |
||
3713 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsInitialisePropertiesFileReturn, MODULEUID, r); |
|
3714 |
return r; |
|
3715 |
} |
|
3716 |
||
3717 |
EFSRV_EXPORT_C TInt RFs::QueryVolumeInfoExt(TInt aDrive, TQueryVolumeInfoExtCmd aCommand, TDes8& aInfo) const |
|
3718 |
/** |
|
3719 |
@internalTechnology |
|
3720 |
Queries specific information on volumes by commands. Available commands is defined by TQueryVolumeInfoExtCmd. |
|
3721 |
||
3722 |
@param aDriveNo The drive on which to query information. |
|
3723 |
@param aCommand A command to specify which information is under query |
|
3724 |
@param aInfo A TPckgBuf<> to carry returned results. |
|
3725 |
||
3726 |
@return KErrNone if successful; otherwise another system-wide error code is returned. |
|
3727 |
||
3728 |
@see TQueryVolumeInfoExtCmd |
|
3729 |
@see TVolumeIOParamInfo |
|
3730 |
*/ |
|
3731 |
{ |
|
3732 |
TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFsQueryVolumeInfoExt, MODULEUID, Handle(), aDrive, aCommand); |
|
3733 |
TInt r = SendReceive(EFsQueryVolumeInfoExt, TIpcArgs(aDrive, aCommand, &aInfo)); |
|
3734 |
||
3735 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsQueryVolumeInfoExtReturn, MODULEUID, r); |
|
3736 |
return r; |
|
3737 |
} |
|
3738 |
||
3739 |
||
3740 |
EFSRV_EXPORT_C TInt RFs::VolumeIOParam(TInt aDrive, TVolumeIOParamInfo& aParamInfo) const |
|
3741 |
/** |
|
3742 |
This function queries a set of I/O parameters on the specified volume, this includes the block size of underlying media, |
|
3743 |
cluster size of the mounted file system and the recommended read/write buffer sizes. |
|
3744 |
||
3745 |
The volume information is retuned through aParamInfo. Even if VolumeIOParam() returns successful, errors |
|
3746 |
can effect the return value of each field within aParamInfo. |
|
3747 |
||
3748 |
@param aDrive A drive number, specifies which volume to query. |
|
3749 |
@param aParamInfo A TVolumeIOParamInfo containing the volume parameters. |
|
3750 |
||
3751 |
@return KErrNone if successful; otherwise, another system wide error code is returned. |
|
3752 |
*/ |
|
3753 |
{ |
|
3754 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsVolumeIOParam, MODULEUID, Handle(), aDrive); |
|
3755 |
||
3756 |
TInt r = KErrNone; |
|
3757 |
||
3758 |
if (!IsValidDrive(aDrive)) |
|
3759 |
r = KErrArgument; |
|
3760 |
||
3761 |
if (r == KErrNone) |
|
3762 |
{ |
|
3763 |
TPckgBuf<TVolumeIOParamInfo> infoPckg; |
|
3764 |
r = QueryVolumeInfoExt(aDrive, EIOParamInfo, infoPckg); |
|
3765 |
if (r == KErrNone) |
|
3766 |
aParamInfo = infoPckg(); |
|
3767 |
} |
|
3768 |
||
3769 |
TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFsVolumeIOParamReturn, MODULEUID, |
|
3770 |
r, aParamInfo.iBlockSize, aParamInfo.iClusterSize, aParamInfo.iRecReadBufSize, aParamInfo.iRecWriteBufSize); |
|
3771 |
return r; |
|
3772 |
} |
|
3773 |
||
3774 |
||
6
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
3775 |
/** |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
3776 |
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
|
3777 |
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
|
3778 |
|
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
3779 |
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
|
3780 |
Examples: |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
3781 |
"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
|
3782 |
"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
|
3783 |
|
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
3784 |
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
|
3785 |
"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
|
3786 |
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
|
3787 |
|
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
3788 |
|
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
3789 |
@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
|
3790 |
@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
|
3791 |
|
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
3792 |
@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
|
3793 |
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
|
3794 |
|
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
3795 |
@see TFSName |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
3796 |
*/ |
0 | 3797 |
EFSRV_EXPORT_C TInt RFs::FileSystemSubType(TInt aDrive, TDes& aName) const |
3798 |
{ |
|
3799 |
TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsFileSystemSubType, MODULEUID, Handle(), aDrive, aName); |
|
3800 |
||
3801 |
TInt r = KErrNone; |
|
3802 |
||
3803 |
if (!IsValidDrive(aDrive)) |
|
3804 |
r = KErrArgument; |
|
3805 |
||
3806 |
if (r == KErrNone) |
|
3807 |
{ |
|
3808 |
TPckgBuf<TFSName> namePckg; |
|
3809 |
r = QueryVolumeInfoExt(aDrive, EFileSystemSubType, namePckg); |
|
3810 |
if (r == KErrNone || r == KErrNotSupported) |
|
3811 |
aName = namePckg(); |
|
3812 |
} |
|
3813 |
||
3814 |
TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsFileSystemSubTypeReturn, MODULEUID, r); |
|
3815 |
return r; |
|
3816 |
} |
|
3817 |
||
3818 |
EXPORT_C TInt RFs::AddProxyDrive(const TDesC& aFileName) |
|
3819 |
/** |
|
3820 |
Loads the specified extension. |
|
3821 |
||
3822 |
@param aFileName The file name of the extension |
|
3823 |
||
3824 |
@return KErrNone, if successful; otherwise one of the other system wide error codes. |
|
3825 |
*/ |
|
3826 |
{ |
|
3827 |
RLoader loader; |
|
3828 |
TInt r = loader.Connect(); |
|
3829 |
if (r==KErrNone) |
|
3830 |
{ |
|
3831 |
r = loader.SendReceive(ELoadFSProxyDrive, TIpcArgs(0, &aFileName, 0)); |
|
3832 |
loader.Close(); |
|
3833 |
} |
|
3834 |
return r; |
|
3835 |
} |
|
3836 |
||
3837 |
||
3838 |
EXPORT_C TInt RFs::RemoveProxyDrive(const TDesC& aExtensionName) |
|
3839 |
/** |
|
3840 |
Removes the specified extension. |
|
3841 |
||
3842 |
@param aExtensionName The fullname of the extension, as returned from |
|
3843 |
a call to ExtensionName(). |
|
3844 |
||
3845 |
@return KErrNone, if successful; |
|
3846 |
KErrInUse if there are still drives mounted that are using it |
|
3847 |
KErrNotFound, if aExtensionName is not found; |
|
3848 |
otherwise one of the other system-wide error codes. |
|
3849 |
*/ |
|
3850 |
{ |
|
3851 |
return(SendReceive(EFsRemoveProxyDrive,TIpcArgs(&aExtensionName))); |
|
3852 |
} |
|
3853 |
||
3854 |
/** |
|
3855 |
Initialises a proxy drive. |
|
3856 |
||
3857 |
@param aProxyDriveNumber drive number that will be used to mount the proxy drive |
|
3858 |
@param aName name of the proxy drive extension |
|
3859 |
@param anInfo initialisation information to be passed to the proxy drive extension to initialise the drive |
|
3860 |
||
3861 |
@return If succesful the internal drive number used to represent the drive (equivalent to a local drive |
|
3862 |
number for normal drives) This number is obtained dynmically. The number will range between KMaxLocalDrives |
|
3863 |
and KMaxDrives. |
|
3864 |
KErrInUse if aProxyDriveNumber is in use or if there are not proxy drive numbers left |
|
3865 |
KErrArgument if aProxyDriveNumber or aName are invalid |
|
3866 |
Any other system wide error code. |
|
3867 |
||
3868 |
||
3869 |
*/ |
|
3870 |
EXPORT_C TInt RFs::DoMountProxyDrive(const TIpcArgs& ipcArgs) |
|
3871 |
{ |
|
3872 |
return SendReceive(EFsMountProxyDrive, ipcArgs); |
|
3873 |
} |
|
3874 |
||
3875 |
||
3876 |
EXPORT_C TInt RFs::DismountProxyDrive(const TUint aProxyDriveNumber) |
|
3877 |
/** |
|
3878 |
Dismounts a proxy drive. |
|
3879 |
||
3880 |
@param aProxyDriveNumber drive number that will be used to mount the proxy drive |
|
3881 |
@param aName name of the proxy drive extension |
|
3882 |
@param anInfo initialisation information to be passed to the proxy drive extension to initialise the drive |
|
3883 |
||
3884 |
@return If succesful the internal drive number used to represent the drive (equivalent to a local drive |
|
3885 |
number for normal drives) This number is obtained dynmically. The number will range between KMaxLocalDrives |
|
3886 |
and KMaxDrives. |
|
3887 |
KErrInUse if aProxyDriveNumber is in use or if there are not proxy drive numbers left |
|
3888 |
KErrArgument if aProxyDriveNumber or aName are invalid |
|
3889 |
Any other system wide error code. |
|
3890 |
||
3891 |
||
3892 |
*/ |
|
3893 |
{ |
|
3894 |
return SendReceive(EFsDismountProxyDrive,TIpcArgs(aProxyDriveNumber)); |
|
3895 |
} |
|
3896 |
||
3897 |
EFSRV_EXPORT_C void RFs::Close() |
|
3898 |
{ |
|
3899 |
TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsClose, MODULEUID, Handle()); |
|
3900 |
RFTRACE_CLOSE; |
|
3901 |
||
3902 |
RSessionBase::Close(); |
|
3903 |
||
3904 |
TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsCloseReturn, MODULEUID); |
|
3905 |
} |
|
3906 |
||
3907 |