[AUDIT] - These are yet more < 10 line wrappers.

[FORMATTING] - Fixup file headers, formatting and some comments.

svn path=/trunk/; revision=22726
This commit is contained in:
Alex Ionescu 2006-06-30 19:09:39 +00:00
parent f5270b0105
commit dec64724df
2 changed files with 55 additions and 86 deletions

View file

@ -1,11 +1,10 @@
/* $Id$ /*
* * PROJECT: ReactOS Kernel
* COPYRIGHT: See COPYING in the top level directory * LICENSE: GPL - See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/io/adapter.c * FILE: ntoskrnl/io/adapter.c
* PURPOSE: DMA handling * PURPOSE: I/O Wrappers for HAL Adapter APIs
* * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
* PROGRAMMERS: David Welch (welch@mcmail.com) * Filip Navara (navaraf@reactos.org)
*/ */
/* INCLUDES *****************************************************************/ /* INCLUDES *****************************************************************/
@ -16,34 +15,35 @@
/* DATA **********************************************************************/ /* DATA **********************************************************************/
POBJECT_TYPE IoAdapterObjectType = NULL; /* FIXME */ POBJECT_TYPE IoAdapterObjectType;
POBJECT_TYPE IoDeviceHandlerObjectType = NULL; /* FIXME */ POBJECT_TYPE IoDeviceHandlerObjectType;
ULONG IoDeviceHandlerObjectSize = 0; /* FIXME */ ULONG IoDeviceHandlerObjectSize;
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
/* /*
* @implemented * @implemented
*/ */
NTSTATUS STDCALL NTSTATUS
IoAllocateAdapterChannel (PADAPTER_OBJECT AdapterObject, NTAPI
PDEVICE_OBJECT DeviceObject, IoAllocateAdapterChannel(IN PADAPTER_OBJECT AdapterObject,
ULONG NumberOfMapRegisters, IN PDEVICE_OBJECT DeviceObject,
PDRIVER_CONTROL ExecutionRoutine, IN ULONG NumberOfMapRegisters,
PVOID Context) IN PDRIVER_CONTROL ExecutionRoutine,
IN PVOID Context)
{ {
DeviceObject->Queue.Wcb.DeviceObject = DeviceObject; PWAIT_CONTEXT_BLOCK Wcb = &DeviceObject->Queue.Wcb;
DeviceObject->Queue.Wcb.DeviceContext = Context;
DeviceObject->Queue.Wcb.CurrentIrp = DeviceObject->CurrentIrp;
return HalAllocateAdapterChannel( AdapterObject, /* Initialize the WCB */
&DeviceObject->Queue.Wcb, Wcb->DeviceObject = DeviceObject;
NumberOfMapRegisters, Wcb->DeviceContext = Context;
ExecutionRoutine); Wcb->CurrentIrp = DeviceObject->CurrentIrp;
/* Call HAL */
return HalAllocateAdapterChannel(AdapterObject,
Wcb,
NumberOfMapRegisters,
ExecutionRoutine);
} }
/* NOTE: Missing IoXXXAdapter finctions in HAL.DLL */
/* EOF */ /* EOF */

View file

