- storage_t st = find_storage_on_mount_list(workstation, stream->storage);
- XBT_DEBUG("STAT on disk '%s'",st->generic_resource.name);
- surf_model_t model = st->generic_resource.model;
- return model->extension.storage.stat(st, stream);
-}
+ if (!fd){
+ XBT_WARN("No such file descriptor. Impossible to unlink");
+ return 0;
+ } else {
+// XBT_INFO("%s %zu", fd->storage, fd->size);
+ storage_t st = find_storage_on_mount_list(workstation, fd->storage);
+ xbt_dict_t content_dict = (st)->content;
+ /* Check if the file is on this storage */
+ if (!xbt_dict_get_or_null(content_dict, fd->name)){
+ XBT_WARN("File %s is not on disk %s. Impossible to unlink", fd->name,
+ st->generic_resource.name);
+ return 0;
+ } else {
+ XBT_DEBUG("UNLINK on disk '%s'",st->generic_resource.name);
+ st->used_size -= fd->size;