ef487dd7b03baafa15d78e3317c0e97df237dfd0
[reactos.git] / reactos / drivers / fs / np / npfs.c
1 /* $Id: npfs.c,v 1.2 2001/10/21 18:58:31 chorns Exp $
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 DeviceObject->Flags = 0;
34 DriverObject->MajorFunction[IRP_MJ_CREATE] = NpfsCreate;
35 DriverObject->MajorFunction[IRP_MJ_CREATE_NAMED_PIPE] =
36 NpfsCreateNamedPipe;
37 DriverObject->MajorFunction[IRP_MJ_CLOSE] = NpfsClose;
38 DriverObject->MajorFunction[IRP_MJ_READ] = NpfsRead;
39 DriverObject->MajorFunction[IRP_MJ_WRITE] = NpfsWrite;
40 DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] =
41 NpfsQueryInformation;
42 DriverObject->MajorFunction[IRP_MJ_SET_INFORMATION] =
43 NpfsSetInformation;
44 DriverObject->MajorFunction[IRP_MJ_QUERY_VOLUME_INFORMATION] =
45 NpfsQueryVolumeInformation;
46 // DriverObject->MajorFunction[IRP_MJ_CLEANUP] = NpfsCleanup;
47 // DriverObject->MajorFunction[IRP_MJ_FLUSH_BUFFERS] = NpfsFlushBuffers;
48 // DriverObject->MajorFunction[IRP_MJ_DIRECTORY_CONTROL] =
49 // NpfsDirectoryControl;
50 DriverObject->MajorFunction[IRP_MJ_FILE_SYSTEM_CONTROL] =
51 NpfsFileSystemControl;
52 // DriverObject->MajorFunction[IRP_MJ_QUERY_SECURITY] =
53 // NpfsQuerySecurity;
54 // DriverObject->MajorFunction[IRP_MJ_SET_SECURITY] =
55 // NpfsSetSecurity;
56
57 DriverObject->DriverUnload = NULL;
58
59 RtlInitUnicodeString(&DeviceName, L"\\Device\\NamedPipe");
60 Status = IoCreateDevice(DriverObject,
61 sizeof(NPFS_DEVICE_EXTENSION),
62 &DeviceName,
63 FILE_DEVICE_NAMED_PIPE,
64 0,
65 FALSE,
66 &DeviceObject);
67 if (!NT_SUCCESS(Status))
68 {
69 DPRINT("Failed to create named pipe device! (Status %x)\n", Status);
70 return(Status);
71 }
72
73 /* initialize the device extension */
74 DeviceExtension = DeviceObject->DeviceExtension;
75 InitializeListHead(&DeviceExtension->PipeListHead);
76 KeInitializeMutex(&DeviceExtension->PipeListLock,
77 0);
78
79 ExInitializeNPagedLookasideList(
80 &NpfsPipeDataLookasideList,
81 NULL,
82 NULL,
83 0,
84 sizeof(NPFS_PIPE_DATA),
85 TAG('N', 'P', 'D', 'A'),
86 0);
87
88 return(STATUS_SUCCESS);
89 }
90
91 /* EOF */