Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'surf++'
[simgrid.git] / src / surf / storage.cpp
index 1244418..d0b2766 100644 (file)
@@ -596,6 +596,21 @@ StorageActionPtr StorageLmm::write(surf_file_t fd, sg_storage_size_t size)
   return action;
 }
 
+void StorageLmm::rename(const char *src, const char *dest)
+{
+  sg_storage_size_t *psize, *new_psize;
+  psize = (sg_storage_size_t*) xbt_dict_get_or_null(p_content,src);
+  new_psize = xbt_new(sg_storage_size_t, 1);
+  *new_psize = *psize;
+  if (psize){// src file exists
+    xbt_dict_remove(p_content, src);
+    xbt_dict_set(p_content, dest, new_psize,NULL);
+    XBT_DEBUG("Change file name from %s to %s, size '%" PRIu64 "'",src, dest, *psize);
+  }
+  else
+    XBT_DEBUG("File %s doesn't exist",src);
+}
+
 xbt_dict_t StorageLmm::getContent()
 {
   /* For the moment this action has no cost, but in the future we could take in account access latency of the disk */