Commit e962296d authored by Lucas Russo's avatar Lucas Russo

hdl/sm_io/*: add generic pointer to a specific handler

SMIO modules often need some state information.
Because of this, we store that in a new a generic
field called smio_handler, inside the general sm_io
structure. Specific realizations of the SMIO module
need to set that pointer to the desired structure,
initilize it correctly (inside bootstrap init function)
and destroy it when donw (inside bootstrap shutdown
function)
parent 7fb61575
......@@ -37,6 +37,9 @@ struct _smio_t {
/* int verbose; */ /* Print activity to stdout */
mdp_worker_t *worker; /* zeroMQ Majordomo worker */
struct _devio_t *parent; /* Pointer back to parent dev_io */
void *smio_handler; /* Generic pointer to a device handler. This
must be cast to a specific type by the
devices functions */
zctx_t *ctx; /* Our context */
void *pipe; /* Pipe back to parent to exchange messages */
......
......@@ -165,6 +165,7 @@ static struct _smio_t *_smio_new (struct _devio_t *parent, struct _zctx_t *ctx,
self->exp_ops_dtable = disp_table_new ();
ASSERT_ALLOC(self->exp_ops_dtable, err_exp_ops_dtable_alloc);
self->smio_handler = NULL; /* This is set by the device functions */
self->ctx = ctx;
self->pipe = pipe;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment