update for HEAD-2003091401
[reactos.git] / drivers / fs / np / npfs.c
1 /* $Id$
2  *
3  * COPYRIGHT:  See COPYING in the top level directory
4  * PROJECT:    ReactOS kernel
5  * FILE:       services/fs/np/mount.c
6  * PURPOSE:    Named pipe filesystem
7  * PROGRAMMER: David Welch <welch@cwcom.net>
8  */
9
10 /* INCLUDES ******************************************************************/
11
12 #include <ddk/ntddk.h>
13 #include "npfs.h"
14
15 #define NDEBUG
16 #include <debug.h>
17
18 /* FUNCTIONS *****************************************************************/
19
20 NTSTATUS STDCALL
21 DriverEntry(PDRIVER_OBJECT DriverObject,
22             PUNICODE_STRING RegistryPath)
23 {
24    PNPFS_DEVICE_EXTENSION DeviceExtension;
25    PDEVICE_OBJECT DeviceObject;
26    UNICODE_STRING DeviceName;
27    NTSTATUS Status;
28    
29    DbgPrint("Named Pipe FSD 0.0.2\n");
30    
31    DriverObject->MajorFunction[IRP_MJ_CREATE] = NpfsCreate;
32    DriverObject->MajorFunction[IRP_MJ_CREATE_NAMED_PIPE] =
33      NpfsCreateNamedPipe;
34    DriverObject->MajorFunction[IRP_MJ_CLOSE] = NpfsClose;
35    DriverObject->MajorFunction[IRP_MJ_READ] = NpfsRead;
36    DriverObject->MajorFunction[IRP_MJ_WRITE] = NpfsWrite;
37    DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] =
38      NpfsQueryInformation;
39    DriverObject->MajorFunction[IRP_MJ_SET_INFORMATION] =
40      NpfsSetInformation;
41    DriverObject->MajorFunction[IRP_MJ_QUERY_VOLUME_INFORMATION] = 
42      NpfsQueryVolumeInformation;
43 //   DriverObject->MajorFunction[IRP_MJ_CLEANUP] = NpfsCleanup;
44 //   DriverObject->MajorFunction[IRP_MJ_FLUSH_BUFFERS] = NpfsFlushBuffers;
45 //   DriverObject->MajorFunction[IRP_MJ_DIRECTORY_CONTROL] =
46 //     NpfsDirectoryControl;
47    DriverObject->MajorFunction[IRP_MJ_FILE_SYSTEM_CONTROL] =
48      NpfsFileSystemControl;
49 //   DriverObject->MajorFunction[IRP_MJ_QUERY_SECURITY] = 
50 //     NpfsQuerySecurity;
51 //   DriverObject->MajorFunction[IRP_MJ_SET_SECURITY] =
52 //     NpfsSetSecurity;
53    
54    DriverObject->DriverUnload = NULL;
55    
56    RtlInitUnicodeString(&DeviceName, L"\\Device\\NamedPipe");
57    Status = IoCreateDevice(DriverObject,
58                            sizeof(NPFS_DEVICE_EXTENSION),
59                            &DeviceName,
60                            FILE_DEVICE_NAMED_PIPE,
61                            0,
62                            FALSE,
63                            &DeviceObject);
64    if (!NT_SUCCESS(Status))
65      {
66         DPRINT("Failed to create named pipe device! (Status %x)\n", Status);
67         return(Status);
68      }
69    
70    /* initialize the device object */
71    DeviceObject->Flags = DO_DIRECT_IO;
72    
73    /* initialize the device extension */
74    DeviceExtension = DeviceObject->DeviceExtension;
75    InitializeListHead(&DeviceExtension->PipeListHead);
76    KeInitializeMutex(&DeviceExtension->PipeListLock,
77                      0);
78
79    /* set the size quotas */
80    DeviceExtension->MinQuota = PAGE_SIZE;
81    DeviceExtension->DefaultQuota = 8 * PAGE_SIZE;
82    DeviceExtension->MaxQuota = 64 * PAGE_SIZE;
83
84    return(STATUS_SUCCESS);
85 }
86
87 /* EOF */