mirror of
https://github.com/reactos/reactos.git
synced 2024-11-11 01:04:11 +00:00
c424146e2c
svn path=/branches/cmake-bringup/; revision=48236
90 lines
3 KiB
C
90 lines
3 KiB
C
/*
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
* PROJECT: ReactOS kernel
|
|
* FILE: drivers/fs/np/mount.c
|
|
* PURPOSE: Named pipe filesystem
|
|
* PROGRAMMER: David Welch <welch@cwcom.net>
|
|
*/
|
|
|
|
/* INCLUDES ******************************************************************/
|
|
|
|
#include "npfs.h"
|
|
|
|
#define NDEBUG
|
|
#include <debug.h>
|
|
|
|
/* FUNCTIONS *****************************************************************/
|
|
|
|
NTSTATUS NTAPI
|
|
DriverEntry(PDRIVER_OBJECT DriverObject,
|
|
PUNICODE_STRING RegistryPath)
|
|
{
|
|
PNPFS_DEVICE_EXTENSION DeviceExtension;
|
|
PDEVICE_OBJECT DeviceObject;
|
|
UNICODE_STRING DeviceName;
|
|
NTSTATUS Status;
|
|
|
|
DPRINT("Named Pipe FSD 0.0.2\n");
|
|
|
|
ASSERT (sizeof(NPFS_CONTEXT) <= FIELD_OFFSET(IRP, Tail.Overlay.DriverContext));
|
|
ASSERT (sizeof(NPFS_WAITER_ENTRY) <= FIELD_OFFSET(IRP, Tail.Overlay.DriverContext));
|
|
|
|
DriverObject->MajorFunction[IRP_MJ_CREATE] = NpfsCreate;
|
|
DriverObject->MajorFunction[IRP_MJ_CREATE_NAMED_PIPE] =
|
|
NpfsCreateNamedPipe;
|
|
DriverObject->MajorFunction[IRP_MJ_CLOSE] = NpfsClose;
|
|
DriverObject->MajorFunction[IRP_MJ_READ] = NpfsRead;
|
|
DriverObject->MajorFunction[IRP_MJ_WRITE] = NpfsWrite;
|
|
DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] =
|
|
NpfsQueryInformation;
|
|
DriverObject->MajorFunction[IRP_MJ_SET_INFORMATION] =
|
|
NpfsSetInformation;
|
|
DriverObject->MajorFunction[IRP_MJ_QUERY_VOLUME_INFORMATION] =
|
|
NpfsQueryVolumeInformation;
|
|
DriverObject->MajorFunction[IRP_MJ_CLEANUP] = NpfsCleanup;
|
|
DriverObject->MajorFunction[IRP_MJ_FLUSH_BUFFERS] = NpfsFlushBuffers;
|
|
// DriverObject->MajorFunction[IRP_MJ_DIRECTORY_CONTROL] =
|
|
// NpfsDirectoryControl;
|
|
DriverObject->MajorFunction[IRP_MJ_FILE_SYSTEM_CONTROL] =
|
|
NpfsFileSystemControl;
|
|
// DriverObject->MajorFunction[IRP_MJ_QUERY_SECURITY] =
|
|
// NpfsQuerySecurity;
|
|
// DriverObject->MajorFunction[IRP_MJ_SET_SECURITY] =
|
|
// NpfsSetSecurity;
|
|
|
|
DriverObject->DriverUnload = NULL;
|
|
|
|
RtlInitUnicodeString(&DeviceName, L"\\Device\\NamedPipe");
|
|
Status = IoCreateDevice(DriverObject,
|
|
sizeof(NPFS_DEVICE_EXTENSION),
|
|
&DeviceName,
|
|
FILE_DEVICE_NAMED_PIPE,
|
|
0,
|
|
FALSE,
|
|
&DeviceObject);
|
|
if (!NT_SUCCESS(Status))
|
|
{
|
|
DPRINT("Failed to create named pipe device! (Status %x)\n", Status);
|
|
return Status;
|
|
}
|
|
|
|
/* initialize the device object */
|
|
DeviceObject->Flags |= DO_DIRECT_IO;
|
|
DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
|
|
|
|
/* initialize the device extension */
|
|
DeviceExtension = DeviceObject->DeviceExtension;
|
|
InitializeListHead(&DeviceExtension->PipeListHead);
|
|
InitializeListHead(&DeviceExtension->ThreadListHead);
|
|
KeInitializeMutex(&DeviceExtension->PipeListLock, 0);
|
|
DeviceExtension->EmptyWaiterCount = 0;
|
|
|
|
/* set the size quotas */
|
|
DeviceExtension->MinQuota = PAGE_SIZE;
|
|
DeviceExtension->DefaultQuota = 8 * PAGE_SIZE;
|
|
DeviceExtension->MaxQuota = 64 * PAGE_SIZE;
|
|
|
|
return STATUS_SUCCESS;
|
|
}
|
|
|
|
/* EOF */
|