- /* Copyright (c) 2007, 2008, 2009, 2010. The SimGrid Team.
+ /* Copyright (c) 2007-2010, 2012-2013. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
XBT_PUBLIC(void*) SIMIX_storage_get_data(smx_storage_t storage);
XBT_PUBLIC(void) SIMIX_storage_set_data(smx_storage_t storage, void *data);
XBT_PUBLIC(xbt_dict_t) SIMIX_storage_get_content(smx_storage_t storage);
+XBT_PUBLIC(xbt_dict_t) simcall_storage_get_content(smx_storage_t storage);
XBT_PUBLIC(const char*) SIMIX_storage_get_name(smx_host_t host);
/************************** AS router **********************************/
XBT_PUBLIC(xbt_dict_t) SIMIX_asr_get_properties(const char *name);
- /* Copyright (c) 2004, 2005, 2006, 2007, 2008, 2009, 2010. 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
surf_action_t(*stat) (void *storage, surf_file_t fd);
surf_action_t(*ls) (void *storage, const char *path);
xbt_dict_t(*get_properties) (const void *storage);
- xbt_dict_t(*get_content) (const void *storage);
+ xbt_dict_t(*get_content) (void *storage);
} s_surf_model_extension_storage_t;
/** \ingroup SURF_models
- /* Copyright (c) 2004, 2005, 2006, 2007, 2008, 2009, 2010. 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
xbt_dynar_t storage_list = simcall_host_get_storage_list(host);
xbt_dynar_foreach(storage_list, i, storage_name){
storage = xbt_lib_get_elm_or_null(storage_lib,storage_name);
- xbt_dict_t content = SIMIX_storage_get_content(storage);
+ xbt_dict_t content = simcall_storage_get_content(storage);
xbt_dynar_push(contents, &content);
}
return contents;
- /* Copyright (c) 2004 - 2013. 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
*
* \brief Returns the content (file list) of a #msg_storage_t.
* \param storage a storage
+ * \return The content of this storage element as a dict (full path file => size)
*/
xbt_dict_t MSG_storage_get_content(msg_storage_t storage)
{
- return SIMIX_storage_get_content(storage);
+ return SIMIX_storage_get_content(storage);
+ //return (simcall_storage_get_properties(storage));
}
- /* Copyright (c) 2007, 2008, 2009, 2010. The SimGrid Team.
+ /* Copyright (c) 2007-2010, 2012-2013. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
ACTION(SIMCALL_STORAGE_GET_FREE_SIZE, storage_get_free_size, WITH_ANSWER, TSIZE(result), TSTRING(name)) sep \
ACTION(SIMCALL_STORAGE_GET_USED_SIZE, storage_get_used_size, WITH_ANSWER, TSIZE(result), TSTRING(name)) sep \
ACTION(SIMCALL_STORAGE_GET_PROPERTIES, storage_get_properties, WITH_ANSWER, TSPEC(result, xbt_dict_t), TSPEC(storage, smx_storage_t)) sep \
+ACTION(SIMCALL_STORAGE_GET_CONTENT, storage_get_content, WITH_ANSWER, TSPEC(result, xbt_dict_t), TSPEC(storage, smx_storage_t)) sep \
ACTION(SIMCALL_ASR_GET_PROPERTIES, asr_get_properties, WITH_ANSWER, TSPEC(result, xbt_dict_t), TSTRING(name)) sep
/* SIMCALL_COMM_IS_LATENCY_BOUNDED and SIMCALL_SET_CATEGORY make things complicated
/* smx_user.c - public interface to simix */
- /* Copyright (c) 2010-2012. Da SimGrid team. All rights reserved. */
+ /* Copyright (c) 2010-2013. The SimGrid Team.
+ All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
return simcall_BODY_storage_get_properties(storage);
}
+/**
+ * \ingroup simix_storage_management
+ * \brief Returns a dict containing the content of a storage element.
+ *
+ * \param storage A storage element
+ * \return The content of this storage element as a dict (full path file => size)
+ */
+xbt_dict_t simcall_storage_get_content(smx_storage_t storage)
+{
+ return simcall_BODY_storage_get_content(storage);
+}
#ifdef HAVE_MC
- /* Copyright (c) 2004 - 2013. The SimGrid Team.
- * All rights reserved. */
+ /* Copyright (c) 2004-2013. The SimGrid Team.
+ * All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
+ * under the terms of the license (GNU LGPL) which comes with this package. */
#include "xbt/ex.h"
#include "xbt/dict.h"
return surf_resource_properties(surf_storage_resource_priv(storage));
}
-static xbt_dict_t storage_get_content(const void *storage)
+static xbt_dict_t storage_get_content(void *storage)
{
/* For the moment this action has no cost, but in the future we could take in account access latency of the disk */
- /* surf_action_t action = storage_action_execute(storage,0, LS); */
+ /*surf_action_t action = storage_action_execute(storage,0, LS);*/
+
+ void *st = surf_storage_resource_priv(storage);
xbt_dict_t content_dict = xbt_dict_new();
xbt_dict_cursor_t cursor = NULL;
char *file;
size_t size;
-
- xbt_dict_foreach(((storage_t)storage)->content, cursor, file, size){
+ xbt_dict_foreach(((storage_t)st)->content, cursor, file, size){
xbt_dict_set(content_dict,file,&size,NULL);
}
return content_dict;