winvblock__any_ptr ext;
};
+extern winvblock__lib_func device__type_ptr device__get(PDEVICE_OBJECT);
+
#endif /* _device_h */
dev,
irp,
IoGetCurrentIrpStackLocation(irp),
- ((driver__dev_ext_ptr) dev->DeviceExtension)->device,
+ device__get(dev),
&completion
);
/* Fall through to the bus defaults, if needed. */
}
/**
- * Get a pointer to the boot bus device
+ * Get a pointer to the boot bus device.
*
- * @ret A pointer to the boot bus, or NULL
+ * @ret A pointer to the boot bus, or NULL.
*/
-winvblock__lib_func bus__type_ptr
-bus__boot (
- void
- )
-{
- driver__dev_ext_ptr dev_ext_ptr;
-
- if ( !boot_bus_fdo )
- {
- DBG ( "No boot bus device!\n" );
- return NULL;
- }
- dev_ext_ptr = ( driver__dev_ext_ptr ) boot_bus_fdo->DeviceExtension;
- return bus__get_ptr ( dev_ext_ptr->device );
-}
+winvblock__lib_func bus__type_ptr bus__boot(void)
+ {
+ if ( !boot_bus_fdo )
+ {
+ DBG ( "No boot bus device!\n" );
+ return NULL;
+ }
+ return bus__get_ptr(device__get(boot_bus_fdo));
+ }
IN PCHAR DebugMessage
)
{
- device__type_ptr dev_ptr =
- ( ( driver__dev_ext_ptr ) DeviceObject->DeviceExtension )->device;
+ device__type_ptr dev_ptr = device__get(DeviceObject);
PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation ( Irp );
PSCSI_REQUEST_BLOCK Srb;
PCDB Cdb;
wv_free(dev_ptr);
}
+
+/**
+ * Get a device from a DEVICE_OBJECT.
+ *
+ * @v dev_obj Points to the DEVICE_OBJECT to get the device from.
+ * @ret Returns a pointer to the device on success, else NULL.
+ */
+winvblock__lib_func device__type_ptr device__get(PDEVICE_OBJECT dev_obj)
+ {
+ driver__dev_ext_ptr dev_ext = dev_obj->DeviceExtension;
+ return dev_ext->device;
+ }
Stack->Parameters.DeviceCapabilities.Capabilities;
NTSTATUS status;
disk__type_ptr disk_ptr;
- driver__dev_ext_ptr bus_dev_ext_ptr;
bus__type_ptr bus_ptr;
DEVICE_CAPABILITIES ParentDeviceCapabilities;
goto ret_path;
}
disk_ptr = disk__get_ptr ( dev_ptr );
- bus_dev_ext_ptr = ( driver__dev_ext_ptr ) dev_ptr->Parent->DeviceExtension;
- bus_ptr = bus__get_ptr ( bus_dev_ext_ptr->device );
+ bus_ptr = bus__get_ptr(device__get(dev_ptr->Parent));
status =
Bus_GetDeviceCapabilities ( bus_ptr->LowerDeviceObject,
&ParentDeviceCapabilities );
#ifdef DEBUGIRPS
Debug_IrpStart ( DeviceObject, Irp );
#endif
- dev_ptr = ( ( driver__dev_ext_ptr ) DeviceObject->DeviceExtension )->device;
+ dev_ptr = device__get(DeviceObject);
/*
* We handle IRP_MJ_POWER as an exception
dev,
irp,
IoGetCurrentIrpStackLocation(irp),
- ((driver__dev_ext_ptr) dev->DeviceExtension)->device,
+ device__get(dev),
&completion
);
/* Fall through to some driver defaults, if needed. */