Subversion Repositories shark

Rev

Blame | Last modification | View Log | RSS feed

#include "kernel/kern.h"
#include "fsf.h"
#include "fsf_server.h"

#include "func.h"

extern struct loader_contract loader_contract_list[];
extern int total_loader_contract;

void fsfinit()
{

  struct loader_contract *c;
  fsf_contract_parameters_t contract;
  fsf_server_id_t server;
  union sigval no_sigval = {0};
  int i;
  int err=0;

  FSF_start_service_task();

  for (i=0;i<total_loader_contract;i++) {

    c = &loader_contract_list[i];

    fsf_initialize_contract(&contract);

    err=fsf_set_contract_basic_parameters(&contract,&c->cmin,&c->tmax,c->workload);
    if (err) exit(err);
    err=fsf_set_contract_reclamation_parameters(&contract,&c->cmax,&c->tmin,FSF_DEFAULT_GRANULARITY, NULL, 1,1);
    if (err) exit(err);

    if (TIMESPEC2USEC(&c->deadline) != 0)
      err=fsf_set_contract_timing_requirements(&contract,false,&c->deadline,0,no_sigval,0,no_sigval);
    else
      err=fsf_set_contract_timing_requirements(&contract,true,NULL,0,no_sigval,0,no_sigval);

    if (err) exit(err);

    switch (c->local_scheduler) {
       case PAR_EDF:
         fsf_set_contract_scheduling_policy(&contract,FSF_EDF);
         break;
       case PAR_RM:
         fsf_set_contract_scheduling_policy(&contract,FSF_FP);
         break;
       case PAR_POSIX:
         fsf_set_contract_scheduling_policy(&contract,FSF_RR);
       break;

    }

 
    err=fsf_negotiate_contract(&contract,&server);
    if (err) exit(err);
    c->server = server;
 
  }

  print_server_list();

}