struct list_res reachability (const struct hs *hs, uint32_t port, const uint32_t *out, int nout) { struct res *in = res_create (data_file->stages + 1); struct list_res res = {0}; hs_copy (&in->hs, hs); in->port = port; list_append (&queues[ntf_get_sw (in->port)], in); int n = data_file->ntfs - 1; struct tdata data[n]; memset (data, 0, sizeof data); g_out = out; g_nout = nout; for (int i = 0; i < n; i++) { struct tdata *p = &data[i]; p->sw = i; pthread_create (&p->tid, NULL, reach_thread, p); } for (int i = 0; i < n; i++) { pthread_join (data[i].tid, NULL); list_concat (&res, &data[i].res); } return res; }
void app_add_in (const struct hs *hs, uint32_t port) { struct res *in = res_create (data_file->stages + 1); hs_copy (&in->hs, hs); in->port = port; list_append (&queues[ntf_get_sw (in->port)], in); }
struct res * res_extend (const struct res *src, const struct hs *hs, uint32_t port, bool append) { struct res *res = res_create (src->rules.n); if (hs) hs_copy (&res->hs, hs); res->port = port; if (append) { res->rules.cur = src->rules.cur; memcpy (res->rules.arr, src->rules.arr, res->rules.cur * sizeof *res->rules.arr); } return res; }
int parse_devmap() { for(size_t x=0; x<devmap->num_devs; x++) { res_t* res = malloc(sizeof(res_t)); uint32_t type = RES_TYPE_UNKWN; if(strcmp(devmap->devs[x].type, "mm")==0) type = RES_TYPE_MMDEV; res_create(res, type, 0x1000, (v_addr_t)devmap->devs[x].addr); res_register(res, devmap->devs[x].name); } return 0; }
Plan plan_create(Prob prob) { Plan plan = plan_create_empty(prob_res_count(prob)); if (plan == NULL) return NULL; for (int i=0; i < plan->nb_res; i++) { plan->res[i] = res_create(prob_job_count(prob)); if (plan->res[i] == NULL) { for (; i >= 0; i--) res_free(plan->res[i]); free(plan->res); free(plan); return NULL; } } return plan; }