Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix vm_ws_destroy()
authorTakahiro Hirofuchi <thirofuchi@debian.(none)>
Thu, 31 Jan 2013 21:09:58 +0000 (22:09 +0100)
committerTakahiro Hirofuchi <thirofuchi@debian.(none)>
Thu, 31 Jan 2013 21:09:58 +0000 (22:09 +0100)
src/include/surf/surf.h
src/surf/vm_workstation.c

index 3749e61..2c28873 100644 (file)
@@ -278,11 +278,11 @@ typedef struct surf_workstation_model_extension_public {
 
 typedef struct surf_vm_workstation_model_extension_public {
   s_surf_model_extension_workstation_t basic;
 
 typedef struct surf_vm_workstation_model_extension_public {
   s_surf_model_extension_workstation_t basic;
-  void* (*create) (const char *name, void *workstation); // First operation of the VM model
+  void* (*create) (const char *name, void *ind_phys_workstation); // First operation of the VM model
   // start does not appear here as it corresponds to turn the state from created to running (see smx_vm.c)
   // start does not appear here as it corresponds to turn the state from created to running (see smx_vm.c)
-  int (*get_state) (void *workstation);
-  void (*set_state) (void *workstation, int state);
-  void (*destroy) (smx_host_t *host); // destory the vm-specific data
+  int (*get_state) (void *ind_phys_workstation);
+  void (*set_state) (void *ind_phys_workstation, int state);
+  void (*destroy) (void *ind_phys_workstation); // will be vm_ws_destroy(), which destroies the vm-specific data
 } s_surf_model_extension_vm_workstation_t;
 
 /** \ingroup SURF_models
 } s_surf_model_extension_vm_workstation_t;
 
 /** \ingroup SURF_models
index 00d9dc5..8c1326c 100644 (file)
@@ -22,7 +22,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_vm_workstation, surf,
 
 surf_model_t surf_vm_workstation_model = NULL;
 
 
 surf_model_t surf_vm_workstation_model = NULL;
 
-static void vm_ws_create (const char *name, void *ind_phys_workstation)
+static void vm_ws_create(const char *name, void *ind_phys_workstation)
 {
   workstation_VM2013_t vm_ws = xbt_new0(s_workstation_VM2013_t, 1);
 // TODO Complete the surf vm workstation model
 {
   workstation_VM2013_t vm_ws = xbt_new0(s_workstation_VM2013_t, 1);
 // TODO Complete the surf vm workstation model
@@ -39,14 +39,14 @@ static void vm_ws_create (const char *name, void *ind_phys_workstation)
  * A physical host does not disapper in the current SimGrid code, but a VM may
  * disapper during a simulation.
  */
  * A physical host does not disapper in the current SimGrid code, but a VM may
  * disapper during a simulation.
  */
-static void vm_ws_destroy(smx_host_t host)
+static void vm_ws_destroy(void *ind_phys_workstation)
 { 
 { 
-       workstation_VM2013_t vm_ws = surf_workstation_resource_priv(host);
+       /* ind_phys_workstation equals to smx_host_t */
+       workstation_VM2013_t vm_ws = surf_workstation_resource_priv(ind_phys_workstation);
        xbt_assert(vm_ws);
        xbt_assert(vm_ws->generic_resource.model == surf_vm_workstation_model);
 
        const char *name = vm_ws->generic_resource.name;
        xbt_assert(vm_ws);
        xbt_assert(vm_ws->generic_resource.model == surf_vm_workstation_model);
 
        const char *name = vm_ws->generic_resource.name;
-       /* not defined yet, but we should have  */
        /* this will call surf_resource_free() */
        xbt_lib_unset(host_lib, name, SURF_WKS_LEVEL);
 
        /* this will call surf_resource_free() */
        xbt_lib_unset(host_lib, name, SURF_WKS_LEVEL);