mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-29 19:26:33 +00:00
[MSFS]
- Remove an useless (and unsafe!) counter - Use the message counter in a thread-safe way in RW operations svn path=/trunk/; revision=69482
This commit is contained in:
@@ -181,7 +181,6 @@ MsfsCreateMailslot(PDEVICE_OBJECT DeviceObject,
|
||||
InitializeListHead(&Fcb->MessageListHead);
|
||||
KeInitializeSpinLock(&Fcb->MessageListLock);
|
||||
|
||||
Fcb->WaitCount = 0;
|
||||
KeInitializeSpinLock(&Fcb->QueueLock);
|
||||
InitializeListHead(&Fcb->PendingIrpQueue);
|
||||
IoCsqInitialize(&Fcb->CancelSafeQueue,
|
||||
|
||||
@@ -38,7 +38,6 @@ typedef struct _MSFS_FCB
|
||||
IO_CSQ CancelSafeQueue;
|
||||
KSPIN_LOCK QueueLock;
|
||||
LIST_ENTRY PendingIrpQueue;
|
||||
ULONG WaitCount;
|
||||
} MSFS_FCB, *PMSFS_FCB;
|
||||
|
||||
|
||||
|
||||
@@ -62,10 +62,11 @@ MsfsRead(PDEVICE_OBJECT DeviceObject,
|
||||
Buffer = Irp->UserBuffer;
|
||||
|
||||
|
||||
KeAcquireSpinLock(&Fcb->MessageListLock, &oldIrql);
|
||||
if (Fcb->MessageCount > 0)
|
||||
{
|
||||
KeAcquireSpinLock(&Fcb->MessageListLock, &oldIrql);
|
||||
Entry = RemoveHeadList(&Fcb->MessageListHead);
|
||||
Fcb->MessageCount--;
|
||||
KeReleaseSpinLock(&Fcb->MessageListLock, oldIrql);
|
||||
|
||||
/* copy current message into buffer */
|
||||
@@ -74,7 +75,6 @@ MsfsRead(PDEVICE_OBJECT DeviceObject,
|
||||
LengthRead = Message->Size;
|
||||
|
||||
ExFreePoolWithTag(Message, 'rFsM');
|
||||
Fcb->MessageCount--;
|
||||
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Information = LengthRead;
|
||||
@@ -82,6 +82,10 @@ MsfsRead(PDEVICE_OBJECT DeviceObject,
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
KeReleaseSpinLock(&Fcb->MessageListLock, oldIrql);
|
||||
}
|
||||
|
||||
Timeout = Fcb->TimeOut;
|
||||
if (Timeout.HighPart == 0 && Timeout.LowPart == 0)
|
||||
@@ -116,7 +120,6 @@ MsfsRead(PDEVICE_OBJECT DeviceObject,
|
||||
KeSetTimer(Timer, Timeout, Dpc);
|
||||
}
|
||||
|
||||
Fcb->WaitCount++;
|
||||
IoMarkIrpPending(Irp);
|
||||
|
||||
return STATUS_PENDING;
|
||||
@@ -184,16 +187,14 @@ MsfsWrite(PDEVICE_OBJECT DeviceObject,
|
||||
|
||||
KeAcquireSpinLock(&Fcb->MessageListLock, &oldIrql);
|
||||
InsertTailList(&Fcb->MessageListHead, &Message->MessageListEntry);
|
||||
Fcb->MessageCount++;
|
||||
KeReleaseSpinLock(&Fcb->MessageListLock, oldIrql);
|
||||
|
||||
Fcb->MessageCount++;
|
||||
|
||||
if (Fcb->WaitCount > 0)
|
||||
CsqIrp = IoCsqRemoveNextIrp(&Fcb->CancelSafeQueue, NULL);
|
||||
if (CsqIrp != NULL)
|
||||
{
|
||||
CsqIrp = IoCsqRemoveNextIrp(&Fcb->CancelSafeQueue, NULL);
|
||||
/* FIXME: It is necessary to reset the timers. */
|
||||
MsfsRead(DeviceObject, CsqIrp);
|
||||
Fcb->WaitCount--;
|
||||
}
|
||||
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
|
||||
Reference in New Issue
Block a user