author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 31 Aug 2010 16:34:26 +0300 | |
branch | RCL_3 |
changeset 43 | c1f20ce4abcf |
parent 2 | 4122176ea935 |
permissions | -rw-r--r-- |
0 | 1 |
// Copyright (c) 1996-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\sfat\sl_drv.cpp |
|
15 |
// |
|
16 |
// |
|
17 |
||
2
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
18 |
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
19 |
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
20 |
//!! |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
21 |
//!! WARNING!! DO NOT edit this file !! '\sfat' component is obsolete and is not being used. '\sfat32'replaces it |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
22 |
//!! |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
23 |
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
24 |
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
25 |
|
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
26 |
|
0 | 27 |
#include "sl_std.h" |
28 |
#include "sl_cache.h" |
|
29 |
||
30 |
const TInt KMaxRecoverableRetries=10; |
|
31 |
const TInt KMaxCriticalRetries=10; |
|
32 |
||
33 |
||
34 |
//--------------------------------------------------------------------------------------------------------------------------------------- |
|
35 |
||
36 |
||
37 |
TFatDriveInterface::TFatDriveInterface() |
|
38 |
:iMount(NULL) |
|
39 |
{ |
|
40 |
} |
|
41 |
||
42 |
/** |
|
43 |
Initialise the interface object. |
|
44 |
@param aMount the CFatMountCB that owns this object |
|
45 |
*/ |
|
46 |
TBool TFatDriveInterface::Init(CFatMountCB* aMount) |
|
47 |
{ |
|
48 |
ASSERT(aMount); |
|
49 |
iMount = aMount; |
|
2
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
50 |
aMount->LocalDrive()->SetMount(aMount); |
0 | 51 |
return iProxyDrive.Init(aMount->LocalDrive()); |
52 |
} |
|
53 |
||
54 |
/** |
|
55 |
pseudo-destructor. |
|
56 |
*/ |
|
57 |
void TFatDriveInterface::Close() |
|
58 |
{ |
|
2
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
59 |
if(iMount) |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
60 |
iMount->LocalDrive()->SetMount(NULL); |
0 | 61 |
iMount = NULL; |
62 |
} |
|
63 |
||
64 |
//--------------------------------------------------------------------------------------------------------------------------------------- |
|
65 |
||
66 |
/** |
|
67 |
Read data from the media via CProxyDrive interface. |
|
68 |
This is non-critical read: on error Non-critical notifier is involved |
|
69 |
||
70 |
@param aPos absolute media position |
|
71 |
@param aLength how many bytes to read |
|
72 |
@param aTrg data descriptor |
|
73 |
||
74 |
@return KErrNone - success |
|
75 |
@return KErrNotReady - non-critical error |
|
76 |
@return KErrCorrupt - an illegal write is detected |
|
77 |
@return KErrBadPower - failure due to low power |
|
78 |
||
79 |
*/ |
|
80 |
TInt TFatDriveInterface::ReadNonCritical(TInt64 aPos, TInt aLength, TDes8& aTrg) const |
|
81 |
{ |
|
82 |
TInt nRes = KErrNone; |
|
83 |
TInt cntRetry = KMaxRecoverableRetries; |
|
84 |
||
85 |
//__PRINT2(_L("#=+++ Read_nc1: pos:%LU, len:%u"), aPos, aLength); |
|
86 |
||
87 |
for(;;) |
|
88 |
{ |
|
89 |
nRes = iProxyDrive.Read(aPos,aLength,aTrg); |
|
90 |
if (nRes==KErrNone) |
|
91 |
break; |
|
92 |
||
93 |
__PRINT4(_L("TFatDriveInterface::ReadNonCritical() failure! drv:%d Posl=%LU len=%d retval=%d"), iMount->DriveNumber(), aPos, aLength, nRes); |
|
94 |
||
95 |
if(--cntRetry <= 0) |
|
96 |
{ |
|
97 |
nRes = KErrCorrupt; |
|
98 |
break; |
|
99 |
} |
|
100 |
||
101 |
nRes = HandleRecoverableError(nRes); |
|
102 |
if (nRes !=ERetry) |
|
103 |
break; |
|
104 |
} |
|
105 |
||
106 |
return nRes; |
|
107 |
} |
|
108 |
||
109 |
//--------------------------------------------------------------------------------------------------------------------------------------- |
|
110 |
||
111 |
/** |
|
112 |
Read data from the media via CProxyDrive interface. |
|
113 |
This is non-critical read: on error Non-critical notifier is involved |
|
114 |
||
115 |
@param aPos absolute media position |
|
116 |
@param aLength how many bytes to read |
|
117 |
@param aTrg data descriptor |
|
118 |
@param aMessage |
|
119 |
@param anOffset |
|
120 |
||
121 |
@return KErrNone - success |
|
122 |
@return KErrNotReady - non-critical error |
|
123 |
@return KErrCorrupt - an illegal write is detected |
|
124 |
@return KErrBadPower - failure due to low power |
|
125 |
||
126 |
*/ |
|
127 |
TInt TFatDriveInterface::ReadNonCritical(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset) const |
|
128 |
{ |
|
129 |
//__PRINT2(_L("#=+++ Read_nc2: pos:%LU, len:%u"), aPos, aLength); |
|
130 |
||
131 |
TInt nRes = KErrNone; |
|
132 |
TInt cntRetry = KMaxRecoverableRetries; |
|
133 |
||
134 |
for(;;) |
|
135 |
{ |
|
136 |
nRes = iProxyDrive.Read(aPos, aLength, aTrg, aMessage, anOffset); |
|
137 |
if (nRes==KErrNone) |
|
138 |
break; |
|
139 |
||
140 |
__PRINT4(_L("TFatDriveInterface::ReadNonCritical() Failure! drv:%d aPosl=%d len=%d anOffset=%d"), iMount->DriveNumber(), aPos,aLength, anOffset); |
|
141 |
||
142 |
if(--cntRetry <= 0) |
|
143 |
{ |
|
144 |
nRes = KErrCorrupt; |
|
145 |
break; |
|
146 |
} |
|
147 |
||
148 |
nRes = HandleRecoverableError(nRes); |
|
149 |
if (nRes !=ERetry) |
|
150 |
break; |
|
151 |
} |
|
152 |
||
153 |
return nRes; |
|
154 |
} |
|
155 |
||
156 |
//--------------------------------------------------------------------------------------------------------------------------------------- |
|
157 |
||
158 |
/** |
|
159 |
Read data from the media via CProxyDrive interface with a critical notifier. |
|
160 |
This method shall be used to read critical filesystem data, such as directory entries, FAT data. |
|
161 |
||
162 |
@param aPos absolute media position |
|
163 |
@param aLength how many bytes to read |
|
164 |
@param aTrg data descriptor |
|
165 |
||
166 |
@return KErrNone - success |
|
167 |
@return KErrNotReady - non-critical error |
|
168 |
@return KErrCorrupt - an illegal write is detected |
|
169 |
@return KErrAbort - user aborted read |
|
170 |
*/ |
|
171 |
TInt TFatDriveInterface::ReadCritical(TInt64 aPos,TInt aLength,TDes8& aTrg) const |
|
172 |
{ |
|
173 |
//__PRINT2(_L("#=+++ Read_C: pos:%LU, len:%u"), aPos, aLength); |
|
174 |
||
175 |
TInt nRes = KErrNone; |
|
176 |
||
177 |
for(;;) |
|
178 |
{ |
|
179 |
nRes = iProxyDrive.Read(aPos, aLength, aTrg); |
|
2
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
180 |
if(nRes == KErrNone) |
0 | 181 |
break; |
182 |
||
2
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
183 |
__PRINT4(_L("TFatDriveInterface::ReadCritical() Error! drv:%d Posl=%LU len=%d retval=%d"), iMount->DriveNumber(), aPos, aLength, nRes); |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
184 |
|
0 | 185 |
nRes=HandleCriticalError(nRes); |
2
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
186 |
if (nRes != ERetry) |
0 | 187 |
break; |
188 |
} |
|
189 |
||
190 |
return nRes; |
|
191 |
} |
|
192 |
||
193 |
//--------------------------------------------------------------------------------------------------------------------------------------- |
|
194 |
||
195 |
/** |
|
196 |
Write data to the media via CProxyDrive interface. |
|
197 |
||
198 |
@param aPos absolute media position |
|
199 |
@param aLength how many bytes to write |
|
200 |
@param aSrc pointer to the data |
|
201 |
@param aMessage |
|
202 |
@param anOffset |
|
203 |
||
204 |
@return KErrNone - success |
|
205 |
@return KErrNotReady - non-critical error |
|
206 |
@return KErrBadPower - write not attempted due to low batteries |
|
207 |
@return KErrCorrupt - an illegal write is detected |
|
208 |
@return KErrAccessDenied - write to protected media |
|
209 |
*/ |
|
210 |
TInt TFatDriveInterface::WriteNonCritical(TInt64 aPos, TInt aLength, const TAny* aSrc, const RMessagePtr2 &aMessage, TInt anOffset) |
|
211 |
{ |
|
212 |
//__PRINT2(_L("#=+++ Write_NC: pos:%LU, len:%u"), aPos, aLength); |
|
213 |
||
214 |
||
215 |
TInt nRes = KErrNone; |
|
216 |
TInt cntRetry = KMaxRecoverableRetries; |
|
217 |
||
218 |
for(;;) |
|
219 |
{ |
|
220 |
iMount->OpenMountForWrite(); //-- make a callback to CFatMountCB to perform some actions on 1st write. |
|
221 |
nRes = iProxyDrive.Write(aPos, aLength, aSrc, aMessage, anOffset); |
|
222 |
if (nRes==KErrNone) |
|
223 |
break; |
|
224 |
||
225 |
__PRINT4(_L("TFatDriveInterface::WriteNonCritical() failure! drv:%d, Pos=%LU len=%d anOffset=%d"), iMount->DriveNumber(), aPos, aLength, anOffset); |
|
226 |
||
227 |
if(--cntRetry <= 0) |
|
228 |
{ |
|
229 |
nRes = KErrCorrupt; |
|
230 |
break; |
|
231 |
} |
|
232 |
||
233 |
nRes = HandleRecoverableError(nRes); |
|
234 |
if (nRes !=ERetry) |
|
235 |
break; |
|
236 |
} |
|
237 |
||
238 |
||
239 |
return nRes; |
|
240 |
} |
|
241 |
||
242 |
//--------------------------------------------------------------------------------------------------------------------------------------- |
|
243 |
||
244 |
/** |
|
245 |
Write data to the media via CProxyDrive interface. On error this method can invoke a critical notifier. |
|
246 |
This method is intended to be called for the filesstem critical data, i.e. FAT metadata, such as directory entries, |
|
247 |
FAT table etc. |
|
248 |
||
249 |
@param aPos absolute media position |
|
250 |
@param aSrc descriptor with the source data |
|
251 |
||
252 |
@return KErrNone - success |
|
253 |
@return KErrNotReady - non-critical error |
|
254 |
@return KErrBadPower - write not attempted due to low batteries |
|
255 |
@return KErrCorrupt - an illegal write is detected |
|
256 |
@return KErrAccessDenied - write to protected media |
|
257 |
*/ |
|
258 |
TInt TFatDriveInterface::WriteCritical(TInt64 aPos, const TDesC8& aSrc) |
|
259 |
{ |
|
260 |
//__PRINT2(_L("#=+++ Write_C: pos:%LU, len:%u"), aPos, aSrc.Length()); |
|
261 |
||
262 |
TInt nRes = KErrNone; |
|
263 |
||
264 |
#ifdef _DEBUG |
|
265 |
||
266 |
TBool simulatedWriteFailure = EFalse; //-- if true it means that the write failure has been simulated |
|
267 |
||
268 |
//-- debug interface to simulate write failure |
|
2
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
269 |
if(iMount->IsWriteFail()) |
0 | 270 |
{ |
2
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
271 |
if(iMount->WriteFailCount() != 0) |
0 | 272 |
{ |
273 |
iMount->DecWriteFailCount(); |
|
274 |
} |
|
275 |
else |
|
2
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
276 |
{//-- simulate write failure |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
277 |
if(iMount->WriteFailError()==-99) |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
278 |
UserSvr::ResetMachine(EStartupWarmReset); |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
279 |
else |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
280 |
{ |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
281 |
//-- invalidate caches, because actual write to the drive isn't going to happen |
0 | 282 |
if(iMount->RawDisk().DirCacheInterface()) |
283 |
iMount->RawDisk().DirCacheInterface()->InvalidateCache(); |
|
284 |
||
285 |
iMount->SetWriteFail(EFalse); |
|
2
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
286 |
|
0 | 287 |
TRAP_IGNORE(iMount->RawDisk().InvalidateUidCache()); //-- invalidate whole UID data cache |
288 |
TRAP_IGNORE(iMount->FAT().InvalidateCacheL()); //-- invalidate whole FAT cache |
|
289 |
||
290 |
iMount->InvalidateLeafDirCache(); |
|
291 |
||
292 |
nRes = iMount->WriteFailError(); |
|
293 |
simulatedWriteFailure = ETrue; //-- won't perform actual write later |
|
294 |
__PRINT4(_L("TFatDriveInterface::WriteCritical() Simulating write failure. drv:%d, aPos=%LU len=%d Code=%d"), iMount->DriveNumber(), aPos,aSrc.Length(),nRes); |
|
295 |
||
2
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
296 |
} |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
297 |
} |
0 | 298 |
}//if(iMount->IsWriteFail()) |
299 |
||
300 |
if(!simulatedWriteFailure) |
|
301 |
#endif // _DEBUG |
|
302 |
{ |
|
303 |
//-- try to write data until success or user gives up |
|
2
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
304 |
for(;;) |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
305 |
{ |
0 | 306 |
for(TInt i=0; i<KMaxCriticalRetries; i++) |
307 |
{ |
|
308 |
iMount->OpenMountForWrite(); //-- make a callback to CFatMountCB to perform some actions on 1st write. |
|
309 |
nRes=iProxyDrive.Write(aPos,aSrc); |
|
2
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
310 |
if (nRes==KErrNone) |
0 | 311 |
return nRes; |
2
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
312 |
} |
0 | 313 |
|
314 |
//-- write error occured |
|
315 |
__PRINT4(_L("TFatDriveInterface::WriteCritical() failure! drv:%d, aPos=%LU len=%d retval=%d"), iMount->DriveNumber(), aPos,aSrc.Length(),nRes); |
|
316 |
||
317 |
nRes=HandleCriticalError(nRes); |
|
318 |
if (nRes!=ERetry) |
|
319 |
break; |
|
320 |
||
2
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
321 |
}//for(;;) |
0 | 322 |
|
323 |
}// if(!simulatedWriteFailure) |
|
324 |
||
325 |
return nRes; |
|
326 |
} |
|
327 |
||
328 |
||
329 |
/** |
|
330 |
Get Last Error Info from the proxy drive |
|
331 |
||
332 |
@param aErrorInfo data descriptor for the error info. |
|
333 |
@return KErrNone - success, interrogate aErrorInfo for further info |
|
334 |
@return KErrNotSupported - media driver does not support |
|
335 |
*/ |
|
336 |
TInt TFatDriveInterface::GetLastErrorInfo(TDes8& aErrorInfo) const |
|
337 |
{ |
|
338 |
return iProxyDrive.GetLastErrorInfo(aErrorInfo); |
|
339 |
} |
|
340 |
||
341 |
||
342 |
//--------------------------------------------------------------------------------------------------------------------------------------- |
|
343 |
||
344 |
/** |
|
345 |
Handle critical error |
|
346 |
||
347 |
@param aResult result from the media driver (error code) |
|
348 |
||
349 |
@return ERetry - Attempt operation again |
|
350 |
@return KErrAbort - User aborted notifier |
|
351 |
@return KErrAccessDenied - media is read only |
|
352 |
@return KErrCorrupt - cf-card is corrupt |
|
353 |
*/ |
|
354 |
TInt TFatDriveInterface::HandleCriticalError(TInt aResult) const |
|
2
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
355 |
{ |
0 | 356 |
__PRINT2(_L("TFatDriveInterface::HandleCriticalError drv:%d, code:%d"), iMount->DriveNumber(),aResult); |
357 |
||
2
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
358 |
TLocaleMessage line1; |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
359 |
TLocaleMessage line2; |
0 | 360 |
|
2
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
361 |
TInt r=KErrAbort; |
0 | 362 |
|
2
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
363 |
if (aResult==KErrLocked) |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
364 |
{ |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
365 |
r=KErrLocked; |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
366 |
goto End; |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
367 |
} |
0 | 368 |
|
2
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
369 |
if (aResult==KErrAccessDenied) |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
370 |
{ |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
371 |
r=KErrAccessDenied; |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
372 |
goto End; |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
373 |
} |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
374 |
|
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
375 |
if (aResult==KErrArgument || aResult==KErrBadDescriptor) |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
376 |
{ |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
377 |
r=KErrCorrupt; |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
378 |
goto End; |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
379 |
} |
0 | 380 |
|
2
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
381 |
if (iMount->Drive().IsChanged()) |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
382 |
{//-- check if the media we accessing is the same as it used to be |
0 | 383 |
if(iMount->CheckVolumeTheSame()) |
2
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
384 |
{//-- the media is the same |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
385 |
if(!IsDriveWriteProtected()) |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
386 |
{ |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
387 |
iMount->Drive().SetChanged(EFalse); |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
388 |
r=ERetry; |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
389 |
goto End; |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
390 |
} |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
391 |
} |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
392 |
} |
0 | 393 |
|
2
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
394 |
if (aResult==KErrAbort && !iMount->Drive().IsChanged()) |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
395 |
{ |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
396 |
r=ERetry; |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
397 |
goto End; |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
398 |
} |
0 | 399 |
|
2
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
400 |
if (aResult==KErrBadPower) |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
401 |
{ |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
402 |
line1=EFileServer_LowPowerLine1; |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
403 |
line2=EFileServer_LowPowerLine2; |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
404 |
} |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
405 |
else if (iMount->Drive().IsChanged()) |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
406 |
{ |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
407 |
line1=EFileServer_PutTheCardBackLine1; |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
408 |
line2=EFileServer_PutTheCardBackLine2; |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
409 |
} |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
410 |
else |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
411 |
{ |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
412 |
line1=EFileServer_DiskErrorLine1; |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
413 |
line2=EFileServer_DiskErrorLine2; |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
414 |
} |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
415 |
|
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
416 |
if (NotifyUser()) |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
417 |
{ |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
418 |
FOREVER |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
419 |
{ |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
420 |
TInt buttonVal; |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
421 |
TInt ret=iMount->Notifier()->Notify(TLocaleMessageText(line1), |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
422 |
TLocaleMessageText(line2), |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
423 |
TLocaleMessageText(EFileServer_Button1), |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
424 |
TLocaleMessageText(EFileServer_Button2), |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
425 |
buttonVal); |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
426 |
if (ret!=KErrNone) |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
427 |
break; |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
428 |
if (buttonVal!=1) |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
429 |
break; // Abort |
0 | 430 |
|
2
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
431 |
if (iMount->Drive().IsChanged()) |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
432 |
{ |
0 | 433 |
// |
434 |
// Without this code, retry will indiscriminately write over whatever disk happens to be present. |
|
435 |
// However if the write error is to the bootsector remounting will always fail because the boot |
|
436 |
// sector will have changed and hence the disk is useless. |
|
437 |
// |
|
438 |
if(!iMount->CheckVolumeTheSame()) |
|
439 |
continue; //-- the media isn't the same as originally mounted; continue asking |
|
440 |
||
441 |
if(IsDriveWriteProtected()) |
|
442 |
continue; //-- still can not write to the drive |
|
443 |
||
444 |
||
2
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
445 |
iMount->Drive().SetChanged(EFalse); |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
446 |
} |
0 | 447 |
|
2
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
448 |
r=ERetry; // Retry |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
449 |
break; |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
450 |
} |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
451 |
} |
0 | 452 |
End: |
2
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
453 |
return(r); |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
454 |
} |
0 | 455 |
|
456 |
//--------------------------------------------------------------------------------------------------------------------------------------- |
|
457 |
||
458 |
/** |
|
459 |
Handle recoverable error |
|
460 |
||
461 |
@param aResult result from the media driver (error code) |
|
462 |
||
463 |
@return ERetry - retry write |
|
464 |
@return KErrCorrupt - media is corrupt |
|
465 |
@return KErrBadPower - low power failure |
|
466 |
@return KErrNotReady - non-critical error |
|
467 |
*/ |
|
468 |
TInt TFatDriveInterface::HandleRecoverableError(TInt aResult) const |
|
2
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
469 |
{ |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
470 |
__PRINT2(_L("TFatDriveInterface::HandleRecoverableError drv:%d, code:%d"), iMount->DriveNumber(),aResult); |
0 | 471 |
|
2
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
472 |
if (aResult==KErrAccessDenied) |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
473 |
return(KErrAccessDenied); |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
474 |
if (aResult == KErrLocked) |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
475 |
return KErrLocked; |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
476 |
if (aResult==KErrArgument || aResult==KErrBadDescriptor) |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
477 |
return(KErrCorrupt); |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
478 |
if (aResult==KErrBadPower) |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
479 |
return(KErrBadPower); |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
480 |
if (aResult==KErrDied) // client thread died |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
481 |
return(KErrDied); |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
482 |
if (iMount->Drive().IsChanged()) |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
483 |
{ |
0 | 484 |
|
485 |
if(! iMount->CheckVolumeTheSame()) |
|
486 |
{//-- the media is different now. |
|
487 |
return KErrNotReady; |
|
2
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
488 |
} |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
489 |
else if(!IsRecoverableRemount()) |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
490 |
{ |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
491 |
return KErrAccessDenied; |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
492 |
} |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
493 |
} |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
494 |
return(ERetry); |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
495 |
} |
0 | 496 |
|
497 |
/** @return true if the mount can be remounted for a recoverable error */ |
|
498 |
TBool TFatDriveInterface::IsRecoverableRemount() const |
|
2
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
499 |
{ |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
500 |
if(IsDriveWriteProtected()&&(iMount->Drive().IsWriteableResource()||iMount->Drive().IsCurrentWriteFunction())) |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
501 |
return(EFalse); |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
502 |
return(ETrue); |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
503 |
} |
0 | 504 |
|
505 |
/** return true if the media is write protected */ |
|
506 |
TBool TFatDriveInterface::IsDriveWriteProtected() const |
|
2
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
507 |
{ |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
508 |
TLocalDriveCapsV2Buf localDriveCaps; |
0 | 509 |
TInt r=iProxyDrive.Caps(localDriveCaps); |
510 |
||
2
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
511 |
if(r!=KErrNone) |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
512 |
return(EFalse); |
0 | 513 |
|
2
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
514 |
return((localDriveCaps().iMediaAtt&KMediaAttWriteProtected)!=0); |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
515 |
} |
0 | 516 |
|
517 |
||
518 |
||
519 |
//--------------------------------------------------------------------------------------------------------------------------------------- |
|
520 |
||
521 |
TFatDriveInterface::XProxyDriveWrapper::XProxyDriveWrapper() |
|
522 |
:iLocalDrive(0) |
|
523 |
{ |
|
524 |
TInt nRes = iLock.CreateLocal(); |
|
525 |
ASSERT(nRes == KErrNone); |
|
526 |
(void)nRes; |
|
527 |
} |
|
528 |
||
529 |
||
530 |
TFatDriveInterface::XProxyDriveWrapper::~XProxyDriveWrapper() |
|
531 |
{ |
|
532 |
iLock.Close(); |
|
533 |
} |
|
534 |
||
535 |
/** |
|
536 |
Initialise interface wrapper. |
|
537 |
@param aProxyDrive pointer to the raw drive access interface |
|
538 |
@return true on success |
|
539 |
*/ |
|
540 |
TBool TFatDriveInterface::XProxyDriveWrapper::Init(CProxyDrive* aProxyDrive) |
|
541 |
{ |
|
542 |
ASSERT(aProxyDrive); |
|
543 |
if(!iLock.Handle()) //-- the mutex must have been created by constructor |
|
544 |
return EFalse; |
|
545 |
||
546 |
iLocalDrive = aProxyDrive; |
|
547 |
return ETrue; |
|
548 |
} |
|
549 |
||
550 |
//-- see original TFatDriveInterface methods |
|
551 |
||
552 |
TInt TFatDriveInterface::XProxyDriveWrapper::Read(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset) const |
|
553 |
{ |
|
554 |
EnterCriticalSection(); |
|
555 |
TInt nRes = iLocalDrive->Read(aPos, aLength, aTrg, aMessage.Handle(), anOffset); |
|
556 |
LeaveCriticalSection(); |
|
557 |
return nRes; |
|
558 |
} |
|
559 |
||
560 |
TInt TFatDriveInterface::XProxyDriveWrapper::Read(TInt64 aPos,TInt aLength,TDes8& aTrg) const |
|
561 |
{ |
|
562 |
EnterCriticalSection(); |
|
563 |
TInt nRes = iLocalDrive->Read(aPos, aLength, aTrg); |
|
564 |
LeaveCriticalSection(); |
|
565 |
return nRes; |
|
566 |
} |
|
567 |
||
568 |
TInt TFatDriveInterface::XProxyDriveWrapper::Write(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset) |
|
569 |
{ |
|
570 |
EnterCriticalSection(); |
|
571 |
TInt nRes = iLocalDrive->Write(aPos, aLength, aSrc, aMessage.Handle(), anOffset); |
|
572 |
LeaveCriticalSection(); |
|
573 |
return nRes; |
|
574 |
} |
|
575 |
||
576 |
TInt TFatDriveInterface::XProxyDriveWrapper::Write(TInt64 aPos, const TDesC8& aSrc) |
|
577 |
{ |
|
578 |
EnterCriticalSection(); |
|
579 |
TInt nRes = iLocalDrive->Write(aPos, aSrc); |
|
580 |
LeaveCriticalSection(); |
|
581 |
return nRes; |
|
582 |
} |
|
583 |
||
584 |
TInt TFatDriveInterface::XProxyDriveWrapper::GetLastErrorInfo(TDes8& aErrorInfo) const |
|
585 |
{ |
|
586 |
EnterCriticalSection(); |
|
587 |
TInt nRes = iLocalDrive->GetLastErrorInfo(aErrorInfo); |
|
588 |
LeaveCriticalSection(); |
|
589 |
return nRes; |
|
590 |
} |
|
591 |
||
592 |
TInt TFatDriveInterface::XProxyDriveWrapper::Caps(TDes8& anInfo) const |
|
593 |
{ |
|
594 |
EnterCriticalSection(); |
|
595 |
TInt nRes = iLocalDrive->Caps(anInfo); |
|
596 |
LeaveCriticalSection(); |
|
597 |
return nRes; |
|
598 |
} |
|
599 |
||
600 |
||
601 |
||
602 |
||
603 |
||
604 |
||
605 |
||
606 |
||
607 |
||
608 |
||
609 |
||
610 |