[NPFS]
authorThomas Faber <thomas.faber@reactos.org>
Thu, 16 Oct 2014 16:36:17 +0000 (16:36 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Thu, 16 Oct 2014 16:36:17 +0000 (16:36 +0000)
- Use NpAcquire*Vcb/NpReleaseVcb instead of using NpVcb directly
- CaseInsensitiveIndex is integer, not boolean
- Minor fixes involving unnecessary casts and magic numbers

svn path=/trunk/; revision=64761

reactos/drivers/filesystems/npfs/create.c
reactos/drivers/filesystems/npfs/datasup.c
reactos/drivers/filesystems/npfs/fileinfo.c
reactos/drivers/filesystems/npfs/fsctrl.c
reactos/drivers/filesystems/npfs/secursup.c
reactos/drivers/filesystems/npfs/volinfo.c
reactos/drivers/filesystems/npfs/writesup.c

index 7fde99d..4be56c6 100644 (file)
@@ -384,7 +384,7 @@ NpFsdCreate(IN PDEVICE_OBJECT DeviceObject,
     IoStatus.Information = 0;
 
     FsRtlEnterFileSystem();
-    ExAcquireResourceExclusiveLite(&NpVcb->Lock, TRUE);
+    NpAcquireExclusiveVcb();
 
     if (RelatedFileObject)
     {
@@ -462,7 +462,7 @@ NpFsdCreate(IN PDEVICE_OBJECT DeviceObject,
             goto Quickie;
         }
 
-        Fcb = NpFindPrefix(&FileName, TRUE, &Prefix);
+        Fcb = NpFindPrefix(&FileName, 1, &Prefix);
     }
 
     if (Prefix.Length)
@@ -499,7 +499,7 @@ NpFsdCreate(IN PDEVICE_OBJECT DeviceObject,
                                  &DeferredList);
 
 Quickie:
-    ExReleaseResourceLite(&NpVcb->Lock);
+    NpReleaseVcb();
     NpCompleteDeferredIrps(&DeferredList);
     FsRtlExitFileSystem();
 
@@ -852,7 +852,7 @@ NpFsdCreateNamedPipe(IN PDEVICE_OBJECT DeviceObject,
             goto Quickie;
         }
 
-        Fcb = NpFindPrefix(&FileName, TRUE, &Prefix);
+        Fcb = NpFindPrefix(&FileName, 1, &Prefix);
     }
 
     if (Prefix.Length)
index a464936..8e40849 100644 (file)
@@ -85,7 +85,7 @@ NpCompleteStalledWrites(IN PNP_DATA_QUEUE DataQueue,
                 {
                     DataQueueEntry->Irp = NULL;
 
-                    Irp->IoStatus.Status = 0;
+                    Irp->IoStatus.Status = STATUS_SUCCESS;
                     Irp->IoStatus.Information = DataQueueEntry->DataSize;
 
                     InsertTailList(List, &Irp->Tail.Overlay.ListEntry);
@@ -216,7 +216,7 @@ NpCancelDataQueueIrp(IN PDEVICE_OBJECT DeviceObject,
 
     InitializeListHead(&DeferredList);
 
-    DataQueue = (PNP_DATA_QUEUE)Irp->Tail.Overlay.DriverContext[2];
+    DataQueue = Irp->Tail.Overlay.DriverContext[2];
     ClientSecurityContext = NULL;
 
     if (DeviceObject)
index d6f2a10..5a152c0 100644 (file)
@@ -27,13 +27,13 @@ NpSetBasicInfo(IN PNP_CCB Ccb,
 NTSTATUS
 NTAPI
 NpSetPipeInfo(IN PNP_FCB Fcb,
-              IN PNP_CCB Ccb, 
+              IN PNP_CCB Ccb,
               IN PFILE_PIPE_INFORMATION Buffer,
-              IN ULONG NamedPipeEnd, 
+              IN ULONG NamedPipeEnd,
               IN PLIST_ENTRY List)
 {
     NTSTATUS Status;
-    PNP_DATA_QUEUE ReadQueue, WriteQueue; 
+    PNP_DATA_QUEUE ReadQueue, WriteQueue;
     PAGED_CODE();
 
     if (Buffer->ReadMode == FILE_PIPE_MESSAGE_MODE && Fcb->NamedPipeType == FILE_PIPE_BYTE_STREAM_TYPE)
@@ -103,7 +103,7 @@ NpCommonSetInformation(IN PDEVICE_OBJECT DeviceObject,
     Buffer = Irp->AssociatedIrp.SystemBuffer;
 
     if (InfoClass == FileBasicInformation) return NpSetBasicInfo(Ccb, Buffer);
-    
+
     if (InfoClass != FilePipeInformation) return STATUS_INVALID_PARAMETER;
 
     return NpSetPipeInfo(Fcb, Ccb, Buffer, NamedPipeEnd, List);
index 74826f8..5e1803b 100644 (file)
@@ -369,7 +369,7 @@ NpPeek(IN PDEVICE_OBJECT DeviceObject,
         return STATUS_INVALID_PARAMETER;
     }
 
-    PeekBuffer = (PFILE_PIPE_PEEK_BUFFER)Irp->AssociatedIrp.SystemBuffer;
+    PeekBuffer = Irp->AssociatedIrp.SystemBuffer;
     if (NamedPipeEnd != FILE_PIPE_CLIENT_END)
     {
         if (NamedPipeEnd != FILE_PIPE_SERVER_END)
@@ -714,7 +714,7 @@ NpWaitForNamedPipe(IN PDEVICE_OBJECT DeviceObject,
     //Status = NpTranslateAlias(&SourceString);
     if (!NT_SUCCESS(Status)) goto Quickie;
 
-    Fcb = NpFindPrefix(&SourceString, TRUE, &Prefix);
+    Fcb = NpFindPrefix(&SourceString, 1, &Prefix);
     Fcb = (PNP_FCB)((ULONG_PTR)Fcb & ~1);
 
     NodeTypeCode = Fcb ? Fcb->NodeType : 0;
index 3934b49..f2a99b4 100644 (file)
@@ -127,7 +127,6 @@ NpGetClientSecurityContext(IN ULONG NamedPipeEnd,
                            IN PETHREAD Thread,
                            IN PSECURITY_CLIENT_CONTEXT *Context)
 {
-   
     PSECURITY_CLIENT_CONTEXT NewContext;
     NTSTATUS Status;
     PAGED_CODE();
index ea0d674..5a6f0a0 100644 (file)
@@ -191,11 +191,11 @@ NpFsdQueryVolumeInformation(IN PDEVICE_OBJECT DeviceObject,
     TRACE("Entered\n");
 
     FsRtlEnterFileSystem();
-    ExAcquireResourceSharedLite(&NpVcb->Lock, TRUE);
+    NpAcquireSharedVcb();
 
     Status = NpCommonQueryVolumeInformation(DeviceObject, Irp);
 
-    ExReleaseResourceLite(&NpVcb->Lock);
+    NpReleaseVcb();
     FsRtlExitFileSystem();
 
     if (Status != STATUS_PENDING)
index fb2d3d0..3f03745 100644 (file)
@@ -15,7 +15,7 @@
 
 /* FUNCTIONS ******************************************************************/
 
-NTSTATUS 
+NTSTATUS
 NTAPI
 NpWriteDataQueue(IN PNP_DATA_QUEUE WriteQueue,
                  IN ULONG Mode,
@@ -57,9 +57,9 @@ NpWriteDataQueue(IN PNP_DATA_QUEUE WriteQueue,
     {
         DataSize = DataEntry->DataSize;
 
-        IoStack = IoGetCurrentIrpStackLocation( DataEntry->Irp);
+        IoStack = IoGetCurrentIrpStackLocation(DataEntry->Irp);
 
-        if (IoStack->MajorFunction == IRP_MJ_FILE_SYSTEM_CONTROL && 
+        if (IoStack->MajorFunction == IRP_MJ_FILE_SYSTEM_CONTROL &&
             IoStack->Parameters.FileSystemControl.FsControlCode == FSCTL_PIPE_INTERNAL_READ_OVFLOW &&
             (DataSize < OutBufferSize || MoreProcessing))
         {
@@ -76,7 +76,7 @@ NpWriteDataQueue(IN PNP_DATA_QUEUE WriteQueue,
         {
             DataEntry->Irp->Overlay.AllocationSize.QuadPart = 0;
         }
-        
+
         BufferSize = *BytesNotWritten;
         if (BufferSize >= DataSize) BufferSize = DataSize;