Changed parameters for IoPageRead/IoPageWrite/IoSynchronousPageWrite.

Removed referencing of the event/file object.

svn path=/trunk/; revision=3424
This commit is contained in:
Hartmut Birr 2002-08-28 07:19:10 +00:00
parent a5a8fc4a5a
commit f454afa33c

View file

@ -1,12 +1,12 @@
/* $Id: page.c,v 1.16 2002/04/27 19:22:09 hbirr Exp $ /* $Id: page.c,v 1.17 2002/08/28 07:19:10 hbirr Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
* FILE: ntoskrnl/ke/bug.c * FILE: ntoskrnl/io/page.c
* PURPOSE: Graceful system shutdown if a bug is detected * PURPOSE:
* PROGRAMMER: David Welch (welch@mcmail.com) * PROGRAMMER:
* UPDATE HISTORY: * UPDATE HISTORY:
* Created 22/05/98 *
*/ */
/* INCLUDES *****************************************************************/ /* INCLUDES *****************************************************************/
@ -19,11 +19,12 @@
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
NTSTATUS STDCALL IoPageWrite(PFILE_OBJECT FileObject, NTSTATUS STDCALL
PMDL Mdl, IoPageWrite(PFILE_OBJECT FileObject,
PLARGE_INTEGER Offset, PMDL Mdl,
PIO_STATUS_BLOCK StatusBlock, PLARGE_INTEGER Offset,
BOOLEAN PagingIo) PKEVENT Event,
PIO_STATUS_BLOCK StatusBlock)
{ {
PIRP Irp; PIRP Irp;
PIO_STACK_LOCATION StackPtr; PIO_STACK_LOCATION StackPtr;
@ -32,37 +33,23 @@ NTSTATUS STDCALL IoPageWrite(PFILE_OBJECT FileObject,
DPRINT("IoPageWrite(FileObject %x, Mdl %x)\n", DPRINT("IoPageWrite(FileObject %x, Mdl %x)\n",
FileObject, Mdl); FileObject, Mdl);
ObReferenceObjectByPointer(FileObject,
STANDARD_RIGHTS_REQUIRED,
IoFileObjectType,
UserMode);
KeResetEvent( &FileObject->Event );
Irp = IoBuildSynchronousFsdRequestWithMdl(IRP_MJ_WRITE, Irp = IoBuildSynchronousFsdRequestWithMdl(IRP_MJ_WRITE,
FileObject->DeviceObject, FileObject->DeviceObject,
Mdl, Mdl,
Offset, Offset,
&FileObject->Event, Event,
StatusBlock, StatusBlock,
PagingIo); TRUE);
if (Irp == NULL)
{
return (STATUS_INSUFFICIENT_RESOURCES);
}
Irp->Flags = IRP_NOCACHE|IRP_PAGING_IO;
StackPtr = IoGetNextIrpStackLocation(Irp); StackPtr = IoGetNextIrpStackLocation(Irp);
StackPtr->FileObject = FileObject; StackPtr->FileObject = FileObject;
DPRINT("Before IoCallDriver\n"); DPRINT("Before IoCallDriver\n");
Status = IoCallDriver(FileObject->DeviceObject,Irp); Status = IofCallDriver(FileObject->DeviceObject,Irp);
DPRINT("Status %d STATUS_PENDING %d\n",Status,STATUS_PENDING); DPRINT("Status %d STATUS_PENDING %d\n",Status,STATUS_PENDING);
if (Status == STATUS_PENDING && !(FileObject->Flags & FO_SYNCHRONOUS_IO))
{
DPRINT("Waiting for io operation\n");
if (FileObject->Flags & FO_ALERTABLE_IO)
{
KeWaitForSingleObject(&FileObject->Event,Executive,KernelMode,TRUE,NULL);
}
else
{
DPRINT("Non-alertable wait\n");
KeWaitForSingleObject(&FileObject->Event,Executive,KernelMode,FALSE,NULL);
}
Status = StatusBlock->Status;
}
return(Status); return(Status);
} }
@ -71,8 +58,8 @@ NTSTATUS STDCALL
IoPageRead(PFILE_OBJECT FileObject, IoPageRead(PFILE_OBJECT FileObject,
PMDL Mdl, PMDL Mdl,
PLARGE_INTEGER Offset, PLARGE_INTEGER Offset,
PIO_STATUS_BLOCK StatusBlock, PKEVENT Event,
BOOLEAN PagingIo) PIO_STATUS_BLOCK StatusBlock)
{ {
PIRP Irp; PIRP Irp;
PIO_STACK_LOCATION StackPtr; PIO_STACK_LOCATION StackPtr;
@ -81,49 +68,60 @@ IoPageRead(PFILE_OBJECT FileObject,
DPRINT("IoPageRead(FileObject %x, Mdl %x)\n", DPRINT("IoPageRead(FileObject %x, Mdl %x)\n",
FileObject, Mdl); FileObject, Mdl);
ObReferenceObjectByPointer(FileObject,
STANDARD_RIGHTS_REQUIRED,
IoFileObjectType,
UserMode);
KeResetEvent( &FileObject->Event );
Irp = IoBuildSynchronousFsdRequestWithMdl(IRP_MJ_READ, Irp = IoBuildSynchronousFsdRequestWithMdl(IRP_MJ_READ,
FileObject->DeviceObject, FileObject->DeviceObject,
Mdl, Mdl,
Offset, Offset,
&FileObject->Event, Event,
StatusBlock, StatusBlock,
PagingIo); TRUE);
if (Irp == NULL)
{
return (STATUS_INSUFFICIENT_RESOURCES);
}
Irp->Flags = IRP_NOCACHE|IRP_PAGING_IO;
StackPtr = IoGetNextIrpStackLocation(Irp); StackPtr = IoGetNextIrpStackLocation(Irp);
StackPtr->FileObject = FileObject; StackPtr->FileObject = FileObject;
DPRINT("Before IoCallDriver\n"); DPRINT("Before IoCallDriver\n");
Status = IoCallDriver(FileObject->DeviceObject, Irp); Status = IofCallDriver(FileObject->DeviceObject, Irp);
DPRINT("Status %d STATUS_PENDING %d\n",Status,STATUS_PENDING); DPRINT("Status %d STATUS_PENDING %d\n",Status,STATUS_PENDING);
if (Status==STATUS_PENDING && !(FileObject->Flags & FO_SYNCHRONOUS_IO))
{
DPRINT("Waiting for io operation\n");
if (FileObject->Flags & FO_ALERTABLE_IO)
{
KeWaitForSingleObject(&FileObject->Event,Executive,KernelMode,TRUE,NULL);
}
else
{
DPRINT("Non-alertable wait\n");
KeWaitForSingleObject(&FileObject->Event,Executive,KernelMode,FALSE,NULL);
}
Status = StatusBlock->Status;
}
return(Status); return(Status);
} }
NTSTATUS STDCALL IoSynchronousPageWrite (DWORD Unknown0, NTSTATUS STDCALL
DWORD Unknown1, IoSynchronousPageWrite (PFILE_OBJECT FileObject,
DWORD Unknown2, PMDL Mdl,
DWORD Unknown3, PLARGE_INTEGER Offset,
DWORD Unknown4) PKEVENT Event,
PIO_STATUS_BLOCK StatusBlock)
{ {
UNIMPLEMENTED; PIRP Irp;
return (STATUS_NOT_IMPLEMENTED); PIO_STACK_LOCATION StackPtr;
NTSTATUS Status;
DPRINT("IoSynchronousPageWrite(FileObject %x, Mdl %x)\n",
FileObject, Mdl);
Irp = IoBuildSynchronousFsdRequestWithMdl(IRP_MJ_WRITE,
FileObject->DeviceObject,
Mdl,
Offset,
Event,
StatusBlock,
TRUE);
if (Irp == NULL)
{
return (STATUS_INSUFFICIENT_RESOURCES);
}
Irp->Flags = IRP_NOCACHE|IRP_PAGING_IO|IRP_SYNCHRONOUS_PAGING_IO;
StackPtr = IoGetNextIrpStackLocation(Irp);
StackPtr->FileObject = FileObject;
DPRINT("Before IoCallDriver\n");
Status = IofCallDriver(FileObject->DeviceObject,Irp);
DPRINT("Status %d STATUS_PENDING %d\n",Status,STATUS_PENDING);
return(Status);
} }