MSG_file_stat(file,&stat);
XBT_INFO("\tFile stat %s Size %.1f",file->name,stat.size);
+ MSG_file_free_stat(&stat);
XBT_INFO("\tClose file '%s'",file->name);
MSG_file_close(file);
XBT_PUBLIC(msg_file_t) MSG_file_open(const char* mount, const char* path, const char* mode);
XBT_PUBLIC(int) MSG_file_close(msg_file_t fp);
XBT_PUBLIC(int) MSG_file_stat(msg_file_t fd, s_msg_stat_t *buf);
+XBT_PUBLIC(void) MSG_file_free_stat(s_msg_stat_t *stat);
/************************** Host handling ***********************************/
*/
int MSG_file_close(msg_file_t fp)
{
- return simcall_file_close(fp->simdata->smx_file);
+ int res = simcall_file_close(fp->simdata->smx_file);
+ free(fp->name);
+ xbt_free(fp->simdata);
+ xbt_free(fp);
+ return res;
}
/** \ingroup msg_file_management
res = simcall_file_stat(fd->simdata->smx_file, buf);
return res;
}
+
+/** \ingroup msg_file_management
+ * \brief Free the stat structure
+ *
+ * \param stat the #s_msg_stat_t to free
+ */
+void MSG_file_free_stat(s_msg_stat_t *stat)
+{
+ free(stat->date);
+ free(stat->group);
+ free(stat->time);
+ free(stat->user);
+ free(stat->user_rights);
+}
simcall->file_open.result->surf_file = (action->io.surf_io)->file;
break;
case SIMCALL_FILE_CLOSE:
- simcall->file_read.result = 0;
+ xbt_free(simcall->file_close.fp);
+ simcall->file_close.result = 0;
break;
case SIMCALL_FILE_WRITE:
simcall->file_write.result = (action->io.surf_io)->cost;
storage_type->properties,
Bread);
- if(!storage_list) storage_list=xbt_dynar_new(sizeof(char *),free);
+ if(!storage_list) storage_list=xbt_dynar_new(sizeof(char *),NULL);
xbt_dynar_push(storage_list,&storage);
return storage;
surf_model_exit(surf_storage_model);
surf_storage_model = NULL;
+ if(storage_list)
+ xbt_dynar_free(&storage_list);
+
xbt_swag_free
(storage_running_action_set_that_does_not_need_being_checked);
storage_running_action_set_that_does_not_need_being_checked = NULL;
// specific to storage
storage_t storage = r;
xbt_dict_free(&storage->content);
+ xbt_dynar_free(&storage->write_actions);
// generic resource
surf_resource_free(r);
}