[NPFS]
authorThomas Faber <thomas.faber@reactos.org>
Thu, 7 Aug 2014 10:24:07 +0000 (10:24 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Thu, 7 Aug 2014 10:24:07 +0000 (10:24 +0000)
- Avoid magic values, remove a few casts and don't name an IO_STATUS_BLOCK Status. No code changes.

svn path=/trunk/; revision=63827

reactos/drivers/filesystems/npfs/datasup.c
reactos/drivers/filesystems/npfs/readsup.c
reactos/drivers/filesystems/npfs/waitsup.c

index e15be94..a464936 100644 (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;
index 5932b87..914484c 100644 (file)
 
 IO_STATUS_BLOCK
 NTAPI
-NpReadDataQueue(IN PNP_DATA_QUEUE DataQueue, 
+NpReadDataQueue(IN PNP_DATA_QUEUE DataQueue,
                 IN BOOLEAN Peek,
                 IN BOOLEAN ReadOverflowOperation,
                 IN PVOID Buffer,
-                IN ULONG BufferSize, 
-                IN ULONG Mode, 
+                IN ULONG BufferSize,
+                IN ULONG Mode,
                 IN PNP_CCB Ccb,
                 IN PLIST_ENTRY List)
 {
@@ -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 */
index 5519d6b..bc80ebb 100644 (file)
@@ -17,7 +17,7 @@
 
 VOID
 NTAPI
-NpCancelWaitQueueIrp(IN PDEVICE_OBJECT DeviceObject, 
+NpCancelWaitQueueIrp(IN PDEVICE_OBJECT DeviceObject,
                      IN PIRP Irp)
 {
     KIRQL OldIrql;
@@ -53,7 +53,7 @@ NpCancelWaitQueueIrp(IN PDEVICE_OBJECT DeviceObject,
     Irp->IoStatus.Status = STATUS_CANCELLED;
     IoCompleteRequest(Irp, IO_NAMED_PIPE_INCREMENT);
 }
+
 VOID
 NTAPI
 NpTimerDispatch(IN PKDPC Dpc,
@@ -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);