Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Misc const qualifiers following yesterday's changes.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 30 Dec 2019 13:57:10 +0000 (14:57 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 30 Dec 2019 21:12:17 +0000 (22:12 +0100)
33 files changed:
examples/deprecated/simdag/scheduling/sd_scheduling.c
include/simgrid/actor.h
include/simgrid/jedule/jedule_platform.hpp
include/simgrid/jedule/jedule_sd_binding.h
include/simgrid/msg.h
include/simgrid/s4u/ConditionVariable.hpp
include/simgrid/s4u/Engine.hpp
include/simgrid/s4u/VirtualMachine.hpp
include/simgrid/vm.h
src/bindings/java/jmsg_as.cpp
src/bindings/java/jmsg_host.cpp
src/bindings/java/jmsg_storage.cpp
src/bindings/java/jmsg_synchro.cpp
src/bindings/lua/lua_host.cpp
src/instr/instr_platform.cpp
src/instr/instr_smpi.hpp
src/instr/jedule/jedule_platform.cpp
src/instr/jedule/jedule_sd_binding.cpp
src/msg/msg_legacy.cpp
src/plugins/file_system/s4u_FileSystem.cpp
src/plugins/host_energy.cpp
src/plugins/host_load.cpp
src/plugins/vm/VirtualMachineImpl.hpp
src/plugins/vm/s4u_VirtualMachine.cpp
src/s4u/s4u_Actor.cpp
src/simdag/sd_daxloader.cpp
src/smpi/internals/instr_smpi.cpp
teshsuite/mc/dwarf-expression/dwarf-expression.cpp
teshsuite/msg/cloud-migration/cloud-migration.c
teshsuite/msg/io-file-remote/io-file-remote.c
teshsuite/msg/platform-properties/platform-properties.c
teshsuite/simdag/availability/availability.c
teshsuite/simdag/flatifier/flatifier.cpp

index 1ad679b..a05a182 100644 (file)
@@ -64,7 +64,7 @@ static xbt_dynar_t get_ready_tasks(const_xbt_dynar_t dax)
   return ready_tasks;
 }
 
-static double finish_on_at(SD_task_t task, const_sg_host_t host)
+static double finish_on_at(const_SD_task_t task, const_sg_host_t host)
 {
   double result;
 
@@ -112,7 +112,7 @@ static double finish_on_at(SD_task_t task, const_sg_host_t host)
   return result;
 }
 
