Commit 9015c80d authored by Lucas Russo's avatar Lucas Russo

hal/sm_io/sm_io_bootstrap.*: add SMIO config thread entry point

This is the first step towards the github issue #11.
In that we use the liblcient to configure some default
values for us.
parent 8e5d2e9f
......@@ -104,7 +104,36 @@ err_self_alloc:
free (smio_service);
err_smio_service_alloc:
DBE_DEBUG (DBG_SM_IO | DBG_LVL_ERR, "[sm_io_bootstrap] Thread exiting\n");
free (args);
free (th_args);
return;
}
/************************************************************/
/*************** SMIO Config Thread entry-point ************/
/************************************************************/
void smio_config_defaults (void *args, zctx_t *ctx, void *pipe)
{
(void) pipe;
(void) ctx;
th_config_args_t *th_args = (th_config_args_t *) args;
DBE_DEBUG (DBG_SM_IO | DBG_LVL_TRACE, "[sm_io_bootstrap] Config thread starting ...\n");
DBE_DEBUG (DBG_SM_IO | DBG_LVL_TRACE, "[sm_io_bootstrap] Thread allocating resources ...\n");
/* We must export our service as the combination of the
* devio name (coming from devio parent) and our own name ID
* followed by an optional parameter coming from priv pointer */
char *smio_service = halutils_concat_strings (th_args->service,
smio_mod_dispatch[th_args->smio_id].name, ':');
ASSERT_ALLOC(smio_service, err_smio_service_alloc);
SMIO_DISPATCH_FUNC_WRAPPER_GEN(config_defaults, th_args->broker,
smio_service, th_args->log_file);
free (smio_service);
err_smio_service_alloc:
DBE_DEBUG (DBG_SM_IO | DBG_LVL_INFO, "[sm_io_bootstrap] Config thread exiting\n");
free (th_args);
return;
}
......
......@@ -47,11 +47,15 @@ typedef smio_err_e (*smio_init_fp)(struct _smio_t *self);
/* Destroy instance of sm)io functuion pointer. This tells how to destroy
* such an object */
typedef smio_err_e (*smio_shutdown_fp)(struct _smio_t *self);
/* Configure SMIO default values using the libclient */
typedef smio_err_e (*smio_config_defaults_fp)(char *broker_endp, char *service,
const char *log_file_name);
/* Main class object that every sm_io must implement */
struct _smio_bootstrap_ops_t {
smio_init_fp init;
smio_shutdown_fp shutdown;
smio_config_defaults_fp config_defaults;
};
typedef struct _smio_bootstrap_ops_t smio_bootstrap_ops_t;
......@@ -69,10 +73,21 @@ struct _th_boot_args_t {
typedef struct _th_boot_args_t th_boot_args_t;
/* Config thread args structure */
struct _th_config_args_t {
uint32_t smio_id; /* ID of the SMIO instance */
char *broker; /* Endpoint to connect to broker */
char *service; /* Full name of the exported service */
char *log_file; /* Thread log file */
};
typedef struct _th_config_args_t th_config_args_t;
/************************************************************/
/************************ Our methods ***********************/
/************************************************************/
void smio_startup (void *args, zctx_t *ctx, void *pipe);
void smio_config_defaults (void *args, zctx_t *ctx, void *pipe);
struct _smio_t *smio_new (struct _devio_t *parent, struct _zctx_t *ctx, void *pipe,
char *broker, char *service, int verbose);
smio_err_e smio_destroy (struct _smio_t **self_p);
......
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