Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
merge redundant surf_cpu_state_t and surf_link_state_t into surf_resource_state_t...
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Sat, 4 Jul 2009 00:02:14 +0000 (00:02 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Sat, 4 Jul 2009 00:02:14 +0000 (00:02 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@6448 48e7efb5-ca39-0410-a469-dd3cf9ba447f

15 files changed:
src/Makefile.am
src/include/surf/datatypes.h [new file with mode: 0644]
src/include/surf/maxmin.h
src/include/surf/surf.h
src/include/surf/trace_mgr.h
src/msg/gos.c
src/simix/private.h
src/simix/smx_action.c
src/surf/cpu.c
src/surf/network.c
src/surf/network_gtnets.c
src/surf/network_private.h
src/surf/surf_private.h
src/surf/workstation.c
src/surf/workstation_ptask_L07.c

index aee232d..9c4b175 100644 (file)
@@ -51,6 +51,7 @@ EXTRA_DIST= \
        surf/gtnets/gtnets_simulator.h \
        surf/gtnets/gtnets_topology.h  \
        \
+       include/surf/datatypes.h \
        include/surf/maxmin.h \
        include/surf/trace_mgr.h \
        include/surf/surf.h \
diff --git a/src/include/surf/datatypes.h b/src/include/surf/datatypes.h
new file mode 100644 (file)
index 0000000..1cc0de5
--- /dev/null
@@ -0,0 +1,35 @@
+/* Copyright (c) 2009 The SimGrid team. All rights reserved.                */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#ifndef MAXMIN_DATATYPES_H
+#define MAXMIN_DATATYPES_H
+
+/** \brief Model datatype
+ *  \ingroup SURF_models
+ *
+ *  Generic data structure for a model. The workstations,
+ *  the CPUs and the network links are examples of models.
+ */
+typedef struct surf_model *surf_model_t;
+/** \brief Action datatype
+ *  \ingroup SURF_actions
+ *
+ * An action is some working amount on a model.
+ * It is represented as a cost, a priority, a duration and a state.
+ */
+typedef struct surf_action *surf_action_t;
+
+
+typedef struct lmm_element *lmm_element_t;
+typedef struct lmm_variable *lmm_variable_t;
+typedef struct lmm_constraint *lmm_constraint_t;
+typedef struct lmm_system *lmm_system_t;
+
+typedef struct tmgr_history *tmgr_history_t;
+typedef struct tmgr_trace *tmgr_trace_t;
+typedef struct tmgr_trace_event *tmgr_trace_event_t;
+
+
+#endif /* MAXMIN_DATATYPES_H */
index d41ef1f..44dcfdf 100644 (file)
@@ -10,6 +10,7 @@
 
 #include "portable.h"
 #include "xbt/misc.h"
+#include "surf/datatypes.h"
 
 #define MAXMIN_PRECISION 0.00001
 static XBT_INLINE void double_update(double *variable, double value)
@@ -24,11 +25,6 @@ static XBT_INLINE int double_positive(double value)
   return (value > MAXMIN_PRECISION);
 }
 
-typedef struct lmm_element *lmm_element_t;
-typedef struct lmm_variable *lmm_variable_t;
-typedef struct lmm_constraint *lmm_constraint_t;
-typedef struct lmm_system *lmm_system_t;
-
 XBT_PUBLIC(lmm_system_t) lmm_system_new(void);
 XBT_PUBLIC(void) lmm_system_free(lmm_system_t sys);
      void lmm_variable_disable(lmm_system_t sys, lmm_variable_t var);
@@ -103,30 +99,11 @@ XBT_PUBLIC(void) bottleneck_solve(lmm_system_t sys);
  */
 
 XBT_PUBLIC(void) lmm_set_default_protocol_function(double (*func_f)
-
-
-
-
-
-                                                    
-                                                   (lmm_variable_t var,
-                                                    double x),
+                                                   (lmm_variable_t var, double x),
                                                    double (*func_fp)
-
-
-
-
-                                                    
-                                                   (lmm_variable_t var,
-                                                    double x),
+                                                   (lmm_variable_t var, double x),
                                                    double (*func_fpi)
-
-
-
-
-                                                    
-                                                   (lmm_variable_t var,
-                                                    double x));
+                                                   (lmm_variable_t var, double x));
 
 XBT_PUBLIC(double func_reno_f) (lmm_variable_t var, double x);
 XBT_PUBLIC(double func_reno_fp) (lmm_variable_t var, double x);
