1179 // Dismount |
1179 // Dismount |
1180 TInt err = DoDismountFileSystem(GetFSys()->Name(), this, EFalse, ETrue); |
1180 TInt err = DoDismountFileSystem(GetFSys()->Name(), this, EFalse, ETrue); |
1181 if (err == CFsRequest::EReqActionBusy) |
1181 if (err == CFsRequest::EReqActionBusy) |
1182 return err; |
1182 return err; |
1183 |
1183 |
1184 DoCompleteDismountNotify(err); |
1184 // Complete, remove and delete notification requests |
|
1185 FsNotify::HandleDismount(EFsDismountNotifyClients, iDriveNumber, ETrue, err); |
|
1186 FsNotify::HandleDismount(EFsDismountForceDismount, iDriveNumber, ETrue, err); |
1185 |
1187 |
1186 SetDismountDeferred(EFalse); |
1188 SetDismountDeferred(EFalse); |
1187 |
1189 |
1188 return err; |
1190 return err; |
1189 } |
1191 } |
1356 // |
1358 // |
1357 // Cancel a pending dismount notifier - Request |
1359 // Cancel a pending dismount notifier - Request |
1358 // |
1360 // |
1359 { |
1361 { |
1360 CSessionFs* session = aRequest->Session(); |
1362 CSessionFs* session = aRequest->Session(); |
1361 TInt drive = FsNotify::CancelDismountNotifySession(session, (TRequestStatus*)aRequest->Message().Ptr0()); |
1363 FsNotify::CancelDismountNotifySession(session, (TRequestStatus*)aRequest->Message().Ptr0()); |
1362 if (drive >= 0) |
1364 |
1363 TheDrives[drive].SetDismountDeferred(EFalse); |
|
1364 return KErrNone; |
1365 return KErrNone; |
1365 } |
1366 } |
1366 |
1367 |
1367 TInt TFsNotifyDismountCancel::Initialise(CFsRequest* /*aRequest*/) |
1368 TInt TFsNotifyDismountCancel::Initialise(CFsRequest* /*aRequest*/) |
1368 // |
1369 // |
1383 |
1384 |
1384 // Verify that the client has registered for notification |
1385 // Verify that the client has registered for notification |
1385 if(!FsNotify::HandlePendingDismount(aRequest->Session(), driveNumber)) |
1386 if(!FsNotify::HandlePendingDismount(aRequest->Session(), driveNumber)) |
1386 return KErrNotFound; |
1387 return KErrNotFound; |
1387 |
1388 |
1388 if(theDrive->DismountLocked()) |
1389 return theDrive->DeferredDismountCheck(); |
1389 return KErrNone; |
|
1390 |
|
1391 TInt clampErr = theDrive->ClampsOnDrive(); |
|
1392 TInt err = KErrNone; |
|
1393 |
|
1394 if ((theDrive->DismountDeferred()) && (clampErr == 0 || clampErr == KErrNotSupported)) |
|
1395 { |
|
1396 // No clamps to worry about, so dismount immediately and complete the request |
|
1397 __ASSERT_DEBUG(aRequest->Drive()->GetFSys(), Fault(EAllowDismount)); |
|
1398 |
|
1399 // When the last client has responded, allow the media to be forcibly dismounted |
|
1400 err = theDrive->DeferredDismount(); |
|
1401 } |
|
1402 |
|
1403 return err; |
|
1404 } |
1390 } |
1405 |
1391 |
1406 TInt TFsAllowDismount::Initialise(CFsRequest* aRequest) |
1392 TInt TFsAllowDismount::Initialise(CFsRequest* aRequest) |
1407 // |
1393 // |
1408 // Notifies the file server that the client is finished with the drive |
1394 // Notifies the file server that the client is finished with the drive |
1409 // |
1395 // |
1410 { |
1396 { |
1411 return ValidateDrive(aRequest->Message().Int0(),aRequest); |
1397 return ValidateDrive(aRequest->Message().Int0(),aRequest); |
1412 } |
1398 } |
|
1399 |
|
1400 |
|
1401 TInt TFsDeferredDismount::Initialise(CFsRequest* /*aRequest*/) |
|
1402 { |
|
1403 return KErrNone; |
|
1404 } |
|
1405 |
|
1406 /* |
|
1407 Dismount the file system - this internal request is queued when one client issues a EFsDismountNotifyClients |
|
1408 request and another client with an outstanding EFsDismountRegisterClient closes their session (in the context |
|
1409 of the main file server thread) without sending a EFsAllowDismount request. |
|
1410 |
|
1411 */ |
|
1412 TInt TFsDeferredDismount::DoRequestL(CFsRequest* aRequest) |
|
1413 { |
|
1414 return TheDrives[aRequest->DriveNumber()].DeferredDismountCheck(); |
|
1415 } |
1413 |
1416 |
1414 |
1417 |
1415 TInt TFsMountProxyDrive::DoRequestL(CFsRequest* aRequest) |
1418 TInt TFsMountProxyDrive::DoRequestL(CFsRequest* aRequest) |
1416 { |
1419 { |
1417 return LocalDrives::MountProxyDrive(aRequest); |
1420 return LocalDrives::MountProxyDrive(aRequest); |