typedef struct workstation_CLM03 {
s_surf_resource_t generic_resource; /* Must remain first to add this to a trace */
typedef struct workstation_CLM03 {
s_surf_resource_t generic_resource; /* Must remain first to add this to a trace */
workstation->generic_resource.model = surf_workstation_model;
workstation->generic_resource.name = xbt_strdup(host->id);
workstation->generic_resource.model = surf_workstation_model;
workstation->generic_resource.name = xbt_strdup(host->id);
workstation->storage = xbt_lib_get_or_null(storage_lib,host->id,ROUTING_STORAGE_HOST_LEVEL);
workstation->net_elm = xbt_lib_get_or_null(host_lib,host->id,ROUTING_HOST_LEVEL);
XBT_DEBUG("Create workstation %s with %ld mounted disks",host->id,xbt_dynar_length(workstation->storage));
workstation->storage = xbt_lib_get_or_null(storage_lib,host->id,ROUTING_STORAGE_HOST_LEVEL);
workstation->net_elm = xbt_lib_get_or_null(host_lib,host->id,ROUTING_HOST_LEVEL);
XBT_DEBUG("Create workstation %s with %ld mounted disks",host->id,xbt_dynar_length(workstation->storage));
- void *cpu = ((workstation_CLM03_t) workstation)->cpu;
- return ((surf_resource_t) cpu)->model->extension.cpu.execute(cpu, size);
+ surf_resource_t cpu = ((surf_resource_t) surf_cpu_resource_priv(workstation));
+ return cpu->model->extension.cpu.execute(workstation, size);
}
static surf_action_t ws_action_sleep(void *workstation, double duration)
{
return surf_cpu_model->extension.cpu.
}
static surf_action_t ws_action_sleep(void *workstation, double duration)
{
return surf_cpu_model->extension.cpu.
- workstation_CLM03_t src = (workstation_CLM03_t) workstation_src;
- workstation_CLM03_t dst = (workstation_CLM03_t) workstation_dst;
+ workstation_CLM03_t src = surf_workstation_resource_priv(workstation_src);
+ workstation_CLM03_t dst = surf_workstation_resource_priv(workstation_dst);
return surf_network_model->extension.network.
communicate(src->net_elm,
dst->net_elm, size, rate);
return surf_network_model->extension.network.
communicate(src->net_elm,
dst->net_elm, size, rate);
}
static double ws_get_speed(void *workstation, double load)
{
return surf_cpu_model->extension.cpu.
}
static double ws_get_speed(void *workstation, double load)
{
return surf_cpu_model->extension.cpu.
static xbt_dynar_t ws_get_route(void *workstation_src, void *workstation_dst)
{
XBT_DEBUG("ws_get_route");
static xbt_dynar_t ws_get_route(void *workstation_src, void *workstation_dst)
{
XBT_DEBUG("ws_get_route");
- workstation_CLM03_t src = (workstation_CLM03_t) workstation_src;
- workstation_CLM03_t dst = (workstation_CLM03_t) workstation_dst;
+ workstation_CLM03_t src = surf_workstation_resource_priv(workstation_src);
+ workstation_CLM03_t dst = surf_workstation_resource_priv(workstation_dst);
return surf_network_model->extension.
network.get_route(src->net_elm,
dst->net_elm);
return surf_network_model->extension.
network.get_route(src->net_elm,
dst->net_elm);
- XBT_DEBUG("Search for storage name '%s' on '%s'",storage,((workstation_CLM03_t) workstation)->generic_resource.name);
+ XBT_DEBUG("Search for storage name '%s' on '%s'",storage,ws->generic_resource.name);
xbt_dynar_foreach(storage_list,cursor,mnt)
{
XBT_DEBUG("See '%s'",mnt.name);
xbt_dynar_foreach(storage_list,cursor,mnt)
{
XBT_DEBUG("See '%s'",mnt.name);
- if(!st) xbt_die("Can't find mount '%s' for '%s'",storage,((workstation_CLM03_t) workstation)->generic_resource.name);
+ if(!st) xbt_die("Can't find mount '%s' for '%s'",storage,ws->generic_resource.name);