mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 07:32:57 +00:00
- Create iofunc.c and put all functions that ultimately create a system IRP to send to a device in it, thus clearing up irp.c and file.c and making the code base more modular.
- File.c now includes only functions dealing with the FILE_OBJECT itself. svn path=/trunk/; revision=22708
This commit is contained in:
parent
c41f64ebf3
commit
f39a0e3e68
5 changed files with 2598 additions and 2565 deletions
File diff suppressed because it is too large
Load diff
2580
reactos/ntoskrnl/io/iofunc.c
Normal file
2580
reactos/ntoskrnl/io/iofunc.c
Normal file
File diff suppressed because it is too large
Load diff
|
@ -13,6 +13,8 @@
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <internal/debug.h>
|
#include <internal/debug.h>
|
||||||
|
|
||||||
|
ULONG IopTraceLevel = IO_IRP_DEBUG;
|
||||||
|
|
||||||
/* DATA ********************************************************************/
|
/* DATA ********************************************************************/
|
||||||
|
|
||||||
POBJECT_TYPE IoDeviceObjectType = NULL;
|
POBJECT_TYPE IoDeviceObjectType = NULL;
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
#undef IoCallDriver
|
#undef IoCallDriver
|
||||||
#undef IoCompleteRequest
|
#undef IoCompleteRequest
|
||||||
|
|
||||||
ULONG IopTraceLevel = IO_IRP_DEBUG;
|
|
||||||
|
|
||||||
/* PRIVATE FUNCTIONS ********************************************************/
|
/* PRIVATE FUNCTIONS ********************************************************/
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
@ -944,8 +942,8 @@ IoCancelThreadIo(IN PETHREAD Thread)
|
||||||
*/
|
*/
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
IoCallDriver(PDEVICE_OBJECT DeviceObject,
|
IoCallDriver(IN PDEVICE_OBJECT DeviceObject,
|
||||||
PIRP Irp)
|
IN PIRP Irp)
|
||||||
{
|
{
|
||||||
/* Call fast call */
|
/* Call fast call */
|
||||||
return IofCallDriver(DeviceObject, Irp);
|
return IofCallDriver(DeviceObject, Irp);
|
||||||
|
@ -956,8 +954,8 @@ IoCallDriver(PDEVICE_OBJECT DeviceObject,
|
||||||
*/
|
*/
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
IoCompleteRequest(PIRP Irp,
|
IoCompleteRequest(IN PIRP Irp,
|
||||||
CCHAR PriorityBoost)
|
IN CCHAR PriorityBoost)
|
||||||
{
|
{
|
||||||
/* Call the fastcall */
|
/* Call the fastcall */
|
||||||
IofCompleteRequest(Irp, PriorityBoost);
|
IofCompleteRequest(Irp, PriorityBoost);
|
||||||
|
@ -979,8 +977,8 @@ IoEnqueueIrp(IN PIRP Irp)
|
||||||
*/
|
*/
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
FASTCALL
|
FASTCALL
|
||||||
IofCallDriver(PDEVICE_OBJECT DeviceObject,
|
IofCallDriver(IN PDEVICE_OBJECT DeviceObject,
|
||||||
PIRP Irp)
|
IN PIRP Irp)
|
||||||
{
|
{
|
||||||
PDRIVER_OBJECT DriverObject;
|
PDRIVER_OBJECT DriverObject;
|
||||||
PIO_STACK_LOCATION Param;
|
PIO_STACK_LOCATION Param;
|
||||||
|
@ -1262,7 +1260,7 @@ IoForwardIrpSynchronously(IN PDEVICE_OBJECT DeviceObject,
|
||||||
*/
|
*/
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
IoFreeIrp(PIRP Irp)
|
IoFreeIrp(IN PIRP Irp)
|
||||||
{
|
{
|
||||||
PNPAGED_LOOKASIDE_LIST List;
|
PNPAGED_LOOKASIDE_LIST List;
|
||||||
PP_NPAGED_LOOKASIDE_NUMBER ListType = LookasideSmallIrpList;
|
PP_NPAGED_LOOKASIDE_NUMBER ListType = LookasideSmallIrpList;
|
||||||
|
@ -1444,7 +1442,7 @@ IoMakeAssociatedIrp(IN PIRP Irp,
|
||||||
|
|
||||||
/* Allocate the IRP */
|
/* Allocate the IRP */
|
||||||
AssocIrp = IoAllocateIrp(StackSize, FALSE);
|
AssocIrp = IoAllocateIrp(StackSize, FALSE);
|
||||||
if (AssocIrp == NULL) return NULL;
|
if (!AssocIrp) return NULL;
|
||||||
|
|
||||||
/* Set the Flags */
|
/* Set the Flags */
|
||||||
AssocIrp->Flags |= IRP_ASSOCIATED_IRP;
|
AssocIrp->Flags |= IRP_ASSOCIATED_IRP;
|
||||||
|
@ -1457,54 +1455,6 @@ IoMakeAssociatedIrp(IN PIRP Irp,
|
||||||
return AssocIrp;
|
return AssocIrp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
NTSTATUS
|
|
||||||
NTAPI
|
|
||||||
IoPageRead(IN PFILE_OBJECT FileObject,
|
|
||||||
IN PMDL Mdl,
|
|
||||||
IN PLARGE_INTEGER Offset,
|
|
||||||
IN PKEVENT Event,
|
|
||||||
IN PIO_STATUS_BLOCK StatusBlock)
|
|
||||||
{
|
|
||||||
PIRP Irp;
|
|
||||||
PIO_STACK_LOCATION StackPtr;
|
|
||||||
PDEVICE_OBJECT DeviceObject;
|
|
||||||
|
|
||||||
/* Get the Device Object */
|
|
||||||
DeviceObject = IoGetRelatedDeviceObject(FileObject);
|
|
||||||
|
|
||||||
/* Allocate IRP */
|
|
||||||
Irp = IoAllocateIrp(DeviceObject->StackSize, FALSE);
|
|
||||||
if (!Irp) return STATUS_INSUFFICIENT_RESOURCES;
|
|
||||||
|
|
||||||
/* Get the Stack */
|
|
||||||
StackPtr = IoGetNextIrpStackLocation(Irp);
|
|
||||||
|
|
||||||
/* Create the IRP Settings */
|
|
||||||
Irp->MdlAddress = Mdl;
|
|
||||||
Irp->UserBuffer = MmGetMdlVirtualAddress(Mdl);
|
|
||||||
Irp->UserIosb = StatusBlock;
|
|
||||||
Irp->UserEvent = Event;
|
|
||||||
Irp->RequestorMode = KernelMode;
|
|
||||||
Irp->Flags = IRP_PAGING_IO |
|
|
||||||
IRP_NOCACHE |
|
|
||||||
IRP_SYNCHRONOUS_PAGING_IO |
|
|
||||||
IRP_INPUT_OPERATION;
|
|
||||||
Irp->Tail.Overlay.OriginalFileObject = FileObject;
|
|
||||||
Irp->Tail.Overlay.Thread = PsGetCurrentThread();
|
|
||||||
|
|
||||||
/* Set the Stack Settings */
|
|
||||||
StackPtr->Parameters.Read.Length = MmGetMdlByteCount(Mdl);
|
|
||||||
StackPtr->Parameters.Read.ByteOffset = *Offset;
|
|
||||||
StackPtr->MajorFunction = IRP_MJ_READ;
|
|
||||||
StackPtr->FileObject = FileObject;
|
|
||||||
|
|
||||||
/* Call the Driver */
|
|
||||||
return IofCallDriver(DeviceObject, Irp);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
|
@ -1573,49 +1523,4 @@ IoSetTopLevelIrp(IN PIRP Irp)
|
||||||
PsGetCurrentThread()->TopLevelIrp = (ULONG)Irp;
|
PsGetCurrentThread()->TopLevelIrp = (ULONG)Irp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
NTSTATUS
|
|
||||||
NTAPI
|
|
||||||
IoSynchronousPageWrite(PFILE_OBJECT FileObject,
|
|
||||||
PMDL Mdl,
|
|
||||||
PLARGE_INTEGER Offset,
|
|
||||||
PKEVENT Event,
|
|
||||||
PIO_STATUS_BLOCK StatusBlock)
|
|
||||||
{
|
|
||||||
PIRP Irp;
|
|
||||||
PIO_STACK_LOCATION StackPtr;
|
|
||||||
PDEVICE_OBJECT DeviceObject;
|
|
||||||
|
|
||||||
/* Get the Device Object */
|
|
||||||
DeviceObject = IoGetRelatedDeviceObject(FileObject);
|
|
||||||
|
|
||||||
/* Allocate IRP */
|
|
||||||
Irp = IoAllocateIrp(DeviceObject->StackSize, FALSE);
|
|
||||||
if (!Irp) return STATUS_INSUFFICIENT_RESOURCES;
|
|
||||||
|
|
||||||
/* Get the Stack */
|
|
||||||
StackPtr = IoGetNextIrpStackLocation(Irp);
|
|
||||||
|
|
||||||
/* Create the IRP Settings */
|
|
||||||
Irp->MdlAddress = Mdl;
|
|
||||||
Irp->UserBuffer = MmGetMdlVirtualAddress(Mdl);
|
|
||||||
Irp->UserIosb = StatusBlock;
|
|
||||||
Irp->UserEvent = Event;
|
|
||||||
Irp->RequestorMode = KernelMode;
|
|
||||||
Irp->Flags = IRP_PAGING_IO | IRP_NOCACHE | IRP_SYNCHRONOUS_PAGING_IO;
|
|
||||||
Irp->Tail.Overlay.OriginalFileObject = FileObject;
|
|
||||||
Irp->Tail.Overlay.Thread = PsGetCurrentThread();
|
|
||||||
|
|
||||||
/* Set the Stack Settings */
|
|
||||||
StackPtr->Parameters.Write.Length = MmGetMdlByteCount(Mdl);
|
|
||||||
StackPtr->Parameters.Write.ByteOffset = *Offset;
|
|
||||||
StackPtr->MajorFunction = IRP_MJ_WRITE;
|
|
||||||
StackPtr->FileObject = FileObject;
|
|
||||||
|
|
||||||
/* Call the Driver */
|
|
||||||
return IofCallDriver(DeviceObject, Irp);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -194,7 +194,8 @@
|
||||||
<file>timer.c</file>
|
<file>timer.c</file>
|
||||||
<file>vpb.c</file>
|
<file>vpb.c</file>
|
||||||
<file>wmi.c</file>
|
<file>wmi.c</file>
|
||||||
<file>file.c</file>
|
<file>file.c</file>
|
||||||
|
<file>iofunc.c</file>
|
||||||
</directory>
|
</directory>
|
||||||
<directory name="kd">
|
<directory name="kd">
|
||||||
<directory name="wrappers">
|
<directory name="wrappers">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue