1 /* 2 * COPYRIGHT: See COPYING in the top level directory 3 * PROJECT: ReactOS kernel 4 * FILE: drivers/filesystems/msfs/msfs.h 5 * PURPOSE: Mailslot filesystem 6 * PROGRAMMER: Eric Kohl 7 * Nikita Pechenkin (n.pechenkin@mail.ru) 8 */ 9 10 #ifndef __DRIVERS_FS_MS_MSFS_H 11 #define __DRIVERS_FS_MS_MSFS_H 12 13 #include <ntifs.h> 14 15 #define DEFAULTAPI NTAPI 16 17 typedef struct _MSFS_DEVICE_EXTENSION 18 { 19 LIST_ENTRY FcbListHead; 20 KMUTEX FcbListLock; 21 } MSFS_DEVICE_EXTENSION, *PMSFS_DEVICE_EXTENSION; 22 23 24 typedef struct _MSFS_FCB 25 { 26 FSRTL_COMMON_FCB_HEADER RFCB; 27 UNICODE_STRING Name; 28 LIST_ENTRY FcbListEntry; 29 KSPIN_LOCK CcbListLock; 30 LIST_ENTRY CcbListHead; 31 struct _MSFS_CCB *ServerCcb; 32 ULONG ReferenceCount; 33 LARGE_INTEGER TimeOut; 34 ULONG MaxMessageSize; 35 ULONG MessageCount; 36 KSPIN_LOCK MessageListLock; 37 LIST_ENTRY MessageListHead; 38 IO_CSQ CancelSafeQueue; 39 KSPIN_LOCK QueueLock; 40 LIST_ENTRY PendingIrpQueue; 41 } MSFS_FCB, *PMSFS_FCB; 42 43 44 typedef struct _MSFS_DPC_CTX 45 { 46 KTIMER Timer; 47 KDPC Dpc; 48 PIO_CSQ Csq; 49 KEVENT Event; 50 IO_CSQ_IRP_CONTEXT CsqContext; 51 } MSFS_DPC_CTX, *PMSFS_DPC_CTX; 52 53 54 typedef struct _MSFS_CCB 55 { 56 LIST_ENTRY CcbListEntry; 57 PMSFS_FCB Fcb; 58 } MSFS_CCB, *PMSFS_CCB; 59 60 61 typedef struct _MSFS_MESSAGE 62 { 63 LIST_ENTRY MessageListEntry; 64 ULONG Size; 65 UCHAR Buffer[1]; 66 } MSFS_MESSAGE, *PMSFS_MESSAGE; 67 68 69 #define KeLockMutex(x) KeWaitForSingleObject(x, \ 70 Executive, \ 71 KernelMode, \ 72 FALSE, \ 73 NULL); 74 75 #define KeUnlockMutex(x) KeReleaseMutex(x, FALSE); 76 77 DRIVER_DISPATCH MsfsCreate; 78 NTSTATUS DEFAULTAPI MsfsCreate(PDEVICE_OBJECT DeviceObject, PIRP Irp); 79 80 DRIVER_DISPATCH MsfsCreateMailslot; 81 NTSTATUS DEFAULTAPI MsfsCreateMailslot(PDEVICE_OBJECT DeviceObject, PIRP Irp); 82 83 DRIVER_DISPATCH MsfsClose; 84 NTSTATUS DEFAULTAPI MsfsClose(PDEVICE_OBJECT DeviceObject, PIRP Irp); 85 86 DRIVER_DISPATCH MsfsQueryInformation; 87 NTSTATUS DEFAULTAPI MsfsQueryInformation(PDEVICE_OBJECT DeviceObject, PIRP Irp); 88 89 DRIVER_DISPATCH MsfsSetInformation; 90 NTSTATUS DEFAULTAPI MsfsSetInformation(PDEVICE_OBJECT DeviceObject, PIRP Irp); 91 92 DRIVER_DISPATCH MsfsRead; 93 NTSTATUS DEFAULTAPI MsfsRead(PDEVICE_OBJECT DeviceObject, PIRP Irp); 94 95 DRIVER_DISPATCH MsfsWrite; 96 NTSTATUS DEFAULTAPI MsfsWrite(PDEVICE_OBJECT DeviceObject, PIRP Irp); 97 98 DRIVER_DISPATCH MsfsFileSystemControl; 99 NTSTATUS DEFAULTAPI MsfsFileSystemControl(PDEVICE_OBJECT DeviceObject, PIRP Irp); 100 101 NTSTATUS NTAPI 102 DriverEntry(PDRIVER_OBJECT DriverObject, 103 PUNICODE_STRING RegistryPath); 104 105 IO_CSQ_INSERT_IRP MsfsInsertIrp; 106 VOID NTAPI 107 MsfsInsertIrp(PIO_CSQ Csq, PIRP Irp); 108 109 IO_CSQ_REMOVE_IRP MsfsRemoveIrp; 110 VOID NTAPI 111 MsfsRemoveIrp(PIO_CSQ Csq, PIRP Irp); 112 113 IO_CSQ_PEEK_NEXT_IRP MsfsPeekNextIrp; 114 PIRP NTAPI 115 MsfsPeekNextIrp(PIO_CSQ Csq, PIRP Irp, PVOID PeekContext); 116 117 IO_CSQ_ACQUIRE_LOCK MsfsAcquireLock; 118 VOID NTAPI 119 MsfsAcquireLock(PIO_CSQ Csq, PKIRQL Irql); 120 121 IO_CSQ_RELEASE_LOCK MsfsReleaseLock; 122 VOID NTAPI 123 MsfsReleaseLock(PIO_CSQ Csq, KIRQL Irql); 124 125 IO_CSQ_COMPLETE_CANCELED_IRP MsfsCompleteCanceledIrp; 126 VOID NTAPI 127 MsfsCompleteCanceledIrp(PIO_CSQ pCsq, PIRP Irp); 128 129 KDEFERRED_ROUTINE MsfsTimeout; 130 VOID NTAPI 131 MsfsTimeout(PKDPC Dpc, 132 PVOID DeferredContext, 133 PVOID SystemArgument1, 134 PVOID SystemArgument2); 135 136 #endif /* __DRIVERS_FS_MS_MSFS_H */ 137