[NTOSKRNL] Implement the support for reserve IRP in IO
[reactos.git] / ntoskrnl / include / internal / io.h
index 778bf6d..86ddbda 100644 (file)
@@ -1,16 +1,17 @@
 /*
 * PROJECT:         ReactOS Kernel
 * LICENSE:         GPL - See COPYING in the top level directory
-* FILE:            ntoskrnl/include/io.h
+* FILE:            ntoskrnl/include/internal/io.h
 * PURPOSE:         Internal header for the I/O Manager
 * PROGRAMMERS:     Alex Ionescu (alex.ionescu@reactos.org)
 */
+
 #include "ntdddisk.h"
 
 //
 // Define this if you want debugging support
 //
-#define _IO_DEBUG_                                      0x01
+#define _IO_DEBUG_                                      0x00
 
 //
 // These define the Debug Masks Supported
 //
 #define RD_SYMLINK_CREATE_FAILED 5
 
+//
+// Max traversal of reparse points for a single open in IoParseDevice
+//
+#define IOP_MAX_REPARSE_TRAVERSAL 0x20
+
+//
+// Private flags for IoCreateFile / IoParseDevice
+//
+#define IOP_USE_TOP_LEVEL_DEVICE_HINT       0x01
+#define IOP_CREATE_FILE_OBJECT_EXTENSION    0x02
+
+
+typedef struct _FILE_OBJECT_EXTENSION
+{
+    PDEVICE_OBJECT TopDeviceObjectHint;
+
+} FILE_OBJECT_EXTENSION, *PFILE_OBJECT_EXTENSION;
+
+
+
 //
 // We can call the Ob Inlined API, it's the same thing
 //
@@ -312,16 +333,6 @@ typedef struct _ERROR_LOG_ENTRY
     LARGE_INTEGER TimeStamp;
 } ERROR_LOG_ENTRY, *PERROR_LOG_ENTRY;
 
-//
-// Event Log LPC Message
-//
-typedef struct _ELF_API_MSG
-{
-    PORT_MESSAGE h;
-    ULONG Unknown[2];
-    IO_ERROR_LOG_MESSAGE IoErrorMessage;
-} ELF_API_MSG, *PELF_API_MSG;
-
 //
 // To simplify matters, the kernel is made to support both the checked and free
 // version of the I/O Remove Lock in the same binary. This structure includes
@@ -502,6 +513,18 @@ typedef struct _DEVICETREE_TRAVERSE_CONTEXT
     PVOID Context;
 } DEVICETREE_TRAVERSE_CONTEXT, *PDEVICETREE_TRAVERSE_CONTEXT;
 
+//
+// Reserve IRP allocator
+// Used for read paging IOs in low-memory situations
+//
+typedef struct _RESERVE_IRP_ALLOCATOR
+{
+    PIRP ReserveIrp;
+    volatile LONG ReserveIrpInUse;
+    KEVENT WaitEvent;
+    CCHAR StackSize;
+} RESERVE_IRP_ALLOCATOR, *PRESERVE_IRP_ALLOCATOR;
+
 //
 // Resource code
 //
@@ -657,7 +680,6 @@ IoDestroyDriverList(
 );
 
 NTSTATUS
-INIT_FUNCTION
 IopInitPlugPlayEvents(VOID);
 
 NTSTATUS
@@ -910,6 +932,18 @@ IopAllocateIrpMustSucceed(
     IN CCHAR StackSize
 );
 
+BOOLEAN
+NTAPI
+IopInitializeReserveIrp(
+    IN PRESERVE_IRP_ALLOCATOR ReserveIrpAllocator
+);
+
+PIRP
+NTAPI
+IopAllocateReserveIrp(
+    IN CCHAR StackSize
+);
+
 //
 // Shutdown routines
 //
@@ -1104,6 +1138,8 @@ NTSTATUS
 FASTCALL
 IopAttachFilterDrivers(
     IN PDEVICE_NODE DeviceNode,
+    IN HANDLE EnumSubKey,
+    IN HANDLE ClassKey,
     IN BOOLEAN Lower
 );
 
@@ -1164,7 +1200,7 @@ IopDeleteFile(
 
 NTSTATUS
 NTAPI
-IopSecurityFile(
+IopGetSetSecurityObject(
     IN PVOID ObjectBody,
     IN SECURITY_OPERATION_CODE OperationCode,
     IN PSECURITY_INFORMATION SecurityInformation,
@@ -1210,6 +1246,21 @@ IoChangeFileObjectFilterContext(
     IN BOOLEAN Define
 );
 
+VOID
+NTAPI
+IopDoNameTransmogrify(
+    IN PIRP Irp,
+    IN PFILE_OBJECT FileObject,
+    IN PREPARSE_DATA_BUFFER DataBuffer
+);
+
+NTSTATUS
+NTAPI
+IoComputeDesiredAccessFileObject(
+    IN PFILE_OBJECT FileObject,
+    IN PACCESS_MASK DesiredAccess
+);
+
 //
 // I/O Timer Routines
 //
@@ -1234,6 +1285,17 @@ IopDeleteIoCompletion(
     PVOID ObjectBody
 );
 
+NTSTATUS
+NTAPI
+IoSetIoCompletion(
+    IN PVOID IoCompletion,
+    IN PVOID KeyContext,
+    IN PVOID ApcContext,
+    IN NTSTATUS IoStatus,
+    IN ULONG_PTR IoStatusInformation,
+    IN BOOLEAN Quota 
+);
+
 //
 // Ramdisk Routines
 //
@@ -1279,6 +1341,7 @@ extern PIO_BUS_TYPE_GUID_LIST PnpBusTypeGuidList;
 extern PDRIVER_OBJECT IopRootDriverObject;
 extern KSPIN_LOCK IopDeviceRelationsSpinLock;
 extern LIST_ENTRY IopDeviceRelationsRequestList;
+extern RESERVE_IRP_ALLOCATOR IopReserveIrpAllocator;
 
 //
 // Inlined Functions