:pserver:cvsanon@mok.lvcm.com:/CVS/ReactOS reactos
[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 NPAGED_LOOKASIDE_LIST NpfsPipeDataLookasideList;
19
20 /* FUNCTIONS *****************************************************************/
21
22 NTSTATUS STDCALL
23 DriverEntry(PDRIVER_OBJECT DriverObject,
24             PUNICODE_STRING RegistryPath)
25 {
26    PNPFS_DEVICE_EXTENSION DeviceExtension;
27    PDEVICE_OBJECT DeviceObject;
28    UNICODE_STRING DeviceName;
29    NTSTATUS Status;
30    
31    DbgPrint("Named Pipe FSD 0.0.2\n");
32    
33    DriverObject->MajorFunction[IRP_MJ_CREATE] = NpfsCreate;
34    DriverObject->MajorFunction[IRP_MJ_CREATE_NAMED_PIPE] =
35      NpfsCreateNamedPipe;
36    DriverObject->MajorFunction[IRP_MJ_CLOSE] = NpfsClose;
37    DriverObject->MajorFunction[IRP_MJ_READ] = NpfsRead;
38    DriverObject->MajorFunction[IRP_MJ_WRITE] = NpfsWrite;
39    DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] =
40      NpfsQueryInformation;
41    DriverObject->MajorFunction[IRP_MJ_SET_INFORMATION] =
42      NpfsSetInformation;
43    DriverObject->MajorFunction[IRP_MJ_QUERY_VOLUME_INFORMATION] = 
44      NpfsQueryVolumeInformation;
45 //   DriverObject->MajorFunction[IRP_MJ_CLEANUP] = NpfsCleanup;
46 //   DriverObject->MajorFunction[IRP_MJ_FLUSH_BUFFERS] = NpfsFlushBuffers;
47 //   DriverObject->MajorFunction[IRP_MJ_DIRECTORY_CONTROL] =
48 //     NpfsDirectoryControl;
49    DriverObject->MajorFunction[IRP_MJ_FILE_SYSTEM_CONTROL] =
50      NpfsFileSystemControl;
51 //   DriverObject->MajorFunction[IRP_MJ_QUERY_SECURITY] = 
52 //     NpfsQuerySecurity;
53 //   DriverObject->MajorFunction[IRP_MJ_SET_SECURITY] =
54 //     NpfsSetSecurity;
55    
56    DriverObject->DriverUnload = NULL;
57    
58    RtlInitUnicodeString(&DeviceName, L"\\Device\\NamedPipe");
59    Status = IoCreateDevice(DriverObject,
60                            sizeof(NPFS_DEVICE_EXTENSION),
61                            &DeviceName,
62                            FILE_DEVICE_NAMED_PIPE,
63                            0,
64                            FALSE,
65                            &DeviceObject);
66    if (!NT_SUCCESS(Status))
67      {
68         DPRINT("Failed to create named pipe device! (Status %x)\n", Status);
69         return(Status);
70      }
71    
72    /* initialize the device object */
73    DeviceObject->Flags = DO_DIRECT_IO;
74    
75    /* initialize the device extension */
76    DeviceExtension = DeviceObject->DeviceExtension;
77    InitializeListHead(&DeviceExtension->PipeListHead);
78    KeInitializeMutex(&DeviceExtension->PipeListLock,
79                      0);
80
81   ExInitializeNPagedLookasideList(
82     &NpfsPipeDataLookasideList,
83     NULL,
84     NULL,
85     0,
86     sizeof(NPFS_PIPE_DATA),
87     TAG('N', 'P', 'D', 'A'),
88     0);
89
90    return(STATUS_SUCCESS);
91 }
92
93 /* EOF */