Rev 1553 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1254 | giacomo | 1 | #include "kernel/kern.h" |
1545 | trimarchi | 2 | #include "fsf.h" |
1254 | giacomo | 3 | #include "fsf_server.h" |
1538 | trimarchi | 4 | |
1254 | giacomo | 5 | #include "func.h" |
6 | |||
7 | extern struct loader_contract loader_contract_list[]; |
||
8 | extern int total_loader_contract; |
||
9 | |||
10 | void fsfinit() |
||
11 | { |
||
12 | |||
13 | struct loader_contract *c; |
||
14 | fsf_contract_parameters_t contract; |
||
15 | fsf_server_id_t server; |
||
1442 | giacomo | 16 | union sigval no_sigval = {0}; |
1254 | giacomo | 17 | int i; |
1559 | trimarchi | 18 | int err=0; |
1254 | giacomo | 19 | |
1538 | trimarchi | 20 | FSF_start_service_task(); |
1467 | trimarchi | 21 | |
1254 | giacomo | 22 | for (i=0;i<total_loader_contract;i++) { |
23 | |||
24 | c = &loader_contract_list[i]; |
||
25 | |||
26 | fsf_initialize_contract(&contract); |
||
27 | |||
1559 | trimarchi | 28 | err=fsf_set_contract_basic_parameters(&contract,&c->cmin,&c->tmax,c->workload); |
29 | if (err) exit(err); |
||
30 | err=fsf_set_contract_reclamation_parameters(&contract,&c->cmax,&c->tmin,FSF_DEFAULT_GRANULARITY, NULL, 1,1); |
||
31 | if (err) exit(err); |
||
1254 | giacomo | 32 | |
1442 | giacomo | 33 | if (TIMESPEC2USEC(&c->deadline) != 0) |
1559 | trimarchi | 34 | err=fsf_set_contract_timing_requirements(&contract,false,&c->deadline,0,no_sigval,0,no_sigval); |
1545 | trimarchi | 35 | else |
1559 | trimarchi | 36 | err=fsf_set_contract_timing_requirements(&contract,true,NULL,0,no_sigval,0,no_sigval); |
1442 | giacomo | 37 | |
1559 | trimarchi | 38 | if (err) exit(err); |
39 | |||
1538 | trimarchi | 40 | switch (c->local_scheduler) { |
41 | case PAR_EDF: |
||
42 | fsf_set_contract_scheduling_policy(&contract,FSF_EDF); |
||
43 | break; |
||
44 | case PAR_RM: |
||
1553 | trimarchi | 45 | fsf_set_contract_scheduling_policy(&contract,FSF_FP); |
1538 | trimarchi | 46 | break; |
47 | case PAR_POSIX: |
||
1553 | trimarchi | 48 | fsf_set_contract_scheduling_policy(&contract,FSF_RR); |
1538 | trimarchi | 49 | break; |
1254 | giacomo | 50 | |
51 | } |
||
1538 | trimarchi | 52 | |
1254 | giacomo | 53 | |
1559 | trimarchi | 54 | err=fsf_negotiate_contract(&contract,&server); |
55 | if (err) exit(err); |
||
1254 | giacomo | 56 | c->server = server; |
1311 | giacomo | 57 | |
1254 | giacomo | 58 | } |
59 | |||
1311 | giacomo | 60 | print_server_list(); |
61 | |||
1254 | giacomo | 62 | } |