void aoe_bus__free(void);
/* Globals. */
-struct bus__type * aoe_bus = NULL;
+WV_SP_BUS_T aoe_bus = NULL;
static NTSTATUS STDCALL aoe_bus__dev_ctl_dispatch_(
IN struct device__type * dev,
* @ret TRUE for success, else FALSE.
*/
winvblock__bool aoe_bus__create(void) {
- struct bus__type * new_bus;
+ WV_SP_BUS_T new_bus;
/* We should only be called once. */
if (aoe_bus) {
);
/* From aoe/bus.c */
-extern struct bus__type * aoe_bus;
+extern WV_SP_BUS_T aoe_bus;
extern winvblock__bool aoe_bus__create(void);
extern void aoe_bus__free(void);
NTSTATUS Status;
OBJECT_ATTRIBUTES ObjectAttributes;
void * ThreadObject;
- struct bus__type * bus_ptr;
+ WV_SP_BUS_T bus_ptr;
DBG("Entry\n");
) {
winvblock__uint32 count;
struct device__type * dev_walker;
- struct bus__type * bus;
+ WV_SP_BUS_T bus;
aoe__mount_disks_ptr disks;
PIO_STACK_LOCATION io_stack_loc = IoGetCurrentIrpStackLocation(irp);
* If you implement your own bus thread routine, you should call
* bus__process_work_items() within its loop.
*/
-typedef void STDCALL bus__thread_func(IN struct bus__type *);
+typedef void STDCALL bus__thread_func(IN WV_SP_BUS_T);
/* The bus type. */
-struct bus__type {
+typedef struct WV_BUS_T {
struct device__type * device;
PDEVICE_OBJECT LowerDeviceObject;
PDEVICE_OBJECT PhysicalDeviceObject;
LIST_ENTRY Nodes;
USHORT NodeCount;
} BusPrivate_;
- };
+ } WV_S_BUS_T, * WV_SP_BUS_T;
/* A child PDO node on a bus. Treat this as an opaque type. */
typedef struct WV_BUS_NODE {
struct {
LIST_ENTRY Link;
PDEVICE_OBJECT Pdo;
- struct bus__type * Bus;
+ WV_SP_BUS_T Bus;
} BusPrivate_;
} WV_S_BUS_NODE, * WV_SP_BUS_NODE;
);
extern NTSTATUS bus__module_init(void);
extern void bus__module_shutdown(void);
-extern winvblock__lib_func void bus__init(struct bus__type *);
-extern winvblock__lib_func struct bus__type * bus__create(void);
+extern winvblock__lib_func void bus__init(WV_SP_BUS_T);
+extern winvblock__lib_func WV_SP_BUS_T bus__create(void);
extern winvblock__lib_func winvblock__bool STDCALL bus__add_child(
- IN OUT struct bus__type *,
+ IN OUT WV_SP_BUS_T,
IN struct device__type *
);
-extern winvblock__lib_func struct bus__type * bus__get(struct device__type *);
-extern winvblock__lib_func void bus__process_work_items(struct bus__type *);
-extern winvblock__lib_func NTSTATUS bus__start_thread(struct bus__type *);
+extern winvblock__lib_func WV_SP_BUS_T bus__get(struct device__type *);
+extern winvblock__lib_func void bus__process_work_items(WV_SP_BUS_T);
+extern winvblock__lib_func NTSTATUS bus__start_thread(WV_SP_BUS_T);
extern winvblock__lib_func winvblock__bool STDCALL WvBusInitNode(
OUT WV_SP_BUS_NODE,
IN PDEVICE_OBJECT
);
extern winvblock__lib_func NTSTATUS STDCALL WvBusAddNode(
- struct bus__type *,
+ WV_SP_BUS_T,
WV_SP_BUS_NODE
);
extern winvblock__lib_func NTSTATUS STDCALL WvBusRemoveNode(WV_SP_BUS_NODE);
extern winvblock__lib_func void STDCALL Driver_CompletePendingIrp(IN PIRP);
/* Note the exception to the function naming convention. */
extern winvblock__lib_func NTSTATUS STDCALL Error(IN PCHAR, IN NTSTATUS);
-extern winvblock__lib_func struct bus__type * driver__bus(void);
+extern winvblock__lib_func struct WV_BUS_T * driver__bus(void);
/* Note the exception to the function naming convention. */
extern NTSTATUS STDCALL DriverEntry(
IN PDRIVER_OBJECT,
static device__pnp_func bus__pnp_dispatch_;
static bus__thread_func bus__default_thread_;
static winvblock__bool bus__add_work_item_(
- struct bus__type *,
+ WV_SP_BUS_T,
WV_SP_BUS_WORK_ITEM_
);
-static WV_SP_BUS_WORK_ITEM_ bus__get_work_item_(struct bus__type *);
+static WV_SP_BUS_WORK_ITEM_ bus__get_work_item_(WV_SP_BUS_T);
/* Globals. */
struct device__irp_mj bus__irp_mj_ = {
* @ret TRUE for success, FALSE for failure.
*/
winvblock__lib_func winvblock__bool STDCALL bus__add_child(
- IN OUT struct bus__type * bus_ptr,
+ IN OUT WV_SP_BUS_T bus_ptr,
IN OUT struct device__type * dev_ptr
) {
/* The new node's device object. */
IN struct device__type * dev,
IN PIRP irp
) {
- struct bus__type * bus = bus__get(dev);
+ WV_SP_BUS_T bus = bus__get(dev);
PDEVICE_OBJECT lower = bus->LowerDeviceObject;
if (lower) {
IN struct device__type * dev,
IN PIRP irp
) {
- struct bus__type * bus = bus__get(dev);
+ WV_SP_BUS_T bus = bus__get(dev);
PDEVICE_OBJECT lower = bus->LowerDeviceObject;
PoStartNextPowerIrp(irp);
*
* @v bus Points to the bus to initialize with defaults.
*/
-winvblock__lib_func void bus__init(struct bus__type * bus) {
+winvblock__lib_func void bus__init(WV_SP_BUS_T bus) {
struct device__type * dev = bus->device;
RtlZeroMemory(bus, sizeof *bus);
*
* This function should not be confused with a PDO creation routine, which is
* actually implemented for each device type. This routine will allocate a
- * bus__type, track it in a global list, as well as populate the bus
+ * WV_S_BUS_T, track it in a global list, as well as populate the bus
* with default values.
*/
-winvblock__lib_func struct bus__type * bus__create(void) {
+winvblock__lib_func WV_SP_BUS_T bus__create(void) {
struct device__type * dev;
- struct bus__type * bus;
+ WV_SP_BUS_T bus;
/* Try to create a device. */
dev = device__create();
*/
static PDEVICE_OBJECT STDCALL bus__create_pdo_(IN struct device__type * dev) {
PDEVICE_OBJECT pdo = NULL;
- struct bus__type * bus;
+ WV_SP_BUS_T bus;
NTSTATUS status;
/* Note the bus device needing a PDO. */
* @v dev_ptr Points to the bus device to delete.
*/
static void STDCALL bus__free_(IN struct device__type * dev_ptr) {
- struct bus__type * bus_ptr = bus__get(dev_ptr);
+ WV_SP_BUS_T bus_ptr = bus__get(dev_ptr);
/* Free the "inherited class". */
bus_ptr->prev_free(dev_ptr);
* @v dev A pointer to a device.
* @ret A pointer to the device's associated bus.
*/
-extern winvblock__lib_func struct bus__type * bus__get(
+extern winvblock__lib_func WV_SP_BUS_T bus__get(
struct device__type * dev
) {
return dev->ext;
* Note that this function will initialize the work item's completion signal.
*/
static winvblock__bool bus__add_work_item_(
- struct bus__type * bus,
+ WV_SP_BUS_T bus,
WV_SP_BUS_WORK_ITEM_ work_item
) {
ExInterlockedInsertTailList(
* @ret bus__work_item_ The work item, or NULL for an empty queue.
*/
static WV_SP_BUS_WORK_ITEM_ bus__get_work_item_(
- struct bus__type * bus
+ WV_SP_BUS_T bus
) {
PLIST_ENTRY list_entry;
*
* @v bus The bus to process its work items.
*/
-winvblock__lib_func void bus__process_work_items(struct bus__type * bus) {
+winvblock__lib_func void bus__process_work_items(WV_SP_BUS_T bus) {
WV_SP_BUS_WORK_ITEM_ work_item;
WV_SP_BUS_NODE node;
/* The device__type::ops.free implementation for a threaded bus. */
static void STDCALL bus__thread_free_(IN struct device__type * dev) {
- struct bus__type * bus = bus__get(dev);
+ WV_SP_BUS_T bus = bus__get(dev);
bus->thread = (bus__thread_func *) 0;
KeSetEvent(&bus->work_signal, 0, FALSE);
* the bus that the thread should use in processing.
*/
static void STDCALL bus__thread_(IN void * context) {
- struct bus__type * bus = context;
+ WV_SP_BUS_T bus = context;
if (!bus || !bus->thread) {
DBG("No bus or no thread!\n");
* If you implement your own thread routine, you are also responsible
* for freeing the bus.
*/
-static void STDCALL bus__default_thread_(IN struct bus__type * bus) {
+static void STDCALL bus__default_thread_(IN WV_SP_BUS_T bus) {
LARGE_INTEGER timeout;
/* Wake up at least every 30 seconds. */
* specify your own thread routine, then call this function to start it.
*/
winvblock__lib_func NTSTATUS bus__start_thread(
- struct bus__type * bus
+ WV_SP_BUS_T bus
) {
OBJECT_ATTRIBUTES obj_attrs;
HANDLE thread_handle;
* node will be added. This is usually from the bus' thread.
*/
winvblock__lib_func NTSTATUS STDCALL WvBusAddNode(
- struct bus__type * Bus,
+ WV_SP_BUS_T Bus,
WV_SP_BUS_NODE Node
) {
WV_SP_BUS_WORK_ITEM_ work_item;
winvblock__lib_func NTSTATUS STDCALL WvBusRemoveNode(
WV_SP_BUS_NODE Node
) {
- struct bus__type * bus;
+ WV_SP_BUS_T bus;
WV_SP_BUS_WORK_ITEM_ work_item;
if (!Node || !(bus = Node->BusPrivate_.Bus))
winvblock__uint32 disk_num = *(winvblock__uint32_ptr) buffer;
struct device__type * dev_walker;
disk__type_ptr disk_walker = NULL, prev_disk_walker;
- struct bus__type * bus;
+ WV_SP_BUS_T bus;
DBG("Request to detach disk: %d\n", disk_num);
bus = bus__get(dev);
) {
NTSTATUS status;
KEVENT event;
- struct bus__type * bus = bus__get(dev);
+ WV_SP_BUS_T bus = bus__get(dev);
PDEVICE_OBJECT lower = bus->LowerDeviceObject;
if (!lower)
IN PIRP irp
) {
NTSTATUS status = STATUS_SUCCESS;
- struct bus__type * bus = bus__get(dev);
+ WV_SP_BUS_T bus = bus__get(dev);
PDEVICE_OBJECT lower = bus->LowerDeviceObject;
struct device__type * walker, * next;
IN PIRP irp
) {
NTSTATUS status;
- struct bus__type * bus = bus__get(dev);
+ WV_SP_BUS_T bus = bus__get(dev);
PDEVICE_OBJECT lower = bus->LowerDeviceObject;
PIO_STACK_LOCATION io_stack_loc = IoGetCurrentIrpStackLocation(irp);
winvblock__uint32 count;
PDEVICE_CAPABILITIES DeviceCapabilities =
io_stack_loc->Parameters.DeviceCapabilities.Capabilities;
NTSTATUS status;
- struct bus__type * bus = bus__get(dev);
+ WV_SP_BUS_T bus = bus__get(dev);
DEVICE_CAPABILITIES ParentDeviceCapabilities;
PDEVICE_OBJECT lower;
IN struct device__type * dev,
IN PIRP irp
) {
- struct bus__type * bus = bus__get(dev);
+ WV_SP_BUS_T bus = bus__get(dev);
WCHAR (*str)[512];
PIO_STACK_LOCATION io_stack_loc = IoGetCurrentIrpStackLocation(irp);
NTSTATUS status;
IN UCHAR code
) {
NTSTATUS status;
- struct bus__type * bus = bus__get(dev);
+ WV_SP_BUS_T bus = bus__get(dev);
PDEVICE_OBJECT lower = bus->LowerDeviceObject;
switch (code) {
io_stack_loc->Parameters.DeviceCapabilities.Capabilities;
NTSTATUS status;
disk__type_ptr disk;
- struct bus__type * bus;
+ WV_SP_BUS_T bus;
DEVICE_CAPABILITIES ParentDeviceCapabilities;
PDEVICE_OBJECT bus_lower;
KIRQL irql;
NTSTATUS status;
PLIST_ENTRY walker;
- struct bus__type * bus;
+ WV_SP_BUS_T bus;
PUNICODE_STRING dev_name = NULL;
PDEVICE_OBJECT fdo = NULL;
struct device__type * dev_ptr;
/* Create the root-enumerated, main bus device. */
NTSTATUS STDCALL driver__create_bus_(void) {
- struct bus__type * bus;
+ WV_SP_BUS_T bus;
NTSTATUS status;
PDEVICE_OBJECT bus_pdo = NULL;
*
* @ret A pointer to the driver bus, or NULL.
*/
-winvblock__lib_func struct bus__type * driver__bus(void) {
+winvblock__lib_func WV_SP_BUS_T driver__bus(void) {
if (!driver__bus_fdo_) {
DBG("No driver bus device!\n");
return NULL;