summaryrefslogtreecommitdiffstats
path: root/src/drivers/block
diff options
context:
space:
mode:
authorMichael Brown2011-06-24 15:14:41 +0200
committerMichael Brown2011-06-28 15:45:08 +0200
commite01ec74601b58f54a5e2ae7b9fd1196972034114 (patch)
tree54f2d2202274523e2365584502dee7db8deca43b /src/drivers/block
parent[xfer] Send xfer_window_changed() after xfer_vredirect() (diff)
downloadipxe-e01ec74601b58f54a5e2ae7b9fd1196972034114.tar.gz
ipxe-e01ec74601b58f54a5e2ae7b9fd1196972034114.tar.xz
ipxe-e01ec74601b58f54a5e2ae7b9fd1196972034114.zip
[process] Pass containing object pointer to process step() methods
Give the step() method a pointer to the containing object, rather than a pointer to the process. This is consistent with the operation of interface methods, and allows a single function to serve as both an interface method and a process step() method. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/drivers/block')
-rw-r--r--src/drivers/block/scsi.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/drivers/block/scsi.c b/src/drivers/block/scsi.c
index d1416513..016a6c55 100644
--- a/src/drivers/block/scsi.c
+++ b/src/drivers/block/scsi.c
@@ -892,11 +892,9 @@ static struct interface_descriptor scsidev_ready_desc =
/**
* SCSI TEST UNIT READY process
*
- * @v process Process
+ * @v scsidev SCSI device
*/
-static void scsidev_step ( struct process *process ) {
- struct scsi_device *scsidev =
- container_of ( process, struct scsi_device, process );
+static void scsidev_step ( struct scsi_device *scsidev ) {
int rc;
/* Wait until underlying SCSI device is ready */
@@ -926,6 +924,10 @@ static struct interface_descriptor scsidev_scsi_desc =
INTF_DESC_PASSTHRU ( struct scsi_device, scsi,
scsidev_scsi_op, block );
+/** SCSI device process descriptor */
+static struct process_descriptor scsidev_process_desc =
+ PROC_DESC ( struct scsi_device, process, scsidev_step );
+
/**
* Open SCSI device
*
@@ -946,7 +948,8 @@ int scsi_open ( struct interface *block, struct interface *scsi,
intf_init ( &scsidev->block, &scsidev_block_desc, &scsidev->refcnt );
intf_init ( &scsidev->scsi, &scsidev_scsi_desc, &scsidev->refcnt );
intf_init ( &scsidev->ready, &scsidev_ready_desc, &scsidev->refcnt );
- process_init ( &scsidev->process, scsidev_step, &scsidev->refcnt );
+ process_init ( &scsidev->process, &scsidev_process_desc,
+ &scsidev->refcnt );
INIT_LIST_HEAD ( &scsidev->cmds );
memcpy ( &scsidev->lun, lun, sizeof ( scsidev->lun ) );
DBGC ( scsidev, "SCSI %p created for LUN " SCSI_LUN_FORMAT "\n",