- Avoid magic values, remove a few casts and don't name an IO_STATUS_BLOCK Status. No code changes.

svn path=/trunk/; revision=63827
This commit is contained in:
Thomas Faber 2014-08-07 10:24:07 +00:00
parent beb99d9992
commit 9ae009c260
3 changed files with 24 additions and 23 deletions

View file

@ -68,7 +68,7 @@ NpCompleteStalledWrites(IN PNP_DATA_QUEUE DataQueue,
Irp = DataQueueEntry->Irp;
if ((DataQueueEntry->DataEntryType == 0) && (Irp))
if ((DataQueueEntry->DataEntryType == Buffered) && (Irp))
{
DataLeft = DataQueueEntry->DataSize - ByteOffset;
@ -127,12 +127,12 @@ NpRemoveDataQueueEntry(IN PNP_DATA_QUEUE DataQueue,
DataQueue->BytesInQueue -= QueueEntry->DataSize;
--DataQueue->EntriesInQueue;
HasWrites = 1;
HasWrites = TRUE;
if (DataQueue->QueueState != WriteEntries ||
DataQueue->QuotaUsed < DataQueue->Quota ||
!QueueEntry->QuotaInEntry)
{
HasWrites = 0;
HasWrites = FALSE;
}
DataQueue->QuotaUsed -= QueueEntry->QuotaInEntry;
@ -140,7 +140,7 @@ NpRemoveDataQueueEntry(IN PNP_DATA_QUEUE DataQueue,
if (IsListEmpty(&DataQueue->Queue))
{
DataQueue->QueueState = Empty;
HasWrites = 0;
HasWrites = FALSE;
}
Irp = QueueEntry->Irp;
@ -183,7 +183,9 @@ NpGetNextRealDataQueueEntry(IN PNP_DATA_QUEUE DataQueue,
NextEntry != &DataQueue->Queue;
NextEntry = DataQueue->Queue.Flink)
{
DataEntry = CONTAINING_RECORD(NextEntry, NP_DATA_QUEUE_ENTRY, QueueEntry);
DataEntry = CONTAINING_RECORD(NextEntry,
NP_DATA_QUEUE_ENTRY,
QueueEntry);
Type = DataEntry->DataEntryType;
if (Type == Buffered || Type == Unbuffered) break;
@ -223,29 +225,29 @@ NpCancelDataQueueIrp(IN PDEVICE_OBJECT DeviceObject,
NpAcquireExclusiveVcb();
}
DataEntry = (PNP_DATA_QUEUE_ENTRY)Irp->Tail.Overlay.DriverContext[3];
DataEntry = Irp->Tail.Overlay.DriverContext[3];
if (DataEntry)
{
if (DataEntry->QueueEntry.Blink == &DataQueue->Queue)
{
DataQueue->ByteOffset = 0;
FirstEntry = 1;
FirstEntry = TRUE;
}
else
{
FirstEntry = 0;
FirstEntry = FALSE;
}
RemoveEntryList(&DataEntry->QueueEntry);
ClientSecurityContext = DataEntry->ClientSecurityContext;
CompleteWrites = 1;
CompleteWrites = TRUE;
if (DataQueue->QueueState != WriteEntries ||
DataQueue->QuotaUsed < DataQueue->Quota ||
!DataEntry->QuotaInEntry)
{
CompleteWrites = 0;
CompleteWrites = FALSE;
}
DataQueue->BytesInQueue -= DataEntry->DataSize;

View file

@ -30,14 +30,14 @@ NpReadDataQueue(IN PNP_DATA_QUEUE DataQueue,
PVOID DataBuffer;
ULONG DataSize, DataLength, TotalBytesCopied, RemainingSize, Offset;
PIRP Irp;
IO_STATUS_BLOCK Status;
IO_STATUS_BLOCK IoStatus;
BOOLEAN CompleteWrites = FALSE;
PAGED_CODE();
if (ReadOverflowOperation) Peek = TRUE;
RemainingSize = BufferSize;
Status.Status = STATUS_SUCCESS;
IoStatus.Status = STATUS_SUCCESS;
TotalBytesCopied = 0;
if (Peek)
@ -110,7 +110,7 @@ NpReadDataQueue(IN PNP_DATA_QUEUE DataQueue,
{
if (Mode == FILE_PIPE_MESSAGE_MODE)
{
Status.Status = STATUS_BUFFER_OVERFLOW;
IoStatus.Status = STATUS_BUFFER_OVERFLOW;
break;
}
}
@ -137,7 +137,7 @@ NpReadDataQueue(IN PNP_DATA_QUEUE DataQueue,
if (Mode == FILE_PIPE_MESSAGE_MODE)
{
Status.Status = STATUS_SUCCESS;
IoStatus.Status = STATUS_SUCCESS;
break;
}
@ -159,9 +159,9 @@ NpReadDataQueue(IN PNP_DATA_QUEUE DataQueue,
}
}
Status.Information = TotalBytesCopied;
IoStatus.Information = TotalBytesCopied;
if (CompleteWrites) NpCompleteStalledWrites(DataQueue, List);
return Status;
return IoStatus;
}
/* EOF */

View file

@ -243,7 +243,7 @@ NpAddWaiter(IN PNP_WAIT_QUEUE WaitQueue,
WaitEntry->WaitQueue = WaitQueue;
WaitEntry->Irp = Irp;
WaitBuffer = (PFILE_PIPE_WAIT_FOR_BUFFER)Irp->AssociatedIrp.SystemBuffer;
WaitBuffer = Irp->AssociatedIrp.SystemBuffer;
if (WaitBuffer->TimeoutSpecified)
{
DueTime = WaitBuffer->Timeout;
@ -281,7 +281,6 @@ NpAddWaiter(IN PNP_WAIT_QUEUE WaitQueue,
KeSetTimer(&WaitEntry->Timer, DueTime, &WaitEntry->Dpc);
WaitEntry = NULL;
}
KeReleaseSpinLock(&WaitQueue->WaitLock, OldIrql);