mirror of
https://github.com/reactos/reactos.git
synced 2025-07-04 16:31:21 +00:00
fixed two race conditions with motor power-off; now handles disk change detection and no-disk-in-drive correctly
svn path=/trunk/; revision=8679
This commit is contained in:
parent
2207df1ae4
commit
007814383b
1 changed files with 6 additions and 4 deletions
|
@ -115,14 +115,16 @@ VOID NTAPI StartMotor(PDRIVE_INFO DriveInfo)
|
||||||
|
|
||||||
KdPrint(("floppy: StartMotor called\n"));
|
KdPrint(("floppy: StartMotor called\n"));
|
||||||
|
|
||||||
if(DriveInfo->ControllerInfo->StopDpcQueued &&
|
if(DriveInfo->ControllerInfo->StopDpcQueued && !KeCancelTimer(&DriveInfo->ControllerInfo->MotorTimer))
|
||||||
!KeCancelTimer(&DriveInfo->ControllerInfo->MotorTimer))
|
|
||||||
{
|
{
|
||||||
/* Motor turner-offer is already running; wait for it to finish */
|
/* Motor turner-offer is already running; wait for it to finish */
|
||||||
|
KdPrint(("floppy: StartMotor: motor turner-offer is already running; waiting for it\n"));
|
||||||
KeWaitForSingleObject(&DriveInfo->ControllerInfo->MotorStoppedEvent, Executive, KernelMode, FALSE, NULL);
|
KeWaitForSingleObject(&DriveInfo->ControllerInfo->MotorStoppedEvent, Executive, KernelMode, FALSE, NULL);
|
||||||
DriveInfo->ControllerInfo->StopDpcQueued = FALSE;
|
KdPrint(("floppy: StartMotor: wait satisfied\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DriveInfo->ControllerInfo->StopDpcQueued = FALSE;
|
||||||
|
|
||||||
if(HwTurnOnMotor(DriveInfo) != STATUS_SUCCESS)
|
if(HwTurnOnMotor(DriveInfo) != STATUS_SUCCESS)
|
||||||
KdPrint(("floppy: StartMotor(): warning: HwTurnOnMotor failed\n"));
|
KdPrint(("floppy: StartMotor(): warning: HwTurnOnMotor failed\n"));
|
||||||
}
|
}
|
||||||
|
@ -768,7 +770,7 @@ static NTSTATUS NTAPI InitController(PCONTROLLER_INFO ControllerInfo)
|
||||||
/* Init the stop stuff */
|
/* Init the stop stuff */
|
||||||
KeInitializeDpc(&ControllerInfo->MotorStopDpc, MotorStopDpcFunc, ControllerInfo);
|
KeInitializeDpc(&ControllerInfo->MotorStopDpc, MotorStopDpcFunc, ControllerInfo);
|
||||||
KeInitializeTimer(&ControllerInfo->MotorTimer);
|
KeInitializeTimer(&ControllerInfo->MotorTimer);
|
||||||
KeInitializeEvent(&ControllerInfo->MotorStoppedEvent, SynchronizationEvent, FALSE);
|
KeInitializeEvent(&ControllerInfo->MotorStoppedEvent, NotificationEvent, FALSE);
|
||||||
ControllerInfo->StopDpcQueued = FALSE;
|
ControllerInfo->StopDpcQueued = FALSE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue