Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use signals for platform callbacks
[simgrid.git] / src / surf / storage_n11.cpp
index bfd139d..c21c670 100644 (file)
@@ -31,7 +31,7 @@ static XBT_INLINE void routing_storage_type_free(void *r)
 static XBT_INLINE void surf_storage_resource_free(void *r)
 {
   // specific to storage
-  Storage *storage = static_cast<Storage*>(r);
+  simgrid::surf::Storage *storage = static_cast<simgrid::surf::Storage*>(r);
   // generic resource
   delete storage;
 }
@@ -56,10 +56,13 @@ void storage_register_callbacks()
 
 void surf_storage_model_init_default(void)
 {
-  surf_storage_model = new StorageN11Model();
+  surf_storage_model = new simgrid::surf::StorageN11Model();
   xbt_dynar_push(all_existing_models, &surf_storage_model);
 }
 
+namespace simgrid {
+namespace surf {
+
 StorageN11Model::StorageN11Model() : StorageModel() {
   Action *action = NULL;
 
@@ -95,7 +98,7 @@ Storage *StorageN11Model::createStorage(const char* id, const char* type_id,
   Storage *storage = new StorageN11(this, id, properties, p_maxminSystem,
       Bread, Bwrite, Bconnection, type_id, (char *)content_name,
       xbt_strdup(content_type), storage_type->size, (char *) attach);
-  surf_callback_emit(storageCreatedCallbacks, storage);
+  storageCreatedCallbacks(storage);
   xbt_lib_set(storage_lib, id, SURF_STORAGE_LEVEL, storage);
 
   XBT_DEBUG("SURF storage create resource\n\t\tid '%s'\n\t\ttype '%s'\n\t\tproperties '%p'\n\t\tBread '%f'\n",
@@ -245,7 +248,7 @@ StorageAction *StorageN11::open(const char* mount, const char* path)
   file->mount = xbt_strdup(mount);
   file->current_position = 0;
 
-  StorageAction *action = new StorageN11Action(getModel(), 0, getState() != SURF_RESOURCE_ON, this, OPEN);
+  StorageAction *action = new StorageN11Action(getModel(), 0, isOff(), this, OPEN);
   action->p_file = file;
 
   return action;
@@ -269,7 +272,7 @@ StorageAction *StorageN11::close(surf_file_t fd)
   free(fd->name);
   free(fd->mount);
   xbt_free(fd);
-  StorageAction *action = new StorageN11Action(getModel(), 0, getState() != SURF_RESOURCE_ON, this, CLOSE);
+  StorageAction *action = new StorageN11Action(getModel(), 0, isOff(), this, CLOSE);
   return action;
 }
 
@@ -286,7 +289,7 @@ StorageAction *StorageN11::read(surf_file_t fd, sg_size_t size)
   else
     fd->current_position += size;
 
-  StorageAction *action = new StorageN11Action(getModel(), size, getState() != SURF_RESOURCE_ON, this, READ);
+  StorageAction *action = new StorageN11Action(getModel(), size, isOff(), this, READ);
   return action;
 }
 
@@ -295,7 +298,7 @@ StorageAction *StorageN11::write(surf_file_t fd, sg_size_t size)
   char *filename = fd->name;
   XBT_DEBUG("\tWrite file '%s' size '%llu/%llu'",filename,size,fd->size);
 
-  StorageAction *action = new StorageN11Action(getModel(), size, getState() != SURF_RESOURCE_ON, this, WRITE);
+  StorageAction *action = new StorageN11Action(getModel(), size, isOff(), this, WRITE);
   action->p_file = fd;
   /* Substract the part of the file that might disappear from the used sized on
    * the storage element */
@@ -394,3 +397,5 @@ void StorageN11Action::setPriority(double /*priority*/)
   THROW_UNIMPLEMENTED;
 }
 
+}
+}