From: Frederic Suter Date: Thu, 8 Jun 2017 19:00:52 +0000 (+0200) Subject: getting closer: no more MSG_STORAGE_LEVEL X-Git-Tag: v3.16~137 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/b04e106fa6f41fb78629ec02eae652a9500e8f84 getting closer: no more MSG_STORAGE_LEVEL next step, stop using storage_lib in surf at all, now that it's a mere map --- diff --git a/include/simgrid/msg.h b/include/simgrid/msg.h index 98580d402a..38e1f5f691 100644 --- a/include/simgrid/msg.h +++ b/include/simgrid/msg.h @@ -75,29 +75,13 @@ typedef struct msg_file_priv { typedef struct msg_file_priv* msg_file_t; /* ******************************** Storage ************************************ */ -/* TODO: PV: to comment */ - -extern int MSG_STORAGE_LEVEL; /** @brief Storage datatype. * @ingroup msg_storage_management * * You should consider this as an opaque object. */ -typedef xbt_dictelm_t msg_storage_t; - -struct msg_storage_priv { - const char* name; - const char* hostname; - sg_size_t size; - void* data; -}; -typedef struct msg_storage_priv s_msg_storage_priv_t; -typedef struct msg_storage_priv* msg_storage_priv_t; - -static inline msg_storage_priv_t MSG_storage_priv(msg_storage_t storage){ - return (msg_storage_priv_t )xbt_lib_get_level(storage, MSG_STORAGE_LEVEL); -} +typedef sg_storage_t msg_storage_t; /** * \brief @brief Communication action. diff --git a/include/surf/surf_routing.h b/include/surf/surf_routing.h deleted file mode 100644 index 2d19df1798..0000000000 --- a/include/surf/surf_routing.h +++ /dev/null @@ -1,21 +0,0 @@ -/* Copyright (c) 2004-2015. 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. */ - -#ifndef SURF_SURF_ROUTING_H -#define SURF_SURF_ROUTING_H - -#include "xbt/lib.h" - -SG_BEGIN_DECL() - -// FIXME: this header file should die - -XBT_PUBLIC_DATA(xbt_lib_t) storage_lib; -XBT_PUBLIC_DATA(int) SURF_STORAGE_LEVEL; // Surf storage level - -SG_END_DECL() - -#endif /* _SURF_SURF_H */ diff --git a/src/bindings/java/jmsg.h b/src/bindings/java/jmsg.h index 34ba2a24a9..c0e7e2d0e7 100644 --- a/src/bindings/java/jmsg.h +++ b/src/bindings/java/jmsg.h @@ -23,7 +23,7 @@ SG_BEGIN_DECL() /* end of eclipse-mandated pimple */ extern int JAVA_HOST_LEVEL; -static std::unordered_map java_storage_map; +static std::unordered_map java_storage_map; JavaVM *get_java_VM(); JNIEnv *get_current_thread_env(); diff --git a/src/bindings/java/jmsg_storage.cpp b/src/bindings/java/jmsg_storage.cpp index e38230cd64..2d3a02931c 100644 --- a/src/bindings/java/jmsg_storage.cpp +++ b/src/bindings/java/jmsg_storage.cpp @@ -69,7 +69,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Storage_getByName(JNIEnv * env, j } env->ReleaseStringUTFChars(jname, name); - if (java_storage_map.find(storage->key) == java_storage_map.end()) { + if (java_storage_map.find(storage) == java_storage_map.end()) { /* Instantiate a new java storage */ jstorage = jstorage_new_instance(env); @@ -93,9 +93,9 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Storage_getByName(JNIEnv * env, j /* the native storage data field is set with the global reference to the * java storage returned by this function */ - java_storage_map.insert({storage->key, jstorage}); + java_storage_map.insert({storage, jstorage}); } else - jstorage = java_storage_map.at(storage->key); + jstorage = java_storage_map.at(storage); /* return the global reference to the java storage instance */ return (jobject)jstorage; @@ -215,8 +215,8 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_Storage_all(JNIEnv * env, jc for (index = 0; index < count; index++) { storage = xbt_dynar_get_as(table,index,msg_storage_t); - if (java_storage_map.find(storage->key) != java_storage_map.end()) { - jstorage = java_storage_map.at(storage->key); + if (java_storage_map.find(storage) != java_storage_map.end()) { + jstorage = java_storage_map.at(storage); } else { jname = env->NewStringUTF(MSG_storage_get_name(storage)); jstorage = Java_org_simgrid_msg_Storage_getByName(env, cls_arg, jname); diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index 4a3c1094ba..4388b32b5f 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -15,7 +15,6 @@ #include "src/internal_config.h" #include "surf/surf_routing.h" #include "surf/datatypes.h" -#include "xbt/lib.h" #include "simgrid/datatypes.h" #include "simgrid/forward.h" @@ -85,8 +84,6 @@ typedef surf_NetworkModel *surf_network_model_t; typedef surf_StorageModel *surf_storage_model_t; typedef surf_Storage* surf_storage_t; -typedef xbt_dictelm_t surf_resource_t; - /** @ingroup SURF_c_bindings * \brief Action structure * @@ -116,15 +113,6 @@ XBT_PUBLIC(void) model_help(const char *category, s_surf_model_description_t * t /* Generic model object */ /***************************/ -static inline surf_storage_t surf_storage_resource_priv(const void* storage) -{ - return (surf_storage_t)xbt_lib_get_level((xbt_dictelm_t)storage, SURF_STORAGE_LEVEL); -} - -static inline void *surf_storage_resource_by_name(const char *name){ - return xbt_lib_get_elm_or_null(storage_lib, name); -} - /** @{ @ingroup SURF_c_bindings */ /** @@ -258,7 +246,7 @@ XBT_PUBLIC(int) surf_host_file_seek(sg_host_t host, surf_file_t fd, sg_offset_t * @param resource The surf storage * @return The size in bytes of the storage */ -XBT_PUBLIC(sg_size_t) surf_storage_get_size(surf_resource_t resource); +XBT_PUBLIC(sg_size_t) surf_storage_get_size(surf_storage_t resource); /** * @brief Get the available size in bytes of a storage @@ -266,7 +254,7 @@ XBT_PUBLIC(sg_size_t) surf_storage_get_size(surf_resource_t resource); * @param resource The surf storage * @return The available size in bytes of the storage */ -XBT_PUBLIC(sg_size_t) surf_storage_get_free_size(surf_resource_t resource); +XBT_PUBLIC(sg_size_t) surf_storage_get_free_size(surf_storage_t resource); /** * @brief Get the size in bytes of a storage @@ -274,10 +262,10 @@ XBT_PUBLIC(sg_size_t) surf_storage_get_free_size(surf_resource_t resource); * @param resource The surf storage * @return The used size in bytes of the storage */ -XBT_PUBLIC(sg_size_t) surf_storage_get_used_size(surf_resource_t resource); +XBT_PUBLIC(sg_size_t) surf_storage_get_used_size(surf_storage_t resource); /** @brief return the properties set associated to that storage */ -XBT_PUBLIC(xbt_dict_t) surf_storage_get_properties(surf_resource_t resource); +XBT_PUBLIC(xbt_dict_t) surf_storage_get_properties(surf_storage_t resource); /** * @brief [brief description] @@ -320,8 +308,8 @@ XBT_PUBLIC(xbt_dict_t) surf_storage_action_get_ls_dict(surf_action_t action); * @return The host name * may not exist. */ -XBT_PUBLIC(const char * ) surf_storage_get_host(surf_resource_t resource); -XBT_PUBLIC(const char * ) surf_storage_get_name(surf_resource_t resource); +XBT_PUBLIC(const char*) surf_storage_get_host(surf_storage_t resource); +XBT_PUBLIC(const char*) surf_storage_get_name(surf_storage_t resource); /** @} */ diff --git a/src/msg/msg_environment.cpp b/src/msg/msg_environment.cpp index fc067f7130..1c3ea9beb5 100644 --- a/src/msg/msg_environment.cpp +++ b/src/msg/msg_environment.cpp @@ -36,17 +36,6 @@ void MSG_create_environment(const char *file) SIMIX_create_environment(file); } -void MSG_post_create_environment() { - xbt_lib_cursor_t cursor; - void **data; - char *name; - - /* Initialize MSG storages */ - xbt_lib_foreach(storage_lib, cursor, name, data) { - __MSG_storage_create(xbt_dict_cursor_get_elm(cursor)); - } -} - msg_netzone_t MSG_zone_get_root() { return simgrid::s4u::Engine::instance()->netRoot(); diff --git a/src/msg/msg_global.cpp b/src/msg/msg_global.cpp index 2dd6fc906b..7c2e367bf1 100644 --- a/src/msg/msg_global.cpp +++ b/src/msg/msg_global.cpp @@ -51,8 +51,6 @@ void MSG_init_nocheck(int *argc, char **argv) { SIMIX_function_register_process_create(MSG_process_create_from_SIMIX); SIMIX_function_register_process_cleanup(MSG_process_cleanup_from_SIMIX); - simgrid::s4u::onPlatformCreated.connect(MSG_post_create_environment); - simgrid::MsgHostExt::EXTENSION_ID = simgrid::s4u::Host::extension_create(); simgrid::s4u::Host::onCreation.connect([](simgrid::s4u::Host& host) { host.extension_set(new simgrid::MsgHostExt()); @@ -64,8 +62,6 @@ void MSG_init_nocheck(int *argc, char **argv) { MC_ignore_heap(&(msg_global->sent_msg), sizeof(msg_global->sent_msg)); } - XBT_DEBUG("ADD MSG LEVELS"); - MSG_STORAGE_LEVEL = xbt_lib_add_level(storage_lib, (void_f_pvoid_t) __MSG_storage_destroy); if (xbt_cfg_get_boolean("clean-atexit")) atexit(MSG_exit); } diff --git a/src/msg/msg_host.cpp b/src/msg/msg_host.cpp index 43a6b24aac..edab20df1a 100644 --- a/src/msg/msg_host.cpp +++ b/src/msg/msg_host.cpp @@ -271,7 +271,7 @@ xbt_dict_t MSG_host_get_storage_content(msg_host_t host) xbt_dict_t storage_list = host->mountedStoragesAsDict(); xbt_dict_foreach(storage_list,cursor,mount_name,storage_name){ - storage = static_cast(xbt_lib_get_elm_or_null(storage_lib,storage_name)); + storage = simgrid::s4u::Storage::byName(storage_name); xbt_dict_t content = MSG_storage_get_content(storage); xbt_dict_set(contents,mount_name, content,nullptr); } diff --git a/src/msg/msg_io.cpp b/src/msg/msg_io.cpp index ef67c5befd..0da4d08307 100644 --- a/src/msg/msg_io.cpp +++ b/src/msg/msg_io.cpp @@ -5,6 +5,7 @@ #include "../surf/StorageImpl.hpp" #include "simgrid/s4u/Host.hpp" +#include "simgrid/s4u/Storage.hpp" #include "src/msg/msg_private.h" #include @@ -108,14 +109,13 @@ sg_size_t MSG_file_read(msg_file_t fd, sg_size_t size) return 0; /* Find the host where the file is physically located and read it */ - msg_storage_t storage_src = static_cast(xbt_lib_get_elm_or_null(storage_lib, fd->storageId)); - msg_storage_priv_t storage_priv_src = MSG_storage_priv(storage_src); - msg_host_t attached_host = MSG_host_by_name(storage_priv_src->hostname); + msg_storage_t storage_src = simgrid::s4u::Storage::byName(fd->storageId); + msg_host_t attached_host = MSG_host_by_name(storage_src->host()); read_size = simcall_file_read(fd->simdata->smx_file, size, attached_host); - if (strcmp(storage_priv_src->hostname, MSG_host_self()->cname())) { + if (strcmp(storage_src->host(), MSG_host_self()->cname())) { /* the file is hosted on a remote host, initiate a communication between src and dest hosts for data transfer */ - XBT_DEBUG("File is on %s remote host, initiate data transfer of %llu bytes.", storage_priv_src->hostname, read_size); + XBT_DEBUG("File is on %s remote host, initiate data transfer of %llu bytes.", storage_src->host(), read_size); msg_host_t m_host_list[] = {MSG_host_self(), attached_host}; double flops_amount[] = {0, 0}; double bytes_amount[] = {0, 0, static_cast(read_size), 0}; @@ -150,13 +150,12 @@ sg_size_t MSG_file_write(msg_file_t fd, sg_size_t size) return 0; /* Find the host where the file is physically located (remote or local)*/ - msg_storage_t storage_src = static_cast(xbt_lib_get_elm_or_null(storage_lib, fd->storageId)); - msg_storage_priv_t storage_priv_src = MSG_storage_priv(storage_src); - msg_host_t attached_host = MSG_host_by_name(storage_priv_src->hostname); + msg_storage_t storage_src = simgrid::s4u::Storage::byName(fd->storageId); + msg_host_t attached_host = MSG_host_by_name(storage_src->host()); - if (strcmp(storage_priv_src->hostname, MSG_host_self()->cname())) { + if (strcmp(storage_src->host(), MSG_host_self()->cname())) { /* the file is hosted on a remote host, initiate a communication between src and dest hosts for data transfer */ - XBT_DEBUG("File is on %s remote host, initiate data transfer of %llu bytes.", storage_priv_src->hostname, size); + XBT_DEBUG("File is on %s remote host, initiate data transfer of %llu bytes.", storage_src->host(), size); msg_host_t m_host_list[] = {MSG_host_self(), attached_host}; double flops_amount[] = {0, 0}; double bytes_amount[] = {0, static_cast(size), 0, 0}; @@ -232,9 +231,8 @@ int MSG_file_close(msg_file_t fd) msg_error_t MSG_file_unlink(msg_file_t fd) { /* Find the host where the file is physically located (remote or local)*/ - msg_storage_t storage_src = static_cast(xbt_lib_get_elm_or_null(storage_lib, fd->storageId)); - msg_storage_priv_t storage_priv_src = MSG_storage_priv(storage_src); - msg_host_t attached_host = MSG_host_by_name(storage_priv_src->hostname); + msg_storage_t storage_src = simgrid::s4u::Storage::byName(fd->storageId); + msg_host_t attached_host = MSG_host_by_name(storage_src->host()); int res = simcall_file_unlink(fd->simdata->smx_file, attached_host); __MSG_file_destroy(fd); return static_cast(res); @@ -306,9 +304,8 @@ msg_error_t MSG_file_move (msg_file_t fd, const char* fullpath) msg_error_t MSG_file_rcopy (msg_file_t file, msg_host_t host, const char* fullpath) { /* Find the host where the file is physically located and read it */ - msg_storage_t storage_src = static_cast(xbt_lib_get_elm_or_null(storage_lib, file->storageId)); - msg_storage_priv_t storage_priv_src = MSG_storage_priv(storage_src); - msg_host_t attached_host = MSG_host_by_name(storage_priv_src->hostname); + msg_storage_t storage_src = simgrid::s4u::Storage::byName(file->storageId); + msg_host_t attached_host = MSG_host_by_name(storage_src->host()); MSG_file_seek(file, 0, SEEK_SET); sg_size_t read_size = simcall_file_read(file->simdata->smx_file, file->size, attached_host); @@ -329,25 +326,22 @@ msg_error_t MSG_file_rcopy (msg_file_t file, msg_host_t host, const char* fullpa if (not strcmp(file_mount_name, mount_name) && strlen(mount_name) > longest_prefix_length) { /* The current mount name is found in the full path and is bigger than the previous*/ longest_prefix_length = strlen(mount_name); - storage_dest = (msg_storage_t)xbt_lib_get_elm_or_null(storage_lib, storage_name); + storage_dest = simgrid::s4u::Storage::byName(storage_name); } xbt_free(file_mount_name); } xbt_dict_free(&storage_list); - char* host_name_dest = nullptr; if(longest_prefix_length>0){ /* Mount point found, retrieve the host the storage is attached to */ - msg_storage_priv_t storage_dest_priv = MSG_storage_priv(storage_dest); - host_name_dest = (char*)storage_dest_priv->hostname; - host_dest = MSG_host_by_name(host_name_dest); + host_dest = MSG_host_by_name(storage_dest->host()); }else{ XBT_WARN("Can't find mount point for '%s' on destination host '%s'", fullpath, host->cname()); return MSG_TASK_CANCELED; } - XBT_DEBUG("Initiate data transfer of %llu bytes between %s and %s.", read_size, storage_priv_src->hostname, - host_name_dest); + XBT_DEBUG("Initiate data transfer of %llu bytes between %s and %s.", read_size, storage_src->host(), + storage_dest->host()); msg_host_t m_host_list[] = {attached_host, host_dest}; double flops_amount[] = {0, 0}; double bytes_amount[] = {0, static_cast(read_size), 0, 0}; @@ -359,7 +353,7 @@ msg_error_t MSG_file_rcopy (msg_file_t file, msg_host_t host, const char* fullpa if(transfer != MSG_OK){ if (transfer == MSG_HOST_FAILURE) - XBT_WARN("Transfer error, %s remote host just turned off!", host_name_dest); + XBT_WARN("Transfer error, %s remote host just turned off!", storage_dest->host()); if (transfer == MSG_TASK_CANCELED) XBT_WARN("Transfer error, task has been canceled!"); @@ -403,25 +397,6 @@ void __MSG_file_destroy(msg_file_t file) * (#msg_storage_t) and the functions for managing it. */ -msg_storage_t __MSG_storage_create(smx_storage_t storage) -{ - msg_storage_priv_t storage_private = xbt_new0(s_msg_storage_priv_t, 1); - - storage_private->name = surf_storage_get_name(storage); - storage_private->hostname = surf_storage_get_host(storage); - storage_private->size = surf_storage_get_size(storage); - - xbt_lib_set(storage_lib, storage_private->name, MSG_STORAGE_LEVEL, storage_private); - return xbt_lib_get_elm_or_null(storage_lib, storage_private->name); -} - -/** - * \brief Destroys a storage (internal call only) - */ -void __MSG_storage_destroy(msg_storage_priv_t storage) { - free(storage); -} - /** \ingroup msg_storage_management * * \brief Returns the name of the #msg_storage_t. @@ -430,8 +405,7 @@ void __MSG_storage_destroy(msg_storage_priv_t storage) { */ const char *MSG_storage_get_name(msg_storage_t storage) { xbt_assert((storage != nullptr), "Invalid parameters"); - msg_storage_priv_t priv = MSG_storage_priv(storage); - return priv->name; + return storage->name(); } /** \ingroup msg_storage_management @@ -440,7 +414,7 @@ const char *MSG_storage_get_name(msg_storage_t storage) { * \return the free space size of the storage element (as a #sg_size_t) */ sg_size_t MSG_storage_get_free_size(msg_storage_t storage){ - return simgrid::simix::kernelImmediate([storage] { return surf_storage_resource_priv(storage)->getFreeSize(); }); + return storage->sizeFree(); } /** \ingroup msg_storage_management @@ -449,7 +423,7 @@ sg_size_t MSG_storage_get_free_size(msg_storage_t storage){ * \return the used space size of the storage element (as a #sg_size_t) */ sg_size_t MSG_storage_get_used_size(msg_storage_t storage){ - return simgrid::simix::kernelImmediate([storage] { return surf_storage_resource_priv(storage)->getUsedSize(); }); + return storage->sizeUsed(); } /** \ingroup msg_storage_management @@ -460,7 +434,7 @@ sg_size_t MSG_storage_get_used_size(msg_storage_t storage){ xbt_dict_t MSG_storage_get_properties(msg_storage_t storage) { xbt_assert((storage != nullptr), "Invalid parameters (storage is nullptr)"); - return (simcall_storage_get_properties(storage)); + return storage->properties(); } /** \ingroup msg_storage_management @@ -472,7 +446,7 @@ xbt_dict_t MSG_storage_get_properties(msg_storage_t storage) */ void MSG_storage_set_property_value(msg_storage_t storage, const char* name, char* value) { - xbt_dict_set(MSG_storage_get_properties(storage), name, value, nullptr); + storage->setProperty(name, value); } /** \ingroup m_storage_management @@ -484,7 +458,7 @@ void MSG_storage_set_property_value(msg_storage_t storage, const char* name, cha */ const char *MSG_storage_get_property_value(msg_storage_t storage, const char *name) { - return static_cast(xbt_dict_get_or_null(MSG_storage_get_properties(storage), name)); + return storage->property(name); } /** \ingroup msg_storage_management @@ -494,23 +468,16 @@ const char *MSG_storage_get_property_value(msg_storage_t storage, const char *na */ msg_storage_t MSG_storage_get_by_name(const char *name) { - return static_cast(xbt_lib_get_elm_or_null(storage_lib,name)); + return simgrid::s4u::Storage::byName(name); } /** \ingroup msg_storage_management * \brief Returns a dynar containing all the storage elements declared at a given point of time */ xbt_dynar_t MSG_storages_as_dynar() { - xbt_lib_cursor_t cursor; - char *key; - void **data; xbt_dynar_t res = xbt_dynar_new(sizeof(msg_storage_t),nullptr); - - xbt_lib_foreach(storage_lib, cursor, key, data) { - if(xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), MSG_STORAGE_LEVEL) != nullptr) { - xbt_dictelm_t elm = xbt_dict_cursor_get_elm(cursor); - xbt_dynar_push(res, &elm); - } + for (auto s : *simgrid::s4u::allStorages()) { + xbt_dynar_push(res, &(s.second)); } return res; } @@ -522,8 +489,7 @@ xbt_dynar_t MSG_storages_as_dynar() { */ msg_error_t MSG_storage_set_data(msg_storage_t storage, void *data) { - msg_storage_priv_t priv = MSG_storage_priv(storage); - priv->data = data; + storage->setUserdata(data); return MSG_OK; } @@ -536,8 +502,7 @@ msg_error_t MSG_storage_set_data(msg_storage_t storage, void *data) void *MSG_storage_get_data(msg_storage_t storage) { xbt_assert((storage != nullptr), "Invalid parameters"); - msg_storage_priv_t priv = MSG_storage_priv(storage); - return priv->data; + return storage->userdata(); } /** \ingroup msg_storage_management @@ -548,8 +513,7 @@ void *MSG_storage_get_data(msg_storage_t storage) */ xbt_dict_t MSG_storage_get_content(msg_storage_t storage) { - std::map* content = - simgrid::simix::kernelImmediate([storage] { return surf_storage_resource_priv(storage)->getContent(); }); + std::map* content = storage->content(); xbt_dict_t content_dict = xbt_dict_new_homogeneous(nullptr); for (auto entry : *content) { @@ -566,8 +530,7 @@ xbt_dict_t MSG_storage_get_content(msg_storage_t storage) */ sg_size_t MSG_storage_get_size(msg_storage_t storage) { - msg_storage_priv_t priv = MSG_storage_priv(storage); - return priv->size; + return storage->size(); } /** \ingroup msg_storage_management @@ -578,8 +541,7 @@ sg_size_t MSG_storage_get_size(msg_storage_t storage) */ const char *MSG_storage_get_host(msg_storage_t storage) { xbt_assert((storage != nullptr), "Invalid parameters"); - msg_storage_priv_t priv = MSG_storage_priv(storage); - return priv->hostname; + return storage->host(); } SG_END_DECL() diff --git a/src/msg/msg_private.h b/src/msg/msg_private.h index d83517bd3f..b0831034d1 100644 --- a/src/msg/msg_private.h +++ b/src/msg/msg_private.h @@ -104,8 +104,6 @@ XBT_PUBLIC_DATA(MSG_Global_t) msg_global; /*************************************************************/ XBT_PRIVATE msg_host_t __MSG_host_create(sg_host_t host); -XBT_PRIVATE msg_storage_t __MSG_storage_create(smx_storage_t storage); -XBT_PRIVATE void __MSG_storage_destroy(msg_storage_priv_t host); XBT_PRIVATE void __MSG_file_destroy(msg_file_t file); XBT_PRIVATE void MSG_process_cleanup_from_SIMIX(smx_actor_t smx_proc); @@ -114,8 +112,6 @@ XBT_PRIVATE smx_actor_t MSG_process_create_from_SIMIX(const char* name, std::fun smx_actor_t parent_process); XBT_PRIVATE void MSG_comm_copy_data_from_SIMIX(smx_activity_t comm, void* buff, size_t buff_size); -XBT_PRIVATE void MSG_post_create_environment(); - XBT_PRIVATE void MSG_host_add_task(msg_host_t host, msg_task_t task); XBT_PRIVATE void MSG_host_del_task(msg_host_t host, msg_task_t task); diff --git a/src/simix/libsmx.cpp b/src/simix/libsmx.cpp index a3aad4a842..ddb760abb6 100644 --- a/src/simix/libsmx.cpp +++ b/src/simix/libsmx.cpp @@ -746,18 +746,6 @@ int simcall_file_move(smx_file_t fd, const char* fullpath) return simcall_BODY_file_move(fd, fullpath); } -/** - * \ingroup simix_storage_management - * \brief Returns a dict of the properties assigned to a storage element. - * - * \param storage A storage element - * \return The properties of this storage element - */ -xbt_dict_t simcall_storage_get_properties(smx_storage_t storage) -{ - return simcall_BODY_storage_get_properties(storage); -} - void simcall_run_kernel(std::function const& code) { simcall_BODY_run_kernel(&code); diff --git a/src/simix/popping_accessors.h b/src/simix/popping_accessors.h index 8ce7f9f2ad..fed1099e36 100644 --- a/src/simix/popping_accessors.h +++ b/src/simix/popping_accessors.h @@ -979,19 +979,6 @@ static inline void simcall_file_move__set__result(smx_simcall_t simcall, int res simgrid::simix::marshal(simcall->result, result); } -static inline smx_storage_t simcall_storage_get_properties__get__storage(smx_simcall_t simcall) { - return simgrid::simix::unmarshal(simcall->args[0]); -} -static inline void simcall_storage_get_properties__set__storage(smx_simcall_t simcall, smx_storage_t arg) { - simgrid::simix::marshal(simcall->args[0], arg); -} -static inline xbt_dict_t simcall_storage_get_properties__get__result(smx_simcall_t simcall){ - return simgrid::simix::unmarshal(simcall->result); -} -static inline void simcall_storage_get_properties__set__result(smx_simcall_t simcall, xbt_dict_t result){ - simgrid::simix::marshal(simcall->result, result); -} - static inline int simcall_mc_random__get__min(smx_simcall_t simcall) { return simgrid::simix::unmarshal(simcall->args[0]); } diff --git a/src/simix/popping_bodies.cpp b/src/simix/popping_bodies.cpp index 758d8748d7..afef6c4288 100644 --- a/src/simix/popping_bodies.cpp +++ b/src/simix/popping_bodies.cpp @@ -348,12 +348,6 @@ inline static int simcall_BODY_file_move(smx_file_t fd, const char* fullpath) { return simcall(SIMCALL_FILE_MOVE, fd, fullpath); } -inline static xbt_dict_t simcall_BODY_storage_get_properties(smx_storage_t storage) { - /* Go to that function to follow the code flow through the simcall barrier */ - if (0) SIMIX_storage_get_properties(storage); - return simcall(SIMCALL_STORAGE_GET_PROPERTIES, storage); - } - inline static int simcall_BODY_mc_random(int min, int max) { /* Go to that function to follow the code flow through the simcall barrier */ if (0) simcall_HANDLER_mc_random(&SIMIX_process_self()->simcall, min, max); diff --git a/src/simix/popping_enum.h b/src/simix/popping_enum.h index e533a242cd..4e59ccf9af 100644 --- a/src/simix/popping_enum.h +++ b/src/simix/popping_enum.h @@ -71,7 +71,6 @@ typedef enum { SIMCALL_FILE_SEEK, SIMCALL_FILE_GET_INFO, SIMCALL_FILE_MOVE, - SIMCALL_STORAGE_GET_PROPERTIES, SIMCALL_MC_RANDOM, SIMCALL_SET_CATEGORY, SIMCALL_RUN_KERNEL, diff --git a/src/simix/popping_generated.cpp b/src/simix/popping_generated.cpp index 45bd19d646..c18c10e148 100644 --- a/src/simix/popping_generated.cpp +++ b/src/simix/popping_generated.cpp @@ -77,7 +77,6 @@ const char* simcall_names[] = { "SIMCALL_FILE_SEEK", "SIMCALL_FILE_GET_INFO", "SIMCALL_FILE_MOVE", - "SIMCALL_STORAGE_GET_PROPERTIES", "SIMCALL_MC_RANDOM", "SIMCALL_SET_CATEGORY", "SIMCALL_RUN_KERNEL", @@ -336,11 +335,6 @@ case SIMCALL_FILE_MOVE: SIMIX_simcall_answer(simcall); break; -case SIMCALL_STORAGE_GET_PROPERTIES: - simgrid::simix::marshal(simcall->result, SIMIX_storage_get_properties(simgrid::simix::unmarshal(simcall->args[0]))); - SIMIX_simcall_answer(simcall); - break; - case SIMCALL_MC_RANDOM: simgrid::simix::marshal(simcall->result, simcall_HANDLER_mc_random(simcall, simgrid::simix::unmarshal(simcall->args[0]), simgrid::simix::unmarshal(simcall->args[1]))); SIMIX_simcall_answer(simcall); diff --git a/src/simix/simcalls.in b/src/simix/simcalls.in index 31bc2788e5..649adfae30 100644 --- a/src/simix/simcalls.in +++ b/src/simix/simcalls.in @@ -96,8 +96,6 @@ int file_seek(smx_file_t fd, sg_offset_t offset, int origin); xbt_dynar_t file_get_info(smx_file_t fd); int file_move(smx_file_t fd, const char* fullpath); -xbt_dict_t storage_get_properties(smx_storage_t storage) [[nohandler]]; - int mc_random(int min, int max); void set_category(smx_activity_t synchro, const char* category) [[nohandler]]; diff --git a/src/simix/smx_io.cpp b/src/simix/smx_io.cpp index 38659cae08..9ba2b7e3b7 100644 --- a/src/simix/smx_io.cpp +++ b/src/simix/smx_io.cpp @@ -176,10 +176,6 @@ int SIMIX_file_move(smx_actor_t process, smx_file_t file, const char* fullpath) return surf_host_file_move(host, file->surf_file, fullpath); } -xbt_dict_t SIMIX_storage_get_properties(smx_storage_t storage){ - return surf_storage_get_properties(storage); -} - void SIMIX_io_destroy(smx_activity_t synchro) { simgrid::kernel::activity::Io *io = static_cast(synchro); diff --git a/src/surf/StorageImpl.cpp b/src/surf/StorageImpl.cpp index d15ab37d50..e4b801e6cf 100644 --- a/src/surf/StorageImpl.cpp +++ b/src/surf/StorageImpl.cpp @@ -15,7 +15,6 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_storage, surf, "Logging specific to the SURF storage module"); xbt_lib_t storage_lib; -int MSG_STORAGE_LEVEL = -1; // Msg storage level int SURF_STORAGE_LEVEL = -1; simgrid::surf::StorageModel* surf_storage_model = nullptr; diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index 7eb25fc686..f2be0fec9a 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -4,6 +4,7 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "simgrid/s4u/Engine.hpp" +#include "simgrid/s4u/Storage.hpp" #include "src/kernel/EngineImpl.hpp" #include "src/simix/smx_private.h" @@ -424,8 +425,7 @@ void sg_platf_new_mount(sg_platf_mount_cbarg_t mount){ if (mount_list.empty()) XBT_DEBUG("Create a Mount list for %s", A_surfxml_host_id); - mount_list.insert( - {std::string(mount->name), surf_storage_resource_priv(surf_storage_resource_by_name(mount->storageId))}); + mount_list.insert({std::string(mount->name), simgrid::surf::StorageImpl::byName(mount->storageId)}); } void sg_platf_new_route(sg_platf_route_cbarg_t route) diff --git a/src/surf/surf_c_bindings.cpp b/src/surf/surf_c_bindings.cpp index 23cc5cc12a..0f0061812d 100644 --- a/src/surf/surf_c_bindings.cpp +++ b/src/surf/surf_c_bindings.cpp @@ -206,28 +206,34 @@ int surf_host_file_move(sg_host_t host, surf_file_t fd, const char* fullpath){ return host->pimpl_->fileMove(fd, fullpath); } -sg_size_t surf_storage_get_size(surf_resource_t resource){ - return static_cast(surf_storage_resource_priv(resource))->size_; +sg_size_t surf_storage_get_size(surf_storage_t resource) +{ + return static_cast(resource)->size_; } -sg_size_t surf_storage_get_free_size(surf_resource_t resource){ - return static_cast(surf_storage_resource_priv(resource))->getFreeSize(); +sg_size_t surf_storage_get_free_size(surf_storage_t resource) +{ + return static_cast(resource)->getFreeSize(); } -sg_size_t surf_storage_get_used_size(surf_resource_t resource){ - return static_cast(surf_storage_resource_priv(resource))->getUsedSize(); +sg_size_t surf_storage_get_used_size(surf_storage_t resource) +{ + return static_cast(resource)->getUsedSize(); } -xbt_dict_t surf_storage_get_properties(surf_resource_t resource){ - return static_cast(surf_storage_resource_priv(resource))->getProperties(); +xbt_dict_t surf_storage_get_properties(surf_storage_t resource) +{ + return static_cast(resource)->getProperties(); } -const char* surf_storage_get_host(surf_resource_t resource){ - return static_cast(surf_storage_resource_priv(resource))->attach_; +const char* surf_storage_get_host(surf_storage_t resource) +{ + return static_cast(resource)->attach_; } -const char* surf_storage_get_name(surf_resource_t resource){ - return static_cast(surf_storage_resource_priv(resource))->cname(); +const char* surf_storage_get_name(surf_storage_t resource) +{ + return static_cast(resource)->cname(); } void surf_cpu_action_set_bound(surf_action_t action, double bound) { diff --git a/tools/cmake/DefinePackages.cmake b/tools/cmake/DefinePackages.cmake index 1226d706d8..a2789e3672 100644 --- a/tools/cmake/DefinePackages.cmake +++ b/tools/cmake/DefinePackages.cmake @@ -688,7 +688,6 @@ set(headers_to_install include/smpi/smpi_extended_traces.h include/smpi/smpi_extended_traces_fortran.h include/smpi/forward.hpp - include/surf/surf_routing.h include/xbt.h include/xbt/RngStream.h include/xbt/asserts.h