[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

@@ -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 );