index 288bc40..fe6e62f 100644 (file)
 #include "xbt/misc.h"
 #include "portable.h"
 #include "xbt/config.h"
+#include "surf/datatypes.h"
 
 SG_BEGIN_DECL()
-/* Actions and models are higly connected structures... */
+/* Actions and models are highly connected structures... */
 
 
-/** \brief Model datatype
- *  \ingroup SURF_models
- *
- *  Generic data structure for a model. The workstations,
- *  the CPUs and the network links are examples of models.
- */
-     typedef struct surf_model *surf_model_t;
-
+typedef enum {
+  SURF_RESOURCE_ON = 1,                   /**< Up & ready        */
+  SURF_RESOURCE_OFF = 0                   /**< Down & broken     */
+} e_surf_resource_state_t;
 
-/** \brief Action datatype
- *  \ingroup SURF_actions
- *
- * An action is some working amount on a model.
- * It is represented as a cost, a priority, a duration and a state.
- *
- * \see e_surf_action_state_t
- */
-typedef struct surf_action *surf_action_t;
 /** @Brief Specify that we use that action */
 XBT_PUBLIC(void) surf_action_ref(surf_action_t action);
 /** @brief Creates a new action.
@@ -92,9 +80,9 @@ XBT_PUBLIC(int) find_model_description(s_surf_model_description_t * table,
 
      typedef struct {
        s_surf_action_t generic_action;
-       void *variable; /* of type lmm_variable_t, which is only visible by loading maxmin */
+       lmm_variable_t variable;
        int suspended;
-     } s_surf_action_maxmin_t,*surf_action_maxmin_t;
+     } s_surf_action_lmm_t,*surf_action_lmm_t;
 /** \brief Action states
  *  \ingroup SURF_actions
  *
@@ -154,14 +142,6 @@ XBT_PUBLIC(int) find_model_description(s_surf_model_description_t * table,
 
      /* Cpu model */
 
-     /** \brief CPU state
-      *  \ingroup SURF_models
-      */
-     typedef enum {
-       SURF_CPU_ON = 1,                   /**< Up & ready        */
-       SURF_CPU_OFF = 0                   /**< Down & broken     */
-     } e_surf_cpu_state_t;
-
      /** \brief CPU model extension public
       *  \ingroup SURF_models
       *
@@ -170,7 +150,7 @@ XBT_PUBLIC(int) find_model_description(s_surf_model_description_t * table,
      typedef struct surf_cpu_model_extension_public {
        surf_action_t(*execute) (void *cpu, double size);
        surf_action_t(*sleep) (void *cpu, double duration);
-       e_surf_cpu_state_t(*get_state) (void *cpu);
+       e_surf_resource_state_t (*get_state) (void *cpu);
        double (*get_speed) (void *cpu, double load);
        double (*get_available_speed) (void *cpu);
      } s_surf_model_extension_cpu_t;
@@ -200,7 +180,7 @@ XBT_PUBLIC(int) find_model_description(s_surf_model_description_t * table,
        surf_action_t(*execute) (void *workstation, double size);                           /**< Execute a computation amount on a workstation
                                                                                        and create the corresponding action */
        surf_action_t(*sleep) (void *workstation, double duration);                         /**< Make a workstation sleep during a given duration */
