equal
deleted
inserted
replaced
318 return KErrInUse; // there are no free proxy drives left |
318 return KErrInUse; // there are no free proxy drives left |
319 |
319 |
320 // Create the actual proxy drive... |
320 // Create the actual proxy drive... |
321 CProxyDrive* pD = NULL; |
321 CProxyDrive* pD = NULL; |
322 TInt r = pF->CreateProxyDrive(pD, NULL); |
322 TInt r = pF->CreateProxyDrive(pD, NULL); |
323 __ASSERT_ALWAYS(r == KErrNone, User::Panic(_L("CreateProxyDrive Error"), r)); |
323 if (r != KErrNone) |
324 __ASSERT_ALWAYS(pD != NULL, User::Panic(_L("CreateProxyDrive returned NULL"), -999)); |
324 { |
|
325 delete pD; |
|
326 return r; |
|
327 } |
|
328 if (pD == NULL) |
|
329 return KErrNoMemory; |
|
330 |
|
331 // Create the proxy drive body... which is used to store the library handle |
|
332 CProxyDriveBody* pBody = new CProxyDriveBody(); |
|
333 if (pBody == NULL) |
|
334 { |
|
335 delete pD; |
|
336 return KErrNoMemory; |
|
337 } |
|
338 pD->iBody = pBody; |
|
339 |
|
340 // Re-open the library so that it is safe to call RFs::RemoveProxyDrive() before the proxy drive has been deleted - |
|
341 // which can happen if the file system is dismounted with open file handles |
|
342 r = pD->SetAndOpenLibrary(pF->Library()); |
|
343 if (r != KErrNone) |
|
344 { |
|
345 delete pD; |
|
346 return r; |
|
347 } |
325 |
348 |
326 iMapping[drive] = i+KMaxLocalDrives; |
349 iMapping[drive] = i+KMaxLocalDrives; |
327 |
350 |
328 aRequest->SetDrive(&TheDrives[drive]); |
351 aRequest->SetDrive(&TheDrives[drive]); |
329 aRequest->SetScratchValue((TUint)pD); |
352 aRequest->SetScratchValue((TUint)pD); |
384 void LocalDrives::ClearProxyDriveMapping(TInt aDrive) |
407 void LocalDrives::ClearProxyDriveMapping(TInt aDrive) |
385 { |
408 { |
386 __ASSERT_ALWAYS(aDrive>=0 && aDrive<KMaxDrives,Fault(EClearProxyDriveMapping1)); |
409 __ASSERT_ALWAYS(aDrive>=0 && aDrive<KMaxDrives,Fault(EClearProxyDriveMapping1)); |
387 __ASSERT_DEBUG(iMapping[aDrive]>= KMaxLocalDrives && iProxyDriveMapping[iMapping[aDrive]-KMaxLocalDrives],Fault(EClearProxyDriveMapping2)); |
410 __ASSERT_DEBUG(iMapping[aDrive]>= KMaxLocalDrives && iProxyDriveMapping[iMapping[aDrive]-KMaxLocalDrives],Fault(EClearProxyDriveMapping2)); |
388 TInt idx = iMapping[aDrive]-KMaxLocalDrives; |
411 TInt idx = iMapping[aDrive]-KMaxLocalDrives; |
389 delete iProxyDriveMapping[idx]; |
412 if (iProxyDriveMapping[idx]->Mount() == NULL) // don't delete if it's still owned by its mount |
|
413 { |
|
414 RLibrary lib = iProxyDriveMapping[idx]->GetLibrary(); |
|
415 delete iProxyDriveMapping[idx]; |
|
416 lib.Close(); |
|
417 } |
390 iProxyDriveMapping[idx] = NULL; |
418 iProxyDriveMapping[idx] = NULL; |
391 iMapping[aDrive] = KDriveInvalid; |
419 iMapping[aDrive] = KDriveInvalid; |
392 } |
420 } |
393 |
421 |
394 TInt LocalDrives::SetupMediaChange(TInt aDrive) |
422 TInt LocalDrives::SetupMediaChange(TInt aDrive) |