From dcbef682c82dc36f62828f331ba4adc39d0324ea Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20B=C3=A9daride?= Date: Thu, 13 Feb 2014 11:07:54 +0100 Subject: [PATCH] Remove host data and had JAVA_HOST_LEVEL --- examples/msg/bittorrent/bittorrent.c | 4 +-- examples/msg/bittorrent/tracker.c | 3 +- include/msg/msg.h | 3 -- include/simgrid/simix.h | 2 -- src/bindings/java/jmsg.c | 10 +++++- src/bindings/java/jmsg.h | 3 ++ src/bindings/java/jmsg_as.c | 2 +- src/bindings/java/jmsg_host.c | 15 ++++---- src/bindings/java/jmsg_task.c | 4 +-- src/bindings/java/jmsg_vm.c | 5 +-- src/msg/msg_host.c | 26 -------------- src/simix/simcalls.in | 2 -- .../simcalls_generated_args_getter_setter.h | 18 ---------- src/simix/simcalls_generated_body.c | 31 ---------------- src/simix/simcalls_generated_case.c | 10 ------ src/simix/simcalls_generated_enum.h | 2 -- .../simcalls_generated_res_getter_setter.h | 8 ----- src/simix/simcalls_generated_string.c | 2 -- src/simix/smx_host.c | 35 ------------------- src/simix/smx_host_private.h | 3 -- src/simix/smx_user.c | 25 ------------- src/surf/surf_interface.cpp | 2 ++ 22 files changed, 30 insertions(+), 185 deletions(-) diff --git a/examples/msg/bittorrent/bittorrent.c b/examples/msg/bittorrent/bittorrent.c index 863a2b6baa..0ad478188e 100644 --- a/examples/msg/bittorrent/bittorrent.c +++ b/examples/msg/bittorrent/bittorrent.c @@ -38,7 +38,7 @@ int main(int argc, char *argv[]) RngStream stream; snprintf(descr, sizeof descr, "RngSream<%s>", MSG_host_get_name(host)); stream = RngStream_CreateStream(descr); - MSG_host_set_data(host, stream); + MSG_host_set_property_value(host, "stream", (char*)stream, NULL); } MSG_function_register("tracker", tracker); @@ -49,7 +49,7 @@ int main(int argc, char *argv[]) MSG_main(); xbt_dynar_foreach(host_list, i, host) { - RngStream stream = MSG_host_get_data(host); + RngStream stream = (RngStream) MSG_host_get_property_value(host, "stream"); RngStream_DeleteStream(&stream); } xbt_dynar_free(&host_list); diff --git a/examples/msg/bittorrent/tracker.c b/examples/msg/bittorrent/tracker.c index e60ef77bbc..631a4560b8 100644 --- a/examples/msg/bittorrent/tracker.c +++ b/examples/msg/bittorrent/tracker.c @@ -20,8 +20,7 @@ int tracker(int argc, char *argv[]) { int i; - RngStream stream = MSG_host_get_data(MSG_host_self()); - + RngStream stream = (RngStream) MSG_host_get_property_value(MSG_host_self(), "stream"); //Checking arguments xbt_assert(argc == 2, "Wrong number of arguments for the tracker."); //Retrieving end time diff --git a/include/msg/msg.h b/include/msg/msg.h index 9845b3e640..2c30c65825 100644 --- a/include/msg/msg.h +++ b/include/msg/msg.h @@ -116,14 +116,11 @@ XBT_PUBLIC(xbt_dict_t) MSG_as_router_get_properties(const char* asr); XBT_PUBLIC(void) MSG_as_router_set_property_value(const char* asr, const char *name, char *value,void_f_pvoid_t free_ctn); /************************** Host handling ***********************************/ -XBT_PUBLIC(msg_error_t) MSG_host_set_data(msg_host_t host, void *data); -XBT_PUBLIC(void *) MSG_host_get_data(msg_host_t host); XBT_PUBLIC(const char *) MSG_host_get_name(msg_host_t host); XBT_PUBLIC(void) MSG_host_on(msg_host_t host); XBT_PUBLIC(void) MSG_host_off(msg_host_t host); XBT_PUBLIC(msg_host_t) MSG_host_self(void); XBT_PUBLIC(int) MSG_get_host_msgload(msg_host_t host); -/* int MSG_get_msgload(void); This function lacks specification; discard it */ XBT_PUBLIC(double) MSG_get_host_speed(msg_host_t h); XBT_PUBLIC(int) MSG_host_get_core_number(msg_host_t h); XBT_PUBLIC(xbt_swag_t) MSG_host_get_process_list(msg_host_t h); diff --git a/include/simgrid/simix.h b/include/simgrid/simix.h index a50748be23..938535a4f2 100644 --- a/include/simgrid/simix.h +++ b/include/simgrid/simix.h @@ -263,8 +263,6 @@ XBT_PUBLIC(void) SIMIX_host_on(smx_host_t host); XBT_PUBLIC(void) SIMIX_host_off(smx_host_t host, smx_process_t issuer); XBT_PUBLIC(void) SIMIX_host_self_set_data(void *data); XBT_PUBLIC(void*) SIMIX_host_self_get_data(void); -XBT_PUBLIC(void*) SIMIX_host_get_data(smx_host_t host); -XBT_PUBLIC(void) SIMIX_host_set_data(smx_host_t host, void *data); XBT_PUBLIC(xbt_dict_t) SIMIX_host_get_storage_list(smx_host_t host); /********************************* Process ************************************/ XBT_PUBLIC(int) SIMIX_process_count(void); diff --git a/src/bindings/java/jmsg.c b/src/bindings/java/jmsg.c index b3ec27cd41..bfc4115af6 100644 --- a/src/bindings/java/jmsg.c +++ b/src/bindings/java/jmsg.c @@ -33,6 +33,8 @@ #endif /* end of eclipse-mandated pimple */ +int JAVA_HOST_LEVEL; + static int create_jprocess(int argc, char *argv[]); XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(jmsg); @@ -79,6 +81,10 @@ Java_org_simgrid_msg_Msg_getClock(JNIEnv * env, jclass cls) return (jdouble) MSG_get_clock(); } +static void __JAVA_host_priv_free(void *host) +{ +} + JNIEXPORT void JNICALL Java_org_simgrid_msg_Msg_init(JNIEnv * env, jclass cls, jobjectArray jargs) { @@ -123,6 +129,8 @@ Java_org_simgrid_msg_Msg_init(JNIEnv * env, jclass cls, jobjectArray jargs) MSG_init(&argc, argv); + JAVA_HOST_LEVEL = xbt_lib_add_level(host_lib, (void_f_pvoid_t) __JAVA_host_priv_free); + for (index = 0; index < argc; index++) free(argv[index]); @@ -155,7 +163,7 @@ JNIEXPORT void JNICALL /* Cleanup java hosts */ hosts = MSG_hosts_as_dynar(); for (index = 0; index < xbt_dynar_length(hosts) - 1; index++) { - jhost = (jobject) MSG_host_get_data(xbt_dynar_get_as(hosts,index,msg_host_t)); + jhost = (jobject) xbt_lib_get_level(xbt_dynar_get_as(hosts,index,msg_host_t), JAVA_HOST_LEVEL); if (jhost) jhost_unref(env, jhost); diff --git a/src/bindings/java/jmsg.h b/src/bindings/java/jmsg.h index 2cf3f7173b..c6c8625502 100644 --- a/src/bindings/java/jmsg.h +++ b/src/bindings/java/jmsg.h @@ -11,6 +11,9 @@ #include #include +extern int JAVA_HOST_LEVEL; +extern xbt_lib_t host_lib; + JavaVM *get_java_VM(void); JNIEnv *get_current_thread_env(void); /** diff --git a/src/bindings/java/jmsg_as.c b/src/bindings/java/jmsg_as.c index 59a9698671..a3daec624b 100644 --- a/src/bindings/java/jmsg_as.c +++ b/src/bindings/java/jmsg_as.c @@ -158,7 +158,7 @@ Java_org_simgrid_msg_As_getHosts(JNIEnv * env, jobject jas) host = xbt_dynar_get_as(table,index,msg_host_t); - jhost = (jobject) (MSG_host_get_data(host)); + jhost = (jobject) xbt_lib_get_level(host, JAVA_HOST_LEVEL); if (!jhost) { jname = (*env)->NewStringUTF(env, MSG_host_get_name(host)); diff --git a/src/bindings/java/jmsg_host.c b/src/bindings/java/jmsg_host.c index 9b8181b12f..81ed7f7340 100644 --- a/src/bindings/java/jmsg_host.c +++ b/src/bindings/java/jmsg_host.c @@ -18,7 +18,6 @@ static jmethodID jhost_method_Host_constructor; static jfieldID jhost_field_Host_bind; static jfieldID jhost_field_Host_name; - jobject jhost_new_instance(JNIEnv * env) { jclass cls = jxbt_get_class(env, "org/simgrid/msg/Host"); return (*env)->NewObject(env, cls, jhost_method_Host_constructor); @@ -85,7 +84,7 @@ Java_org_simgrid_msg_Host_getByName(JNIEnv * env, jclass cls, } (*env)->ReleaseStringUTFChars(env, jname, name); - if (!MSG_host_get_data(host)) { /* native host not associated yet with java host */ + if (!xbt_lib_get_level(host, JAVA_HOST_LEVEL)) { /* native host not associated yet with java host */ /* Instantiate a new java host */ jhost = jhost_new_instance(env); @@ -110,11 +109,11 @@ Java_org_simgrid_msg_Host_getByName(JNIEnv * env, jclass cls, /* the native host data field is set with the global reference to the * java host returned by this function */ - MSG_host_set_data(host, (void *) jhost); + xbt_lib_set(host_lib, host->key, JAVA_HOST_LEVEL, (void *) jhost); } /* return the global reference to the java host instance */ - return (jobject) MSG_host_get_data(host); + return (jobject) xbt_lib_get_level(host, JAVA_HOST_LEVEL); } JNIEXPORT jobject JNICALL @@ -123,7 +122,7 @@ Java_org_simgrid_msg_Host_currentHost(JNIEnv * env, jclass cls) { msg_host_t host = MSG_host_self(); - if (!MSG_host_get_data(host)) { + if (!xbt_lib_get_level(host, JAVA_HOST_LEVEL)) { /* the native host not yet associated with the java host instance */ /* instanciate a new java host instance */ @@ -147,9 +146,9 @@ Java_org_simgrid_msg_Host_currentHost(JNIEnv * env, jclass cls) { (*env)->SetObjectField(env, jhost, jhost_field_Host_name, jname); /* Bind & store it */ jhost_bind(jhost, host, env); - MSG_host_set_data(host, (void *) jhost); + xbt_lib_set(host_lib, host->key, JAVA_HOST_LEVEL, (void *) jhost); } else { - jhost = (jobject) MSG_host_get_data(host); + jhost = (jobject) xbt_lib_get_level(host, JAVA_HOST_LEVEL); } return jhost; @@ -291,7 +290,7 @@ Java_org_simgrid_msg_Host_all(JNIEnv * env, jclass cls_arg) for (index = 0; index < count; index++) { host = xbt_dynar_get_as(table,index,msg_host_t); - jhost = (jobject) (MSG_host_get_data(host)); + jhost = (jobject) (xbt_lib_get_level(host, JAVA_HOST_LEVEL)); if (!jhost) { jname = (*env)->NewStringUTF(env, MSG_host_get_name(host)); diff --git a/src/bindings/java/jmsg_task.c b/src/bindings/java/jmsg_task.c index ba640e4b69..77aa3158e7 100644 --- a/src/bindings/java/jmsg_task.c +++ b/src/bindings/java/jmsg_task.c @@ -285,12 +285,12 @@ Java_org_simgrid_msg_Task_getSource(JNIEnv * env, if (host == NULL) { return NULL; } - if (!MSG_host_get_data(host)) { + if (!xbt_lib_get_level(host, JAVA_HOST_LEVEL)) { jxbt_throw_jni(env, "MSG_task_get_source() failed"); return NULL; } - return (jobject) MSG_host_get_data(host); + return (jobject) xbt_lib_get_level(host, JAVA_HOST_LEVEL); } JNIEXPORT jdouble JNICALL diff --git a/src/bindings/java/jmsg_vm.c b/src/bindings/java/jmsg_vm.c index 722c4b57ca..475cc91471 100644 --- a/src/bindings/java/jmsg_vm.c +++ b/src/bindings/java/jmsg_vm.c @@ -6,6 +6,7 @@ /* 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. */ +#include "jmsg.h" #include "jmsg_vm.h" #include "jmsg_host.h" #include "jmsg_process.h" @@ -157,7 +158,7 @@ Java_org_simgrid_msg_VM_get_pm(JNIEnv *env, jobject jvm) { msg_vm_t vm = jvm_get_native(env,jvm); msg_host_t host = MSG_vm_get_pm(vm); - if (!MSG_host_get_data(host)) { + if (!xbt_lib_get_level(host, JAVA_HOST_LEVEL)) { /* the native host not yet associated with the java host instance */ /* instanciate a new java host instance */ @@ -183,7 +184,7 @@ Java_org_simgrid_msg_VM_get_pm(JNIEnv *env, jobject jvm) { jhost_bind(jhost, host, env); MSG_host_set_data(host, (void *) jhost); } else { - jhost = (jobject) MSG_host_get_data(host); + jhost = (jobject) xbt_lib_get_level(host, JAVA_HOST_LEVEL); } return jhost; diff --git a/src/msg/msg_host.c b/src/msg/msg_host.c index 670f820120..627b1e608a 100644 --- a/src/msg/msg_host.c +++ b/src/msg/msg_host.c @@ -72,32 +72,6 @@ msg_host_t MSG_get_host_by_name(const char *name) return (msg_host_t) xbt_lib_get_elm_or_null(host_lib,name); } -/** \ingroup m_host_management - * - * \brief Set the user data of a #msg_host_t. - * - * This functions checks whether some data has already been associated to \a host - or not and attach \a data to \a host if it is possible. - */ -msg_error_t MSG_host_set_data(msg_host_t host, void *data) -{ - SIMIX_host_set_data(host,data); - - return MSG_OK; -} - -/** \ingroup m_host_management - * - * \brief Return the user data of a #msg_host_t. - * - * This functions checks whether \a host is a valid pointer or not and return - the user data associated to \a host if it is possible. - */ -void *MSG_host_get_data(msg_host_t host) -{ - return SIMIX_host_get_data(host); -} - /** \ingroup m_host_management * * \brief Return the name of the #msg_host_t. diff --git a/src/simix/simcalls.in b/src/simix/simcalls.in index f34823e7ca..29a13f537d 100644 --- a/src/simix/simcalls.in +++ b/src/simix/simcalls.in @@ -15,8 +15,6 @@ host_get_process_list True (void*, xbt_swag_t) (host, void*, smx_host_t) host_get_speed True (double) (host, void*, smx_host_t) host_get_available_speed True (double) (host, void*, smx_host_t) host_get_state True (int) (host, void*, smx_host_t) -host_get_data True (void*) (host, void*, smx_host_t) -host_set_data True (void) (host, void*, smx_host_t) (data, void*) host_get_current_power_peak True (double) (host, void*, smx_host_t) host_get_power_peak_at True (double) (host, void*, smx_host_t) (pstate_index, int) host_get_nb_pstates True (int) (host, void*, smx_host_t) diff --git a/src/simix/simcalls_generated_args_getter_setter.h b/src/simix/simcalls_generated_args_getter_setter.h index 48a1241dd5..4aa985512e 100644 --- a/src/simix/simcalls_generated_args_getter_setter.h +++ b/src/simix/simcalls_generated_args_getter_setter.h @@ -65,24 +65,6 @@ static inline smx_host_t simcall_host_get_state__get__host(smx_simcall_t simcall static inline void simcall_host_get_state__set__host(smx_simcall_t simcall, void* arg){ simcall->args[0].dp = arg; } -static inline smx_host_t simcall_host_get_data__get__host(smx_simcall_t simcall){ - return (smx_host_t) simcall->args[0].dp; -} -static inline void simcall_host_get_data__set__host(smx_simcall_t simcall, void* arg){ - simcall->args[0].dp = arg; -} -static inline smx_host_t simcall_host_set_data__get__host(smx_simcall_t simcall){ - return (smx_host_t) simcall->args[0].dp; -} -static inline void simcall_host_set_data__set__host(smx_simcall_t simcall, void* arg){ - simcall->args[0].dp = arg; -} -static inline void* simcall_host_set_data__get__data(smx_simcall_t simcall){ - return simcall->args[1].dp; -} -static inline void simcall_host_set_data__set__data(smx_simcall_t simcall, void* arg){ - simcall->args[1].dp = arg; -} static inline smx_host_t simcall_host_get_current_power_peak__get__host(smx_simcall_t simcall){ return (smx_host_t) simcall->args[0].dp; } diff --git a/src/simix/simcalls_generated_body.c b/src/simix/simcalls_generated_body.c index 7ad2b3a3b0..f103ad6e2a 100644 --- a/src/simix/simcalls_generated_body.c +++ b/src/simix/simcalls_generated_body.c @@ -155,37 +155,6 @@ } return self->simcall.result.i; } - inline static void* simcall_BODY_host_get_data(smx_host_t host) { - smx_process_t self = SIMIX_process_self(); - self->simcall.call = SIMCALL_HOST_GET_DATA; - memset(&self->simcall.result, 0, sizeof(self->simcall.result)); - memset(self->simcall.args, 0, sizeof(self->simcall.args)); - self->simcall.args[0].dp = (void*) host; - if (self != simix_global->maestro_process) { - XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name, - SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); - SIMIX_process_yield(self); - } else { - SIMIX_simcall_pre(&self->simcall, 0); - } - return self->simcall.result.dp; - } - inline static void simcall_BODY_host_set_data(smx_host_t host, void* data) { - smx_process_t self = SIMIX_process_self(); - self->simcall.call = SIMCALL_HOST_SET_DATA; - memset(&self->simcall.result, 0, sizeof(self->simcall.result)); - memset(self->simcall.args, 0, sizeof(self->simcall.args)); - self->simcall.args[0].dp = (void*) host; - self->simcall.args[1].dp = (void*) data; - if (self != simix_global->maestro_process) { - XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name, - SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); - SIMIX_process_yield(self); - } else { - SIMIX_simcall_pre(&self->simcall, 0); - } - - } inline static double simcall_BODY_host_get_current_power_peak(smx_host_t host) { smx_process_t self = SIMIX_process_self(); self->simcall.call = SIMCALL_HOST_GET_CURRENT_POWER_PEAK; diff --git a/src/simix/simcalls_generated_case.c b/src/simix/simcalls_generated_case.c index 9e3a364663..906cf65c15 100644 --- a/src/simix/simcalls_generated_case.c +++ b/src/simix/simcalls_generated_case.c @@ -55,16 +55,6 @@ case SIMCALL_HOST_GET_STATE: SIMIX_simcall_answer(simcall); break; -case SIMCALL_HOST_GET_DATA: - simcall->result.dp = SIMIX_pre_host_get_data(simcall , (smx_host_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_HOST_SET_DATA: - SIMIX_pre_host_set_data(simcall , (smx_host_t) simcall->args[0].dp, simcall->args[1].dp); - SIMIX_simcall_answer(simcall); - break; - case SIMCALL_HOST_GET_CURRENT_POWER_PEAK: simcall->result.d = SIMIX_pre_host_get_current_power_peak(simcall , (smx_host_t) simcall->args[0].dp); SIMIX_simcall_answer(simcall); diff --git a/src/simix/simcalls_generated_enum.h b/src/simix/simcalls_generated_enum.h index 06c77a9876..9156eca4e3 100644 --- a/src/simix/simcalls_generated_enum.h +++ b/src/simix/simcalls_generated_enum.h @@ -15,8 +15,6 @@ SIMCALL_HOST_GET_PROCESS_LIST, SIMCALL_HOST_GET_SPEED, SIMCALL_HOST_GET_AVAILABLE_SPEED, SIMCALL_HOST_GET_STATE, -SIMCALL_HOST_GET_DATA, -SIMCALL_HOST_SET_DATA, SIMCALL_HOST_GET_CURRENT_POWER_PEAK, SIMCALL_HOST_GET_POWER_PEAK_AT, SIMCALL_HOST_GET_NB_PSTATES, diff --git a/src/simix/simcalls_generated_res_getter_setter.h b/src/simix/simcalls_generated_res_getter_setter.h index 0c79e3a0c4..5c6df780eb 100644 --- a/src/simix/simcalls_generated_res_getter_setter.h +++ b/src/simix/simcalls_generated_res_getter_setter.h @@ -57,14 +57,6 @@ static inline int simcall_host_get_state__get__result(smx_simcall_t simcall){ static inline void simcall_host_get_state__set__result(smx_simcall_t simcall, int result){ simcall->result.i = result; } -static inline void* simcall_host_get_data__get__result(smx_simcall_t simcall){ - return simcall->result.dp; -} -static inline void simcall_host_get_data__set__result(smx_simcall_t simcall, void* result){ - simcall->result.dp = result; -} - - static inline double simcall_host_get_current_power_peak__get__result(smx_simcall_t simcall){ return simcall->result.d; } diff --git a/src/simix/simcalls_generated_string.c b/src/simix/simcalls_generated_string.c index de3896a0a6..461d7fea2b 100644 --- a/src/simix/simcalls_generated_string.c +++ b/src/simix/simcalls_generated_string.c @@ -15,8 +15,6 @@ [SIMCALL_HOST_GET_SPEED] = "SIMCALL_HOST_GET_SPEED", [SIMCALL_HOST_GET_AVAILABLE_SPEED] = "SIMCALL_HOST_GET_AVAILABLE_SPEED", [SIMCALL_HOST_GET_STATE] = "SIMCALL_HOST_GET_STATE", -[SIMCALL_HOST_GET_DATA] = "SIMCALL_HOST_GET_DATA", -[SIMCALL_HOST_SET_DATA] = "SIMCALL_HOST_SET_DATA", [SIMCALL_HOST_GET_CURRENT_POWER_PEAK] = "SIMCALL_HOST_GET_CURRENT_POWER_PEAK", [SIMCALL_HOST_GET_POWER_PEAK_AT] = "SIMCALL_HOST_GET_POWER_PEAK_AT", [SIMCALL_HOST_GET_NB_PSTATES] = "SIMCALL_HOST_GET_NB_PSTATES", diff --git a/src/simix/smx_host.c b/src/simix/smx_host.c index 2ff44aa9a1..2f88f82313 100644 --- a/src/simix/smx_host.c +++ b/src/simix/smx_host.c @@ -28,7 +28,6 @@ smx_host_t SIMIX_host_create(const char *name, s_smx_process_t proc; /* Host structure */ - smx_host->data = data; smx_host->process_list = xbt_swag_new(xbt_swag_offset(proc, host_proc_hookup)); @@ -310,30 +309,6 @@ int SIMIX_host_get_state(smx_host_t host){ return surf_resource_get_state(surf_workstation_resource_priv(host)); } -void* SIMIX_pre_host_self_get_data(smx_simcall_t simcall){ - return SIMIX_host_self_get_data(); -} -void* SIMIX_host_self_get_data(void) -{ - smx_host_t self = SIMIX_host_self(); - return SIMIX_host_get_data(self); -} - -void SIMIX_host_self_set_data(void *data) -{ - smx_host_t self = SIMIX_host_self(); - SIMIX_host_set_data(self, data); -} - -void* SIMIX_pre_host_get_data(smx_simcall_t simcall,smx_host_t host){ - return SIMIX_host_get_data(host); -} -void* SIMIX_host_get_data(smx_host_t host){ - xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)"); - - return SIMIX_host_priv(host)->data; -} - void _SIMIX_host_free_process_arg(void *data) { smx_process_arg_t arg = *(void**)data; @@ -447,16 +422,6 @@ void SIMIX_host_autorestart(smx_host_t host) xbt_die("No function for simix_global->autorestart"); } -void SIMIX_pre_host_set_data(smx_simcall_t simcall, smx_host_t host, void *data) { - SIMIX_host_set_data(host, data); -} -void SIMIX_host_set_data(smx_host_t host, void *data){ - xbt_assert((host != NULL), "Invalid parameters"); - xbt_assert((SIMIX_host_priv(host)->data == NULL), "Data already set"); - - SIMIX_host_priv(host)->data = data; -} - smx_action_t SIMIX_pre_host_execute(smx_simcall_t simcall,const char *name, smx_host_t host, double computation_amount, double priority, double bound, unsigned long affinity_mask){ return SIMIX_host_execute(name, host, computation_amount, priority, bound, affinity_mask); diff --git a/src/simix/smx_host_private.h b/src/simix/smx_host_private.h index c3e5d6456f..677cdde9cf 100644 --- a/src/simix/smx_host_private.h +++ b/src/simix/smx_host_private.h @@ -17,7 +17,6 @@ typedef struct s_smx_host_priv { xbt_swag_t process_list; xbt_dynar_t auto_restart_processes; xbt_dynar_t boot_processes; - void *data; /**< @brief user data */ } s_smx_host_priv_t; static inline smx_host_priv_t SIMIX_host_priv(smx_host_t host){ @@ -87,8 +86,6 @@ int SIMIX_pre_host_get_nb_pstates(smx_simcall_t, smx_host_t host); void SIMIX_pre_host_set_power_peak_at(smx_simcall_t, smx_host_t host, int pstate_index); double SIMIX_pre_host_get_consumed_energy(smx_simcall_t, smx_host_t); void* SIMIX_pre_host_self_get_data(smx_simcall_t); -void* SIMIX_pre_host_get_data(smx_simcall_t, smx_host_t); -void SIMIX_pre_host_set_data(smx_simcall_t, smx_host_t, void*); smx_action_t SIMIX_pre_host_execute(smx_simcall_t, const char*, smx_host_t, double, double, double, unsigned long); smx_action_t SIMIX_pre_host_parallel_execute(smx_simcall_t, const char*, int, smx_host_t*, double*, double*, double, double); diff --git a/src/simix/smx_user.c b/src/simix/smx_user.c index 5e1d9d8680..63d8f4a1dd 100644 --- a/src/simix/smx_user.c +++ b/src/simix/smx_user.c @@ -154,31 +154,6 @@ int simcall_host_get_state(smx_host_t host) return simcall_BODY_host_get_state(host); } -/** - * \ingroup simix_host_management - * \brief Returns the user data associated to a host. - * - * \param host SIMIX host - * \return the user data of this host - */ -void* simcall_host_get_data(smx_host_t host) -{ - return simcall_BODY_host_get_data(host); -} - -/** - * \ingroup simix_host_management - * \brief Sets the user data associated to a host. - * - * The host must not have previous user data associated to it. - * \param host A SIMIX host - * \param data The user data to set - */ -void simcall_host_set_data(smx_host_t host, void *data) -{ - simcall_host_set_data(host, data); -} - /** * \ingroup simix_host_management * \brief Returns the power peak of a host. diff --git a/src/surf/surf_interface.cpp b/src/surf/surf_interface.cpp index 43789734df..b59b7b04cc 100644 --- a/src/surf/surf_interface.cpp +++ b/src/surf/surf_interface.cpp @@ -724,6 +724,8 @@ const char *Resource::getName() { } xbt_dict_t Resource::getProperties() { + if (p_properties==NULL) + p_properties = xbt_dict_new(); return p_properties; } -- 2.20.1