@ -1,10 +1,9 @@
/* /*
* COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS Kernel
* PROJECT: ReactOS kernel * LICENSE: GPL - See COPYING in the top level directory
* FILE: ntoskrnl/io/contrller.c * FILE: ntoskrnl/io/controller.c
* PURPOSE: Implements the controller object * PURPOSE: I/O Wrappers (called Controllers) for Kernel Device Queues
* * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
* PROGRAMMERS: Alex Ionescu (alex@relsoft.net)
*/ */
/* INCLUDES *****************************************************************/ /* INCLUDES *****************************************************************/
@ -20,27 +19,16 @@ POBJECT_TYPE IoControllerObjectType;
/* /*
* @implemented * @implemented
*
* FUNCTION: Sets up a call to a driver-supplied ControllerControl routine
* as soon as the device controller, represented by the given controller
* object, is available to carry out an I/O operation for the target device,
* represented by the given device object.
* ARGUMENTS:
* ControllerObject = Driver created controller object
* DeviceObject = Target device for the current irp
* ExecutionRoutine = Routine to be called when the device is available
* Context = Driver supplied context to be passed on to the above routine
*/ */
VOID VOID
STDCALL NTAPI
IoAllocateController(PCONTROLLER_OBJECT ControllerObject, IoAllocateController(IN PCONTROLLER_OBJECT ControllerObject,
PDEVICE_OBJECT DeviceObject, IN PDEVICE_OBJECT DeviceObject,
PDRIVER_CONTROL ExecutionRoutine, IN PDRIVER_CONTROL ExecutionRoutine,
PVOID Context) IN PVOID Context)
{ {
IO_ALLOCATION_ACTION Result; IO_ALLOCATION_ACTION Result;
ASSERT_IRQL(DISPATCH_LEVEL);
ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
/* Initialize the Wait Context Block */ /* Initialize the Wait Context Block */
DeviceObject->Queue.Wcb.DeviceContext = Context; DeviceObject->Queue.Wcb.DeviceContext = Context;
@ -50,36 +38,29 @@ IoAllocateController(PCONTROLLER_OBJECT ControllerObject,
if (!KeInsertDeviceQueue(&ControllerObject->DeviceWaitQueue, if (!KeInsertDeviceQueue(&ControllerObject->DeviceWaitQueue,
&DeviceObject->Queue.Wcb.WaitQueueEntry)); &DeviceObject->Queue.Wcb.WaitQueueEntry));
{ {
/* Call the execution routine */
Result = ExecutionRoutine(DeviceObject, Result = ExecutionRoutine(DeviceObject,
DeviceObject->CurrentIrp, DeviceObject->CurrentIrp,
NULL, NULL,
Context); Context);
}
if (Result == DeallocateObject) /* Free the controller if this was requested */
{ if (Result == DeallocateObject) IoFreeController(ControllerObject);
IoFreeController(ControllerObject);
} }
} }
/* /*
* @implemented * @implemented
*
* FUNCTION: Allocates memory and initializes a controller object
* ARGUMENTS:
* Size = Size (in bytes) to be allocated for the controller extension
* RETURNS: A pointer to the created object
*/ */
PCONTROLLER_OBJECT PCONTROLLER_OBJECT
STDCALL NTAPI
IoCreateController(ULONG Size) IoCreateController(IN ULONG Size)
{ {
PCONTROLLER_OBJECT Controller; PCONTROLLER_OBJECT Controller;
OBJECT_ATTRIBUTES ObjectAttributes; OBJECT_ATTRIBUTES ObjectAttributes;
HANDLE Handle; HANDLE Handle;
NTSTATUS Status; NTSTATUS Status;
ASSERT_IRQL(PASSIVE_LEVEL); PAGED_CODE();
/* Initialize an empty OBA */ /* Initialize an empty OBA */
InitializeObjectAttributes(&ObjectAttributes, NULL, 0, NULL, NULL); InitializeObjectAttributes(&ObjectAttributes, NULL, 0, NULL, NULL);
@ -123,15 +104,10 @@ IoCreateController(ULONG Size)
/* /*
* @implemented * @implemented
*
* FUNCTION: Removes a given controller object from the system
* ARGUMENTS:
* ControllerObject = Controller object to be released
*/ */
VOID VOID
STDCALL NTAPI
IoDeleteController(PCONTROLLER_OBJECT ControllerObject) IoDeleteController(IN PCONTROLLER_OBJECT ControllerObject)
{ {
/* Just Dereference it */ /* Just Dereference it */
ObDereferenceObject(ControllerObject); ObDereferenceObject(ControllerObject);
@ -139,40 +115,33 @@ IoDeleteController(PCONTROLLER_OBJECT ControllerObject)
/* /*
* @implemented * @implemented
*
* FUNCTION: Releases a previously allocated controller object when a
* device has finished an I/O request
* ARGUMENTS:
* ControllerObject = Controller object to be released
*/ */
VOID VOID
STDCALL NTAPI
IoFreeController(PCONTROLLER_OBJECT ControllerObject) IoFreeController(IN PCONTROLLER_OBJECT ControllerObject)
{ {
PKDEVICE_QUEUE_ENTRY QueueEntry; PKDEVICE_QUEUE_ENTRY QueueEntry;
PDEVICE_OBJECT DeviceObject; PDEVICE_OBJECT DeviceObject;
IO_ALLOCATION_ACTION Result; IO_ALLOCATION_ACTION Result;
/* Remove the Queue */ /* Remove the Queue */
if ((QueueEntry = KeRemoveDeviceQueue(&ControllerObject->DeviceWaitQueue))) QueueEntry = KeRemoveDeviceQueue(&ControllerObject->DeviceWaitQueue);
if (QueueEntry)
{ {
/* Get the Device Object */ /* Get the Device Object */
DeviceObject = CONTAINING_RECORD(QueueEntry, DeviceObject = CONTAINING_RECORD(QueueEntry,
DEVICE_OBJECT, DEVICE_OBJECT,
Queue.Wcb.WaitQueueEntry); Queue.Wcb.WaitQueueEntry);
/* Call the routine */ /* Call the routine */
Result = DeviceObject->Queue.Wcb.DeviceRoutine(DeviceObject, Result = DeviceObject->Queue.Wcb.DeviceRoutine(DeviceObject,
DeviceObject->CurrentIrp, DeviceObject->CurrentIrp,
NULL, NULL,
DeviceObject->Queue.Wcb.DeviceContext); DeviceObject->
/* Check the result */ Queue.Wcb.DeviceContext);
if (Result == DeallocateObject) /* Free the controller if this was requested */
{ if (Result == DeallocateObject) IoFreeController(ControllerObject);
/* Free it again */
IoFreeController(ControllerObject);
}
} }
} }
/* EOF */ /* EOF */