-static sg_host_t SD_task_get_best_host(SD_task_t task)
+static sg_host_t SD_task_get_best_host(const_SD_task_t task)
 {
   sg_host_t *hosts = sg_host_list();
   int nhosts = sg_host_count();
index a053ee4..d591995 100644 (file)
@@ -60,8 +60,8 @@ XBT_PUBLIC const char* sg_actor_self_get_name();
 XBT_PUBLIC void* sg_actor_self_data();
 XBT_PUBLIC void sg_actor_self_data_set(void* data);
 XBT_PUBLIC void sg_actor_self_execute(double flops);
-XBT_PUBLIC void sg_actor_ref(sg_actor_t actor);
-XBT_PUBLIC void sg_actor_unref(sg_actor_t actor);
+XBT_PUBLIC void sg_actor_ref(const_sg_actor_t actor);
+XBT_PUBLIC void sg_actor_unref(const_sg_actor_t actor);
 XBT_PUBLIC void* sg_actor_data(const_sg_actor_t actor);
 XBT_PUBLIC void sg_actor_data_set(sg_actor_t actor, void* userdata);
 
index 007e1c1..ebbcbef 100644 (file)
@@ -32,7 +32,7 @@ public:
   std::vector<sg_host_t> resource_list;
   void add_child(Container* child);
   void add_resources(std::vector<sg_host_t> hosts);
-  void create_hierarchy(sg_netzone_t from_as);
+  void create_hierarchy(const_sg_netzone_t from_as);
   std::vector<int> get_hierarchy();
   std::string get_hierarchy_as_string();
   void print(FILE *file);
index c570bfc..6b3736c 100644 (file)
@@ -9,7 +9,7 @@
 #include <simgrid/simdag.h>
 
 SG_BEGIN_DECL
-XBT_PUBLIC void jedule_log_sd_event(SD_task_t task);
+XBT_PUBLIC void jedule_log_sd_event(const_SD_task_t task);
 XBT_PUBLIC void jedule_sd_init(void);
 XBT_PUBLIC void jedule_sd_exit(void);
 XBT_PUBLIC void jedule_sd_dump(const char* filename);
index 059ee65..1011dae 100644 (file)
@@ -67,12 +67,12 @@ typedef enum {
 typedef sg_netzone_t msg_netzone_t;
 
 XBT_PUBLIC msg_netzone_t MSG_zone_get_root();
-XBT_PUBLIC const char* MSG_zone_get_name(msg_netzone_t zone);
+XBT_PUBLIC const char* MSG_zone_get_name(const_sg_netzone_t zone);
 XBT_PUBLIC msg_netzone_t MSG_zone_get_by_name(const char* name);
-XBT_PUBLIC void MSG_zone_get_sons(msg_netzone_t zone, xbt_dict_t whereto);
-XBT_PUBLIC const char* MSG_zone_get_property_value(msg_netzone_t zone, const char* name);
-XBT_PUBLIC void MSG_zone_set_property_value(msg_netzone_t zone, const char* name, char* value);
-XBT_PUBLIC void MSG_zone_get_hosts(msg_netzone_t zone, xbt_dynar_t whereto);
+XBT_PUBLIC void MSG_zone_get_sons(const_sg_netzone_t zone, xbt_dict_t whereto);
+XBT_PUBLIC const char* MSG_zone_get_property_value(const_sg_netzone_t zone, const char* name);
+XBT_PUBLIC void MSG_zone_set_property_value(msg_netzone_t zone, const char* name, const char* value);
+XBT_PUBLIC void MSG_zone_get_hosts(const_sg_netzone_t zone, xbt_dynar_t whereto);
 
 /* ******************************** Hosts ************************************ */
 /** @brief Host datatype.
@@ -145,8 +145,8 @@ XBT_PUBLIC int MSG_vm_is_suspended(msg_vm_t vm);
 
 XBT_PUBLIC const char* MSG_vm_get_name(const_sg_vm_t vm);
 XBT_PUBLIC void MSG_vm_set_ramsize(msg_vm_t vm, size_t size);
-XBT_PUBLIC size_t MSG_vm_get_ramsize(msg_vm_t vm);
-XBT_PUBLIC msg_host_t MSG_vm_get_pm(msg_vm_t vm);
+XBT_PUBLIC size_t MSG_vm_get_ramsize(const_sg_vm_t vm);
+XBT_PUBLIC msg_host_t MSG_vm_get_pm(const_sg_vm_t vm);
 XBT_PUBLIC void MSG_vm_set_bound(msg_vm_t vm, double bound);
 
 XBT_PUBLIC void MSG_vm_start(msg_vm_t vm);
@@ -158,15 +158,15 @@ XBT_PUBLIC void MSG_vm_destroy(msg_vm_t vm);
 /* ******************************** Storage ********************************* */
 typedef sg_storage_t msg_storage_t;
 
-XBT_PUBLIC const char* MSG_storage_get_name(msg_storage_t storage);
+XBT_PUBLIC const char* MSG_storage_get_name(const_sg_storage_t storage);
 XBT_PUBLIC msg_storage_t MSG_storage_get_by_name(const char* name);
-XBT_PUBLIC xbt_dict_t MSG_storage_get_properties(msg_storage_t storage);
+XBT_PUBLIC xbt_dict_t MSG_storage_get_properties(const_sg_storage_t storage);
 XBT_PUBLIC void MSG_storage_set_property_value(msg_storage_t storage, const char* name, const char* value);
-XBT_PUBLIC const char* MSG_storage_get_property_value(msg_storage_t storage, const char* name);
+XBT_PUBLIC const char* MSG_storage_get_property_value(const_sg_storage_t storage, const char* name);
 XBT_PUBLIC xbt_dynar_t MSG_storages_as_dynar();
 XBT_PUBLIC void MSG_storage_set_data(msg_storage_t storage, void* data);
-XBT_PUBLIC void* MSG_storage_get_data(msg_storage_t storage);
-XBT_PUBLIC const char* MSG_storage_get_host(msg_storage_t storage);
+XBT_PUBLIC void* MSG_storage_get_data(const_sg_storage_t storage);
+XBT_PUBLIC const char* MSG_storage_get_host(const_sg_storage_t storage);
 XBT_PUBLIC sg_size_t MSG_storage_read(msg_storage_t storage, sg_size_t size);
 XBT_PUBLIC sg_size_t MSG_storage_write(msg_storage_t storage, sg_size_t size);
 
@@ -231,8 +231,8 @@ XBT_PUBLIC msg_process_t MSG_process_self();
 XBT_PUBLIC aid_t MSG_process_self_PID();
 XBT_PUBLIC aid_t MSG_process_self_PPID();
 XBT_PUBLIC const char* MSG_process_self_name();
-XBT_PUBLIC void MSG_process_ref(msg_process_t process);
-XBT_PUBLIC void MSG_process_unref(msg_process_t process);
+XBT_PUBLIC void MSG_process_ref(const_sg_actor_t process);
+XBT_PUBLIC void MSG_process_unref(const_sg_actor_t process);
 
 /** @brief Object representing an ongoing communication between processes.
  *
@@ -427,7 +427,7 @@ XBT_PUBLIC void MSG_sem_acquire(msg_sem_t sem);
 XBT_PUBLIC int MSG_sem_acquire_timeout(msg_sem_t sem, double timeout);
 XBT_PUBLIC void MSG_sem_release(msg_sem_t sem);
 XBT_PUBLIC int MSG_sem_get_capacity(msg_sem_t sem);
-XBT_PUBLIC void MSG_sem_destroy(msg_sem_t sem);
+XBT_PUBLIC void MSG_sem_destroy(const_sg_sem_t sem);
 XBT_PUBLIC int MSG_sem_would_block(msg_sem_t sem);
 
 /** @brief Opaque type representing a barrier identifier */
index 8e84127..a8fb305 100644 (file)
@@ -55,7 +55,7 @@ public:
 
   std::cv_status wait_until(const std::unique_lock<Mutex>& lock, double timeout_time);
   std::cv_status wait_for(const std::unique_lock<Mutex>& lock, double duration);
-  template <class P> bool wait_until(std::unique_lock<Mutex> & lock, double timeout_time, P pred)
+  template <class P> bool wait_until(const std::unique_lock<Mutex>& lock, double timeout_time, P pred)
   {
     while (not pred())
       if (this->wait_until(lock, timeout_time) == std::cv_status::timeout)
index 4158609..025f2e9 100644 (file)
@@ -168,7 +168,8 @@ private:
 };
 
 #ifndef DOXYGEN /* Internal use only, no need to expose it */
-template <class T> XBT_PRIVATE void get_filtered_netzones_recursive(s4u::NetZone* current, std::vector<T*>* whereto)
+template <class T>
+XBT_PRIVATE void get_filtered_netzones_recursive(const s4u::NetZone* current, std::vector<T*>* whereto)
 {
   static_assert(std::is_base_of<kernel::routing::NetZoneImpl, T>::value,
                 "Filtering netzones is only possible for subclasses of kernel::routing::NetZoneImpl");
index 25dfd3d..927d5f2 100644 (file)
@@ -46,9 +46,9 @@ public:
   void shutdown();
   void destroy() override;
 
-  Host* get_pm();
+  Host* get_pm() const;
   void set_pm(Host* pm);
-  size_t get_ramsize();
+  size_t get_ramsize() const;
   void set_ramsize(size_t ramsize);
   void set_bound(double bound);
 
index e7e29bb..dc84d9b 100644 (file)
@@ -31,9 +31,9 @@ XBT_PUBLIC int sg_vm_is_suspended(sg_vm_t vm);
 
 XBT_PUBLIC const char* sg_vm_get_name(const_sg_vm_t vm);
 XBT_PUBLIC void sg_vm_set_ramsize(sg_vm_t vm, size_t size);
-XBT_PUBLIC size_t sg_vm_get_ramsize(sg_vm_t vm);
+XBT_PUBLIC size_t sg_vm_get_ramsize(const_sg_vm_t vm);
 XBT_PUBLIC void sg_vm_set_bound(sg_vm_t vm, double bound);
-XBT_PUBLIC sg_host_t sg_vm_get_pm(sg_vm_t vm);
+XBT_PUBLIC sg_host_t sg_vm_get_pm(const_sg_vm_t vm);
 
 XBT_PUBLIC void sg_vm_start(sg_vm_t vm);
 XBT_PUBLIC void sg_vm_suspend(sg_vm_t vm);
index 628bffc..ba41361 100644 (file)
@@ -62,7 +62,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_As_getName(JNIEnv * env, jobject
 JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_As_getSons(JNIEnv * env, jobject jas) {
   int index = 0;
   jobjectArray jtable;
-  sg_netzone_t self_as = jnetzone_get_native(env, jas);
+  const simgrid::s4u::NetZone* self_as = jnetzone_get_native(env, jas);
 
   jclass cls = env->FindClass("org/simgrid/msg/As");
 
@@ -96,7 +96,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_As_getSons(JNIEnv * env, job
 }
 
 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_As_getProperty(JNIEnv *env, jobject jas, jobject jname) {
-  simgrid::s4u::NetZone* as = jnetzone_get_native(env, jas);
+  const simgrid::s4u::NetZone* as = jnetzone_get_native(env, jas);
 
   if (not as) {
     jxbt_throw_notbound(env, "as", jas);
@@ -121,7 +121,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_As_getHosts(JNIEnv * env, jo
   jobjectArray jtable;
   jobject jhost;
   jstring jname;
-  simgrid::s4u::NetZone* as = jnetzone_get_native(env, jas);
+  const simgrid::s4u::NetZone* as = jnetzone_get_native(env, jas);
 
   jclass cls = jxbt_get_class(env, "org/simgrid/msg/Host");
   if (not cls)
index a0c640d..9e328b7 100644 (file)
@@ -262,7 +262,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_Host_getMountedStorage(JNIEn
 
 JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_Host_getAttachedStorage(JNIEnv * env, jobject jhost)
 {
-  msg_host_t host = jhost_get_native(env, jhost);
+  const_sg_host_t host = jhost_get_native(env, jhost);
 
   if (not host) {
     jxbt_throw_notbound(env, "host", jhost);
index b6b9891..bf28cdc 100644 (file)
@@ -136,7 +136,7 @@ JNIEXPORT jlong JNICALL Java_org_simgrid_msg_Storage_getUsedSize(JNIEnv * env,jo
 }
 
 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Storage_getProperty(JNIEnv *env, jobject jstorage, jobject jname) {
-  msg_storage_t storage = jstorage_get_native(env, jstorage);
+  const_sg_storage_t storage = jstorage_get_native(env, jstorage);
 
   if (not storage) {
     jxbt_throw_notbound(env, "storage", jstorage);
@@ -173,7 +173,7 @@ Java_org_simgrid_msg_Storage_setProperty(JNIEnv *env, jobject jstorage, jobject
 }
 
 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Storage_getHost(JNIEnv * env,jobject jstorage) {
-  msg_storage_t storage = jstorage_get_native(env, jstorage);
+  const_sg_storage_t storage = jstorage_get_native(env, jstorage);
 
   if (not storage) {
     jxbt_throw_notbound(env, "storage", jstorage);
index f00245c..769eec4 100644 (file)
@@ -40,7 +40,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Mutex_release(JNIEnv * env, jobject
 }
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Mutex_nativeFinalize(JNIEnv * env, jobject obj) {
-  sg_mutex_t mutex = (sg_mutex_t)(uintptr_t)env->GetLongField(obj, jsynchro_field_Mutex_bind);
+  const_sg_mutex_t mutex = (sg_mutex_t)(uintptr_t)env->GetLongField(obj, jsynchro_field_Mutex_bind);
   sg_mutex_destroy(mutex);
 }
 
@@ -83,7 +83,7 @@ JNIEXPORT jboolean JNICALL Java_org_simgrid_msg_Semaphore_wouldBlock(JNIEnv * en
 }
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Semaphore_nativeFinalize(JNIEnv * env, jobject obj) {
-  sg_sem_t sem;
+  const_sg_sem_t sem;
 
   sem = (sg_sem_t)(uintptr_t)env->GetLongField(obj, jsynchro_field_Semaphore_bind);
   sg_sem_destroy(sem);
index 93bb626..2c94d87 100644 (file)
@@ -126,7 +126,7 @@ static int l_host_at(lua_State * L)
  */
 static int l_host_get_property_value(lua_State * L)
 {
-  sg_host_t ht = sglua_check_host(L, 1);
+  const_sg_host_t ht = sglua_check_host(L, 1);
   const char *prop = luaL_checkstring(L, 2);
   lua_pushstring(L, sg_host_get_property_value(ht,prop));
   return 1;
index 98bdf5c..a800ece 100644 (file)
@@ -121,7 +121,7 @@ static void linkContainers(container_t src, container_t dst, std::set<std::strin
   XBT_DEBUG("  linkContainers %s <-> %s", src->get_cname(), dst->get_cname());
 }
 
-static void recursiveGraphExtraction(simgrid::s4u::NetZone* netzone, container_t container,
+static void recursiveGraphExtraction(const simgrid::s4u::NetZone* netzone, container_t container,
                                      std::set<std::string>* filter)
 {
   if (not TRACE_platform_topology()) {
@@ -491,7 +491,7 @@ void instr_new_value_for_user_state_type(const std::string& type_name, const cha
 #define GRAPHICATOR_SUPPORT_FUNCTIONS
 
 static void recursiveXBTGraphExtraction(xbt_graph_t graph, std::map<std::string, xbt_node_t>* nodes,
-                                        std::map<std::string, xbt_edge_t>* edges, sg_netzone_t netzone,
+                                        std::map<std::string, xbt_edge_t>* edges, const_sg_netzone_t netzone,
                                         container_t container)
 {
   if (not netzone->get_children().empty()) {
index 5414c53..9dfe486 100644 (file)
@@ -26,7 +26,7 @@ XBT_PRIVATE void TRACE_smpi_send(int rank, int src, int dst, int tag, int size);
 XBT_PRIVATE void TRACE_smpi_recv(int src, int dst, int tag);
 XBT_PRIVATE void TRACE_smpi_init(int rank);
 /* SMPI + LB (load balancer) */
-XBT_PRIVATE void TRACE_smpi_process_change_host(int rank, sg_host_t new_host);
+XBT_PRIVATE void TRACE_smpi_process_change_host(int rank, const_sg_host_t new_host);
 
 class smpi_trace_call_location_t {
 public:
index a0cd7dd..7f03f08 100644 (file)
@@ -49,7 +49,7 @@ void Container::add_resources(std::vector<sg_host_t> hosts)
   }
 }
 
-void Container::create_hierarchy(sg_netzone_t from_as)
+void Container::create_hierarchy(const_sg_netzone_t from_as)
 {
   if (from_as->get_children().empty()) {
     // I am no AS
index 918cfaa..4a748b8 100644 (file)
@@ -15,7 +15,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(jed_sd, jedule, "Logging specific to Jedule SD b
 
 jedule_t my_jedule;
 
-void jedule_log_sd_event(SD_task_t task)
+void jedule_log_sd_event(const_SD_task_t task)
 {
   xbt_assert(task != nullptr);
 
@@ -27,7 +27,7 @@ void jedule_log_sd_event(SD_task_t task)
 
 void jedule_sd_init()
 {
-  sg_netzone_t root_comp = simgrid::s4u::Engine::get_instance()->get_netzone_root();
+  const_sg_netzone_t root_comp = simgrid::s4u::Engine::get_instance()->get_netzone_root();
   XBT_DEBUG("root name %s\n", root_comp->get_cname());
 
   my_jedule = new simgrid::jedule::Jedule(root_comp->get_name());
index 80c28e0..23415ca 100644 (file)
@@ -197,12 +197,12 @@ msg_process_t MSG_process_self()
 }
 
 /** @brief Take an extra reference on that process to prevent it to be garbage-collected */
-void MSG_process_ref(msg_process_t process)
+void MSG_process_ref(const_sg_actor_t process)
 {
   sg_actor_ref(process);
 }
 /** @brief Release a reference on that process so that it can get be garbage-collected */
-void MSG_process_unref(msg_process_t process)
+void MSG_process_unref(const_sg_actor_t process)
 {
   sg_actor_unref(process);
 }
@@ -216,7 +216,7 @@ sg_netzone_t MSG_zone_get_root()
 {
   return sg_zone_get_root();
 }
-const char* MSG_zone_get_name(sg_netzone_t zone)
+const char* MSG_zone_get_name(const_sg_netzone_t zone)
 {
   return sg_zone_get_name(zone);
 }
@@ -224,25 +224,25 @@ sg_netzone_t MSG_zone_get_by_name(const char* name)
 {
   return sg_zone_get_by_name(name);
 }
-void MSG_zone_get_sons(sg_netzone_t zone, xbt_dict_t whereto)
+void MSG_zone_get_sons(const_sg_netzone_t zone, xbt_dict_t whereto)
 {
   return sg_zone_get_sons(zone, whereto);
 }
-const char* MSG_zone_get_property_value(sg_netzone_t zone, const char* name)
+const char* MSG_zone_get_property_value(const_sg_netzone_t zone, const char* name)
 {
   return sg_zone_get_property_value(zone, name);
 }
-void MSG_zone_set_property_value(sg_netzone_t zone, const char* name, char* value)
+void MSG_zone_set_property_value(sg_netzone_t zone, const char* name, const char* value)
 {
   sg_zone_set_property_value(zone, name, value);
 }
-void MSG_zone_get_hosts(sg_netzone_t zone, xbt_dynar_t whereto)
+void MSG_zone_get_hosts(const_sg_netzone_t zone, xbt_dynar_t whereto)
 {
   sg_zone_get_hosts(zone, whereto);
 }
 
 /* ************************** Storages *************************** */
-const char* MSG_storage_get_name(sg_storage_t storage)
+const char* MSG_storage_get_name(const_sg_storage_t storage)
 {
   return sg_storage_get_name(storage);
 }
@@ -250,7 +250,7 @@ sg_storage_t MSG_storage_get_by_name(const char* name)
 {
   return sg_storage_get_by_name(name);
 }
-xbt_dict_t MSG_storage_get_properties(sg_storage_t storage)
+xbt_dict_t MSG_storage_get_properties(const_sg_storage_t storage)
 {
   return sg_storage_get_properties(storage);
 }
@@ -258,7 +258,7 @@ void MSG_storage_set_property_value(sg_storage_t storage, const char* name, cons
 {
   sg_storage_set_property_value(storage, name, value);
 }
-const char* MSG_storage_get_property_value(sg_storage_t storage, const char* name)
+const char* MSG_storage_get_property_value(const_sg_storage_t storage, const char* name)
 {
   return sg_storage_get_property_value(storage, name);
 }
@@ -270,11 +270,11 @@ void MSG_storage_set_data(sg_storage_t storage, void* data)
 {
   sg_storage_set_data(storage, data);
 }
-void* MSG_storage_get_data(sg_storage_t storage)
+void* MSG_storage_get_data(const_sg_storage_t storage)
 {
   return sg_storage_get_data(storage);
 }
-const char* MSG_storage_get_host(sg_storage_t storage)
+const char* MSG_storage_get_host(const_sg_storage_t storage)
 {
   return sg_storage_get_host(storage);
 }
@@ -414,11 +414,11 @@ void MSG_vm_set_ramsize(sg_vm_t vm, size_t size)
 {
   sg_vm_set_ramsize(vm, size);
 }
-size_t MSG_vm_get_ramsize(sg_vm_t vm)
+size_t MSG_vm_get_ramsize(const_sg_vm_t vm)
 {
   return sg_vm_get_ramsize(vm);
 }
-sg_host_t MSG_vm_get_pm(sg_vm_t vm)
+sg_host_t MSG_vm_get_pm(const_sg_vm_t vm)
 {
   return sg_vm_get_pm(vm);
 }
@@ -482,7 +482,7 @@ int MSG_sem_get_capacity(sg_sem_t sem)
 {
   return sg_sem_get_capacity(sem);
 }
-void MSG_sem_destroy(sg_sem_t sem)
+void MSG_sem_destroy(const_sg_sem_t sem)
 {
   sg_sem_destroy(sem);
 }
index ea1aaf9..2bddf52 100644 (file)
@@ -405,7 +405,7 @@ int File::remote_copy(sg_host_t host, const char* fullpath)
   size_t longest_prefix_length = 0;
   if (local_storage_) {
     /* Find the host that owns the storage where the file has to be copied */
-    Storage* storage_dest        = nullptr;
+    const Storage* storage_dest = nullptr;
 
     for (auto const& elm : host->get_mounted_storages()) {
       std::string mount_point = std::string(fullpath).substr(0, elm.first.size());
index 6c49c91..2b069fe 100644 (file)
@@ -476,7 +476,7 @@ static void on_action_state_change(simgrid::kernel::resource::CpuAction const& a
     simgrid::s4u::Host* host = cpu->get_host();
     if (host != nullptr) {
       // If it's a VM, take the corresponding PM
-      simgrid::s4u::VirtualMachine* vm = dynamic_cast<simgrid::s4u::VirtualMachine*>(host);
+      const simgrid::s4u::VirtualMachine* vm = dynamic_cast<simgrid::s4u::VirtualMachine*>(host);
       if (vm) // If it's a VM, take the corresponding PM
         host = vm->get_pm();
 
@@ -556,7 +556,7 @@ void sg_host_energy_plugin_init()
   simgrid::s4u::Exec::on_start.connect([](simgrid::s4u::Actor const&, simgrid::s4u::Exec const& activity) {
     if (activity.get_host_number() == 1) { // We only run on one host
       simgrid::s4u::Host* host         = activity.get_host();
-      simgrid::s4u::VirtualMachine* vm = dynamic_cast<simgrid::s4u::VirtualMachine*>(host);
+      const simgrid::s4u::VirtualMachine* vm = dynamic_cast<simgrid::s4u::VirtualMachine*>(host);
       if (vm != nullptr)
         host = vm->get_pm();
       xbt_assert(host != nullptr);
index eae683d..1266107 100644 (file)
@@ -236,7 +236,7 @@ void sg_host_load_plugin_init()
   simgrid::s4u::Exec::on_start.connect([](simgrid::s4u::Actor const&, simgrid::s4u::Exec const& activity) {
     if (activity.get_host_number() == 1) { // We only run on one host
       simgrid::s4u::Host* host         = activity.get_host();
-      simgrid::s4u::VirtualMachine* vm = dynamic_cast<simgrid::s4u::VirtualMachine*>(host);
+      const simgrid::s4u::VirtualMachine* vm = dynamic_cast<simgrid::s4u::VirtualMachine*>(host);
       if (vm != nullptr)
         host = vm->get_pm();
       xbt_assert(host != nullptr);
@@ -252,7 +252,7 @@ void sg_host_load_plugin_init()
   simgrid::s4u::Exec::on_completion.connect([](simgrid::s4u::Actor const&, simgrid::s4u::Exec const& activity) {
     if (activity.get_host_number() == 1) { // We only run on one host
       simgrid::s4u::Host* host         = activity.get_host();
-      simgrid::s4u::VirtualMachine* vm = dynamic_cast<simgrid::s4u::VirtualMachine*>(host);
+      const simgrid::s4u::VirtualMachine* vm = dynamic_cast<simgrid::s4u::VirtualMachine*>(host);
       if (vm != nullptr)
         host = vm->get_pm();
       xbt_assert(host != nullptr);
index aa9013b..4d1910d 100644 (file)
@@ -45,10 +45,10 @@ public:
   /** @brief Get the physical host on which the given VM is running */
   s4u::Host* get_physical_host() { return physical_host_; }
 
-  sg_size_t get_ramsize() { return ramsize_; }
+  sg_size_t get_ramsize() const { return ramsize_; }
   void set_ramsize(sg_size_t ramsize) { ramsize_ = ramsize; }
 
-  s4u::VirtualMachine::state get_state() { return vm_state_; }
+  s4u::VirtualMachine::state get_state() const { return vm_state_; }
   void set_state(s4u::VirtualMachine::state state) { vm_state_ = state; }
 
   int get_core_amount() { return core_amount_; }
index 84e1527..43263fa 100644 (file)
@@ -122,7 +122,7 @@ void VirtualMachine::destroy()
   Host::destroy();
 }
 
-simgrid::s4u::Host* VirtualMachine::get_pm()
+simgrid::s4u::Host* VirtualMachine::get_pm() const
 {
   return pimpl_vm_->get_physical_host();
 }
@@ -137,7 +137,7 @@ VirtualMachine::state VirtualMachine::get_state()
   return kernel::actor::simcall([this]() { return pimpl_vm_->get_state(); });
 }
 
-size_t VirtualMachine::get_ramsize()
+size_t VirtualMachine::get_ramsize() const
 {
   return pimpl_vm_->get_ramsize();
 }
@@ -203,7 +203,7 @@ const char* sg_vm_get_name(const_sg_vm_t vm)
 }
 
 /** @brief Get the physical host of a given VM. */
-sg_host_t sg_vm_get_pm(sg_vm_t vm)
+sg_host_t sg_vm_get_pm(const_sg_vm_t vm)
 {
   return vm->get_pm();
 }
@@ -213,7 +213,7 @@ void sg_vm_set_ramsize(sg_vm_t vm, size_t size)
   vm->set_ramsize(size);
 }
 
-size_t sg_vm_get_ramsize(sg_vm_t vm)
+size_t sg_vm_get_ramsize(const_sg_vm_t vm)
 {
   return vm->get_ramsize();
 }
index b3ed7d8..4499d92 100644 (file)
@@ -735,12 +735,12 @@ void sg_actor_self_execute(double flops)
 }
 
 /** @brief Take an extra reference on that actor to prevent it to be garbage-collected */
-void sg_actor_ref(sg_actor_t actor)
+void sg_actor_ref(const_sg_actor_t actor)
 {
   intrusive_ptr_add_ref(actor);
 }
 /** @brief Release a reference on that actor so that it can get be garbage-collected */
-void sg_actor_unref(sg_actor_t actor)
+void sg_actor_unref(const_sg_actor_t actor)
 {
   intrusive_ptr_release(actor);
 }
index 3331c7b..a5d2cb2 100644 (file)
@@ -21,8 +21,8 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sd_daxparse, sd, "Parsing DAX files");
 /* Ensure that transfer tasks have unique names even though a file is used several times */
 void uniq_transfer_task_name(SD_task_t task)
 {
-  SD_task_t child = *(task->successors->begin());
-  SD_task_t parent = *(task->predecessors->begin());
+  const_SD_task_t child  = *(task->successors->begin());
+  const_SD_task_t parent = *(task->predecessors->begin());
 
   std::string new_name =
       std::string(SD_task_get_name(parent)) + "_" + SD_task_get_name(task) + "_" + SD_task_get_name(child);
index 8a728cf..b4db2bd 100644 (file)
@@ -252,7 +252,7 @@ void TRACE_smpi_recv(int src, int dst, int tag)
 }
 
 /**************** Functions to trace the migration of tasks. *****************/
-void TRACE_smpi_process_change_host(int rank, sg_host_t new_host)
+void TRACE_smpi_process_change_host(int rank, const_sg_host_t new_host)
 {
   if (not TRACE_smpi_is_enabled()) return;
 
index 364b4e1..6543cd0 100644 (file)
@@ -23,7 +23,7 @@ static std::default_random_engine rnd_engine;
 
 static simgrid::mc::RemoteClient* process;
 
-static uintptr_t eval_binary_operation(simgrid::dwarf::ExpressionContext& state, int op, uintptr_t a, uintptr_t b)
+static uintptr_t eval_binary_operation(simgrid::dwarf::ExpressionContext const& state, int op, uintptr_t a, uintptr_t b)
 {
   Dwarf_Op ops[15];
   ops[0].atom = DW_OP_const8u;
index df47314..c40b713 100644 (file)
@@ -11,7 +11,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example")
 
 static void vm_migrate(msg_vm_t vm, msg_host_t dst_pm)
 {
-  msg_host_t src_pm = MSG_vm_get_pm(vm);
+  const_sg_host_t src_pm = MSG_vm_get_pm(vm);
   double mig_sta    = MSG_get_clock();
   MSG_vm_migrate(vm, dst_pm);
   double mig_end = MSG_get_clock();
@@ -34,7 +34,7 @@ static int migration_worker_main(int argc, char* argv[])
   return 0;
 }
 
-static void vm_migrate_async(const_sg_vm_t vm, msg_host_t dst_pm)
+static void vm_migrate_async(const_sg_vm_t vm, const_sg_host_t dst_pm)
 {
   const char* vm_name     = MSG_vm_get_name(vm);
   const char* dst_pm_name = MSG_host_get_name(dst_pm);
index 3d6cf51..da6e4c9 100644 (file)
@@ -36,7 +36,7 @@ static int host(int argc, char* argv[])
     sg_size_t write = MSG_file_write(file, MSG_file_get_size(file) * 1024);
     XBT_INFO("Have written %llu bytes to '%s'.", write, filename);
 
-    msg_host_t src  = MSG_host_self();
+    const_sg_host_t src = MSG_host_self();
     msg_host_t dest = MSG_host_by_name(argv[3]);
     if (xbt_str_parse_int(argv[5], "Argument 5 (move or copy) must be an int, not '%s'")) {
       XBT_INFO("Move '%s' (of size %llu) from '%s' to '%s'", filename, MSG_file_get_size(file), MSG_host_get_name(src),
@@ -56,7 +56,7 @@ static int host(int argc, char* argv[])
 int main(int argc, char** argv)
 {
   unsigned int cur;
-  msg_storage_t st;
+  const_sg_storage_t st;
 
   MSG_init(&argc, argv);
   MSG_storage_file_system_init();
index 3838b06..a4a28f5 100644 (file)
@@ -70,7 +70,7 @@ static int david(XBT_ATTRIB_UNUSED int argc, XBT_ATTRIB_UNUSED char* argv[])
 static int bob(XBT_ATTRIB_UNUSED int argc, XBT_ATTRIB_UNUSED char* argv[])
 {
   /* this host also tests the properties of the AS*/
-  msg_netzone_t root = MSG_zone_get_root();
+  const_sg_netzone_t root = MSG_zone_get_root();
   XBT_INFO("== Print the properties of the AS");
   XBT_INFO("   Process property: filename -> %s", MSG_zone_get_property_value(root, "filename"));
   XBT_INFO("   Process property: date -> %s", MSG_zone_get_property_value(root, "date"));
index 4051242..91ecb4a 100644 (file)
@@ -15,7 +15,7 @@ static int name_compare_hosts(const void *n1, const void *n2)
   return strcmp(sg_host_get_name(*(const sg_host_t*)n1), sg_host_get_name(*(const sg_host_t*)n2));
 }
 
-static void scheduleDAX(xbt_dynar_t dax)
+static void scheduleDAX(const_xbt_dynar_t dax)
 {
   unsigned int cursor;
   SD_task_t task;
index fd9f914..041c022 100644 (file)
@@ -75,11 +75,12 @@ static void dump_links()
   unsigned int totalLinks    = sg_link_count();
   simgrid::s4u::Link** links = sg_link_list();
 
-  std::sort(links, links + totalLinks,
-            [](simgrid::s4u::Link* a, simgrid::s4u::Link* b) { return strcmp(sg_link_name(a), sg_link_name(b)) < 0; });
+  std::sort(links, links + totalLinks, [](const simgrid::s4u::Link* a, const simgrid::s4u::Link* b) {
+    return strcmp(sg_link_name(a), sg_link_name(b)) < 0;
+  });
 
   for (unsigned int i = 0; i < totalLinks; i++) {
-    simgrid::s4u::Link* link = links[i];
+    const simgrid::s4u::Link* link = links[i];
     std::printf("  <link id=\"");
 
     std::printf("%s\" bandwidth=\"%.0f\" latency=\"%.9f\"", link->get_cname(), link->get_bandwidth(), link->get_latency());
@@ -112,7 +113,7 @@ static void dump_routes()
   unsigned int totalHosts = sg_host_count();
   sg_host_t* hosts        = sg_host_list();
   std::sort(hosts, hosts + totalHosts,
-            [](sg_host_t a, sg_host_t b) { return strcmp(sg_host_get_name(a), sg_host_get_name(b)) < 0; });
+            [](const_sg_host_t a, const_sg_host_t b) { return strcmp(sg_host_get_name(a), sg_host_get_name(b)) < 0; });
   std::vector<simgrid::kernel::routing::NetPoint*> netpoints =
       simgrid::s4u::Engine::get_instance()->get_all_netpoints();
   std::sort(netpoints.begin(), netpoints.end(),