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