Added .Type and .Size attributes to the IRP object: so far nothing

seems broken.
Added __stdcall to some Io subsystem functions.
Attempt to implement IoIsOperationSynchronous().

svn path=/trunk/; revision=1033
This commit is contained in:
Emanuele Aliberti 2000-03-06 01:02:30 +00:00
parent 79d0e047eb
commit 1eed2a945a
6 changed files with 210 additions and 33 deletions

View file

@ -1,4 +1,4 @@
/* $Id: iofuncs.h,v 1.6 2000/03/05 19:17:37 ea Exp $ */ /* $Id: iofuncs.h,v 1.7 2000/03/06 01:02:30 ea Exp $ */
/* IO MANAGER ***************************************************************/ /* IO MANAGER ***************************************************************/
BOOLEAN BOOLEAN
@ -100,6 +100,7 @@ IoAllocateErrorLogEntry (
* On failure NULL * On failure NULL
*/ */
PIRP PIRP
STDCALL
IoAllocateIrp ( IoAllocateIrp (
CCHAR StackSize, CCHAR StackSize,
BOOLEAN ChargeQuota BOOLEAN ChargeQuota
@ -281,11 +282,17 @@ IoBuildSynchronousFsdRequest (
* FUNCTION: Sends an irp to the next lower driver * FUNCTION: Sends an irp to the next lower driver
*/ */
NTSTATUS NTSTATUS
FASTCALL
IofCallDriver (
PDEVICE_OBJECT DeviceObject,
PIRP Irp
);
NTSTATUS
STDCALL
IoCallDriver ( IoCallDriver (
PDEVICE_OBJECT DeviceObject, PDEVICE_OBJECT DeviceObject,
PIRP irp PIRP Irp
); );
BOOLEAN BOOLEAN
IoCancelIrp ( IoCancelIrp (
PIRP Irp PIRP Irp
@ -309,11 +316,17 @@ IoCheckShareAccess (
* thread making the request * thread making the request
*/ */
VOID VOID
FASTCALL
IofCompleteRequest (
PIRP Irp,
CCHAR PriorityBoost
);
VOID
STDCALL
IoCompleteRequest ( IoCompleteRequest (
PIRP Irp, PIRP Irp,
CCHAR PriorityBoost CCHAR PriorityBoost
); );
NTSTATUS NTSTATUS
IoConnectInterrupt ( IoConnectInterrupt (
PKINTERRUPT * InterruptObject, PKINTERRUPT * InterruptObject,
@ -458,12 +471,11 @@ VOID
IoFreeController ( IoFreeController (
PCONTROLLER_OBJECT ControllerObject PCONTROLLER_OBJECT ControllerObject
); );
VOID VOID
STDCALL
IoFreeIrp ( IoFreeIrp (
PIRP Irp PIRP Irp
); );
VOID VOID
IoFreeMapRegisters ( IoFreeMapRegisters (
PADAPTER_OBJECT AdapterObject, PADAPTER_OBJECT AdapterObject,
@ -502,12 +514,11 @@ IoGetDeviceObjectPointer (
PFILE_OBJECT * FileObject, PFILE_OBJECT * FileObject,
PDEVICE_OBJECT * DeviceObject PDEVICE_OBJECT * DeviceObject
); );
PDEVICE_OBJECT PDEVICE_OBJECT
STDCALL
IoGetDeviceToVerify ( IoGetDeviceToVerify (
PETHREAD Thread PETHREAD Thread
); );
PGENERIC_MAPPING PGENERIC_MAPPING
IoGetFileObjectGenericMapping (VOID); IoGetFileObjectGenericMapping (VOID);
@ -547,6 +558,7 @@ IoInitializeDpcRequest (
* StackSize = Number of stack locations in the IRP * StackSize = Number of stack locations in the IRP
*/ */
VOID VOID
STDCALL
IoInitializeIrp ( IoInitializeIrp (
PIRP Irp, PIRP Irp,
USHORT PacketSize, USHORT PacketSize,
@ -564,18 +576,21 @@ BOOLEAN
IoIsErrorUserInduced ( IoIsErrorUserInduced (
NTSTATUS Status NTSTATUS Status
); );
BOOLEAN
STDCALL
IoIsOperationSynchronous (
IN PIRP Irp
);
BOOLEAN BOOLEAN
IoIsTotalDeviceFailure ( IoIsTotalDeviceFailure (
NTSTATUS Status NTSTATUS Status
); );
PIRP PIRP
STDCALL
IoMakeAssociatedIrp ( IoMakeAssociatedIrp (
PIRP Irp, PIRP Irp,
CCHAR StackSize CCHAR StackSize
); );
PHYSICAL_ADDRESS PHYSICAL_ADDRESS
IoMapTransfer ( IoMapTransfer (
PADAPTER_OBJECT AdapterObject, PADAPTER_OBJECT AdapterObject,

View file

@ -1,4 +1,4 @@
/* $Id: iotypes.h,v 1.11 2000/03/05 19:17:37 ea Exp $ /* $Id: iotypes.h,v 1.12 2000/03/06 01:02:30 ea Exp $
* *
*/ */
@ -265,6 +265,8 @@ typedef struct _FILE_OBJECT
typedef struct _IRP typedef struct _IRP
{ {
CSHORT Type;
USHORT Size;
PMDL MdlAddress; PMDL MdlAddress;
ULONG Flags; ULONG Flags;
union union

View file

@ -1,4 +1,5 @@
/* /* $Id: fs.c,v 1.11 2000/03/06 01:02:30 ea 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/io/fs.c * FILE: ntoskrnl/io/fs.c

View file

@ -1,4 +1,5 @@
/* /* $Id: irp.c,v 1.26 2000/03/06 01:02:30 ea 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/io/irp.c * FILE: ntoskrnl/io/irp.c
@ -39,7 +40,9 @@
/* FUNCTIONS ****************************************************************/ /* FUNCTIONS ****************************************************************/
PDEVICE_OBJECT IoGetDeviceToVerify(PETHREAD Thread) PDEVICE_OBJECT
STDCALL
IoGetDeviceToVerify (PETHREAD Thread)
/* /*
* FUNCTION: Returns a pointer to the device, representing a removable-media * FUNCTION: Returns a pointer to the device, representing a removable-media
* device, that is the target of the given thread's I/O request * device, that is the target of the given thread's I/O request
@ -48,7 +51,10 @@ PDEVICE_OBJECT IoGetDeviceToVerify(PETHREAD Thread)
UNIMPLEMENTED; UNIMPLEMENTED;
} }
VOID IoFreeIrp(PIRP Irp)
VOID
STDCALL
IoFreeIrp (PIRP Irp)
/* /*
* FUNCTION: Releases a caller allocated irp * FUNCTION: Releases a caller allocated irp
* ARGUMENTS: * ARGUMENTS:
@ -58,7 +64,10 @@ VOID IoFreeIrp(PIRP Irp)
ExFreePool(Irp); ExFreePool(Irp);
} }
PIRP IoMakeAssociatedIrp(PIRP Irp, CCHAR StackSize)
PIRP
STDCALL
IoMakeAssociatedIrp (PIRP Irp, CCHAR StackSize)
/* /*
* FUNCTION: Allocates and initializes an irp to associated with a master irp * FUNCTION: Allocates and initializes an irp to associated with a master irp
* ARGUMENTS: * ARGUMENTS:
@ -73,7 +82,13 @@ PIRP IoMakeAssociatedIrp(PIRP Irp, CCHAR StackSize)
UNIMPLEMENTED; UNIMPLEMENTED;
} }
VOID IoMarkIrpPending(PIRP Irp)
/**********************************************************************
* NAME INTERNAL
* IoMarkIrpPending
*/
VOID
IoMarkIrpPending (PIRP Irp)
/* /*
* FUNCTION: Marks the specified irp, indicating further processing will * FUNCTION: Marks the specified irp, indicating further processing will
* be required by other driver routines * be required by other driver routines
@ -86,7 +101,13 @@ VOID IoMarkIrpPending(PIRP Irp)
IoGetCurrentIrpStackLocation(Irp)->Control |= SL_PENDING_RETURNED; IoGetCurrentIrpStackLocation(Irp)->Control |= SL_PENDING_RETURNED;
} }
USHORT IoSizeOfIrp(CCHAR StackSize)
/**********************************************************************
* NAME INTERNAL
* IoSizeOfIrp
*/
USHORT
IoSizeOfIrp (CCHAR StackSize)
/* /*
* FUNCTION: Determines the size of an IRP * FUNCTION: Determines the size of an IRP
* ARGUMENTS: * ARGUMENTS:
@ -97,7 +118,10 @@ USHORT IoSizeOfIrp(CCHAR StackSize)
return(sizeof(IRP)+((StackSize-1)*sizeof(IO_STACK_LOCATION))); return(sizeof(IRP)+((StackSize-1)*sizeof(IO_STACK_LOCATION)));
} }
VOID IoInitializeIrp(PIRP Irp, USHORT PacketSize, CCHAR StackSize)
VOID
STDCALL
IoInitializeIrp (PIRP Irp, USHORT PacketSize, CCHAR StackSize)
/* /*
* FUNCTION: Initalizes an irp allocated by the caller * FUNCTION: Initalizes an irp allocated by the caller
* ARGUMENTS: * ARGUMENTS:
@ -109,12 +133,19 @@ VOID IoInitializeIrp(PIRP Irp, USHORT PacketSize, CCHAR StackSize)
assert(Irp != NULL); assert(Irp != NULL);
memset(Irp, 0, PacketSize); memset(Irp, 0, PacketSize);
Irp->Size = PacketSize;
Irp->StackCount = StackSize; Irp->StackCount = StackSize;
Irp->CurrentLocation = StackSize; Irp->CurrentLocation = StackSize;
Irp->Tail.Overlay.CurrentStackLocation = IoGetCurrentIrpStackLocation(Irp); Irp->Tail.Overlay.CurrentStackLocation = IoGetCurrentIrpStackLocation(Irp);
} }
PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
/**********************************************************************
* NAME INTERNAL
* IoGetCurrentIrpStackLocation
*/
PIO_STACK_LOCATION
IoGetCurrentIrpStackLocation (PIRP Irp)
/* /*
* FUNCTION: Gets a pointer to the callers location in the I/O stack in * FUNCTION: Gets a pointer to the callers location in the I/O stack in
* the given IRP * the given IRP
@ -131,13 +162,25 @@ PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
return(&Irp->Stack[(ULONG)Irp->CurrentLocation]); return(&Irp->Stack[(ULONG)Irp->CurrentLocation]);
} }
VOID IoSetNextIrpStackLocation(PIRP Irp)
/**********************************************************************
* NAME INTERNAL
* IoSetNextIrpStackLocation
*/
VOID
IoSetNextIrpStackLocation (PIRP Irp)
{ {
Irp->CurrentLocation--; Irp->CurrentLocation--;
Irp->Tail.Overlay.CurrentStackLocation--; Irp->Tail.Overlay.CurrentStackLocation--;
} }
PIO_STACK_LOCATION IoGetNextIrpStackLocation(PIRP Irp)
/**********************************************************************
* NAME INTERNAL
* IoGetNextIrpStackLocation
*/
PIO_STACK_LOCATION
IoGetNextIrpStackLocation (PIRP Irp)
/* /*
* FUNCTION: Gives a higher level driver access to the next lower driver's * FUNCTION: Gives a higher level driver access to the next lower driver's
* I/O stack location * I/O stack location
@ -153,7 +196,10 @@ PIO_STACK_LOCATION IoGetNextIrpStackLocation(PIRP Irp)
return(&Irp->Stack[Irp->CurrentLocation-1]); return(&Irp->Stack[Irp->CurrentLocation-1]);
} }
NTSTATUS IoCallDriver(PDEVICE_OBJECT DeviceObject, PIRP Irp)
NTSTATUS
FASTCALL
IofCallDriver (PDEVICE_OBJECT DeviceObject, PIRP Irp)
/* /*
* FUNCTION: Sends an IRP to the next lower driver * FUNCTION: Sends an IRP to the next lower driver
*/ */
@ -178,7 +224,21 @@ NTSTATUS IoCallDriver(PDEVICE_OBJECT DeviceObject, PIRP Irp)
return Status; return Status;
} }
PIRP IoAllocateIrp(CCHAR StackSize, BOOLEAN ChargeQuota)
NTSTATUS
STDCALL
IoCallDriver (PDEVICE_OBJECT DeviceObject, PIRP Irp)
{
return IofCallDriver (
DeviceObject,
Irp
);
}
PIRP
STDCALL
IoAllocateIrp (CCHAR StackSize, BOOLEAN ChargeQuota)
/* /*
* FUNCTION: Allocates an IRP * FUNCTION: Allocates an IRP
* ARGUMENTS: * ARGUMENTS:
@ -218,7 +278,13 @@ PIRP IoAllocateIrp(CCHAR StackSize, BOOLEAN ChargeQuota)
return Irp; return Irp;
} }
VOID IoSetCompletionRoutine(PIRP Irp,
/**********************************************************************
* NAME INTERNAL
* IoSetCompletionRoutine
*/
VOID
IoSetCompletionRoutine (PIRP Irp,
PIO_COMPLETION_ROUTINE CompletionRoutine, PIO_COMPLETION_ROUTINE CompletionRoutine,
PVOID Context, PVOID Context,
BOOLEAN InvokeOnSuccess, BOOLEAN InvokeOnSuccess,
@ -256,7 +322,10 @@ VOID IopCompleteRequest(struct _KAPC* Apc,
(KPRIORITY)(*SystemArgument2)); (KPRIORITY)(*SystemArgument2));
} }
VOID IoCompleteRequest(PIRP Irp, CCHAR PriorityBoost)
VOID
FASTCALL
IofCompleteRequest (PIRP Irp, CCHAR PriorityBoost)
/* /*
* FUNCTION: Indicates the caller has finished all processing for a given * FUNCTION: Indicates the caller has finished all processing for a given
* I/O request and is returning the given IRP to the I/O manager * I/O request and is returning the given IRP to the I/O manager
@ -320,3 +389,73 @@ VOID IoCompleteRequest(PIRP Irp, CCHAR PriorityBoost)
} }
} }
VOID
STDCALL
IoCompleteRequest (PIRP Irp, CCHAR PriorityBoost)
{
IofCompleteRequest (
Irp,
PriorityBoost
);
}
/**********************************************************************
* NAME EXPORTED
* IoIsOperationSynchronous@4
*
* DESCRIPTION
* Check if the I/O operation associated with the given IRP
* is synchronous.
*
* ARGUMENTS
* Irp Packet to check.
*
* RETURN VALUE
* TRUE if Irp's operation is synchronous; otherwise FALSE.
*/
BOOLEAN
STDCALL
IoIsOperationSynchronous (
IN PIRP Irp
)
{
ULONG Flags = 0;
PFILE_OBJECT FileObject = NULL;
/*
* Check the associated FILE_OBJECT's
* flags first.
*/
FileObject = Irp->Tail.Overlay.OriginalFileObject;
if (!(FO_SYNCHRONOUS_IO & FileObject->Flags))
{
/* Check IRP's flags. */
Flags = Irp->Flags;
if (!( (IRP_SYNCHRONOUS_API | IRP_SYNCHRONOUS_PAGING_IO)
& Flags
))
{
return FALSE;
}
}
/*
* Check more IRP's flags.
*/
Flags = Irp->Flags;
if ( !(IRP_MOUNT_COMPLETION & Flags)
|| (IRP_SYNCHRONOUS_PAGING_IO & Flags)
)
{
return TRUE;
}
/*
* Otherwise, it is an
* asynchronous operation.
*/
return FALSE;
}
/* EOF */

View file

@ -1,4 +1,4 @@
; $Id: ntoskrnl.def,v 1.52 2000/03/05 19:17:39 ea Exp $ ; $Id: ntoskrnl.def,v 1.53 2000/03/06 01:02:30 ea Exp $
; ;
; reactos/ntoskrnl/ntoskrnl.def ; reactos/ntoskrnl/ntoskrnl.def
; ;
@ -146,11 +146,12 @@ FsRtlTruncateMcb@8
FsRtlUninitializeFileLock@4 FsRtlUninitializeFileLock@4
FsRtlUninitializeLargeMcb@4 FsRtlUninitializeLargeMcb@4
FsRtlUninitializeMcb@4 FsRtlUninitializeMcb@4
IoAllocateIrp@8
IoAllocateController IoAllocateController
IoAttachDeviceToDeviceStack IoAttachDeviceToDeviceStack
IoBuildSynchronousFsdRequest IoBuildSynchronousFsdRequest
IoCallDriver IoCallDriver@8
IoCompleteRequest IoCompleteRequest@8
IoConnectInterrupt IoConnectInterrupt
IoCreateController IoCreateController
IoCreateDevice IoCreateDevice
@ -161,11 +162,16 @@ IoDeleteController
IoDeleteDevice IoDeleteDevice
IoDisconnectInterrupt IoDisconnectInterrupt
IoFreeController IoFreeController
IoFreeIrp@4
IoGetBaseFileSystemDeviceObject@4 IoGetBaseFileSystemDeviceObject@4
IoGetCurrentIrpStackLocation IoGetCurrentIrpStackLocation
IoGetDeviceToVerify@4
IoGetRelatedDeviceObject@4 IoGetRelatedDeviceObject@4
IoInitializeDpcRequest IoInitializeDpcRequest
IoInitializeIrp@12
IoInitializeTimer IoInitializeTimer
IoIsOperationSynchronous@4
IoMakeAssociatedIrp@8
IoMarkIrpPending IoMarkIrpPending
IoRegisterFileSystem IoRegisterFileSystem
IoRequestDpc IoRequestDpc
@ -174,6 +180,10 @@ IoStartNextPacket
IoStartNextPacketByKey IoStartNextPacketByKey
IoStartTimer IoStartTimer
IoStopTimer IoStopTimer
;@IofCallDriver@0
IofCallDriver@8
;@IofCompleteRequest@0
IofCompleteRequest@8
KdDebuggerEnabled DATA KdDebuggerEnabled DATA
KdDebuggerNotPresent DATA KdDebuggerNotPresent DATA
KdPollBreakIn@0 KdPollBreakIn@0

View file

@ -1,4 +1,4 @@
; $Id: ntoskrnl.edf,v 1.39 2000/03/05 19:17:40 ea Exp $ ; $Id: ntoskrnl.edf,v 1.40 2000/03/06 01:02:30 ea Exp $
; ;
; reactos/ntoskrnl/ntoskrnl.def ; reactos/ntoskrnl/ntoskrnl.def
; ;
@ -146,11 +146,12 @@ FsRtlTruncateMcb=FsRtlTruncateMcb@8
FsRtlUninitializeFileLock=FsRtlUninitializeFileLock@4 FsRtlUninitializeFileLock=FsRtlUninitializeFileLock@4
FsRtlUninitializeLargeMcb=FsRtlUninitializeLargeMcb@4 FsRtlUninitializeLargeMcb=FsRtlUninitializeLargeMcb@4
FsRtlUninitializeMcb=FsRtlUninitializeMcb@4 FsRtlUninitializeMcb=FsRtlUninitializeMcb@4
IoAllocateIrp=IoAllocateIrp@8
IoAllocateController IoAllocateController
IoAttachDeviceToDeviceStack IoAttachDeviceToDeviceStack
IoBuildSynchronousFsdRequest IoBuildSynchronousFsdRequest
IoCallDriver IoCallDriver=IoCallDriver@8
IoCompleteRequest IoCompleteRequest=IoCompleteRequest@8
IoConnectInterrupt IoConnectInterrupt
IoCreateController IoCreateController
IoCreateDevice IoCreateDevice
@ -161,11 +162,16 @@ IoDeleteController
IoDeleteDevice IoDeleteDevice
IoDisconnectInterrupt IoDisconnectInterrupt
IoFreeController IoFreeController
IoFreeIrp=IoFreeIrp@4
IoGetBaseFileSystemDeviceObject=IoGetBaseFileSystemDeviceObject@4 IoGetBaseFileSystemDeviceObject=IoGetBaseFileSystemDeviceObject@4
IoGetCurrentIrpStackLocation IoGetCurrentIrpStackLocation
IoGetDeviceToVerify=IoGetDeviceToVerify@4
IoGetRelatedDeviceObject=IoGetRelatedDeviceObject@4 IoGetRelatedDeviceObject=IoGetRelatedDeviceObject@4
IoInitializeDpcRequest IoInitializeDpcRequest
IoInitializeIrp=IoInitializeIrp@12
IoInitializeTimer IoInitializeTimer
IoIsOperationSynchronous=IoIsOperationSynchronous@4
IoMakeAssociatedIrp@8
IoMarkIrpPending IoMarkIrpPending
IoRegisterFileSystem IoRegisterFileSystem
IoRequestDpc IoRequestDpc
@ -174,6 +180,10 @@ IoStartNextPacket
IoStartNextPacketByKey IoStartNextPacketByKey
IoStartTimer IoStartTimer
IoStopTimer IoStopTimer
;IofCallDriver=@IofCallDriver@0
IofCallDriver=IofCallDriver@8
;IofCompleteRequest=@IofCompleteRequest@0
IofCompleteRequest=IofCompleteRequest@8
KdDebuggerEnabled DATA KdDebuggerEnabled DATA
KdDebuggerNotPresent DATA KdDebuggerNotPresent DATA
KdPollBreakIn=KdPollBreakIn@0 KdPollBreakIn=KdPollBreakIn@0