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