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

View file

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

View file

@ -17,7 +17,7 @@
VOID VOID
NTAPI NTAPI
NpCancelWaitQueueIrp(IN PDEVICE_OBJECT DeviceObject, NpCancelWaitQueueIrp(IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp) IN PIRP Irp)
{ {
KIRQL OldIrql; KIRQL OldIrql;
@ -53,7 +53,7 @@ NpCancelWaitQueueIrp(IN PDEVICE_OBJECT DeviceObject,
Irp->IoStatus.Status = STATUS_CANCELLED; Irp->IoStatus.Status = STATUS_CANCELLED;
IoCompleteRequest(Irp, IO_NAMED_PIPE_INCREMENT); IoCompleteRequest(Irp, IO_NAMED_PIPE_INCREMENT);
} }
VOID VOID
NTAPI NTAPI
NpTimerDispatch(IN PKDPC Dpc, NpTimerDispatch(IN PKDPC Dpc,
@ -243,7 +243,7 @@ NpAddWaiter(IN PNP_WAIT_QUEUE WaitQueue,
WaitEntry->WaitQueue = WaitQueue; WaitEntry->WaitQueue = WaitQueue;
WaitEntry->Irp = Irp; WaitEntry->Irp = Irp;
WaitBuffer = (PFILE_PIPE_WAIT_FOR_BUFFER)Irp->AssociatedIrp.SystemBuffer; WaitBuffer = Irp->AssociatedIrp.SystemBuffer;
if (WaitBuffer->TimeoutSpecified) if (WaitBuffer->TimeoutSpecified)
{ {
DueTime = WaitBuffer->Timeout; DueTime = WaitBuffer->Timeout;
@ -281,7 +281,6 @@ NpAddWaiter(IN PNP_WAIT_QUEUE WaitQueue,
KeSetTimer(&WaitEntry->Timer, DueTime, &WaitEntry->Dpc); KeSetTimer(&WaitEntry->Timer, DueTime, &WaitEntry->Dpc);
WaitEntry = NULL; WaitEntry = NULL;
} }
KeReleaseSpinLock(&WaitQueue->WaitLock, OldIrql); KeReleaseSpinLock(&WaitQueue->WaitLock, OldIrql);