Author: ekohl
Date: Sun May 21 17:19:10 2006
New Revision: 21962
URL:
http://svn.reactos.ru/svn/reactos?rev=21962&view=rev
Log:
The MSFS_PIPE struct is actually an FCB (File Control Block). Rename it accordingly and
store pointers to it in FileObject->FsContext.
Modified:
trunk/reactos/drivers/filesystems/np/create.c
trunk/reactos/drivers/filesystems/np/finfo.c
trunk/reactos/drivers/filesystems/np/fsctrl.c
trunk/reactos/drivers/filesystems/np/npfs.h
trunk/reactos/drivers/filesystems/np/rw.c
Modified: trunk/reactos/drivers/filesystems/np/create.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/filesystems/np/crea…
==============================================================================
--- trunk/reactos/drivers/filesystems/np/create.c (original)
+++ trunk/reactos/drivers/filesystems/np/create.c Sun May 21 17:19:10 2006
@@ -15,23 +15,23 @@
/* FUNCTIONS *****************************************************************/
-static PNPFS_PIPE
+static PNPFS_FCB
NpfsFindPipe(PNPFS_DEVICE_EXTENSION DeviceExt,
PUNICODE_STRING PipeName)
{
PLIST_ENTRY CurrentEntry;
- PNPFS_PIPE Pipe;
+ PNPFS_FCB Fcb;
CurrentEntry = DeviceExt->PipeListHead.Flink;
while (CurrentEntry != &DeviceExt->PipeListHead)
{
- Pipe = CONTAINING_RECORD(CurrentEntry, NPFS_PIPE, PipeListEntry);
+ Fcb = CONTAINING_RECORD(CurrentEntry, NPFS_FCB, PipeListEntry);
if (RtlCompareUnicodeString(PipeName,
- &Pipe->PipeName,
+ &Fcb->PipeName,
TRUE) == 0)
{
- DPRINT("<%wZ> = <%wZ>\n", PipeName, &Pipe->PipeName);
- return Pipe;
+ DPRINT("<%wZ> = <%wZ>\n", PipeName, &Fcb->PipeName);
+ return Fcb;
}
CurrentEntry = CurrentEntry->Flink;
@@ -42,15 +42,15 @@
static PNPFS_CCB
-NpfsFindListeningServerInstance(PNPFS_PIPE Pipe)
+NpfsFindListeningServerInstance(PNPFS_FCB Fcb)
{
PLIST_ENTRY CurrentEntry;
PNPFS_WAITER_ENTRY Waiter;
KIRQL oldIrql;
PIRP Irp;
- CurrentEntry = Pipe->WaiterListHead.Flink;
- while (CurrentEntry != &Pipe->WaiterListHead)
+ CurrentEntry = Fcb->WaiterListHead.Flink;
+ while (CurrentEntry != &Fcb->WaiterListHead)
{
Waiter = CONTAINING_RECORD(CurrentEntry, NPFS_WAITER_ENTRY, Entry);
Irp = CONTAINING_RECORD(Waiter, IRP, Tail.Overlay.DriverContext);
@@ -76,15 +76,15 @@
static VOID
-NpfsSignalAndRemoveListeningServerInstance(PNPFS_PIPE Pipe,
+NpfsSignalAndRemoveListeningServerInstance(PNPFS_FCB Fcb,
PNPFS_CCB Ccb)
{
PLIST_ENTRY CurrentEntry;
PNPFS_WAITER_ENTRY Waiter;
PIRP Irp;
- CurrentEntry = Pipe->WaiterListHead.Flink;
- while (CurrentEntry != &Pipe->WaiterListHead)
+ CurrentEntry = Fcb->WaiterListHead.Flink;
+ while (CurrentEntry != &Fcb->WaiterListHead)
{
Waiter = CONTAINING_RECORD(CurrentEntry, NPFS_WAITER_ENTRY, Entry);
if (Waiter->Ccb == Ccb)
@@ -109,7 +109,7 @@
{
PEXTENDED_IO_STACK_LOCATION IoStack;
PFILE_OBJECT FileObject;
- PNPFS_PIPE Pipe;
+ PNPFS_FCB Fcb;
PNPFS_CCB ClientCcb;
PNPFS_CCB ServerCcb = NULL;
PNPFS_DEVICE_EXTENSION DeviceExt;
@@ -137,9 +137,9 @@
* Step 1. Find the pipe we're trying to open.
*/
KeLockMutex(&DeviceExt->PipeListLock);
- Pipe = NpfsFindPipe(DeviceExt,
- &FileObject->FileName);
- if (Pipe == NULL)
+ Fcb = NpfsFindPipe(DeviceExt,
+ &FileObject->FileName);
+ if (Fcb == NULL)
{
/* Not found, bail out with error. */
DPRINT("No pipe found!\n");
@@ -155,7 +155,7 @@
* Acquire the lock for CCB lists. From now on no modifications to the
* CCB lists are allowed, because it can cause various misconsistencies.
*/
- KeLockMutex(&Pipe->CcbListLock);
+ KeLockMutex(&Fcb->CcbListLock);
/*
* Step 2. Create the client CCB.
@@ -164,14 +164,14 @@
if (ClientCcb == NULL)
{
DPRINT("No memory!\n");
- KeUnlockMutex(&Pipe->CcbListLock);
+ KeUnlockMutex(&Fcb->CcbListLock);
Irp->IoStatus.Status = STATUS_NO_MEMORY;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return STATUS_NO_MEMORY;
}
ClientCcb->Thread = (struct ETHREAD *)Irp->Tail.Overlay.Thread;
- ClientCcb->Pipe = Pipe;
+ ClientCcb->Fcb = Fcb;
ClientCcb->PipeEnd = FILE_PIPE_CLIENT_END;
ClientCcb->OtherSide = NULL;
ClientCcb->PipeState = SpecialAccess ? 0 : FILE_PIPE_DISCONNECTED_STATE;
@@ -180,14 +180,14 @@
DPRINT("CCB: %p\n", ClientCcb);
/* Initialize data list. */
- if (Pipe->OutboundQuota)
- {
- ClientCcb->Data = ExAllocatePool(PagedPool, Pipe->OutboundQuota);
+ if (Fcb->OutboundQuota)
+ {
+ ClientCcb->Data = ExAllocatePool(PagedPool, Fcb->OutboundQuota);
if (ClientCcb->Data == NULL)
{
DPRINT("No memory!\n");
ExFreePool(ClientCcb);
- KeUnlockMutex(&Pipe->CcbListLock);
+ KeUnlockMutex(&Fcb->CcbListLock);
Irp->IoStatus.Status = STATUS_NO_MEMORY;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return STATUS_NO_MEMORY;
@@ -201,8 +201,8 @@
ClientCcb->ReadPtr = ClientCcb->Data;
ClientCcb->WritePtr = ClientCcb->Data;
ClientCcb->ReadDataAvailable = 0;
- ClientCcb->WriteQuotaAvailable = Pipe->OutboundQuota;
- ClientCcb->MaxDataLength = Pipe->OutboundQuota;
+ ClientCcb->WriteQuotaAvailable = Fcb->OutboundQuota;
+ ClientCcb->MaxDataLength = Fcb->OutboundQuota;
ExInitializeFastMutex(&ClientCcb->DataListLock);
KeInitializeEvent(&ClientCcb->ConnectEvent, SynchronizationEvent, FALSE);
KeInitializeEvent(&ClientCcb->ReadEvent, SynchronizationEvent, FALSE);
@@ -221,7 +221,7 @@
* complete even this request.
*/
- ServerCcb = NpfsFindListeningServerInstance(Pipe);
+ ServerCcb = NpfsFindListeningServerInstance(Fcb);
if (ServerCcb == NULL)
{
PLIST_ENTRY CurrentEntry;
@@ -232,8 +232,8 @@
* one of the listing server CCB on the pipe.
*/
- CurrentEntry = Pipe->ServerCcbListHead.Flink;
- while (CurrentEntry != &Pipe->ServerCcbListHead)
+ CurrentEntry = Fcb->ServerCcbListHead.Flink;
+ while (CurrentEntry != &Fcb->ServerCcbListHead)
{
Ccb = CONTAINING_RECORD(CurrentEntry, NPFS_CCB, CcbListEntry);
if (Ccb->PipeState == FILE_PIPE_LISTENING_STATE)
@@ -254,7 +254,7 @@
DPRINT("No listening server CCB found!\n");
if (ClientCcb->Data)
ExFreePool(ClientCcb->Data);
- KeUnlockMutex(&Pipe->CcbListLock);
+ KeUnlockMutex(&Fcb->CcbListLock);
Irp->IoStatus.Status = STATUS_PIPE_BUSY;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return STATUS_PIPE_BUSY;
@@ -264,13 +264,13 @@
{
/* Signal the server thread and remove it from the waiter list */
/* FIXME: Merge this with the NpfsFindListeningServerInstance routine. */
- NpfsSignalAndRemoveListeningServerInstance(Pipe, ServerCcb);
+ NpfsSignalAndRemoveListeningServerInstance(Fcb, ServerCcb);
}
}
- else if (IsListEmpty(&Pipe->ServerCcbListHead))
+ else if (IsListEmpty(&Fcb->ServerCcbListHead))
{
DPRINT("No server fcb found!\n");
- KeUnlockMutex(&Pipe->CcbListLock);
+ KeUnlockMutex(&Fcb->CcbListLock);
Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return STATUS_UNSUCCESSFUL;
@@ -281,7 +281,7 @@
*/
/* Add the client CCB to the pipe CCB list. */
- InsertTailList(&Pipe->ClientCcbListHead, &ClientCcb->CcbListEntry);
+ InsertTailList(&Fcb->ClientCcbListHead, &ClientCcb->CcbListEntry);
/* Connect to listening server side */
if (ServerCcb)
@@ -292,8 +292,9 @@
ServerCcb->PipeState = FILE_PIPE_CONNECTED_STATE;
}
- KeUnlockMutex(&Pipe->CcbListLock);
-
+ KeUnlockMutex(&Fcb->CcbListLock);
+
+ FileObject->FsContext = Fcb;
FileObject->FsContext2 = ClientCcb;
FileObject->Flags |= FO_NAMED_PIPE;
@@ -313,7 +314,7 @@
PEXTENDED_IO_STACK_LOCATION IoStack;
PFILE_OBJECT FileObject;
PNPFS_DEVICE_EXTENSION DeviceExt;
- PNPFS_PIPE Pipe;
+ PNPFS_FCB Fcb;
PNPFS_CCB Ccb;
PNAMED_PIPE_CREATE_PARAMETERS Buffer;
BOOLEAN NewPipe = FALSE;
@@ -352,9 +353,9 @@
/*
* First search for existing Pipe with the same name.
*/
- Pipe = NpfsFindPipe(DeviceExt,
- &FileObject->FileName);
- if (Pipe != NULL)
+ Fcb = NpfsFindPipe(DeviceExt,
+ &FileObject->FileName);
+ if (Fcb != NULL)
{
/*
* Found Pipe with the same name. Check if we are
@@ -362,7 +363,7 @@
*/
KeUnlockMutex(&DeviceExt->PipeListLock);
- if (Pipe->CurrentInstances >= Pipe->MaximumInstances)
+ if (Fcb->CurrentInstances >= Fcb->MaximumInstances)
{
DPRINT("Out of instances.\n");
ExFreePool(Ccb);
@@ -372,8 +373,8 @@
}
/* FIXME: Check pipe modes also! */
- if (Pipe->MaximumInstances != Buffer->MaximumInstances ||
- Pipe->TimeOut.QuadPart != Buffer->DefaultTimeout.QuadPart)
+ if (Fcb->MaximumInstances != Buffer->MaximumInstances ||
+ Fcb->TimeOut.QuadPart != Buffer->DefaultTimeout.QuadPart)
{
DPRINT("Asked for invalid pipe mode.\n");
ExFreePool(Ccb);
@@ -385,8 +386,8 @@
else
{
NewPipe = TRUE;
- Pipe = ExAllocatePool(NonPagedPool, sizeof(NPFS_PIPE));
- if (Pipe == NULL)
+ Fcb = ExAllocatePool(NonPagedPool, sizeof(NPFS_FCB));
+ if (Fcb == NULL)
{
KeUnlockMutex(&DeviceExt->PipeListLock);
Irp->IoStatus.Status = STATUS_NO_MEMORY;
@@ -395,13 +396,13 @@
return STATUS_NO_MEMORY;
}
- Pipe->PipeName.Length = FileObject->FileName.Length;
- Pipe->PipeName.MaximumLength = Pipe->PipeName.Length +
sizeof(UNICODE_NULL);
- Pipe->PipeName.Buffer = ExAllocatePool(NonPagedPool,
Pipe->PipeName.MaximumLength);
- if (Pipe->PipeName.Buffer == NULL)
+ Fcb->PipeName.Length = FileObject->FileName.Length;
+ Fcb->PipeName.MaximumLength = Fcb->PipeName.Length + sizeof(UNICODE_NULL);
+ Fcb->PipeName.Buffer = ExAllocatePool(NonPagedPool,
Fcb->PipeName.MaximumLength);
+ if (Fcb->PipeName.Buffer == NULL)
{
KeUnlockMutex(&DeviceExt->PipeListLock);
- ExFreePool(Pipe);
+ ExFreePool(Fcb);
ExFreePool(Ccb);
Irp->IoStatus.Status = STATUS_NO_MEMORY;
Irp->IoStatus.Information = 0;
@@ -409,88 +410,88 @@
return STATUS_NO_MEMORY;
}
- RtlCopyUnicodeString(&Pipe->PipeName, &FileObject->FileName);
-
- InitializeListHead(&Pipe->ServerCcbListHead);
- InitializeListHead(&Pipe->ClientCcbListHead);
- InitializeListHead(&Pipe->WaiterListHead);
- KeInitializeMutex(&Pipe->CcbListLock, 0);
-
- Pipe->PipeType = Buffer->NamedPipeType;
- Pipe->WriteMode = Buffer->ReadMode;
- Pipe->ReadMode = Buffer->ReadMode;
- Pipe->CompletionMode = Buffer->CompletionMode;
+ RtlCopyUnicodeString(&Fcb->PipeName, &FileObject->FileName);
+
+ InitializeListHead(&Fcb->ServerCcbListHead);
+ InitializeListHead(&Fcb->ClientCcbListHead);
+ InitializeListHead(&Fcb->WaiterListHead);
+ KeInitializeMutex(&Fcb->CcbListLock, 0);
+
+ Fcb->PipeType = Buffer->NamedPipeType;
+ Fcb->WriteMode = Buffer->ReadMode;
+ Fcb->ReadMode = Buffer->ReadMode;
+ Fcb->CompletionMode = Buffer->CompletionMode;
switch (IoStack->Parameters.CreatePipe.ShareAccess &
(FILE_SHARE_READ|FILE_SHARE_WRITE))
{
case FILE_SHARE_READ:
- Pipe->PipeConfiguration = FILE_PIPE_OUTBOUND;
+ Fcb->PipeConfiguration = FILE_PIPE_OUTBOUND;
break;
case FILE_SHARE_WRITE:
- Pipe->PipeConfiguration = FILE_PIPE_INBOUND;
+ Fcb->PipeConfiguration = FILE_PIPE_INBOUND;
break;
case FILE_SHARE_READ|FILE_SHARE_WRITE:
- Pipe->PipeConfiguration = FILE_PIPE_FULL_DUPLEX;
+ Fcb->PipeConfiguration = FILE_PIPE_FULL_DUPLEX;
break;
}
- Pipe->MaximumInstances = Buffer->MaximumInstances;
- Pipe->CurrentInstances = 0;
- Pipe->TimeOut = Buffer->DefaultTimeout;
- if (!(Pipe->PipeConfiguration & FILE_PIPE_OUTBOUND) ||
- Pipe->PipeConfiguration & FILE_PIPE_FULL_DUPLEX)
+ Fcb->MaximumInstances = Buffer->MaximumInstances;
+ Fcb->CurrentInstances = 0;
+ Fcb->TimeOut = Buffer->DefaultTimeout;
+ if (!(Fcb->PipeConfiguration & FILE_PIPE_OUTBOUND) ||
+ Fcb->PipeConfiguration & FILE_PIPE_FULL_DUPLEX)
{
if (Buffer->InboundQuota == 0)
{
- Pipe->InboundQuota = DeviceExt->DefaultQuota;
+ Fcb->InboundQuota = DeviceExt->DefaultQuota;
}
else
{
- Pipe->InboundQuota = PAGE_ROUND_UP(Buffer->InboundQuota);
- if (Pipe->InboundQuota < DeviceExt->MinQuota)
+ Fcb->InboundQuota = PAGE_ROUND_UP(Buffer->InboundQuota);
+ if (Fcb->InboundQuota < DeviceExt->MinQuota)
{
- Pipe->InboundQuota = DeviceExt->MinQuota;
+ Fcb->InboundQuota = DeviceExt->MinQuota;
}
- else if (Pipe->InboundQuota > DeviceExt->MaxQuota)
+ else if (Fcb->InboundQuota > DeviceExt->MaxQuota)
{
- Pipe->InboundQuota = DeviceExt->MaxQuota;
+ Fcb->InboundQuota = DeviceExt->MaxQuota;
}
}
}
else
{
- Pipe->InboundQuota = 0;
- }
-
- if (Pipe->PipeConfiguration & (FILE_PIPE_FULL_DUPLEX|FILE_PIPE_OUTBOUND))
+ Fcb->InboundQuota = 0;
+ }
+
+ if (Fcb->PipeConfiguration & (FILE_PIPE_FULL_DUPLEX|FILE_PIPE_OUTBOUND))
{
if (Buffer->OutboundQuota == 0)
{
- Pipe->OutboundQuota = DeviceExt->DefaultQuota;
+ Fcb->OutboundQuota = DeviceExt->DefaultQuota;
}
else
{
- Pipe->OutboundQuota = PAGE_ROUND_UP(Buffer->OutboundQuota);
- if (Pipe->OutboundQuota < DeviceExt->MinQuota)
+ Fcb->OutboundQuota = PAGE_ROUND_UP(Buffer->OutboundQuota);
+ if (Fcb->OutboundQuota < DeviceExt->MinQuota)
{
- Pipe->OutboundQuota = DeviceExt->MinQuota;
+ Fcb->OutboundQuota = DeviceExt->MinQuota;
}
- else if (Pipe->OutboundQuota > DeviceExt->MaxQuota)
+ else if (Fcb->OutboundQuota > DeviceExt->MaxQuota)
{
- Pipe->OutboundQuota = DeviceExt->MaxQuota;
+ Fcb->OutboundQuota = DeviceExt->MaxQuota;
}
}
}
else
{
- Pipe->OutboundQuota = 0;
- }
-
- InsertTailList(&DeviceExt->PipeListHead, &Pipe->PipeListEntry);
+ Fcb->OutboundQuota = 0;
+ }
+
+ InsertTailList(&DeviceExt->PipeListHead, &Fcb->PipeListEntry);
KeUnlockMutex(&DeviceExt->PipeListLock);
}
- if (Pipe->InboundQuota)
+ if (Fcb->InboundQuota)
{
- Ccb->Data = ExAllocatePool(PagedPool, Pipe->InboundQuota);
+ Ccb->Data = ExAllocatePool(PagedPool, Fcb->InboundQuota);
if (Ccb->Data == NULL)
{
ExFreePool(Ccb);
@@ -498,10 +499,10 @@
if (NewPipe)
{
KeLockMutex(&DeviceExt->PipeListLock);
- RemoveEntryList(&Pipe->PipeListEntry);
+ RemoveEntryList(&Fcb->PipeListEntry);
KeUnlockMutex(&DeviceExt->PipeListLock);
- RtlFreeUnicodeString(&Pipe->PipeName);
- ExFreePool(Pipe);
+ RtlFreeUnicodeString(&Fcb->PipeName);
+ ExFreePool(Fcb);
}
Irp->IoStatus.Status = STATUS_NO_MEMORY;
@@ -517,14 +518,14 @@
Ccb->ReadPtr = Ccb->Data;
Ccb->WritePtr = Ccb->Data;
Ccb->ReadDataAvailable = 0;
- Ccb->WriteQuotaAvailable = Pipe->InboundQuota;
- Ccb->MaxDataLength = Pipe->InboundQuota;
+ Ccb->WriteQuotaAvailable = Fcb->InboundQuota;
+ Ccb->MaxDataLength = Fcb->InboundQuota;
InitializeListHead(&Ccb->ReadRequestListHead);
ExInitializeFastMutex(&Ccb->DataListLock);
- Pipe->CurrentInstances++;
-
- Ccb->Pipe = Pipe;
+ Fcb->CurrentInstances++;
+
+ Ccb->Fcb = Fcb;
Ccb->PipeEnd = FILE_PIPE_SERVER_END;
Ccb->PipeState = FILE_PIPE_LISTENING_STATE;
Ccb->OtherSide = NULL;
@@ -535,10 +536,11 @@
KeInitializeEvent(&Ccb->ReadEvent, SynchronizationEvent, FALSE);
KeInitializeEvent(&Ccb->WriteEvent, SynchronizationEvent, FALSE);
- KeLockMutex(&Pipe->CcbListLock);
- InsertTailList(&Pipe->ServerCcbListHead, &Ccb->CcbListEntry);
- KeUnlockMutex(&Pipe->CcbListLock);
-
+ KeLockMutex(&Fcb->CcbListLock);
+ InsertTailList(&Fcb->ServerCcbListHead, &Ccb->CcbListEntry);
+ KeUnlockMutex(&Fcb->CcbListLock);
+
+ FileObject->FsContext = Fcb;
FileObject->FsContext2 = Ccb;
FileObject->Flags |= FO_NAMED_PIPE;
@@ -559,7 +561,7 @@
PIO_STACK_LOCATION IoStack;
PFILE_OBJECT FileObject;
PNPFS_CCB Ccb, OtherSide;
- PNPFS_PIPE Pipe;
+ PNPFS_FCB Fcb;
BOOLEAN Server;
DPRINT("NpfsCleanup(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
@@ -579,11 +581,11 @@
}
DPRINT("CCB %p\n", Ccb);
- Pipe = Ccb->Pipe;
-
- DPRINT("Cleaning pipe %wZ\n", &Pipe->PipeName);
-
- KeLockMutex(&Pipe->CcbListLock);
+ Fcb = Ccb->Fcb;
+
+ DPRINT("Cleaning pipe %wZ\n", &Fcb->PipeName);
+
+ KeLockMutex(&Fcb->CcbListLock);
Server = (Ccb->PipeEnd == FILE_PIPE_SERVER_END);
@@ -637,8 +639,8 @@
KIRQL oldIrql;
PIRP tmpIrp;
- Entry = Ccb->Pipe->WaiterListHead.Flink;
- while (Entry != &Ccb->Pipe->WaiterListHead)
+ Entry = Ccb->Fcb->WaiterListHead.Flink;
+ while (Entry != &Ccb->Fcb->WaiterListHead)
{
WaitEntry = CONTAINING_RECORD(Entry, NPFS_WAITER_ENTRY, Entry);
if (WaitEntry->Ccb == Ccb)
@@ -666,7 +668,7 @@
}
Ccb->PipeState = FILE_PIPE_CLOSING_STATE;
- KeUnlockMutex(&Pipe->CcbListLock);
+ KeUnlockMutex(&Fcb->CcbListLock);
ExAcquireFastMutex(&Ccb->DataListLock);
if (Ccb->Data)
@@ -694,8 +696,8 @@
PNPFS_DEVICE_EXTENSION DeviceExt;
PIO_STACK_LOCATION IoStack;
PFILE_OBJECT FileObject;
+ PNPFS_FCB Fcb;
PNPFS_CCB Ccb;
- PNPFS_PIPE Pipe;
BOOLEAN Server;
DPRINT("NpfsClose(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
@@ -715,18 +717,18 @@
}
DPRINT("CCB %x\n", Ccb);
- Pipe = Ccb->Pipe;
-
- DPRINT("Closing pipe %wZ\n", &Pipe->PipeName);
-
- KeLockMutex(&Pipe->CcbListLock);
+ Fcb = Ccb->Fcb;
+
+ DPRINT("Closing pipe %wZ\n", &Fcb->PipeName);
+
+ KeLockMutex(&Fcb->CcbListLock);
Server = (Ccb->PipeEnd == FILE_PIPE_SERVER_END);
if (Server)
{
DPRINT("Server\n");
- Pipe->CurrentInstances--;
+ Fcb->CurrentInstances--;
}
else
{
@@ -741,16 +743,17 @@
ExFreePool(Ccb);
- KeUnlockMutex(&Pipe->CcbListLock);
-
- if (IsListEmpty(&Pipe->ServerCcbListHead) &&
- IsListEmpty(&Pipe->ClientCcbListHead))
- {
- RtlFreeUnicodeString(&Pipe->PipeName);
+ KeUnlockMutex(&Fcb->CcbListLock);
+
+ if (IsListEmpty(&Fcb->ServerCcbListHead) &&
+ IsListEmpty(&Fcb->ClientCcbListHead))
+ {
+ RtlFreeUnicodeString(&Fcb->PipeName);
KeLockMutex(&DeviceExt->PipeListLock);
- RemoveEntryList(&Pipe->PipeListEntry);
+ RemoveEntryList(&Fcb->PipeListEntry);
KeUnlockMutex(&DeviceExt->PipeListLock);
- ExFreePool(Pipe);
+ ExFreePool(Fcb);
+ FileObject->FsContext = NULL;
}
Irp->IoStatus.Status = STATUS_SUCCESS;
Modified: trunk/reactos/drivers/filesystems/np/finfo.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/filesystems/np/finf…
==============================================================================
--- trunk/reactos/drivers/filesystems/np/finfo.c (original)
+++ trunk/reactos/drivers/filesystems/np/finfo.c Sun May 21 17:19:10 2006
@@ -22,17 +22,17 @@
PFILE_PIPE_INFORMATION Info,
PULONG BufferLength)
{
- PNPFS_PIPE Pipe;
+ PNPFS_FCB Fcb;
PFILE_PIPE_INFORMATION Request;
DPRINT("NpfsSetPipeInformation()\n");
/* Get the Pipe and data */
- Pipe = Ccb->Pipe;
+ Fcb = Ccb->Fcb;
Request = (PFILE_PIPE_INFORMATION)Info;
/* Set Pipe Data */
- Pipe->ReadMode = Request->ReadMode;
- Pipe->CompletionMode = Request->CompletionMode;
+ Fcb->ReadMode = Request->ReadMode;
+ Fcb->CompletionMode = Request->CompletionMode;
/* Return Success */
return STATUS_SUCCESS;
@@ -45,17 +45,17 @@
PFILE_PIPE_INFORMATION Info,
PULONG BufferLength)
{
- PNPFS_PIPE Pipe;
+ PNPFS_FCB Fcb;
PFILE_PIPE_REMOTE_INFORMATION Request;
DPRINT("NpfsSetPipeRemoteInformation()\n");
/* Get the Pipe and data */
- Pipe = Ccb->Pipe;
+ Fcb = Ccb->Fcb;
Request = (PFILE_PIPE_REMOTE_INFORMATION)Info;
/* Set the Settings */
- Pipe->TimeOut = Request->CollectDataTime;
- Pipe->InboundQuota = Request->MaximumCollectionCount;
+ Fcb->TimeOut = Request->CollectDataTime;
+ Fcb->InboundQuota = Request->MaximumCollectionCount;
/* Return Success */
return STATUS_SUCCESS;
@@ -68,18 +68,18 @@
PFILE_PIPE_INFORMATION Info,
PULONG BufferLength)
{
- PNPFS_PIPE Pipe;
+ PNPFS_FCB Fcb;
DPRINT("NpfsQueryPipeInformation()\n");
/* Get the Pipe */
- Pipe = Ccb->Pipe;
+ Fcb = Ccb->Fcb;
/* Clear Info */
RtlZeroMemory(Info, sizeof(FILE_PIPE_INFORMATION));
/* Return Info */
- Info->CompletionMode = Pipe->CompletionMode;
- Info->ReadMode = Pipe->ReadMode;
+ Info->CompletionMode = Fcb->CompletionMode;
+ Info->ReadMode = Fcb->ReadMode;
/* Return success */
*BufferLength -= sizeof(FILE_PIPE_INFORMATION);
@@ -93,18 +93,18 @@
PFILE_PIPE_REMOTE_INFORMATION Info,
PULONG BufferLength)
{
- PNPFS_PIPE Pipe;
+ PNPFS_FCB Fcb;
DPRINT("NpfsQueryPipeRemoteInformation()\n");
/* Get the Pipe */
- Pipe = Ccb->Pipe;
+ Fcb = Ccb->Fcb;
/* Clear Info */
RtlZeroMemory(Info, sizeof(FILE_PIPE_REMOTE_INFORMATION));
/* Return Info */
- Info->MaximumCollectionCount = Pipe->InboundQuota;
- Info->CollectDataTime = Pipe->TimeOut;
+ Info->MaximumCollectionCount = Fcb->InboundQuota;
+ Info->CollectDataTime = Fcb->TimeOut;
/* Return success */
*BufferLength -= sizeof(FILE_PIPE_REMOTE_INFORMATION);
@@ -118,21 +118,21 @@
PFILE_PIPE_LOCAL_INFORMATION Info,
PULONG BufferLength)
{
- PNPFS_PIPE Pipe;
+ PNPFS_FCB Fcb;
DPRINT("NpfsQueryLocalPipeInformation()\n");
- Pipe = Ccb->Pipe;
+ Fcb = Ccb->Fcb;
RtlZeroMemory(Info,
sizeof(FILE_PIPE_LOCAL_INFORMATION));
- Info->NamedPipeType = Pipe->PipeType;
- Info->NamedPipeConfiguration = Pipe->PipeConfiguration;
- Info->MaximumInstances = Pipe->MaximumInstances;
- Info->CurrentInstances = Pipe->CurrentInstances;
- Info->InboundQuota = Pipe->InboundQuota;
- Info->OutboundQuota = Pipe->OutboundQuota;
+ Info->NamedPipeType = Fcb->PipeType;
+ Info->NamedPipeConfiguration = Fcb->PipeConfiguration;
+ Info->MaximumInstances = Fcb->MaximumInstances;
+ Info->CurrentInstances = Fcb->CurrentInstances;
+ Info->InboundQuota = Fcb->InboundQuota;
+ Info->OutboundQuota = Fcb->OutboundQuota;
Info->NamedPipeState = Ccb->PipeState;
Info->NamedPipeEnd = Ccb->PipeEnd;
@@ -160,8 +160,8 @@
FILE_INFORMATION_CLASS FileInformationClass;
PFILE_OBJECT FileObject;
PNPFS_DEVICE_EXTENSION DeviceExtension;
+ PNPFS_FCB Fcb;
PNPFS_CCB Ccb;
- PNPFS_PIPE Pipe;
PVOID SystemBuffer;
ULONG BufferLength;
NTSTATUS Status;
@@ -173,12 +173,12 @@
DeviceExtension = DeviceObject->DeviceExtension;
FileObject = IoStack->FileObject;
Ccb = (PNPFS_CCB)FileObject->FsContext2;
- Pipe = Ccb->Pipe;
+ Fcb = Ccb->Fcb;
SystemBuffer = Irp->AssociatedIrp.SystemBuffer;
BufferLength = IoStack->Parameters.QueryFile.Length;
- DPRINT("Pipe name: %wZ\n", &Pipe->PipeName);
+ DPRINT("Pipe name: %wZ\n", &Fcb->PipeName);
DPRINT("FileInformationClass %d\n", FileInformationClass);
DPRINT("SystemBuffer %p\n", SystemBuffer);
DPRINT("BufferLength %lu\n", BufferLength);
@@ -229,8 +229,8 @@
PIO_STACK_LOCATION IoStack;
FILE_INFORMATION_CLASS FileInformationClass;
PFILE_OBJECT FileObject;
+ PNPFS_FCB Fcb;
PNPFS_CCB Ccb;
- PNPFS_PIPE Pipe;
PVOID SystemBuffer;
ULONG BufferLength;
NTSTATUS Status;
@@ -241,12 +241,12 @@
FileInformationClass = IoStack->Parameters.QueryFile.FileInformationClass;
FileObject = IoStack->FileObject;
Ccb = (PNPFS_CCB)FileObject->FsContext2;
- Pipe = Ccb->Pipe;
+ Fcb = Ccb->Fcb;
SystemBuffer = Irp->AssociatedIrp.SystemBuffer;
BufferLength = IoStack->Parameters.QueryFile.Length;
- DPRINT("Pipe name: %wZ\n", &Pipe->PipeName);
+ DPRINT("Pipe name: %wZ\n", &Fcb->PipeName);
DPRINT("FileInformationClass %d\n", FileInformationClass);
DPRINT("SystemBuffer %p\n", SystemBuffer);
DPRINT("BufferLength %lu\n", BufferLength);
Modified: trunk/reactos/drivers/filesystems/np/fsctrl.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/filesystems/np/fsct…
==============================================================================
--- trunk/reactos/drivers/filesystems/np/fsctrl.c (original)
+++ trunk/reactos/drivers/filesystems/np/fsctrl.c Sun May 21 17:19:10 2006
@@ -25,14 +25,14 @@
Waiter = (PNPFS_WAITER_ENTRY)&Irp->Tail.Overlay.DriverContext;
DPRINT1("NpfsListeningCancelRoutine() called for <%wZ>\n",
- &Waiter->Ccb->Pipe->PipeName);
+ &Waiter->Ccb->Fcb->PipeName);
IoReleaseCancelSpinLock(Irp->CancelIrql);
- KeLockMutex(&Waiter->Ccb->Pipe->CcbListLock);
+ KeLockMutex(&Waiter->Ccb->Fcb->CcbListLock);
RemoveEntryList(&Waiter->Entry);
- KeUnlockMutex(&Waiter->Ccb->Pipe->CcbListLock);
+ KeUnlockMutex(&Waiter->Ccb->Fcb->CcbListLock);
Irp->IoStatus.Status = STATUS_CANCELLED;
Irp->IoStatus.Information = 0;
@@ -51,17 +51,17 @@
Entry->Ccb = Ccb;
- KeLockMutex(&Ccb->Pipe->CcbListLock);
+ KeLockMutex(&Ccb->Fcb->CcbListLock);
IoMarkIrpPending(Irp);
- InsertTailList(&Ccb->Pipe->WaiterListHead, &Entry->Entry);
+ InsertTailList(&Ccb->Fcb->WaiterListHead, &Entry->Entry);
IoAcquireCancelSpinLock(&oldIrql);
if (!Irp->Cancel)
{
(void)IoSetCancelRoutine(Irp, NpfsListeningCancelRoutine);
IoReleaseCancelSpinLock(oldIrql);
- KeUnlockMutex(&Ccb->Pipe->CcbListLock);
+ KeUnlockMutex(&Ccb->Fcb->CcbListLock);
return STATUS_PENDING;
}
IoReleaseCancelSpinLock(oldIrql);
@@ -71,7 +71,7 @@
Irp->IoStatus.Status = STATUS_CANCELLED;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
- KeUnlockMutex(&Ccb->Pipe->CcbListLock);
+ KeUnlockMutex(&Ccb->Fcb->CcbListLock);
return STATUS_CANCELLED;
}
@@ -81,8 +81,8 @@
NpfsConnectPipe(PIRP Irp,
PNPFS_CCB Ccb)
{
- PNPFS_PIPE Pipe;
PLIST_ENTRY current_entry;
+ PNPFS_FCB Fcb;
PNPFS_CCB ClientCcb;
NTSTATUS Status;
@@ -99,13 +99,13 @@
DPRINT("Waiting for connection...\n");
- Pipe = Ccb->Pipe;
+ Fcb = Ccb->Fcb;
/* search for a listening client fcb */
- KeLockMutex(&Pipe->CcbListLock);
-
- current_entry = Pipe->ClientCcbListHead.Flink;
- while (current_entry != &Pipe->ClientCcbListHead)
+ KeLockMutex(&Fcb->CcbListLock);
+
+ current_entry = Fcb->ClientCcbListHead.Flink;
+ while (current_entry != &Fcb->ClientCcbListHead)
{
ClientCcb = CONTAINING_RECORD(current_entry,
NPFS_CCB,
@@ -133,7 +133,7 @@
Ccb->PipeState = FILE_PIPE_CONNECTED_STATE;
ClientCcb->PipeState = FILE_PIPE_CONNECTED_STATE;
- KeUnlockMutex(&Pipe->CcbListLock);
+ KeUnlockMutex(&Fcb->CcbListLock);
/* FIXME: create and initialize data queues */
@@ -155,7 +155,7 @@
Status = NpfsAddListeningServerInstance(Irp, Ccb);
- KeUnlockMutex(&Pipe->CcbListLock);
+ KeUnlockMutex(&Fcb->CcbListLock);
DPRINT("NpfsConnectPipe() done (Status %lx)\n", Status);
@@ -167,14 +167,14 @@
NpfsDisconnectPipe(PNPFS_CCB Ccb)
{
NTSTATUS Status;
+ PNPFS_FCB Fcb;
PNPFS_CCB OtherSide;
- PNPFS_PIPE Pipe;
BOOLEAN Server;
DPRINT("NpfsDisconnectPipe()\n");
- Pipe = Ccb->Pipe;
- KeLockMutex(&Pipe->CcbListLock);
+ Fcb = Ccb->Fcb;
+ KeLockMutex(&Fcb->CcbListLock);
if (Ccb->PipeState == FILE_PIPE_DISCONNECTED_STATE)
{
@@ -225,8 +225,8 @@
BOOLEAN Complete = FALSE;
PIRP Irp = NULL;
- Entry = Ccb->Pipe->WaiterListHead.Flink;
- while (Entry != &Ccb->Pipe->WaiterListHead)
+ Entry = Ccb->Fcb->WaiterListHead.Flink;
+ while (Entry != &Ccb->Fcb->WaiterListHead)
{
WaitEntry = CONTAINING_RECORD(Entry, NPFS_WAITER_ENTRY, Entry);
if (WaitEntry->Ccb == Ccb)
@@ -259,7 +259,7 @@
{
Status = STATUS_UNSUCCESSFUL;
}
- KeUnlockMutex(&Pipe->CcbListLock);
+ KeUnlockMutex(&Fcb->CcbListLock);
return Status;
}
@@ -268,8 +268,8 @@
NpfsWaitPipe(PIRP Irp,
PNPFS_CCB Ccb)
{
- PNPFS_PIPE Pipe;
PLIST_ENTRY current_entry;
+ PNPFS_FCB Fcb;
PNPFS_CCB ServerCcb;
PFILE_PIPE_WAIT_FOR_BUFFER WaitPipe;
NTSTATUS Status;
@@ -277,7 +277,7 @@
DPRINT("NpfsWaitPipe\n");
WaitPipe = (PFILE_PIPE_WAIT_FOR_BUFFER)Irp->AssociatedIrp.SystemBuffer;
- Pipe = Ccb->Pipe;
+ Fcb = Ccb->Fcb;
if (Ccb->PipeState != 0)
{
@@ -286,8 +286,8 @@
}
/* search for listening server */
- current_entry = Pipe->ServerCcbListHead.Flink;
- while (current_entry != &Pipe->ServerCcbListHead)
+ current_entry = Fcb->ServerCcbListHead.Flink;
+ while (current_entry != &Fcb->ServerCcbListHead)
{
ServerCcb = CONTAINING_RECORD(current_entry,
NPFS_CCB,
@@ -339,8 +339,8 @@
PIO_STACK_LOCATION IoStack)
{
ULONG OutputBufferLength;
- PNPFS_PIPE Pipe;
PFILE_PIPE_PEEK_BUFFER Reply;
+ PNPFS_FCB Fcb;
PNPFS_CCB Ccb;
NTSTATUS Status;
@@ -358,7 +358,7 @@
Ccb = IoStack->FileObject->FsContext2;
Reply = (PFILE_PIPE_PEEK_BUFFER)Irp->AssociatedIrp.SystemBuffer;
- Pipe = Ccb->Pipe;
+ Fcb = Ccb->Fcb;
Reply->NamedPipeState = Ccb->PipeState;
@@ -389,7 +389,7 @@
PFILE_OBJECT FileObject;
NTSTATUS Status;
PNPFS_DEVICE_EXTENSION DeviceExt;
- PNPFS_PIPE Pipe;
+ PNPFS_FCB Fcb;
PNPFS_CCB Ccb;
DPRINT("NpfsFileSystemContol(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
@@ -401,9 +401,9 @@
DPRINT("FileObject: %p\n", FileObject);
Ccb = FileObject->FsContext2;
DPRINT("CCB: %p\n", Ccb);
- Pipe = Ccb->Pipe;
- DPRINT("Pipe: %p\n", Pipe);
- DPRINT("PipeName: %wZ\n", &Pipe->PipeName);
+ Fcb = Ccb->Fcb;
+ DPRINT("Pipe: %p\n", Fcb);
+ DPRINT("PipeName: %wZ\n", &Fcb->PipeName);
Irp->IoStatus.Information = 0;
@@ -415,17 +415,17 @@
break;
case FSCTL_PIPE_DISCONNECT:
- DPRINT("Disconnecting pipe %wZ\n", &Pipe->PipeName);
+ DPRINT("Disconnecting pipe %wZ\n", &Fcb->PipeName);
Status = NpfsDisconnectPipe(Ccb);
break;
case FSCTL_PIPE_LISTEN:
- DPRINT("Connecting pipe %wZ\n", &Pipe->PipeName);
+ DPRINT("Connecting pipe %wZ\n", &Fcb->PipeName);
Status = NpfsConnectPipe(Irp, Ccb);
break;
case FSCTL_PIPE_PEEK:
- DPRINT("Peeking pipe %wZ\n", &Pipe->PipeName);
+ DPRINT("Peeking pipe %wZ\n", &Fcb->PipeName);
Status = NpfsPeekPipe(Irp, (PIO_STACK_LOCATION)IoStack);
break;
@@ -442,7 +442,7 @@
break;
case FSCTL_PIPE_WAIT:
- DPRINT("Waiting for pipe %wZ\n", &Pipe->PipeName);
+ DPRINT("Waiting for pipe %wZ\n", &Fcb->PipeName);
Status = NpfsWaitPipe(Irp, Ccb);
break;
Modified: trunk/reactos/drivers/filesystems/np/npfs.h
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/filesystems/np/npfs…
==============================================================================
--- trunk/reactos/drivers/filesystems/np/npfs.h (original)
+++ trunk/reactos/drivers/filesystems/np/npfs.h Sun May 21 17:19:10 2006
@@ -15,8 +15,9 @@
ULONG MaxQuota;
} NPFS_DEVICE_EXTENSION, *PNPFS_DEVICE_EXTENSION;
-typedef struct _NPFS_PIPE
+typedef struct _NPFS_FCB
{
+ FSRTL_COMMON_FCB_HEADER RFCB;
UNICODE_STRING PipeName;
LIST_ENTRY PipeListEntry;
KMUTEX CcbListLock;
@@ -34,14 +35,14 @@
ULONG InboundQuota;
ULONG OutboundQuota;
LARGE_INTEGER TimeOut;
-} NPFS_PIPE, *PNPFS_PIPE;
+} NPFS_FCB, *PNPFS_FCB;
typedef struct _NPFS_CCB
{
LIST_ENTRY CcbListEntry;
struct _NPFS_CCB* OtherSide;
struct ETHREAD *Thread;
- PNPFS_PIPE Pipe;
+ PNPFS_FCB Fcb;
KEVENT ConnectEvent;
KEVENT ReadEvent;
KEVENT WriteEvent;
Modified: trunk/reactos/drivers/filesystems/np/rw.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/filesystems/np/rw.c…
==============================================================================
--- trunk/reactos/drivers/filesystems/np/rw.c (original)
+++ trunk/reactos/drivers/filesystems/np/rw.c Sun May 21 17:19:10 2006
@@ -414,7 +414,7 @@
KeSetEvent(&Ccb->OtherSide->WriteEvent, IO_NO_INCREMENT, FALSE);
}
if (Information > 0 &&
- (Ccb->Pipe->ReadMode != FILE_PIPE_BYTE_STREAM_MODE ||
+ (Ccb->Fcb->ReadMode != FILE_PIPE_BYTE_STREAM_MODE ||
Ccb->PipeState != FILE_PIPE_CONNECTED_STATE))
{
break;
@@ -430,13 +430,13 @@
{
/* Wait for ReadEvent to become signaled */
- DPRINT("Waiting for readable data (%wZ)\n",
&Ccb->Pipe->PipeName);
+ DPRINT("Waiting for readable data (%wZ)\n",
&Ccb->Fcb->PipeName);
Status = KeWaitForSingleObject(&Ccb->ReadEvent,
UserRequest,
KernelMode,
FALSE,
NULL);
- DPRINT("Finished waiting (%wZ)! Status: %x\n",
&Ccb->Pipe->PipeName, Status);
+ DPRINT("Finished waiting (%wZ)! Status: %x\n",
&Ccb->Fcb->PipeName, Status);
ExAcquireFastMutex(&Ccb->DataListLock);
}
else
@@ -455,7 +455,7 @@
}
}
ASSERT(IoGetCurrentIrpStackLocation(Irp)->FileObject != NULL);
- if (Ccb->Pipe->ReadMode == FILE_PIPE_BYTE_STREAM_MODE)
+ if (Ccb->Fcb->ReadMode == FILE_PIPE_BYTE_STREAM_MODE)
{
DPRINT("Byte stream mode\n");
/* Byte stream mode */
@@ -603,9 +603,9 @@
{
PIO_STACK_LOCATION IoStack;
PFILE_OBJECT FileObject;
+ PNPFS_FCB Fcb = NULL;
PNPFS_CCB Ccb = NULL;
PNPFS_CCB ReaderCcb;
- PNPFS_PIPE Pipe = NULL;
PUCHAR Buffer;
NTSTATUS Status = STATUS_SUCCESS;
ULONG Length;
@@ -623,7 +623,7 @@
Ccb = FileObject->FsContext2;
ReaderCcb = Ccb->OtherSide;
- Pipe = Ccb->Pipe;
+ Fcb = Ccb->Fcb;
Length = IoStack->Parameters.Write.Length;
Offset = IoStack->Parameters.Write.ByteOffset.u.LowPart;
@@ -680,13 +680,13 @@
}
ExReleaseFastMutex(&ReaderCcb->DataListLock);
- DPRINT("Waiting for buffer space (%S)\n", Pipe->PipeName.Buffer);
+ DPRINT("Waiting for buffer space (%S)\n", Fcb->PipeName.Buffer);
Status = KeWaitForSingleObject(&Ccb->WriteEvent,
UserRequest,
KernelMode,
FALSE,
NULL);
- DPRINT("Finished waiting (%S)! Status: %x\n", Pipe->PipeName.Buffer,
Status);
+ DPRINT("Finished waiting (%S)! Status: %x\n", Fcb->PipeName.Buffer,
Status);
ExAcquireFastMutex(&ReaderCcb->DataListLock);
/*
@@ -702,7 +702,7 @@
}
}
- if (Pipe->WriteMode == FILE_PIPE_BYTE_STREAM_MODE)
+ if (Fcb->WriteMode == FILE_PIPE_BYTE_STREAM_MODE)
{
DPRINT("Byte stream mode\n");
while (Length > 0 && ReaderCcb->WriteQuotaAvailable > 0)