[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>
This commit is contained in:
Michael Brown
2011-06-24 14:14:41 +01:00
parent ba3633782b
commit e01ec74601
16 changed files with 229 additions and 101 deletions

View File

@@ -244,11 +244,9 @@ static struct interface_descriptor fc_els_job_desc =
/**
* Fibre Channel ELS process
*
* @v process Process
* @v els Fibre Channel ELS transaction
*/
static void fc_els_step ( struct process *process ) {
struct fc_els *els =
container_of ( process, struct fc_els, process );
static void fc_els_step ( struct fc_els *els ) {
int xchg_id;
int rc;
@@ -278,6 +276,10 @@ static void fc_els_step ( struct process *process ) {
}
}
/** Fibre Channel ELS process descriptor */
static struct process_descriptor fc_els_process_desc =
PROC_DESC ( struct fc_els, process, fc_els_step );
/**
* Create ELS transaction
*
@@ -298,7 +300,8 @@ static struct fc_els * fc_els_create ( struct fc_port *port,
ref_init ( &els->refcnt, fc_els_free );
intf_init ( &els->job, &fc_els_job_desc, &els->refcnt );
intf_init ( &els->xchg, &fc_els_xchg_desc, &els->refcnt );
process_init_stopped ( &els->process, fc_els_step, &els->refcnt );
process_init_stopped ( &els->process, &fc_els_process_desc,
&els->refcnt );
els->port = fc_port_get ( port );
memcpy ( &els->port_id, port_id, sizeof ( els->port_id ) );
memcpy ( &els->peer_port_id, peer_port_id,