--- trunk/reactos/drivers/fs/np/create.c 2005-10-31 16:46:46 UTC (rev 18911)
+++ trunk/reactos/drivers/fs/np/create.c 2005-10-31 18:56:44 UTC (rev 18912)
@@ -113,7 +113,6 @@
PNPFS_FCB ClientFcb;
PNPFS_FCB ServerFcb = NULL;
PNPFS_DEVICE_EXTENSION DeviceExt;
- BOOLEAN SpecialAccess;
DPRINT("NpfsCreate(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
@@ -125,12 +124,6 @@
Irp->IoStatus.Information = 0;
- SpecialAccess = ((IoStack->Parameters.CreatePipe.ShareAccess & 3) == 3);
- if (SpecialAccess)
- {
- DPRINT("NpfsCreate() open client end for special use!\n");
- }
-
/*
* Step 1. Find the pipe we're trying to open.
*/
@@ -172,7 +165,7 @@
ClientFcb->Pipe = Pipe;
ClientFcb->PipeEnd = FILE_PIPE_CLIENT_END;
ClientFcb->OtherSide = NULL;
- ClientFcb->PipeState = SpecialAccess ? 0 : FILE_PIPE_DISCONNECTED_STATE;
+ ClientFcb->PipeState = FILE_PIPE_DISCONNECTED_STATE;
InitializeListHead(&ClientFcb->ReadRequestListHead);
DPRINT("Fcb: %x\n", ClientFcb);
@@ -211,67 +204,56 @@
* Step 3. Search for listening server FCB.
*/
- if (!SpecialAccess)
+ /*
+ * WARNING: Point of no return! Once we get the server FCB it's
+ * possible that we completed a wait request and so we have to
+ * complete even this request.
+ */
+
+ ServerFcb = NpfsFindListeningServerInstance(Pipe);
+ if (ServerFcb == NULL)
{
+ PLIST_ENTRY CurrentEntry;
+ PNPFS_FCB Fcb;
+
/*
- * WARNING: Point of no return! Once we get the server FCB it's
- * possible that we completed a wait request and so we have to
- * complete even this request.
+ * If no waiting server FCB was found then try to pick
+ * one of the listing server FCB on the pipe.
*/
- ServerFcb = NpfsFindListeningServerInstance(Pipe);
- if (ServerFcb == NULL)
+ CurrentEntry = Pipe->ServerFcbListHead.Flink;
+ while (CurrentEntry != &Pipe->ServerFcbListHead)
{
- PLIST_ENTRY CurrentEntry;
- PNPFS_FCB Fcb;
-
- /*
- * If no waiting server FCB was found then try to pick
- * one of the listing server FCB on the pipe.
- */
-
- CurrentEntry = Pipe->ServerFcbListHead.Flink;
- while (CurrentEntry != &Pipe->ServerFcbListHead)
+ Fcb = CONTAINING_RECORD(CurrentEntry, NPFS_FCB, FcbListEntry);
+ if (Fcb->PipeState == FILE_PIPE_LISTENING_STATE)
{
- Fcb = CONTAINING_RECORD(CurrentEntry, NPFS_FCB, FcbListEntry);
- if (Fcb->PipeState == FILE_PIPE_LISTENING_STATE)
- {
- ServerFcb = Fcb;
- break;
- }
- CurrentEntry = CurrentEntry->Flink;
+ ServerFcb = Fcb;
+ break;
}
+ CurrentEntry = CurrentEntry->Flink;
+ }
- /*
- * No one is listening to me?! I'm so lonely... :(
- */
+ /*
+ * No one is listening to me?! I'm so lonely... :(
+ */
- if (ServerFcb == NULL)
- {
- /* Not found, bail out with error for FILE_OPEN requests. */
- DPRINT("No listening server fcb found!\n");
- if (ClientFcb->Data)
- ExFreePool(ClientFcb->Data);
- KeUnlockMutex(&Pipe->FcbListLock);
- Irp->IoStatus.Status = STATUS_PIPE_BUSY;
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
- return STATUS_PIPE_BUSY;
- }
- }
- else
+ if (ServerFcb == NULL)
{
- /* Signal the server thread and remove it from the waiter list */
- /* FIXME: Merge this with the NpfsFindListeningServerInstance routine. */
- NpfsSignalAndRemoveListeningServerInstance(Pipe, ServerFcb);
+ /* Not found, bail out with error for FILE_OPEN requests. */
+ DPRINT("No listening server fcb found!\n");
+ if (ClientFcb->Data)
+ ExFreePool(ClientFcb->Data);
+ KeUnlockMutex(&Pipe->FcbListLock);
+ Irp->IoStatus.Status = STATUS_PIPE_NOT_AVAILABLE;
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+ return STATUS_PIPE_NOT_AVAILABLE;
}
}
- else if (IsListEmpty(&Pipe->ServerFcbListHead))
+ else
{
- DPRINT("No server fcb found!\n");
- KeUnlockMutex(&Pipe->FcbListLock);
- Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
- return STATUS_UNSUCCESSFUL;
+ /* Signal the server thread and remove it from the waiter list */
+ /* FIXME: Merge this with the NpfsFindListeningServerInstance routine. */
+ NpfsSignalAndRemoveListeningServerInstance(Pipe, ServerFcb);
}
/*