+static surf_action_t ws_action_close(void *workstation, surf_file_t fd)
+{
+ storage_t st = find_storage_on_mount_list(workstation, fd->storage);
+ XBT_DEBUG("CLOSE on disk '%s'",st->generic_resource.name);
+ surf_model_t model = st->generic_resource.model;
+ return model->extension.storage.close(st, fd);
+}
+
+static surf_action_t ws_action_read(void *workstation, void* ptr, size_t size,
+ surf_file_t fd)
+{
+ storage_t st = find_storage_on_mount_list(workstation, fd->storage);
+ XBT_DEBUG("READ on disk '%s'",st->generic_resource.name);
+ surf_model_t model = st->generic_resource.model;
+ return model->extension.storage.read(st, ptr, size, fd);
+}
+
+static surf_action_t ws_action_write(void *workstation, const void* ptr,
+ size_t size, surf_file_t fd)
+{
+ storage_t st = find_storage_on_mount_list(workstation, fd->storage);
+ XBT_DEBUG("WRITE on disk '%s'",st->generic_resource.name);
+ surf_model_t model = st->generic_resource.model;
+ return model->extension.storage.write(st, ptr, size, fd);
+}
+
+static int ws_file_unlink(void *workstation, surf_file_t fd)
+{
+ 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);
+ surf_model_t model = st->generic_resource.model;
+ return model->extension.storage.ls(st, path);
+}
+
+static size_t ws_file_get_size(void *workstation, surf_file_t fd)
+{
+ return fd->size;
+}
+
+void ws_get_params(void *ws, ws_params_t params)
+{
+ workstation_CLM03_t ws_clm03 = surf_workstation_resource_priv(ws);
+ memcpy(params, &ws_clm03->params, sizeof(s_ws_params_t));
+}
+
+void ws_set_params(void *ws, ws_params_t params)
+{
+ workstation_CLM03_t ws_clm03 = surf_workstation_resource_priv(ws);
+ /* may check something here. */
+ memcpy(&ws_clm03->params, params, sizeof(s_ws_params_t));
+}
+
+static xbt_dynar_t ws_get_vms(void *pm)
+{
+ xbt_dynar_t dyn = xbt_dynar_new(sizeof(smx_host_t), NULL);
+
+ /* iterate for all hosts including virtual machines */
+ xbt_lib_cursor_t cursor;
+ char *key;
+ void **ind_host;
+ xbt_lib_foreach(host_lib, cursor, key, ind_host) {
+ workstation_CLM03_t ws_clm03 = ind_host[SURF_WKS_LEVEL];
+ if (!ws_clm03)
+ continue;
+ /* skip if it is not a virtual machine */
+ if (ws_clm03->generic_resource.model != surf_vm_workstation_model)
+ continue;
+
+ /* It is a virtual machine, so we can cast it to workstation_VM2013_t */
+ workstation_VM2013_t ws_vm2013 = (workstation_VM2013_t) ws_clm03;
+ if (pm == ws_vm2013->sub_ws)
+ xbt_dynar_push(dyn, &ws_vm2013->sub_ws);
+ }
+
+ return dyn;
+}
+
+