mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
Major npfs update.
svn path=/trunk/; revision=2118
This commit is contained in:
parent
ab405511d9
commit
a600af1a27
8 changed files with 334 additions and 136 deletions
|
@ -1,53 +1,38 @@
|
|||
# $Id: Makefile,v 1.10 2001/07/28 14:46:27 ea Exp $
|
||||
# $Id: Makefile,v 1.11 2001/07/29 16:40:20 ekohl Exp $
|
||||
#
|
||||
# Named Pipes File System
|
||||
#
|
||||
PATH_TO_TOP=../../..
|
||||
|
||||
TARGETNAME=npfs
|
||||
TARGET = npfs
|
||||
|
||||
CFLAGS=-D__NTDRIVER__ -I../../../include
|
||||
CFLAGS = -D__NTDRIVER__
|
||||
|
||||
OBJECTS=create.o finfo.o fsctrl.o mount.o rw.o volume.o npfs.coff
|
||||
OBJECTS = create.o finfo.o fsctrl.o npfs.o rw.o volume.o npfs.coff
|
||||
|
||||
LIBS=$(PATH_TO_TOP)/ntoskrnl/ntoskrnl.a
|
||||
LIBS = $(PATH_TO_TOP)/ntoskrnl/ntoskrnl.a
|
||||
|
||||
all: $(TARGETNAME).sys
|
||||
all: $(TARGET).sys.unstripped $(TARGET).sys
|
||||
|
||||
.phony: all
|
||||
|
||||
clean:
|
||||
- $(RM) *.o npfs.coff junk.tmp base.tmp temp.exp $(TARGETNAME).sys
|
||||
- $(RM) *.o *.sym $(TARGET).coff junk.tmp base.tmp temp.exp $(TARGET).sys $(TARGET).sys.unstripped
|
||||
|
||||
.phony: clean
|
||||
|
||||
$(TARGETNAME).sys: $(OBJECTS) $(LIBS)
|
||||
$(CC) \
|
||||
-mdll \
|
||||
-o junk.tmp \
|
||||
-Wl,--defsym,_end=end \
|
||||
-Wl,--defsym,_edata=__data_end__ \
|
||||
-Wl,--defsym,_etext=etext \
|
||||
-Wl,--base-file,base.tmp \
|
||||
$(OBJECTS) $(LIBS)
|
||||
$(RM) junk.tmp
|
||||
$(DLLTOOL) \
|
||||
--dllname $(TARGETNAME).sys \
|
||||
--base-file base.tmp \
|
||||
--output-exp temp.exp \
|
||||
--kill-at
|
||||
$(RM) base.tmp
|
||||
$(CC) \
|
||||
--verbose \
|
||||
-Wl,--image-base,0x10000 \
|
||||
-Wl,-e,_DriverEntry@8 \
|
||||
-mdll \
|
||||
-o $(TARGETNAME).sys \
|
||||
$(OBJECTS) $(LIBS) \
|
||||
-Wl,temp.exp
|
||||
$(RM) temp.exp
|
||||
$(NM) --numeric-sort npfs.sys > npfs.sym
|
||||
install: $(FLOPPY_DIR)/drivers/$(TARGET).sys
|
||||
|
||||
$(TARGETNAME).coff: $(PATH_TO_TOP)/include/reactos/buildno.h npfs.rc
|
||||
$(FLOPPY_DIR)/drivers/$(TARGET).sys: $(TARGET).sys
|
||||
$(CP) $(TARGET).sys $(FLOPPY_DIR)/drivers/$(TARGET).sys
|
||||
|
||||
dist: $(PATH_TO_TOP)/$(DIST_DIR)/drivers/$(TARGET).sys
|
||||
|
||||
$(PATH_TO_TOP)/$(DIST_DIR)/drivers/$(TARGET).sys: $(TARGET).sys
|
||||
$(CP) $(TARGET).sys $(PATH_TO_TOP)/$(DIST_DIR)/drivers/$(TARGET).sys
|
||||
|
||||
$(TARGET).sys $(TARGET).sys.unstripped: $(OBJECTS) $(LIBS)
|
||||
|
||||
npfs.coff: $(PATH_TO_TOP)/include/reactos/buildno.h npfs.rc
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: create.c,v 1.7 2001/06/12 12:35:04 ekohl Exp $
|
||||
/* $Id: create.c,v 1.8 2001/07/29 16:40:20 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -30,22 +30,22 @@ NpfsCreate(PDEVICE_OBJECT DeviceObject,
|
|||
PFILE_OBJECT FileObject;
|
||||
NTSTATUS Status;
|
||||
PNPFS_PIPE Pipe;
|
||||
PNPFS_FCB Fcb;
|
||||
PNPFS_FCB ClientFcb;
|
||||
PNPFS_FCB ServerFcb;
|
||||
PNPFS_PIPE current;
|
||||
PLIST_ENTRY current_entry;
|
||||
PNPFS_DEVICE_EXTENSION DeviceExt;
|
||||
KIRQL oldIrql;
|
||||
|
||||
DPRINT1("NpfsCreate(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
|
||||
DPRINT("NpfsCreate(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
|
||||
|
||||
DeviceExt = (PNPFS_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
IoStack = IoGetCurrentIrpStackLocation(Irp);
|
||||
FileObject = IoStack->FileObject;
|
||||
DPRINT("FileObject %p\n", FileObject);
|
||||
|
||||
Fcb = ExAllocatePool(NonPagedPool, sizeof(NPFS_FCB));
|
||||
if (Fcb == NULL)
|
||||
ClientFcb = ExAllocatePool(NonPagedPool, sizeof(NPFS_FCB));
|
||||
if (ClientFcb == NULL)
|
||||
{
|
||||
Irp->IoStatus.Status = STATUS_NO_MEMORY;
|
||||
Irp->IoStatus.Information = 0;
|
||||
|
@ -75,7 +75,7 @@ NpfsCreate(PDEVICE_OBJECT DeviceObject,
|
|||
|
||||
if (current_entry == &DeviceExt->PipeListHead)
|
||||
{
|
||||
ExFreePool(Fcb);
|
||||
ExFreePool(ClientFcb);
|
||||
KeUnlockMutex(&DeviceExt->PipeListLock);
|
||||
|
||||
Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
|
||||
|
@ -88,65 +88,62 @@ NpfsCreate(PDEVICE_OBJECT DeviceObject,
|
|||
|
||||
Pipe = current;
|
||||
|
||||
Fcb->WriteModeMessage = FALSE;
|
||||
Fcb->ReadModeMessage = FALSE;
|
||||
Fcb->NonBlocking = FALSE;
|
||||
Fcb->InBufferSize = PAGESIZE;
|
||||
Fcb->OutBufferSize = PAGESIZE;
|
||||
Fcb->Pipe = Pipe;
|
||||
Fcb->IsServer = FALSE;
|
||||
Fcb->OtherSide = NULL;
|
||||
|
||||
/* search for disconnected server fcb */
|
||||
|
||||
current_entry = Pipe->FcbListHead.Flink;
|
||||
while (current_entry != &Pipe->FcbListHead)
|
||||
{
|
||||
ServerFcb = CONTAINING_RECORD(current_entry,
|
||||
NPFS_FCB,
|
||||
FcbListEntry);
|
||||
|
||||
DPRINT("ServerFcb->IsServer: %x\n", ServerFcb->IsServer);
|
||||
DPRINT("ServerFcb->OtherSide: %p\n", ServerFcb->OtherSide);
|
||||
if ((ServerFcb->IsServer == TRUE) && (ServerFcb->OtherSide == NULL))
|
||||
{
|
||||
DPRINT("Server found! Fcb %p\n", ServerFcb);
|
||||
break;
|
||||
}
|
||||
|
||||
current_entry = current_entry->Flink;
|
||||
}
|
||||
ClientFcb->Pipe = Pipe;
|
||||
ClientFcb->PipeEnd = FILE_PIPE_CLIENT_END;
|
||||
ClientFcb->OtherSide = NULL;
|
||||
ClientFcb->PipeState = FILE_PIPE_DISCONNECTED_STATE;
|
||||
|
||||
KeInitializeEvent(&ClientFcb->ConnectEvent,
|
||||
SynchronizationEvent,
|
||||
FALSE);
|
||||
|
||||
if (current_entry == &Pipe->FcbListHead)
|
||||
{
|
||||
DPRINT("No server fcb found!\n");
|
||||
|
||||
ExFreePool(Fcb);
|
||||
KeUnlockMutex(&DeviceExt->PipeListLock);
|
||||
|
||||
Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
|
||||
Irp->IoStatus.Information = 0;
|
||||
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
|
||||
KeAcquireSpinLock(&Pipe->FcbListLock, &oldIrql);
|
||||
InsertTailList(&Pipe->FcbListHead, &Fcb->FcbListEntry);
|
||||
InsertTailList(&Pipe->ClientFcbListHead, &ClientFcb->FcbListEntry);
|
||||
KeReleaseSpinLock(&Pipe->FcbListLock, oldIrql);
|
||||
|
||||
Pipe->ReferenceCount++;
|
||||
|
||||
|
||||
Fcb->OtherSide = ServerFcb;
|
||||
ServerFcb->OtherSide = Fcb;
|
||||
|
||||
KeSetEvent(&ServerFcb->ConnectEvent, 0, FALSE);
|
||||
|
||||
KeUnlockMutex(&DeviceExt->PipeListLock);
|
||||
|
||||
FileObject->FsContext = Fcb;
|
||||
/* search for disconnected or listening server fcb */
|
||||
current_entry = Pipe->ServerFcbListHead.Flink;
|
||||
while (current_entry != &Pipe->ServerFcbListHead)
|
||||
{
|
||||
ServerFcb = CONTAINING_RECORD(current_entry,
|
||||
NPFS_FCB,
|
||||
FcbListEntry);
|
||||
if ((ServerFcb->PipeState == FILE_PIPE_LISTENING_STATE)
|
||||
|| (ServerFcb->PipeState == FILE_PIPE_DISCONNECTED_STATE))
|
||||
{
|
||||
DPRINT("Server found! Fcb %p\n", ServerFcb);
|
||||
break;
|
||||
}
|
||||
current_entry = current_entry->Flink;
|
||||
}
|
||||
|
||||
if (current_entry == &Pipe->ServerFcbListHead)
|
||||
{
|
||||
DPRINT("No server fcb found!\n");
|
||||
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Information = 0;
|
||||
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
ClientFcb->OtherSide = ServerFcb;
|
||||
ServerFcb->OtherSide = ClientFcb;
|
||||
ClientFcb->PipeState = FILE_PIPE_CONNECTED_STATE;
|
||||
ServerFcb->PipeState = FILE_PIPE_CONNECTED_STATE;
|
||||
|
||||
/* FIXME: create data queue(s) */
|
||||
|
||||
/* wake server thread */
|
||||
KeSetEvent(&ServerFcb->ConnectEvent, 0, FALSE);
|
||||
|
||||
FileObject->FsContext = ClientFcb;
|
||||
|
||||
Irp->IoStatus.Status = Status;
|
||||
Irp->IoStatus.Information = 0;
|
||||
|
@ -220,11 +217,19 @@ NpfsCreateNamedPipe(PDEVICE_OBJECT DeviceObject,
|
|||
}
|
||||
|
||||
Pipe->ReferenceCount = 0;
|
||||
InitializeListHead(&Pipe->FcbListHead);
|
||||
InitializeListHead(&Pipe->ServerFcbListHead);
|
||||
InitializeListHead(&Pipe->ClientFcbListHead);
|
||||
KeInitializeSpinLock(&Pipe->FcbListLock);
|
||||
|
||||
Pipe->MaxInstances = Buffer->MaxInstances;
|
||||
Pipe->PipeType = Buffer->WriteModeMessage;
|
||||
Pipe->PipeReadMode = Buffer->ReadModeMessage;
|
||||
Pipe->PipeBlockMode = Buffer->NonBlocking;
|
||||
Pipe->PipeConfiguration = IoStack->Parameters.Create.Options & 0x3;
|
||||
Pipe->MaximumInstances = Buffer->MaxInstances;
|
||||
Pipe->CurrentInstances = 0;
|
||||
Pipe->TimeOut = Buffer->TimeOut;
|
||||
Pipe->InboundQuota = Buffer->InBufferSize;
|
||||
Pipe->OutboundQuota = Buffer->OutBufferSize;
|
||||
|
||||
KeLockMutex(&DeviceExt->PipeListLock);
|
||||
current_entry = DeviceExt->PipeListHead.Flink;
|
||||
|
@ -254,21 +259,21 @@ NpfsCreateNamedPipe(PDEVICE_OBJECT DeviceObject,
|
|||
InsertTailList(&DeviceExt->PipeListHead, &Pipe->PipeListEntry);
|
||||
}
|
||||
Pipe->ReferenceCount++;
|
||||
Pipe->CurrentInstances++;
|
||||
|
||||
KeAcquireSpinLock(&Pipe->FcbListLock, &oldIrql);
|
||||
InsertTailList(&Pipe->FcbListHead, &Fcb->FcbListEntry);
|
||||
InsertTailList(&Pipe->ServerFcbListHead, &Fcb->FcbListEntry);
|
||||
KeReleaseSpinLock(&Pipe->FcbListLock, oldIrql);
|
||||
|
||||
Fcb->WriteModeMessage = Buffer->WriteModeMessage;
|
||||
Fcb->ReadModeMessage = Buffer->ReadModeMessage;
|
||||
Fcb->NonBlocking = Buffer->NonBlocking;
|
||||
Fcb->InBufferSize = Buffer->InBufferSize;
|
||||
Fcb->OutBufferSize = Buffer->OutBufferSize;
|
||||
|
||||
Fcb->Pipe = Pipe;
|
||||
Fcb->IsServer = TRUE;
|
||||
Fcb->PipeEnd = FILE_PIPE_SERVER_END;
|
||||
Fcb->OtherSide = NULL;
|
||||
|
||||
Fcb->PipeState = FILE_PIPE_DISCONNECTED_STATE;
|
||||
Fcb->ReadDataAvailable = 0;
|
||||
Fcb->WriteQuotaAvailable = 0;
|
||||
// Fcb->InBuffer = NULL;
|
||||
// Fcb->OutBuffer = NULL;
|
||||
|
||||
KeInitializeEvent(&Fcb->ConnectEvent,
|
||||
SynchronizationEvent,
|
||||
FALSE);
|
||||
|
@ -309,11 +314,26 @@ NpfsClose(PDEVICE_OBJECT DeviceObject,
|
|||
|
||||
KeLockMutex(&DeviceExt->PipeListLock);
|
||||
|
||||
if (Fcb->PipeEnd == FILE_PIPE_SERVER_END)
|
||||
{
|
||||
/* FIXME: Clean up existing connections here ?? */
|
||||
Pipe->CurrentInstances--;
|
||||
}
|
||||
Pipe->ReferenceCount--;
|
||||
|
||||
if ((Fcb->PipeEnd == FILE_PIPE_CLIENT_END)
|
||||
&& (Fcb->PipeState == FILE_PIPE_CONNECTED_STATE))
|
||||
{
|
||||
Fcb->OtherSide->PipeState = FILE_PIPE_CLOSING_STATE;
|
||||
Fcb->OtherSide->OtherSide = NULL;
|
||||
Fcb->OtherSide = NULL;
|
||||
Fcb->PipeState = FILE_PIPE_DISCONNECTED_STATE;
|
||||
}
|
||||
|
||||
KeAcquireSpinLock(&Pipe->FcbListLock, &oldIrql);
|
||||
RemoveEntryList(&Fcb->FcbListEntry);
|
||||
KeReleaseSpinLock(&Pipe->FcbListLock, oldIrql);
|
||||
|
||||
ExFreePool(Fcb);
|
||||
FileObject->FsContext = NULL;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: finfo.c,v 1.1 2001/06/12 12:35:04 ekohl Exp $
|
||||
/* $Id: finfo.c,v 1.2 2001/07/29 16:40:20 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -20,6 +20,45 @@
|
|||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
static NTSTATUS
|
||||
NpfsQueryLocalInformation(PDEVICE_OBJECT DeviceObject,
|
||||
PNPFS_FCB Fcb,
|
||||
PFILE_PIPE_LOCAL_INFORMATION Info,
|
||||
PULONG BufferLength)
|
||||
{
|
||||
PNPFS_PIPE Pipe;
|
||||
|
||||
DPRINT("NpfsQueryLocalInformation()\n");
|
||||
|
||||
Pipe = Fcb->Pipe;
|
||||
|
||||
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->NamedPipeState = Fcb->PipeState;
|
||||
Info->NamedPipeEnd = Fcb->PipeEnd;
|
||||
|
||||
if (Fcb->PipeEnd == FILE_PIPE_SERVER_END)
|
||||
{
|
||||
Info->ReadDataAvailable = Fcb->ReadDataAvailable;
|
||||
Info->WriteQuotaAvailable = Fcb->WriteQuotaAvailable;
|
||||
}
|
||||
else if (Fcb->OtherSide != NULL)
|
||||
{
|
||||
Info->ReadDataAvailable = Fcb->OtherSide->ReadDataAvailable;
|
||||
Info->WriteQuotaAvailable = Fcb->OtherSide->WriteQuotaAvailable;
|
||||
}
|
||||
|
||||
*BufferLength -= sizeof(FILE_PIPE_LOCAL_INFORMATION);
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS STDCALL
|
||||
NpfsQueryInformation(PDEVICE_OBJECT DeviceObject,
|
||||
|
@ -57,12 +96,18 @@ NpfsQueryInformation(PDEVICE_OBJECT DeviceObject,
|
|||
case FilePipeInformation:
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
break;
|
||||
|
||||
case FilePipeLocalInformation:
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
Status = NpfsQueryLocalInformation(DeviceObject,
|
||||
Fcb,
|
||||
SystemBuffer,
|
||||
&BufferLength);
|
||||
break;
|
||||
|
||||
case FilePipeRemoteInformation:
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
break;
|
||||
|
||||
default:
|
||||
Status = STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: fsctrl.c,v 1.4 2001/06/12 12:35:04 ekohl Exp $
|
||||
/* $Id: fsctrl.c,v 1.5 2001/07/29 16:40:20 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -22,38 +22,129 @@
|
|||
static NTSTATUS
|
||||
NpfsConnectPipe(PNPFS_FCB Fcb)
|
||||
{
|
||||
PNPFS_PIPE Pipe;
|
||||
PLIST_ENTRY current_entry;
|
||||
PNPFS_FCB ClientFcb;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("NpfsConnectPipe()\n");
|
||||
|
||||
if (Fcb->PipeState == FILE_PIPE_CONNECTED_STATE)
|
||||
return STATUS_PIPE_CONNECTED;
|
||||
|
||||
if (Fcb->PipeState == FILE_PIPE_CLOSING_STATE)
|
||||
return STATUS_PIPE_CLOSING;
|
||||
|
||||
/*
|
||||
* Acceptable states are: FILE_PIPE_DISCONNECTED_STATE and
|
||||
* FILE_PIPE_LISTENING_STATE
|
||||
*/
|
||||
|
||||
DPRINT("Waiting for connection...\n");
|
||||
|
||||
Status = KeWaitForSingleObject(&Fcb->ConnectEvent,
|
||||
UserRequest,
|
||||
KernelMode,
|
||||
FALSE,
|
||||
NULL);
|
||||
Pipe = Fcb->Pipe;
|
||||
|
||||
Fcb->PipeState = FILE_PIPE_LISTENING_STATE;
|
||||
|
||||
/* search for a listening client fcb */
|
||||
|
||||
current_entry = Pipe->ClientFcbListHead.Flink;
|
||||
while (current_entry != &Pipe->ClientFcbListHead)
|
||||
{
|
||||
ClientFcb = CONTAINING_RECORD(current_entry,
|
||||
NPFS_FCB,
|
||||
FcbListEntry);
|
||||
|
||||
if (ClientFcb->PipeState == FILE_PIPE_LISTENING_STATE)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
current_entry = current_entry->Flink;
|
||||
}
|
||||
|
||||
if (current_entry != &Pipe->ClientFcbListHead)
|
||||
{
|
||||
/* found a listening client fcb */
|
||||
DPRINT("Listening client fcb found -- connecting\n");
|
||||
|
||||
/* connect client and server fcb's */
|
||||
Fcb->OtherSide = ClientFcb;
|
||||
ClientFcb->OtherSide = Fcb;
|
||||
|
||||
/* set connected state */
|
||||
Fcb->PipeState = FILE_PIPE_CONNECTED_STATE;
|
||||
ClientFcb->PipeState = FILE_PIPE_CONNECTED_STATE;
|
||||
|
||||
/* FIXME: create and initialize data queues */
|
||||
|
||||
/* signal client's connect event */
|
||||
KeSetEvent(&ClientFcb->ConnectEvent, IO_NO_INCREMENT, FALSE);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
/* no listening client fcb found */
|
||||
DPRINT("No listening client fcb found -- waiting for client\n");
|
||||
Status = KeWaitForSingleObject(&Fcb->ConnectEvent,
|
||||
UserRequest,
|
||||
KernelMode,
|
||||
FALSE,
|
||||
NULL);
|
||||
|
||||
DPRINT("Finished waiting! Status: %x\n", Status);
|
||||
}
|
||||
|
||||
DPRINT("Finished waiting! Status: %x\n", Status);
|
||||
|
||||
DPRINT("Client Fcb: %p\n", Fcb->OtherSide);
|
||||
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
return STATUS_PIPE_CONNECTED;
|
||||
}
|
||||
|
||||
|
||||
static NTSTATUS
|
||||
NpfsDisconnectPipe(PNPFS_FCB Fcb)
|
||||
{
|
||||
PNPFS_FCB ServerFcb;
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
DPRINT("NpfsDisconnectPipe()\n");
|
||||
|
||||
if (Fcb->PipeState == FILE_PIPE_DISCONNECTED_STATE)
|
||||
return(STATUS_SUCCESS);
|
||||
|
||||
if (Fcb->PipeState == FILE_PIPE_CONNECTED_STATE)
|
||||
{
|
||||
Fcb->PipeState = FILE_PIPE_DISCONNECTED_STATE;
|
||||
Fcb->OtherSide->PipeState = FILE_PIPE_DISCONNECTED_STATE;
|
||||
|
||||
/* FIXME: remove data queue(s) */
|
||||
|
||||
Fcb->OtherSide->OtherSide = NULL;
|
||||
Fcb->OtherSide = NULL;
|
||||
|
||||
DPRINT("Pipe disconnected\n");
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
if (Fcb->PipeState == FILE_PIPE_CLOSING_STATE)
|
||||
{
|
||||
Fcb->PipeState = FILE_PIPE_DISCONNECTED_STATE;
|
||||
|
||||
/* FIXME: remove data queue(s) */
|
||||
|
||||
DPRINT("Pipe disconnected\n");
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
|
||||
|
||||
static NTSTATUS
|
||||
NpfsWaitPipe(PNPFS_FCB Fcb)
|
||||
{
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
DPRINT("NpfsWaitPipe\n");
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
|
@ -72,10 +163,14 @@ NpfsFileSystemControl(PDEVICE_OBJECT DeviceObject,
|
|||
|
||||
DeviceExt = (PNPFS_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
IoStack = IoGetCurrentIrpStackLocation(Irp);
|
||||
DPRINT("IoStack: %p\n", IoStack);
|
||||
FileObject = IoStack->FileObject;
|
||||
DPRINT("FileObject: %p\n", FileObject);
|
||||
Fcb = FileObject->FsContext;
|
||||
DPRINT("Fcb: %p\n", Fcb);
|
||||
Pipe = Fcb->Pipe;
|
||||
DPRINT("Pipe: %p\n", Pipe);
|
||||
DPRINT("PipeName: %wZ\n", &Pipe->PipeName);
|
||||
|
||||
switch (IoStack->Parameters.FileSystemControl.IoControlCode)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: mount.c,v 1.8 2001/06/12 12:35:04 ekohl Exp $
|
||||
/* $Id: npfs.c,v 1.1 2001/07/29 16:40:20 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef __SERVICES_FS_NP_NPFS_H
|
||||
#define __SERVICES_FS_NP_NPFS_H
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
LIST_ENTRY PipeListHead;
|
||||
|
@ -12,24 +13,30 @@ typedef struct
|
|||
UNICODE_STRING PipeName;
|
||||
LIST_ENTRY PipeListEntry;
|
||||
KSPIN_LOCK FcbListLock;
|
||||
LIST_ENTRY FcbListHead;
|
||||
LIST_ENTRY ServerFcbListHead;
|
||||
LIST_ENTRY ClientFcbListHead;
|
||||
ULONG ReferenceCount;
|
||||
ULONG MaxInstances;
|
||||
ULONG PipeType;
|
||||
ULONG PipeReadMode;
|
||||
ULONG PipeBlockMode;
|
||||
ULONG PipeConfiguration;
|
||||
ULONG MaximumInstances;
|
||||
ULONG CurrentInstances;
|
||||
ULONG InboundQuota;
|
||||
ULONG OutboundQuota;
|
||||
LARGE_INTEGER TimeOut;
|
||||
} NPFS_PIPE, *PNPFS_PIPE;
|
||||
|
||||
typedef struct _NPFS_FCB
|
||||
{
|
||||
LIST_ENTRY FcbListEntry;
|
||||
BOOLEAN WriteModeMessage;
|
||||
BOOLEAN ReadModeMessage;
|
||||
BOOLEAN NonBlocking;
|
||||
ULONG InBufferSize;
|
||||
ULONG OutBufferSize;
|
||||
PNPFS_PIPE Pipe;
|
||||
struct _NPFS_FCB* OtherSide;
|
||||
BOOLEAN IsServer;
|
||||
PNPFS_PIPE Pipe;
|
||||
KEVENT ConnectEvent;
|
||||
ULONG PipeEnd;
|
||||
ULONG PipeState;
|
||||
ULONG ReadDataAvailable;
|
||||
ULONG WriteQuotaAvailable;
|
||||
} NPFS_FCB, *PNPFS_FCB;
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: rw.c,v 1.2 2001/05/01 11:09:01 ekohl Exp $
|
||||
/* $Id: rw.c,v 1.3 2001/07/29 16:40:20 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -32,6 +32,8 @@ NpfsRead(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
|||
// PNPFS_CONTEXT current;
|
||||
ULONG Information;
|
||||
|
||||
DPRINT1("NpfsRead()\n");
|
||||
|
||||
DeviceExt = (PNPFS_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
IoStack = IoGetCurrentIrpStackLocation(Irp);
|
||||
FileObject = IoStack->FileObject;
|
||||
|
@ -88,18 +90,36 @@ NTSTATUS STDCALL
|
|||
NpfsWrite(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
PIO_STACK_LOCATION IoStack;
|
||||
PFILE_OBJECT FileObject;
|
||||
PNPFS_FCB Fcb = NULL;
|
||||
PNPFS_PIPE Pipe = NULL;
|
||||
PUCHAR Buffer;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
ULONG Length;
|
||||
ULONG Offset;
|
||||
|
||||
DPRINT1("NpfsWrite()\n");
|
||||
DPRINT("NpfsWrite()\n");
|
||||
|
||||
Status = STATUS_SUCCESS;
|
||||
IoStack = IoGetCurrentIrpStackLocation(Irp);
|
||||
FileObject = IoStack->FileObject;
|
||||
DPRINT("FileObject %p\n", FileObject);
|
||||
DPRINT("Pipe name %wZ\n", &FileObject->FileName);
|
||||
|
||||
Irp->IoStatus.Status = Status;
|
||||
Irp->IoStatus.Information = 0;
|
||||
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
||||
return(Status);
|
||||
Fcb = FileObject->FsContext;
|
||||
Pipe = Fcb->Pipe;
|
||||
|
||||
Length = IoStack->Parameters.Write.Length;
|
||||
Buffer = MmGetSystemAddressForMdl (Irp->MdlAddress);
|
||||
Offset = IoStack->Parameters.Write.ByteOffset.u.LowPart;
|
||||
|
||||
|
||||
Irp->IoStatus.Status = Status;
|
||||
Irp->IoStatus.Information = Length;
|
||||
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
||||
return(Status);
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -153,4 +153,30 @@ typedef struct _NPFS_GET_STATE
|
|||
LARGE_INTEGER Timeout;
|
||||
} NPFS_GET_STATE, *PNPFS_GET_STATE;
|
||||
|
||||
|
||||
#define FILE_PIPE_BYTE_STREAM_TYPE 0x00000000
|
||||
#define FILE_PIPE_MESSAGE_TYPE 0x00000001
|
||||
|
||||
#define FILE_PIPE_BYTE_STREAM_MODE 0x00000000
|
||||
#define FILE_PIPE_MESSAGE_MODE 0x00000001
|
||||
|
||||
#define FILE_PIPE_QUEUE_OPERATION 0x00000000
|
||||
#define FILE_PIPE_COMPLETE_OPERATION 0x00000001
|
||||
|
||||
#define FILE_PIPE_INBOUND 0x00000000
|
||||
#define FILE_PIPE_OUTBOUND 0x00000001
|
||||
#define FILE_PIPE_FULL_DUPLEX 0x00000002
|
||||
|
||||
#define FILE_PIPE_DISCONNECTED_STATE 0x00000001
|
||||
#define FILE_PIPE_LISTENING_STATE 0x00000002
|
||||
#define FILE_PIPE_CONNECTED_STATE 0x00000003
|
||||
#define FILE_PIPE_CLOSING_STATE 0x00000004
|
||||
|
||||
#define FILE_PIPE_CLIENT_END 0x00000000
|
||||
#define FILE_PIPE_SERVER_END 0x00000001
|
||||
|
||||
#define FILE_PIPE_READ_DATA 0x00000000
|
||||
#define FILE_PIPE_WRITE_SPACE 0x00000001
|
||||
|
||||
|
||||
#endif /* __INCLUDE_NAPI_NPIPE_H */
|
||||
|
|
Loading…
Reference in a new issue