Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1672 | tullio | 1 | #include "kernel/kern.h" |
2 | #include "fsf.h" |
||
3 | #include "fsf_server.h" |
||
4 | |||
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; |
||
16 | union sigval no_sigval = {0}; |
||
17 | int i; |
||
18 | int err=0; |
||
19 | |||
20 | FSF_start_service_task(); |
||
21 | |||
22 | for (i=0;i<total_loader_contract;i++) { |
||
23 | |||
24 | c = &loader_contract_list[i]; |
||
25 | |||
26 | fsf_initialize_contract(&contract); |
||
27 | |||
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); |
||
32 | |||
33 | if (TIMESPEC2USEC(&c->deadline) != 0) |
||
34 | err=fsf_set_contract_timing_requirements(&contract,false,&c->deadline,0,no_sigval,0,no_sigval); |
||
35 | else |
||
36 | err=fsf_set_contract_timing_requirements(&contract,true,NULL,0,no_sigval,0,no_sigval); |
||
37 | |||
38 | if (err) exit(err); |
||
39 | |||
40 | switch (c->local_scheduler) { |
||
41 | case PAR_EDF: |
||
42 | fsf_set_contract_scheduling_policy(&contract,FSF_EDF); |
||
43 | break; |
||
44 | case PAR_RM: |
||
45 | fsf_set_contract_scheduling_policy(&contract,FSF_FP); |
||
46 | break; |
||
47 | case PAR_POSIX: |
||
48 | fsf_set_contract_scheduling_policy(&contract,FSF_RR); |
||
49 | break; |
||
50 | |||
51 | } |
||
52 | |||
53 | |||
54 | err=fsf_negotiate_contract(&contract,&server); |
||
55 | if (err) exit(err); |
||
56 | c->server = server; |
||
57 | |||
58 | } |
||
59 | |||
60 | print_server_list(); |
||
61 | |||
62 | } |