[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>
pull/5/head
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

@ -26,15 +26,7 @@ static void hw_finished ( struct hw *hw, int rc ) {
process_del ( &hw->process );
}
static struct interface_operation hw_xfer_operations[] = {
INTF_OP ( intf_close, struct hw *, hw_finished ),
};
static struct interface_descriptor hw_xfer_desc =
INTF_DESC ( struct hw, xfer, hw_xfer_operations );
static void hw_step ( struct process *process ) {
struct hw *hw = container_of ( process, struct hw, process );
static void hw_step ( struct hw *hw ) {
int rc;
if ( xfer_window ( &hw->xfer ) ) {
@ -43,6 +35,16 @@ static void hw_step ( struct process *process ) {
}
}
static struct interface_operation hw_xfer_operations[] = {
INTF_OP ( intf_close, struct hw *, hw_finished ),
};
static struct interface_descriptor hw_xfer_desc =
INTF_DESC ( struct hw, xfer, hw_xfer_operations );
static struct process_descriptor hw_process_desc =
PROC_DESC ( struct hw, process, hw_step );
static int hw_open ( struct interface *xfer, struct uri *uri __unused ) {
struct hw *hw;
@ -52,7 +54,7 @@ static int hw_open ( struct interface *xfer, struct uri *uri __unused ) {
return -ENOMEM;
ref_init ( &hw->refcnt, NULL );
intf_init ( &hw->xfer, &hw_xfer_desc, &hw->refcnt );
process_init ( &hw->process, hw_step, &hw->refcnt );
process_init ( &hw->process, &hw_process_desc, &hw->refcnt );
/* Attach parent interface, mortalise self, and return */
intf_plug_plug ( &hw->xfer, xfer );

View File

@ -33,6 +33,16 @@ FILE_LICENCE ( GPL2_OR_LATER );
/** Process run queue */
static LIST_HEAD ( run_queue );
/**
* Get pointer to object containing process
*
* @v process Process
* @ret object Containing object
*/
void * process_object ( struct process *process ) {
return ( ( ( void * ) process ) - process->desc->offset );
}
/**
* Add process to process list
*
@ -43,13 +53,13 @@ static LIST_HEAD ( run_queue );
*/
void process_add ( struct process *process ) {
if ( ! process_running ( process ) ) {
DBGC ( process, "PROCESS %p (%p) starting\n",
process, process->step );
DBGC ( PROC_COL ( process ), "PROCESS " PROC_FMT
" starting\n", PROC_DBG ( process ) );
ref_get ( process->refcnt );
list_add_tail ( &process->list, &run_queue );
} else {
DBGC ( process, "PROCESS %p (%p) already started\n",
process, process->step );
DBGC ( PROC_COL ( process ), "PROCESS " PROC_FMT
" already started\n", PROC_DBG ( process ) );
}
}
@ -63,14 +73,14 @@ void process_add ( struct process *process ) {
*/
void process_del ( struct process *process ) {
if ( process_running ( process ) ) {
DBGC ( process, "PROCESS %p (%p) stopping\n",
process, process->step );
DBGC ( PROC_COL ( process ), "PROCESS " PROC_FMT
" stopping\n", PROC_DBG ( process ) );
list_del ( &process->list );
INIT_LIST_HEAD ( &process->list );
ref_put ( process->refcnt );
} else {
DBGC ( process, "PROCESS %p (%p) already stopped\n",
process, process->step );
DBGC ( PROC_COL ( process ), "PROCESS " PROC_FMT
" already stopped\n", PROC_DBG ( process ) );
}
}
@ -82,17 +92,21 @@ void process_del ( struct process *process ) {
*/
void step ( void ) {
struct process *process;
struct process_descriptor *desc;
void *object;
if ( ( process = list_first_entry ( &run_queue, struct process,
list ) ) ) {
ref_get ( process->refcnt ); /* Inhibit destruction mid-step */
desc = process->desc;
object = process_object ( process );
list_del ( &process->list );
list_add_tail ( &process->list, &run_queue );
ref_get ( process->refcnt ); /* Inhibit destruction mid-step */
DBGC2 ( process, "PROCESS %p (%p) executing\n",
process, process->step );
process->step ( process );
DBGC2 ( process, "PROCESS %p (%p) finished executing\n",
process, process->step );
DBGC2 ( PROC_COL ( process ), "PROCESS " PROC_FMT
" executing\n", PROC_DBG ( process ) );
desc->step ( object );
DBGC2 ( PROC_COL ( process ), "PROCESS " PROC_FMT
" finished executing\n", PROC_DBG ( process ) );
ref_put ( process->refcnt ); /* Allow destruction */
}
}

View File

@ -86,16 +86,17 @@ struct numeric_resolv {
int rc;
};
static void numeric_step ( struct process *process ) {
struct numeric_resolv *numeric =
container_of ( process, struct numeric_resolv, process );
static void numeric_step ( struct numeric_resolv *numeric ) {
process_del ( process );
process_del ( &numeric->process );
if ( numeric->rc == 0 )
resolv_done ( &numeric->resolv, &numeric->sa );
intf_shutdown ( &numeric->resolv, numeric->rc );
}
static struct process_descriptor numeric_process_desc =
PROC_DESC ( struct numeric_resolv, process, numeric_step );
static int numeric_resolv ( struct interface *resolv,
const char *name, struct sockaddr *sa ) {
struct numeric_resolv *numeric;
@ -107,7 +108,8 @@ static int numeric_resolv ( struct interface *resolv,
return -ENOMEM;
ref_init ( &numeric->refcnt, NULL );
intf_init ( &numeric->resolv, &null_intf_desc, &numeric->refcnt );
process_init ( &numeric->process, numeric_step, &numeric->refcnt );
process_init ( &numeric->process, &numeric_process_desc,
&numeric->refcnt );
memcpy ( &numeric->sa, sa, sizeof ( numeric->sa ) );
DBGC ( numeric, "NUMERIC %p attempting to resolve \"%s\"\n",

View File

@ -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",

View File

@ -17,6 +17,20 @@ FILE_LICENCE ( GPL2_OR_LATER );
struct process {
/** List of processes */
struct list_head list;
/** Process descriptor */
struct process_descriptor *desc;
/** Reference counter
*
* If this process is not part of a reference-counted object,
* this field may be NULL.
*/
struct refcnt *refcnt;
};
/** A process descriptor */
struct process_descriptor {
/** Offset of process within containing object */
size_t offset;
/**
* Single-step the process
*
@ -24,15 +38,63 @@ struct process {
* Returning from this method is isomorphic to yielding the
* CPU to another process.
*/
void ( * step ) ( struct process *process );
/** Reference counter
*
* If this interface is not part of a reference-counted
* object, this field may be NULL.
*/
struct refcnt *refcnt;
void ( * step ) ( void *object );
};
/**
* Define a process step() method
*
* @v object_type Implementing method's expected object type
* @v step Implementing method
* @ret step Process step method
*/
#define PROC_STEP( object_type, step ) \
( ( ( ( typeof ( step ) * ) NULL ) == \
( ( void ( * ) ( object_type *object ) ) NULL ) ) ? \
( void ( * ) ( void *object ) ) step : \
( void ( * ) ( void *object ) ) step )
/**
* Calculate offset of process within containing object
*
* @v object_type Containing object data type
* @v name Process name (i.e. field within object data type)
* @ret offset Offset of process within containing object
*/
#define process_offset( object_type, name ) \
( ( ( ( typeof ( ( ( object_type * ) NULL )->name ) * ) NULL ) \
== ( ( struct process * ) NULL ) ) \
? offsetof ( object_type, name ) \
: offsetof ( object_type, name ) )
/**
* Define a process descriptor
*
* @v object_type Containing object data type
* @v process Process name (i.e. field within object data type)
* @v step Process' step() method
* @ret desc Object interface descriptor
*/
#define PROC_DESC( object_type, process, _step ) { \
.offset = process_offset ( object_type, process ), \
.step = PROC_STEP ( object_type, _step ), \
}
/**
* Define a process descriptor for a pure process
*
* A pure process is a process that does not have a containing object.
*
* @v step Process' step() method
* @ret desc Object interface descriptor
*/
#define PROC_DESC_PURE( _step ) { \
.offset = 0, \
.step = PROC_STEP ( struct process, _step ), \
}
extern void * __attribute__ (( pure ))
process_object ( struct process *process );
extern void process_add ( struct process *process );
extern void process_del ( struct process *process );
extern void step ( void );
@ -41,14 +103,15 @@ extern void step ( void );
* Initialise process without adding to process list
*
* @v process Process
* @v step Process' step() method
* @v desc Process descriptor
* @v refcnt Containing object reference count, or NULL
*/
static inline __attribute__ (( always_inline )) void
process_init_stopped ( struct process *process,
void ( * step ) ( struct process *process ),
struct process_descriptor *desc,
struct refcnt *refcnt ) {
INIT_LIST_HEAD ( &process->list );
process->step = step;
process->desc = desc;
process->refcnt = refcnt;
}
@ -56,13 +119,14 @@ process_init_stopped ( struct process *process,
* Initialise process and add to process list
*
* @v process Process
* @v step Process' step() method
* @v desc Process descriptor
* @v refcnt Containing object reference count, or NULL
*/
static inline __attribute__ (( always_inline )) void
process_init ( struct process *process,
void ( * step ) ( struct process *process ),
struct process_descriptor *desc,
struct refcnt *refcnt ) {
process_init_stopped ( process, step, refcnt );
process_init_stopped ( process, desc, refcnt );
process_add ( process );
}
@ -88,4 +152,36 @@ process_running ( struct process *process ) {
*/
#define __permanent_process __table_entry ( PERMANENT_PROCESSES, 01 )
/** Define a permanent process
*
*/
#define PERMANENT_PROCESS( name, step ) \
struct process_descriptor name ## _desc = PROC_DESC_PURE ( step ); \
struct process name __permanent_process = { \
.list = LIST_HEAD_INIT ( name.list ), \
.desc = & name ## _desc, \
.refcnt = NULL, \
};
/**
* Find debugging colourisation for a process
*
* @v process Process
* @ret col Debugging colourisation
*
* Use as the first argument to DBGC() or equivalent macro.
*/
#define PROC_COL( process ) process_object ( process )
/** printf() format string for PROC_DBG() */
#define PROC_FMT "%p+%zx"
/**
* printf() arguments for representing a process
*
* @v process Process
* @ret args printf() argument list corresponding to PROC_FMT
*/
#define PROC_DBG( process ) process_object ( process ), (process)->desc->offset
#endif /* _IPXE_PROCESS_H */

View File

@ -159,7 +159,7 @@ net80211_marshal_request_info ( struct net80211_device *dev,
* @defgroup net80211_assoc_ll 802.11 association handling functions
* @{
*/
static void net80211_step_associate ( struct process *proc );
static void net80211_step_associate ( struct net80211_device *dev );
static void net80211_handle_auth ( struct net80211_device *dev,
struct io_buffer *iob );
static void net80211_handle_assoc_reply ( struct net80211_device *dev,
@ -729,6 +729,11 @@ int net80211_tx_mgmt ( struct net80211_device *dev, u16 fc, u8 dest[6],
/* ---------- Driver API ---------- */
/** 802.11 association process descriptor */
static struct process_descriptor net80211_process_desc =
PROC_DESC ( struct net80211_device, proc_assoc,
net80211_step_associate );
/**
* Allocate 802.11 device
*
@ -760,7 +765,7 @@ struct net80211_device * net80211_alloc ( size_t priv_size )
dev->priv = ( u8 * ) dev + sizeof ( *dev );
dev->op = &net80211_null_ops;
process_init_stopped ( &dev->proc_assoc, net80211_step_associate,
process_init_stopped ( &dev->proc_assoc, &net80211_process_desc,
&netdev->refcnt );
INIT_LIST_HEAD ( &dev->mgmt_queue );
INIT_LIST_HEAD ( &dev->mgmt_info_queue );
@ -1630,12 +1635,10 @@ void net80211_free_wlanlist ( struct list_head *list )
/**
* Step 802.11 association process
*
* @v proc Association process
* @v dev 802.11 device
*/
static void net80211_step_associate ( struct process *proc )
static void net80211_step_associate ( struct net80211_device *dev )
{
struct net80211_device *dev =
container_of ( proc, struct net80211_device, proc_assoc );
int rc = 0;
int status = dev->state & NET80211_STATUS_MASK;
@ -1836,7 +1839,7 @@ static void net80211_step_associate ( struct process *proc )
dev->rctl = rc80211_init ( dev );
process_del ( proc );
process_del ( &dev->proc_assoc );
DBGC ( dev, "802.11 %p associated with %s (%s)\n", dev,
dev->essid, eth_ntoa ( dev->bssid ) );
@ -1861,7 +1864,7 @@ static void net80211_step_associate ( struct process *proc )
net80211_free_wlan ( dev->associating );
dev->associating = NULL;
process_del ( proc );
process_del ( &dev->proc_assoc );
DBGC ( dev, "802.11 %p association failed (state=%04x): "
"%s\n", dev, dev->state, strerror ( dev->assoc_rc ) );

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,

View File

@ -153,11 +153,9 @@ static int fc_ns_query_deliver ( struct fc_ns_query *query,
/**
* Name server query process
*
* @v process Process
* @v query Name server query
*/
static void fc_ns_query_step ( struct process *process ) {
struct fc_ns_query *query =
container_of ( process, struct fc_ns_query, process );
static void fc_ns_query_step ( struct fc_ns_query *query ) {
struct xfer_metadata meta;
struct fc_ns_gid_pn_request gid_pn;
int xchg_id;
@ -208,6 +206,10 @@ static struct interface_operation fc_ns_query_xchg_op[] = {
static struct interface_descriptor fc_ns_query_xchg_desc =
INTF_DESC ( struct fc_ns_query, xchg, fc_ns_query_xchg_op );
/** Name server process descriptor */
static struct process_descriptor fc_ns_query_process_desc =
PROC_DESC ( struct fc_ns_query, process, fc_ns_query_step );
/**
* Issue Fibre Channel name server query
*
@ -226,7 +228,8 @@ int fc_ns_query ( struct fc_peer *peer, struct fc_port *port,
return -ENOMEM;
ref_init ( &query->refcnt, fc_ns_query_free );
intf_init ( &query->xchg, &fc_ns_query_xchg_desc, &query->refcnt );
process_init ( &query->process, fc_ns_query_step, &query->refcnt );
process_init ( &query->process, &fc_ns_query_process_desc,
&query->refcnt );
query->peer = fc_peer_get ( peer );
query->port = fc_port_get ( port );
query->done = done;

View File

@ -649,11 +649,9 @@ static int fcpcmd_recv_unknown ( struct fcp_command *fcpcmd,
/**
* Transmit FCP frame
*
* @v process FCP command process
* @v fcpcmd FCP command
*/
static void fcpcmd_step ( struct process *process ) {
struct fcp_command *fcpcmd =
container_of ( process, struct fcp_command, process );
static void fcpcmd_step ( struct fcp_command *fcpcmd ) {
int rc;
/* Send the current IU */
@ -723,6 +721,10 @@ static struct interface_operation fcpcmd_xchg_op[] = {
static struct interface_descriptor fcpcmd_xchg_desc =
INTF_DESC_PASSTHRU ( struct fcp_command, xchg, fcpcmd_xchg_op, scsi );
/** FCP command process descriptor */
static struct process_descriptor fcpcmd_process_desc =
PROC_DESC ( struct fcp_command, process, fcpcmd_step );
/**
* Issue FCP SCSI command
*
@ -765,7 +767,8 @@ static int fcpdev_scsi_command ( struct fcp_device *fcpdev,
ref_init ( &fcpcmd->refcnt, fcpcmd_free );
intf_init ( &fcpcmd->scsi, &fcpcmd_scsi_desc, &fcpcmd->refcnt );
intf_init ( &fcpcmd->xchg, &fcpcmd_xchg_desc, &fcpcmd->refcnt );
process_init_stopped ( &fcpcmd->process, fcpcmd_step, &fcpcmd->refcnt );
process_init_stopped ( &fcpcmd->process, &fcpcmd_process_desc,
&fcpcmd->refcnt );
fcpcmd->fcpdev = fcpdev_get ( fcpdev );
list_add ( &fcpcmd->list, &fcpdev->fcpcmds );
memcpy ( &fcpcmd->command, command, sizeof ( fcpcmd->command ) );

View File

@ -866,10 +866,7 @@ static void ib_step ( struct process *process __unused ) {
}
/** Infiniband event queue process */
struct process ib_process __permanent_process = {
.list = LIST_HEAD_INIT ( ib_process.list ),
.step = ib_step,
};
PERMANENT_PROCESS ( ib_process, ib_step );
/***************************************************************************
*

View File

@ -92,7 +92,7 @@ struct ib_cmrc_connection {
/**
* Shut down CMRC connection gracefully
*
* @v process Process
* @v cmrc Communication-Managed Reliable Connection
*
* The Infiniband data structures are not reference-counted or
* guarded. It is therefore unsafe to shut them down while we may be
@ -107,9 +107,7 @@ struct ib_cmrc_connection {
* connection, ensuring that the structure is not freed before the
* shutdown process has run.
*/
static void ib_cmrc_shutdown ( struct process *process ) {
struct ib_cmrc_connection *cmrc =
container_of ( process, struct ib_cmrc_connection, shutdown );
static void ib_cmrc_shutdown ( struct ib_cmrc_connection *cmrc ) {
DBGC ( cmrc, "CMRC %p shutting down\n", cmrc );
@ -363,6 +361,10 @@ static struct interface_operation ib_cmrc_xfer_operations[] = {
static struct interface_descriptor ib_cmrc_xfer_desc =
INTF_DESC ( struct ib_cmrc_connection, xfer, ib_cmrc_xfer_operations );
/** CMRC shutdown process descriptor */
static struct process_descriptor ib_cmrc_shutdown_desc =
PROC_DESC ( struct ib_cmrc_connection, shutdown, ib_cmrc_shutdown );
/**
* Open CMRC connection
*
@ -388,7 +390,7 @@ int ib_cmrc_open ( struct interface *xfer, struct ib_device *ibdev,
cmrc->ibdev = ibdev;
memcpy ( &cmrc->dgid, dgid, sizeof ( cmrc->dgid ) );
memcpy ( &cmrc->service_id, service_id, sizeof ( cmrc->service_id ) );
process_init_stopped ( &cmrc->shutdown, ib_cmrc_shutdown,
process_init_stopped ( &cmrc->shutdown, &ib_cmrc_shutdown_desc,
&cmrc->refcnt );
/* Open Infiniband device */

View File

@ -769,7 +769,4 @@ static void net_step ( struct process *process __unused ) {
}
/** Networking stack process */
struct process net_process __permanent_process = {
.list = LIST_HEAD_INIT ( net_process.list ),
.step = net_step,
};
PERMANENT_PROCESS ( net_process, net_step );

View File

@ -198,7 +198,4 @@ static void retry_step ( struct process *process __unused ) {
}
/** Retry timer process */
struct process retry_process __permanent_process = {
.list = LIST_HEAD_INIT ( retry_process.list ),
.step = retry_step,
};
PERMANENT_PROCESS ( retry_process, retry_step );

View File

@ -483,11 +483,9 @@ static int http_socket_deliver ( struct http_request *http,
/**
* HTTP process
*
* @v process Process
* @v http HTTP request
*/
static void http_step ( struct process *process ) {
struct http_request *http =
container_of ( process, struct http_request, process );
static void http_step ( struct http_request *http ) {
const char *host = http->uri->host;
const char *user = http->uri->user;
const char *password =
@ -561,6 +559,10 @@ static struct interface_descriptor http_xfer_desc =
INTF_DESC_PASSTHRU ( struct http_request, xfer,
http_xfer_operations, socket );
/** HTTP process descriptor */
static struct process_descriptor http_process_desc =
PROC_DESC ( struct http_request, process, http_step );
/**
* Initiate an HTTP connection, with optional filter
*
@ -591,7 +593,7 @@ int http_open_filter ( struct interface *xfer, struct uri *uri,
intf_init ( &http->xfer, &http_xfer_desc, &http->refcnt );
http->uri = uri_get ( uri );
intf_init ( &http->socket, &http_socket_desc, &http->refcnt );
process_init ( &http->process, http_step, &http->refcnt );
process_init ( &http->process, &http_process_desc, &http->refcnt );
/* Open socket */
memset ( &server, 0, sizeof ( server ) );

View File

@ -1427,9 +1427,7 @@ static void iscsi_tx_done ( struct iscsi_session *iscsi ) {
*
* Constructs data to be sent for the current TX state
*/
static void iscsi_tx_step ( struct process *process ) {
struct iscsi_session *iscsi =
container_of ( process, struct iscsi_session, process );
static void iscsi_tx_step ( struct iscsi_session *iscsi ) {
struct iscsi_bhs_common *common = &iscsi->tx_bhs.common;
int ( * tx ) ( struct iscsi_session *iscsi );
enum iscsi_tx_state next_state;
@ -1488,6 +1486,10 @@ static void iscsi_tx_step ( struct process *process ) {
}
}
/** iSCSI TX process descriptor */
static struct process_descriptor iscsi_process_desc =
PROC_DESC ( struct iscsi_session, process, iscsi_tx_step );
/**
* Receive basic header segment of an iSCSI PDU
*
@ -2034,7 +2036,7 @@ static int iscsi_open ( struct interface *parent, struct uri *uri ) {
intf_init ( &iscsi->control, &iscsi_control_desc, &iscsi->refcnt );
intf_init ( &iscsi->data, &iscsi_data_desc, &iscsi->refcnt );
intf_init ( &iscsi->socket, &iscsi_socket_desc, &iscsi->refcnt );
process_init_stopped ( &iscsi->process, iscsi_tx_step,
process_init_stopped ( &iscsi->process, &iscsi_process_desc,
&iscsi->refcnt );
/* Parse root path */

View File

@ -1645,11 +1645,9 @@ static struct interface_descriptor tls_cipherstream_desc =
/**
* TLS TX state machine
*
* @v process TLS process
* @v tls TLS session
*/
static void tls_step ( struct process *process ) {
struct tls_session *tls =
container_of ( process, struct tls_session, process );
static void tls_step ( struct tls_session *tls ) {
int rc;
/* Wait for cipherstream to become ready */
@ -1717,6 +1715,10 @@ static void tls_step ( struct process *process ) {
tls_close ( tls, rc );
}
/** TLS TX process descriptor */
static struct process_descriptor tls_process_desc =
PROC_DESC ( struct tls_session, process, tls_step );
/******************************************************************************
*
* Instantiator
@ -1748,7 +1750,7 @@ int add_tls ( struct interface *xfer, struct interface **next ) {
digest_init ( &md5_algorithm, tls->handshake_md5_ctx );
digest_init ( &sha1_algorithm, tls->handshake_sha1_ctx );
tls->tx_state = TLS_TX_CLIENT_HELLO;
process_init ( &tls->process, tls_step, &tls->refcnt );
process_init ( &tls->process, &tls_process_desc, &tls->refcnt );
/* Attach to parent interface, mortalise self, and return */
intf_plug_plug ( &tls->plainstream, xfer );