Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix issue with file unlinking
[simgrid.git] / src / plugins / file_system / s4u_FileSystem.cpp
index d39845b..6b63130 100644 (file)
@@ -17,7 +17,7 @@
 #include <fstream>
 #include <numeric>
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_file, "S4U files");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_file, s4u, "S4U files");
 int sg_storage_max_file_descriptors = 1024;
 
 namespace simgrid {
@@ -26,10 +26,11 @@ simgrid::xbt::Extension<Disk, FileSystemDiskExt> FileSystemDiskExt::EXTENSION_ID
 simgrid::xbt::Extension<Storage, FileSystemStorageExt> FileSystemStorageExt::EXTENSION_ID;
 simgrid::xbt::Extension<Host, FileDescriptorHostExt> FileDescriptorHostExt::EXTENSION_ID;
 
-File::File(const std::string& fullpath, void* userdata) : File(fullpath, Host::current(), userdata){};
+File::File(const std::string& fullpath, void* userdata) : File(fullpath, Host::current(), userdata){}
 
-File::File(const std::string& fullpath, sg_host_t host, void* userdata) : fullpath_(fullpath), userdata_(userdata)
+File::File(const std::string& fullpath, sg_host_t host, void* userdata) : fullpath_(fullpath)
 {
+  this->set_data(userdata);
   // this cannot fail because we get a xbt_die if the mountpoint does not exist
   if (not host->get_mounted_storages().empty()) {
     Storage* st                  = nullptr;
@@ -335,7 +336,7 @@ int File::unlink()
       local_disk_->extension<FileSystemDiskExt>()->decr_used_size(size_);
 
     // Remove the file from storage
-    content->erase(fullpath_);
+    content->erase(path_);
 
     return 0;
   }
@@ -640,12 +641,12 @@ void sg_file_dump(sg_file_t fd)
 
 void* sg_file_get_data(sg_file_t fd)
 {
-  return fd->get_userdata();
+  return fd->get_data();
 }
 
 void sg_file_set_data(sg_file_t fd, void* data)
 {
-  fd->set_userdata(data);
+  fd->set_data(data);
 }
 
 /**