XBT_INFO("\tHave written %zu on %s",write,file->name);
read = MSG_file_read(ptr,110000,sizeof(char*),file); // Read for 110KB
- XBT_INFO("\tHave read %zu on %s",read,file->name);
+ XBT_INFO("\tHave read %zu on %s (of size %zu)",read,file->name,
+ MSG_file_get_size(file));
XBT_INFO("\tClose file '%s'",file->name);
MSG_file_close(file);
XBT_PUBLIC(size_t) MSG_file_read(void* ptr, size_t size, size_t nmemb, msg_file_t stream);
XBT_PUBLIC(size_t) MSG_file_write(const void* ptr, size_t size, size_t nmemb, msg_file_t stream);
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_close(msg_file_t fd);
XBT_PUBLIC(size_t) MSG_file_get_size(msg_file_t fd);
XBT_PUBLIC(int) MSG_file_unlink(msg_file_t fd);
typedef struct surf_storage_model_extension_public {
surf_action_t(*open) (void *storage, const char* mount, const char* path, const char* mode);
- surf_action_t(*close) (void *storage, surf_file_t fp);
+ surf_action_t(*close) (void *storage, surf_file_t fd);
surf_action_t(*read) (void *storage, void* ptr, double size, size_t nmemb, surf_file_t stream);
surf_action_t(*write) (void *storage, const void* ptr, size_t size, size_t nmemb, surf_file_t stream);
surf_action_t(*stat) (void *storage, surf_file_t stream);
/** \ingroup msg_file_management
* \brief Close the file
*
- * \param fp is the file to close
+ * \param fd is the file to close
* \return 0 on success or 1 on error
*/
-int MSG_file_close(msg_file_t fp)
+int MSG_file_close(msg_file_t fd)
{
- int res = simcall_file_close(fp->simdata->smx_file);
- free(fp->name);
- xbt_free(fp->simdata);
- xbt_free(fp);
+ int res = simcall_file_close(fd->simdata->smx_file);
+ free(fd->name);
+ xbt_free(fd->simdata);
+ xbt_free(fd);
return res;
}
return action;
}
-static surf_action_t storage_action_close(void *storage, surf_file_t fp)
+static surf_action_t storage_action_close(void *storage, surf_file_t fd)
{
- char *filename = fp->name;
- XBT_DEBUG("\tClose file '%s' size '%zu'",filename,fp->size);
+ char *filename = fd->name;
+ XBT_DEBUG("\tClose file '%s' size '%zu'",filename,fd->size);
// unref write actions from storage
surf_action_storage_t write_action;
unsigned int i;
xbt_dynar_foreach(((storage_t)storage)->write_actions,i,write_action) {
- if ((write_action->generic_lmm_action.generic_action.file) == fp) {
+ if ((write_action->generic_lmm_action.generic_action.file) == fd) {
xbt_dynar_cursor_rm(((storage_t)storage)->write_actions, &i);
storage_action_unref((surf_action_t) write_action);
}
}
- free(fp->name);
- xbt_free(fp);
+ free(fd->name);
+ xbt_free(fd);
surf_action_t action = storage_action_execute(storage,0, CLOSE);
return action;
}
return model->extension.storage.open(st, mount, path, mode);
}
-static surf_action_t ws_action_close(void *workstation, surf_file_t fp)
+static surf_action_t ws_action_close(void *workstation, surf_file_t fd)
{
- storage_t st = find_storage_on_mount_list(workstation, fp->storage);
+ 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, fp);
+ return model->extension.storage.close(st, fd);
}
static surf_action_t ws_action_read(void *workstation, void* ptr, size_t size, size_t nmemb, surf_file_t stream)