-/* Copyright (c) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012. The SimGrid Team.
+/* Copyright (c) 2004 - 2013. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
return action;
}
-static surf_action_t storage_action_get_size(void *storage, surf_file_t stream)
-{
- surf_action_t action = storage_action_execute(storage,0,GET_SIZE);
- action->file = stream;
- return action;
-}
-
-static surf_action_t storage_action_unlink(void *storage, surf_file_t stream)
+static surf_action_t storage_action_unlink(void *storage, surf_file_t fd)
{
surf_action_t action = storage_action_execute(storage,0, UNLINK);
// Add memory to storage
- ((storage_t)storage)->used_size -= stream->size;
+ ((storage_t)storage)->used_size -= fd->size;
// Remove the file from storage
xbt_dict_t content_dict = ((storage_t)storage)->content;
- xbt_dict_remove(content_dict,stream->name);
+ xbt_dict_remove(content_dict,fd->name);
- free(stream->name);
- xbt_free(stream);
+ free(fd->name);
+ xbt_free(fd);
return action;
}
-static surf_action_t storage_action_open(void *storage, const char* mount, const char* path, const char* mode)
+static surf_action_t storage_action_open(void *storage, const char* mount,
+ const char* path)
{
XBT_DEBUG("\tOpen file '%s'",path);
xbt_dict_t content_dict = ((storage_t)storage)->content;
return action;
}
-static surf_action_t storage_action_read(void *storage, void* ptr, double size, size_t nmemb, surf_file_t stream)
+static surf_action_t storage_action_read(void *storage, void* ptr, double size,
+ size_t nmemb, surf_file_t fd)
{
- if(size > stream->size)
- size = stream->size;
+ if(size > fd->size)
+ size = fd->size;
surf_action_t action = storage_action_execute(storage,size,READ);
return action;
}
-static surf_action_t storage_action_write(void *storage, const void* ptr, size_t size, size_t nmemb, surf_file_t stream)
+static surf_action_t storage_action_write(void *storage, const void* ptr,
+ size_t size, size_t nmemb,
+ surf_file_t fd)
{
- char *filename = stream->name;
- XBT_DEBUG("\tWrite file '%s' size '%zu/%zu'",filename,size,stream->size);
+ char *filename = fd->name;
+ XBT_DEBUG("\tWrite file '%s' size '%zu/%zu'",filename,size,fd->size);
surf_action_t action = storage_action_execute(storage,size,WRITE);
- action->file = stream;
+ action->file = fd;
// If the storage is full
if(((storage_t)storage)->used_size==((storage_t)storage)->size) {
case STAT:
case UNLINK:
case LS:
- case GET_SIZE:
break;
case READ:
lmm_expand(storage_maxmin_system, STORAGE->constraint_read,
surf_storage_model->extension.storage.write = storage_action_write;
surf_storage_model->extension.storage.unlink = storage_action_unlink;
surf_storage_model->extension.storage.ls = storage_action_ls;
- surf_storage_model->extension.storage.get_size = storage_action_get_size;
if (!storage_maxmin_system) {
storage_maxmin_system = lmm_system_new(storage_selective_update);