Commit bf67f3bf authored by Aurelio Colosimo's avatar Aurelio Colosimo

pp-instance.h: pointer to pp_globals in each pp_instance

Signed-off-by: Aurelio Colosimo's avatarAurelio Colosimo <aurelio@aureliocolosimo.it>
parent 05e8a274
......@@ -54,6 +54,7 @@ int main(int argc, char **argv)
}
ppi = &ppg->pp_instances[i];
ppi->glbs = ppg;
/* FIXME check all of these calloc's, since some stuff will be
* part of pp_globals */
......
......@@ -137,6 +137,9 @@ struct pp_instance {
struct pp_servo *servo;
unsigned long flags; /* ppi-specific flags (diag mainly) */
/* Pointer to global instance owning this pp_instance*/
struct pp_globals *glbs;
/* Operations that may be different in each instance */
struct pp_network_operations *n_ops;
struct pp_time_operations *t_ops;
......
......@@ -31,6 +31,11 @@ static inline struct pp_runtime_opts *OPTS(struct pp_instance *ppi)
return ppi->rt_opts;
}
static inline struct pp_globals *GLBS(struct pp_instance *ppi)
{
return ppi->glbs;
}
static inline struct DSDefault *DSDEF(struct pp_instance *ppi)
{
return ppi->defaultDS;
......
......@@ -19,6 +19,7 @@ void ppsi_clear_bss(void)
*ptr = 0;
}
static struct pp_globals ppg_static;
static struct pp_instance ppi_static;
CONST_VERBOSITY int pp_diag_verbosity = 0;
......@@ -32,10 +33,12 @@ static struct pp_servo servo;
int ppsi_main(int argc, char **argv)
{
struct pp_globals *ppg = &ppg_static;
struct pp_instance *ppi = &ppi_static; /* no malloc, one instance */
PP_PRINTF("bare: starting. Compiled on %s\n", __DATE__);
ppi->glbs = ppg;
ppi->defaultDS = &defaultDS;
ppi->currentDS = &currentDS;
ppi->parentDS = &parentDS;
......
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