Clean up the pipe type and mode mess.
Modified: trunk/reactos/drivers/fs/np/create.c
Modified: trunk/reactos/drivers/fs/np/fsctrl.c
Modified: trunk/reactos/drivers/fs/np/npfs.h
Modified: trunk/reactos/drivers/fs/np/rw.c
_____
Modified: trunk/reactos/drivers/fs/np/create.c
--- trunk/reactos/drivers/fs/np/create.c 2005-01-03 11:30:28 UTC
(rev 12753)
+++ trunk/reactos/drivers/fs/np/create.c 2005-01-03 13:50:04 UTC
(rev 12754)
@@ -320,11 +320,11 @@
InitializeListHead(&Pipe->ClientFcbListHead);
KeInitializeMutex(&Pipe->FcbListLock, 0);
- Pipe->PipeType = Buffer->NamedPipeType ? FILE_PIPE_MESSAGE_TYPE
: FILE_PIPE_BYTE_STREAM_TYPE;
- Pipe->PipeWriteMode = Buffer->NamedPipeType ?
FILE_PIPE_MESSAGE_MODE : FILE_PIPE_BYTE_STREAM_MODE;
- Pipe->PipeReadMode = Buffer->ReadMode ? FILE_PIPE_MESSAGE_MODE :
FILE_PIPE_BYTE_STREAM_MODE;
- Pipe->PipeBlockMode = Buffer->CompletionMode;
- Pipe->PipeConfiguration = IoStack->Parameters.Create.Options &
0x3;
+ Pipe->PipeType = Buffer->NamedPipeType;
+ Pipe->WriteMode = Buffer->ReadMode;
+ Pipe->ReadMode = Buffer->ReadMode;
+ Pipe->CompletionMode = Buffer->CompletionMode;
+ Pipe->PipeConfiguration = IoStack->Parameters.CreatePipe.Options
& 0x3;
Pipe->MaximumInstances = Buffer->MaximumInstances;
Pipe->CurrentInstances = 0;
Pipe->TimeOut = Buffer->DefaultTimeout;
_____
Modified: trunk/reactos/drivers/fs/np/fsctrl.c
--- trunk/reactos/drivers/fs/np/fsctrl.c 2005-01-03 11:30:28 UTC
(rev 12753)
+++ trunk/reactos/drivers/fs/np/fsctrl.c 2005-01-03 13:50:04 UTC
(rev 12754)
@@ -217,64 +217,31 @@
NpfsGetState(PIRP Irp,
PIO_STACK_LOCATION IrpSp)
{
- ULONG OutputBufferLength;
PNPFS_GET_STATE Reply;
- NTSTATUS Status;
PNPFS_PIPE Pipe;
PNPFS_FCB Fcb;
- OutputBufferLength =
IrpSp->Parameters.DeviceIoControl.OutputBufferLength;
-
/* Validate parameters */
- if (OutputBufferLength >= sizeof(NPFS_GET_STATE))
+ if (IrpSp->Parameters.DeviceIoControl.OutputBufferLength <
sizeof(NPFS_GET_STATE))
{
- Fcb = IrpSp->FileObject->FsContext;
- Reply = (PNPFS_GET_STATE)Irp->AssociatedIrp.SystemBuffer;
- Pipe = Fcb->Pipe;
-
- if (Pipe->PipeWriteMode == FILE_PIPE_MESSAGE_MODE)
- {
- Reply->WriteModeMessage = TRUE;
+ DPRINT("Status (0x%X).\n", STATUS_INVALID_PARAMETER);
+ return STATUS_INVALID_PARAMETER;
}
- else
- {
- Reply->WriteModeMessage = FALSE;
- }
- if (Pipe->PipeReadMode == FILE_PIPE_MESSAGE_MODE)
- {
- Reply->ReadModeMessage = TRUE;
- }
- else
- {
- Reply->ReadModeMessage = FALSE;
- }
+ Fcb = IrpSp->FileObject->FsContext;
+ Reply = (PNPFS_GET_STATE)Irp->AssociatedIrp.SystemBuffer;
+ Pipe = Fcb->Pipe;
- if (Pipe->PipeBlockMode == FILE_PIPE_QUEUE_OPERATION)
- {
- Reply->NonBlocking = TRUE;
- }
- else
- {
- Reply->NonBlocking = FALSE;
- }
+ Reply->WriteModeMessage = (Pipe->WriteMode ==
FILE_PIPE_MESSAGE_MODE);
+ Reply->ReadModeMessage = (Pipe->ReadMode == FILE_PIPE_MESSAGE_MODE);
+ Reply->NonBlocking = (Pipe->CompletionMode ==
FILE_PIPE_QUEUE_OPERATION);
+ Reply->InBufferSize = Pipe->InboundQuota;
+ Reply->OutBufferSize = Pipe->OutboundQuota;
+ Reply->Timeout = Pipe->TimeOut;
- Reply->InBufferSize = Pipe->InboundQuota;
+ DPRINT("Status (0x%X).\n", STATUS_SUCCESS);
- Reply->OutBufferSize = Pipe->OutboundQuota;
-
- Reply->Timeout = Pipe->TimeOut;
-
- Status = STATUS_SUCCESS;
- }
- else
- {
- Status = STATUS_INVALID_PARAMETER;
- }
-
- DPRINT("Status (0x%X).\n", Status);
-
- return Status;
+ return STATUS_SUCCESS;
}
@@ -290,64 +257,34 @@
NpfsSetState(PIRP Irp,
PIO_STACK_LOCATION IrpSp)
{
- ULONG InputBufferLength;
PNPFS_SET_STATE Request;
PNPFS_PIPE Pipe;
- NTSTATUS Status;
PNPFS_FCB Fcb;
- InputBufferLength =
IrpSp->Parameters.DeviceIoControl.InputBufferLength;
-
/* Validate parameters */
- if (InputBufferLength >= sizeof(NPFS_SET_STATE))
- {
- Fcb = IrpSp->FileObject->FsContext;
- Request = (PNPFS_SET_STATE)Irp->AssociatedIrp.SystemBuffer;
- Pipe = Fcb->Pipe;
-
- if (Request->WriteModeMessage)
+ if (IrpSp->Parameters.DeviceIoControl.InputBufferLength <
sizeof(NPFS_SET_STATE))
{
- Pipe->PipeWriteMode = FILE_PIPE_MESSAGE_MODE;
+ DPRINT("Status (0x%X).\n", STATUS_INVALID_PARAMETER);
+ return STATUS_INVALID_PARAMETER;
}
- else
- {
- Pipe->PipeWriteMode = FILE_PIPE_BYTE_STREAM_MODE;
- }
- if (Request->ReadModeMessage)
- {
- Pipe->PipeReadMode = FILE_PIPE_MESSAGE_MODE;
- }
- else
- {
- Pipe->PipeReadMode = FILE_PIPE_BYTE_STREAM_MODE;
- }
+ Fcb = IrpSp->FileObject->FsContext;
+ Request = (PNPFS_SET_STATE)Irp->AssociatedIrp.SystemBuffer;
+ Pipe = Fcb->Pipe;
- if (Request->NonBlocking)
- {
- Pipe->PipeBlockMode = FILE_PIPE_QUEUE_OPERATION;
- }
- else
- {
- Pipe->PipeBlockMode = FILE_PIPE_COMPLETE_OPERATION;
- }
+ Pipe->WriteMode =
+ Request->WriteModeMessage ? FILE_PIPE_MESSAGE_MODE :
FILE_PIPE_BYTE_STREAM_MODE;
+ Pipe->ReadMode =
+ Request->WriteModeMessage ? FILE_PIPE_MESSAGE_MODE :
FILE_PIPE_BYTE_STREAM_MODE;
+ Pipe->CompletionMode =
+ Request->NonBlocking ? FILE_PIPE_QUEUE_OPERATION :
FILE_PIPE_COMPLETE_OPERATION;
+ Pipe->InboundQuota = Request->InBufferSize;
+ Pipe->OutboundQuota = Request->OutBufferSize;
+ Pipe->TimeOut = Request->Timeout;
- Pipe->InboundQuota = Request->InBufferSize;
+ DPRINT("Status (0x%X).\n", STATUS_SUCCESS);
- Pipe->OutboundQuota = Request->OutBufferSize;
-
- Pipe->TimeOut = Request->Timeout;
-
- Status = STATUS_SUCCESS;
- }
- else
- {
- Status = STATUS_INVALID_PARAMETER;
- }
-
- DPRINT("Status (0x%X).\n", Status);
-
- return Status;
+ return STATUS_SUCCESS;
}
_____
Modified: trunk/reactos/drivers/fs/np/npfs.h
--- trunk/reactos/drivers/fs/np/npfs.h 2005-01-03 11:30:28 UTC (rev
12753)
+++ trunk/reactos/drivers/fs/np/npfs.h 2005-01-03 13:50:04 UTC (rev
12754)
@@ -26,9 +26,9 @@
LIST_ENTRY ServerFcbListHead;
LIST_ENTRY ClientFcbListHead;
ULONG PipeType;
- ULONG PipeReadMode;
- ULONG PipeWriteMode;
- ULONG PipeBlockMode;
+ ULONG ReadMode;
+ ULONG WriteMode;
+ ULONG CompletionMode;
ULONG PipeConfiguration;
ULONG MaximumInstances;
ULONG CurrentInstances;
_____
Modified: trunk/reactos/drivers/fs/np/rw.c
--- trunk/reactos/drivers/fs/np/rw.c 2005-01-03 11:30:28 UTC (rev
12753)
+++ trunk/reactos/drivers/fs/np/rw.c 2005-01-03 13:50:04 UTC (rev
12754)
@@ -1,4 +1,4 @@
-/* $Id: rw.c,v 1.16 2004/12/30 16:15:10 ekohl Exp $
+/* $Id$
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -168,7 +168,7 @@
KeAcquireSpinLock(&ReadFcb->DataListLock, &OldIrql);
}
- if (Pipe->PipeReadMode == FILE_PIPE_BYTE_STREAM_MODE)
+ if (Pipe->ReadMode == FILE_PIPE_BYTE_STREAM_MODE)
{
DPRINT("Byte stream mode\n");
/* Byte stream mode */
@@ -363,7 +363,7 @@
KeAcquireSpinLock(&Fcb->DataListLock, &OldIrql);
}
- if (Pipe->PipeWriteMode == FILE_PIPE_BYTE_STREAM_MODE)
+ if (Pipe->WriteMode == FILE_PIPE_BYTE_STREAM_MODE)
{
DPRINT("Byte stream mode\n");
while (Length > 0 && Fcb->WriteQuotaAvailable > 0)