- storage_t st = find_storage_on_mount_list(workstation, storage);
- XBT_DEBUG("STAT on disk '%s'",st->generic_resource.name);
+ 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;
+
+ // Remove the file from storage
+ xbt_dict_remove(content_dict,fd->name);
+
+ free(fd->name);
+ free(fd->storage);
+ xbt_free(fd);
+ return 1;
+ }
+ }
+}
+
+static surf_action_t ws_action_ls(void *workstation, const char* mount,
+ const char *path)
+{
+ XBT_DEBUG("LS on mount '%s' and file '%s'",mount, path);
+ storage_t st = find_storage_on_mount_list(workstation, mount);