-       e_surf_cpu_state_t(*get_state) (void *workstation);                                 /**< Return the CPU state of a workstation */
+       e_surf_resource_state_t(*get_state) (void *workstation);                                 /**< Return the CPU state of a workstation */
        double (*get_speed) (void *workstation, double load);                               /**< Return the speed of a workstation */
        double (*get_available_speed) (void *workstation);                                  /**< Return tha available speed of a workstation */
        surf_action_t(*communicate) (void *workstation_src,                                 /**< Execute a communication amount between two workstations */
@@ -275,6 +255,19 @@ XBT_PUBLIC(int) find_model_description(s_surf_model_description_t * table,
 
      XBT_PUBLIC(const char*) surf_resource_name(const void *resource);
 XBT_PUBLIC(void) surf_resource_free(void* resource);
+
+/**
+ * Resource which have a metric handled by a maxmin system
+ */
+typedef struct surf_resource_lmm {
+  s_surf_resource_t generic_resource;
+  lmm_constraint_t constraint;
+  e_surf_resource_state_t state_current;
+  tmgr_trace_event_t state_event;
+  double metric_current;
+  tmgr_trace_event_t metric_event;
+}s_surf_resource_lmm_t, *surf_resource_lmm_t;
+
 /**************************************/
 /* Implementations of model object */
 /**************************************/
index ca86deb..693e06a 100644 (file)
 #include "xbt/heap.h"
 #include "xbt/dynar.h"
 #include "surf/maxmin.h"
-
-typedef struct tmgr_history *tmgr_history_t;
-typedef struct tmgr_trace *tmgr_trace_t;
-typedef struct tmgr_trace_event *tmgr_trace_event_t;
+#include "surf/datatypes.h"
 
 /* Creation functions */
 XBT_PUBLIC(tmgr_history_t) tmgr_history_new(void);
index cee89a4..b61e499 100644 (file)
@@ -251,7 +251,7 @@ MSG_error_t MSG_process_sleep(double nb_sec)
   SIMIX_mutex_destroy(mutex);
 
   if (SIMIX_action_get_state(act_sleep) == SURF_ACTION_DONE) {
-    if (SIMIX_host_get_state(SIMIX_host_self()) == SURF_CPU_OFF) {
+    if (SIMIX_host_get_state(SIMIX_host_self()) == SURF_RESOURCE_OFF) {
       SIMIX_action_destroy(act_sleep);
       MSG_RETURN(MSG_HOST_FAILURE);
     }
index 9570768..bc0eccf 100644 (file)
@@ -105,7 +105,7 @@ typedef struct s_smx_simdata_action {
 
 
 #define SIMIX_CHECK_HOST()  xbt_assert0(surf_workstation_model->extension.workstation. \
-                                 get_state(SIMIX_host_self()->simdata->host)==SURF_CPU_ON,\
+                                 get_state(SIMIX_host_self()->simdata->host)==SURF_RESOURCE_ON,\
                                   "Host failed, you cannot call this function.")
 
 smx_host_t __SIMIX_host_create(const char *name, void *workstation,
index 310cad8..166ee67 100644 (file)
@@ -33,12 +33,12 @@ smx_action_t SIMIX_action_communicate(smx_host_t sender,
 
   /* check if the host is active */
   if (surf_workstation_model->extension.
-      workstation.get_state(sender->simdata->host) != SURF_CPU_ON) {
+      workstation.get_state(sender->simdata->host) != SURF_RESOURCE_ON) {
     THROW1(network_error, 0, "Host %s failed, you cannot call this function",
            sender->name);
   }
   if (surf_workstation_model->extension.
-      workstation.get_state(receiver->simdata->host) != SURF_CPU_ON) {
+      workstation.get_state(receiver->simdata->host) != SURF_RESOURCE_ON) {
     THROW1(network_error, 0, "Host %s failed, you cannot call this function",
            receiver->name);
   }
@@ -79,7 +79,7 @@ smx_action_t SIMIX_action_execute(smx_host_t host, const char *name,
 
   /* check if the host is active */
   if (surf_workstation_model->extension.
-      workstation.get_state(host->simdata->host) != SURF_CPU_ON) {
+      workstation.get_state(host->simdata->host) != SURF_RESOURCE_ON) {
     THROW1(host_error, 0, "Host %s failed, you cannot call this function",
            host->name);
   }
@@ -120,7 +120,7 @@ smx_action_t SIMIX_action_sleep(smx_host_t host, double duration)
 
   /* check if the host is active */
   if (surf_workstation_model->extension.
-      workstation.get_state(host->simdata->host) != SURF_CPU_ON) {
+      workstation.get_state(host->simdata->host) != SURF_RESOURCE_ON) {
     THROW1(host_error, 0, "Host %s failed, you cannot call this function",
            host->name);
   }
index 2311d33..a6cfe86 100644 (file)
@@ -7,14 +7,14 @@
 
 #include "surf_private.h"
 
-typedef s_surf_action_maxmin_t s_surf_action_cpu_Cas01_t, *surf_action_cpu_Cas01_t;
+typedef s_surf_action_lmm_t s_surf_action_cpu_Cas01_t, *surf_action_cpu_Cas01_t;
 
 typedef struct cpu_Cas01 {
   s_surf_resource_t generic_resource;
   double power_scale;
   double power_current;
   tmgr_trace_event_t power_event;
-  e_surf_cpu_state_t state_current;
+  e_surf_resource_state_t state_current;
   tmgr_trace_event_t state_event;
   lmm_constraint_t constraint;
 } s_cpu_Cas01_t, *cpu_Cas01_t;
@@ -33,7 +33,7 @@ static xbt_swag_t running_action_set_that_does_not_need_being_checked = NULL;
 static cpu_Cas01_t cpu_new(char *name, double power_scale,
                            double power_initial,
                            tmgr_trace_t power_trace,
-                           e_surf_cpu_state_t state_initial,
+                           e_surf_resource_state_t state_initial,
                            tmgr_trace_t state_trace,
                            xbt_dict_t cpu_properties)
 {
@@ -70,7 +70,7 @@ static void parse_cpu_init(void)
   double power_scale = 0.0;
   double power_initial = 0.0;
   tmgr_trace_t power_trace = NULL;
-  e_surf_cpu_state_t state_initial = SURF_CPU_OFF;
+  e_surf_resource_state_t state_initial = SURF_RESOURCE_OFF;
   tmgr_trace_t state_trace = NULL;
 
   power_scale = get_cpu_power(A_surfxml_host_power);
@@ -81,9 +81,9 @@ static void parse_cpu_init(void)
               (A_surfxml_host_state == A_surfxml_host_state_OFF),
               "Invalid state");
   if (A_surfxml_host_state == A_surfxml_host_state_ON)
-    state_initial = SURF_CPU_ON;
+    state_initial = SURF_RESOURCE_ON;
   if (A_surfxml_host_state == A_surfxml_host_state_OFF)
-    state_initial = SURF_CPU_OFF;
+    state_initial = SURF_RESOURCE_OFF;
   surf_parse_get_trace(&state_trace, A_surfxml_host_state_file);
 
   current_property_set = xbt_dict_new();
@@ -217,13 +217,13 @@ static void update_resource_state(void *id,
                                 cpu->power_current * cpu->power_scale);
   } else if (event_type == cpu->state_event) {
     if (value > 0)
-      cpu->state_current = SURF_CPU_ON;
+      cpu->state_current = SURF_RESOURCE_ON;
     else {
       lmm_constraint_t cnst = cpu->constraint;
       lmm_variable_t var = NULL;
       lmm_element_t elem = NULL;
 
-      cpu->state_current = SURF_CPU_OFF;
+      cpu->state_current = SURF_RESOURCE_OFF;
 
       while ((var = lmm_get_var_from_cnst(cpu_maxmin_system, cnst, &elem))) {
         surf_action_t action = lmm_variable_id(var);
@@ -251,7 +251,7 @@ static surf_action_t execute(void *cpu, double size)
 
   XBT_IN2("(%s,%g)", CPU->generic_resource.name, size);
   action = surf_action_new(sizeof(s_surf_action_cpu_Cas01_t),size,surf_cpu_model,
-      CPU->state_current != SURF_CPU_ON);
+      CPU->state_current != SURF_RESOURCE_ON);
 
   action->suspended = 0;        /* Should be useless because of the
                                    calloc but it seems to help valgrind... */
@@ -336,7 +336,7 @@ static void action_set_priority(surf_action_t action, double priority)
   XBT_OUT;
 }
 
-static e_surf_cpu_state_t get_state(void *cpu)
+static e_surf_resource_state_t get_state(void *cpu)
 {
   return ((cpu_Cas01_t) cpu)->state_current;
 }
index c5b61f6..c3611b4 100644 (file)
@@ -31,7 +31,7 @@ static link_CM02_t link_new(char *name,
                             tmgr_trace_t bw_trace,
                             double lat_initial,
                             tmgr_trace_t lat_trace,
-                            e_surf_link_state_t
+                            e_surf_resource_state_t
                             state_initial,
                             tmgr_trace_t state_trace,
                             e_surf_link_sharing_policy_t
@@ -76,7 +76,7 @@ static void parse_link_init(void)
   tmgr_trace_t bw_trace;
   double lat_initial;
   tmgr_trace_t lat_trace;
-  e_surf_link_state_t state_initial_link = SURF_LINK_ON;
+  e_surf_resource_state_t state_initial_link = SURF_RESOURCE_ON;
   e_surf_link_sharing_policy_t policy_initial_link = SURF_LINK_SHARED;
   tmgr_trace_t state_trace;
 
@@ -90,9 +90,9 @@ static void parse_link_init(void)
               || (A_surfxml_link_state ==
                   A_surfxml_link_state_OFF), "Invalid state");
   if (A_surfxml_link_state == A_surfxml_link_state_ON)
-    state_initial_link = SURF_LINK_ON;
+    state_initial_link = SURF_RESOURCE_ON;
   else if (A_surfxml_link_state == A_surfxml_link_state_OFF)
-    state_initial_link = SURF_LINK_OFF;
+    state_initial_link = SURF_RESOURCE_OFF;
 
   if (A_surfxml_link_sharing_policy == A_surfxml_link_sharing_policy_SHARED)
     policy_initial_link = SURF_LINK_SHARED;
@@ -319,13 +319,13 @@ static void update_resource_state(void *id,
     }
   } else if (event_type == nw_link->state_event) {
     if (value > 0)
-      nw_link->state_current = SURF_LINK_ON;
+      nw_link->state_current = SURF_RESOURCE_ON;
     else {
       lmm_constraint_t cnst = nw_link->constraint;
       lmm_variable_t var = NULL;
       lmm_element_t elem = NULL;
 
-      nw_link->state_current = SURF_LINK_OFF;
+      nw_link->state_current = SURF_RESOURCE_OFF;
       while ((var = lmm_get_var_from_cnst
               (network_maxmin_system, cnst, &elem))) {
         surf_action_t action = lmm_variable_id(var);
@@ -367,7 +367,7 @@ static surf_action_t communicate(const char *src_name, const char *dst_name,int
   link_CM02_t link;
   int failed=0;
   xbt_dynar_foreach(route,i,link) {
-    if (link->state_current == SURF_LINK_OFF) {
+    if (link->state_current == SURF_RESOURCE_OFF) {
       failed = 1;
       break;
     }
@@ -517,7 +517,7 @@ static void surf_network_model_init_internal(void)
   routing_model_create(sizeof(link_CM02_t),
       link_new(xbt_strdup("__loopback__"),
           498000000, NULL, 0.000015, NULL,
-          SURF_LINK_ON, NULL, SURF_LINK_FATPIPE, NULL));
+          SURF_RESOURCE_ON, NULL, SURF_LINK_FATPIPE, NULL));
 }
 
 /************************************************************************/
index eb561fa..e7536d6 100644 (file)
@@ -157,12 +157,12 @@ static void parse_link_init(void)
   char *name;
   double bw;
   double lat;
-  e_surf_link_state_t state;
+  e_surf_resource_state_t state;
 
   name = xbt_strdup(A_surfxml_link_id);
   surf_parse_get_double(&bw, A_surfxml_link_bandwidth);
   surf_parse_get_double(&lat, A_surfxml_link_latency);
-  state = SURF_LINK_ON;
+  state = SURF_RESOURCE_ON;
 
   tmgr_trace_t bw_trace;
   tmgr_trace_t state_trace;
index 98f984d..a43e670 100644 (file)
@@ -21,7 +21,7 @@ typedef struct network_link_CM02 {
   tmgr_trace_event_t bw_event;
   double lat_current;
   tmgr_trace_event_t lat_event;
-  e_surf_link_state_t state_current;
+  e_surf_resource_state_t state_current;
   tmgr_trace_event_t state_event;
   lmm_constraint_t constraint;
 } s_link_CM02_t, *link_CM02_t;
index a52ff94..8c70cd3 100644 (file)
@@ -20,11 +20,6 @@ extern double sg_tcp_gamma;
 
 extern const char *surf_action_state_names[6];
 
-typedef enum {
-  SURF_LINK_ON = 1,             /* Ready        */
-  SURF_LINK_OFF = 0             /* Running      */
-} e_surf_link_state_t;
-
 typedef enum {
   SURF_LINK_SHARED = 1,
   SURF_LINK_FATPIPE = 0
index 503b6eb..7d5a655 100644 (file)
@@ -197,7 +197,7 @@ static surf_action_t communicate(void *workstation_src,
         size, rate);
 }
 
-static e_surf_cpu_state_t get_state(void *workstation)
+static e_surf_resource_state_t get_state(void *workstation)
 {
   return surf_cpu_model->extension.
     cpu.get_state(((workstation_CLM03_t) workstation)->cpu);
index f95cc84..ac34f93 100644 (file)
@@ -25,7 +25,7 @@ typedef struct cpu_L07 {
   double power_scale;
   double power_current;
   tmgr_trace_event_t power_event;
-  e_surf_cpu_state_t state_current;
+  e_surf_resource_state_t state_current;
   tmgr_trace_event_t state_event;
   int id;                       /* cpu and network card are a single object... */
 } s_cpu_L07_t, *cpu_L07_t;
@@ -42,7 +42,7 @@ typedef struct link_L07 {
   tmgr_trace_event_t lat_event;
   double bw_current;
   tmgr_trace_event_t bw_event;
-  e_surf_link_state_t state_current;
+  e_surf_resource_state_t state_current;
   tmgr_trace_event_t state_event;
 } s_link_L07_t, *link_L07_t;
 
@@ -298,10 +298,10 @@ static void update_actions_state(double now, double delta)
         if (((((link_L07_t) constraint_id)->type ==
               SURF_WORKSTATION_RESOURCE_LINK) &&
              (((link_L07_t) constraint_id)->state_current ==
-              SURF_LINK_OFF)) ||
+              SURF_RESOURCE_OFF)) ||
             ((((cpu_L07_t) constraint_id)->type ==
               SURF_WORKSTATION_RESOURCE_CPU) &&
-             (((cpu_L07_t) constraint_id)->state_current == SURF_CPU_OFF))) {
+             (((cpu_L07_t) constraint_id)->state_current == SURF_RESOURCE_OFF))) {
           DEBUG1("Action (%p) Failed!!", action);
           action->generic_action.finish = surf_get_clock();
           surf_action_state_set((surf_action_t) action,
@@ -343,9 +343,9 @@ static void update_resource_state(void *id,
 
     } else if (event_type == nw_link->state_event) {
       if (value > 0)
-        nw_link->state_current = SURF_LINK_ON;
+        nw_link->state_current = SURF_RESOURCE_ON;
       else
-        nw_link->state_current = SURF_LINK_OFF;
+        nw_link->state_current = SURF_RESOURCE_OFF;
     } else {
       CRITICAL0("Unknown event ! \n");
       xbt_abort();
@@ -359,9 +359,9 @@ static void update_resource_state(void *id,
                                   cpu->power_current * cpu->power_scale);
     } else if (event_type == cpu->state_event) {
       if (value > 0)
-        cpu->state_current = SURF_CPU_ON;
+        cpu->state_current = SURF_RESOURCE_ON;
       else
-        cpu->state_current = SURF_CPU_OFF;
+        cpu->state_current = SURF_RESOURCE_OFF;
     } else {
       CRITICAL0("Unknown event ! \n");
       xbt_abort();
@@ -396,7 +396,7 @@ static void finalize(void)
 /******* Resource Private    **********/
 /**************************************/
 
-static e_surf_cpu_state_t resource_get_state(void *cpu)
+static e_surf_resource_state_t resource_get_state(void *cpu)
 {
   return ((cpu_L07_t) cpu)->state_current;
 }
@@ -583,7 +583,7 @@ static int link_shared(const void *link)
 static cpu_L07_t cpu_new(const char *name, double power_scale,
                          double power_initial,
                          tmgr_trace_t power_trace,
-                         e_surf_cpu_state_t state_initial,
+                         e_surf_resource_state_t state_initial,
                          tmgr_trace_t state_trace, xbt_dict_t cpu_properties)
 {
   cpu_L07_t cpu = xbt_new0(s_cpu_L07_t, 1);
@@ -624,7 +624,7 @@ static void parse_cpu_init(void)
   double power_scale = 0.0;
   double power_initial = 0.0;
   tmgr_trace_t power_trace = NULL;
-  e_surf_cpu_state_t state_initial = SURF_CPU_OFF;
+  e_surf_resource_state_t state_initial = SURF_RESOURCE_OFF;
   tmgr_trace_t state_trace = NULL;
 
   power_scale = get_cpu_power(A_surfxml_host_power);
@@ -635,9 +635,9 @@ static void parse_cpu_init(void)
               (A_surfxml_host_state == A_surfxml_host_state_OFF),
               "Invalid state");
   if (A_surfxml_host_state == A_surfxml_host_state_ON)
-    state_initial = SURF_CPU_ON;
+    state_initial = SURF_RESOURCE_ON;
   if (A_surfxml_host_state == A_surfxml_host_state_OFF)
-    state_initial = SURF_CPU_OFF;
+    state_initial = SURF_RESOURCE_OFF;
   surf_parse_get_trace(&state_trace, A_surfxml_host_state_file);
 
   current_property_set = xbt_dict_new();
@@ -650,7 +650,7 @@ static link_L07_t link_new(char *name,
                            tmgr_trace_t bw_trace,
                            double lat_initial,
                            tmgr_trace_t lat_trace,
-                           e_surf_link_state_t
+                           e_surf_resource_state_t
                            state_initial,
                            tmgr_trace_t state_trace,
                            e_surf_link_sharing_policy_t
@@ -696,7 +696,7 @@ static void parse_link_init(void)
   tmgr_trace_t bw_trace;
   double lat_initial;
   tmgr_trace_t lat_trace;
-  e_surf_link_state_t state_initial_link = SURF_LINK_ON;
+  e_surf_resource_state_t state_initial_link = SURF_RESOURCE_ON;
   e_surf_link_sharing_policy_t policy_initial_link = SURF_LINK_SHARED;
   tmgr_trace_t state_trace;
 
@@ -710,9 +710,9 @@ static void parse_link_init(void)
               || (A_surfxml_link_state ==
                   A_surfxml_link_state_OFF), "Invalid state");
   if (A_surfxml_link_state == A_surfxml_link_state_ON)
-    state_initial_link = SURF_LINK_ON;
+    state_initial_link = SURF_RESOURCE_ON;
   else if (A_surfxml_link_state == A_surfxml_link_state_OFF)
-    state_initial_link = SURF_LINK_OFF;
+    state_initial_link = SURF_RESOURCE_OFF;
 
   if (A_surfxml_link_sharing_policy == A_surfxml_link_sharing_policy_SHARED)
     policy_initial_link = SURF_LINK_SHARED;
@@ -850,7 +850,7 @@ static void model_init_internal(void)
   routing_model_create(sizeof(link_L07_t),
         link_new(xbt_strdup("__loopback__"),
             498000000, NULL, 0.000015, NULL,
-            SURF_LINK_ON, NULL, SURF_LINK_FATPIPE, NULL));
+            SURF_RESOURCE_ON, NULL, SURF_LINK_FATPIPE, NULL));
 
 }