ad11bd56b308a2c9f4c5c18a0c98c14f0b6a1ac6
[reactos.git] / reactos / drivers / filesystems / msfs / msfs.h
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: services/fs/ms/msfs.h
5 * PURPOSE: Mailslot filesystem
6 * PROGRAMMER: Eric Kohl
7 */
8
9 #ifndef __DRIVERS_FS_MS_MSFS_H
10 #define __DRIVERS_FS_MS_MSFS_H
11
12 #include <ntifs.h>
13 #include <iotypes.h>
14
15 /*
16 * FIXME: GCC doesn't have a working option for defaulting to a calling
17 * convention. It will always default to cdecl. The MS DDK was designed
18 * for compilers which support this option, and thus some of their headers
19 * do not specify STDCALL or NTAPI everywhere. As such, callbacks will be
20 * interpreted as cdecl on gcc, while they should be stdcall. Defining
21 * NTAPI manually won't work either, since msvc will realize that the
22 * two definitions are different. So we have to use something to close
23 * the compatibility gap, until someone fixes gcc.
24 */
25 #ifdef _MSC_VER
26 #define DEFAULTAPI
27 #else
28 #define DEFAULTAPI __stdcall
29 #endif
30
31 typedef struct _MSFS_DEVICE_EXTENSION
32 {
33 LIST_ENTRY FcbListHead;
34 KMUTEX FcbListLock;
35 } MSFS_DEVICE_EXTENSION, *PMSFS_DEVICE_EXTENSION;
36
37
38 typedef struct _MSFS_FCB
39 {
40 FSRTL_COMMON_FCB_HEADER RFCB;
41 UNICODE_STRING Name;
42 LIST_ENTRY FcbListEntry;
43 KSPIN_LOCK CcbListLock;
44 LIST_ENTRY CcbListHead;
45 struct _MSFS_CCB *ServerCcb;
46 ULONG ReferenceCount;
47 LARGE_INTEGER TimeOut;
48 KEVENT MessageEvent;
49 ULONG MaxMessageSize;
50 ULONG MessageCount;
51 KSPIN_LOCK MessageListLock;
52 LIST_ENTRY MessageListHead;
53 } MSFS_FCB, *PMSFS_FCB;
54
55
56 typedef struct _MSFS_CCB
57 {
58 LIST_ENTRY CcbListEntry;
59 PMSFS_FCB Fcb;
60 } MSFS_CCB, *PMSFS_CCB;
61
62
63 typedef struct _MSFS_MESSAGE
64 {
65 LIST_ENTRY MessageListEntry;
66 ULONG Size;
67 UCHAR Buffer[1];
68 } MSFS_MESSAGE, *PMSFS_MESSAGE;
69
70
71 #define KeLockMutex(x) KeWaitForSingleObject(x, \
72 UserRequest, \
73 KernelMode, \
74 FALSE, \
75 NULL);
76
77 #define KeUnlockMutex(x) KeReleaseMutex(x, FALSE);
78
79 DRIVER_DISPATCH MsfsCreate;
80 NTSTATUS DEFAULTAPI MsfsCreate(PDEVICE_OBJECT DeviceObject, PIRP Irp);
81
82 DRIVER_DISPATCH MsfsCreateMailslot;
83 NTSTATUS DEFAULTAPI MsfsCreateMailslot(PDEVICE_OBJECT DeviceObject, PIRP Irp);
84
85 DRIVER_DISPATCH MsfsClose;
86 NTSTATUS DEFAULTAPI MsfsClose(PDEVICE_OBJECT DeviceObject, PIRP Irp);
87
88 DRIVER_DISPATCH MsfsQueryInformation;
89 NTSTATUS DEFAULTAPI MsfsQueryInformation(PDEVICE_OBJECT DeviceObject, PIRP Irp);
90
91 DRIVER_DISPATCH MsfsSetInformation;
92 NTSTATUS DEFAULTAPI MsfsSetInformation(PDEVICE_OBJECT DeviceObject, PIRP Irp);
93
94 DRIVER_DISPATCH MsfsRead;
95 NTSTATUS DEFAULTAPI MsfsRead(PDEVICE_OBJECT DeviceObject, PIRP Irp);
96
97 DRIVER_DISPATCH MsfsWrite;
98 NTSTATUS DEFAULTAPI MsfsWrite(PDEVICE_OBJECT DeviceObject, PIRP Irp);
99
100 DRIVER_DISPATCH MsfsFileSystemControl;
101 NTSTATUS DEFAULTAPI MsfsFileSystemControl(PDEVICE_OBJECT DeviceObject, PIRP Irp);
102
103 NTSTATUS NTAPI
104 DriverEntry(PDRIVER_OBJECT DriverObject,
105 PUNICODE_STRING RegistryPath);
106
107 #endif /* __DRIVERS_FS_MS_MSFS_H */