From: Paul Bédaride Date: Mon, 18 Nov 2013 15:43:50 +0000 (+0100) Subject: Change sg_storage_size_t to sg_size_t and fix surf network bug X-Git-Tag: v3_11_beta~283 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/2d882c1ac3c6eb891f8eb26a84ec2d6890a67730 Change sg_storage_size_t to sg_size_t and fix surf network bug --- diff --git a/examples/msg/io/file.c b/examples/msg/io/file.c index 9e07765119..3f1ea65e40 100644 --- a/examples/msg/io/file.c +++ b/examples/msg/io/file.c @@ -35,7 +35,7 @@ int host(int argc, char *argv[]) { msg_file_t file = NULL; char* mount = xbt_strdup("/home"); - sg_storage_size_t read,write; + sg_size_t read,write; if(!strcmp(MSG_process_get_name(MSG_process_self()),"0")){ file = MSG_file_open(mount,FILENAME1, NULL); diff --git a/examples/msg/io/file_unlink.c b/examples/msg/io/file_unlink.c index ec901daaef..42e3224a77 100644 --- a/examples/msg/io/file_unlink.c +++ b/examples/msg/io/file_unlink.c @@ -32,7 +32,7 @@ int host(int argc, char *argv[]) { msg_file_t file = NULL; char* mount = xbt_strdup("/home"); - sg_storage_size_t write; + sg_size_t write; // First open XBT_INFO("\tOpen file '%s'",FILENAME1); diff --git a/examples/msg/io/storage.c b/examples/msg/io/storage.c index 3fa8fb68d2..2b8eafe5f5 100644 --- a/examples/msg/io/storage.c +++ b/examples/msg/io/storage.c @@ -22,7 +22,7 @@ #include "xbt/log.h" #include "xbt/dict.h" - /* To use PRIu64 format specifier for printing uint64_t (sg_storage_size_t) */ + /* To use PRIu64 format specifier for printing uint64_t (sg_size_t) */ #include XBT_LOG_NEW_DEFAULT_CATEGORY(storage,"Messages specific for this simulation"); @@ -47,9 +47,9 @@ static int host(int argc, char *argv[]){ storage = MSG_storage_get_by_name(storage_name); // Retrieve disk's information - sg_storage_size_t free_size = MSG_storage_get_free_size(mount_name); - sg_storage_size_t used_size = MSG_storage_get_used_size(mount_name); - sg_storage_size_t size = MSG_storage_get_size(storage); + sg_size_t free_size = MSG_storage_get_free_size(mount_name); + sg_size_t used_size = MSG_storage_get_used_size(mount_name); + sg_size_t size = MSG_storage_get_size(storage); XBT_INFO("Total size: %"PRIu64" bytes", size); XBT_INFO("Free size: %"PRIu64" bytes", free_size); @@ -63,7 +63,7 @@ static int host(int argc, char *argv[]){ char* mount = xbt_strdup("/home"); char* file_name = xbt_strdup("./tmp/data.txt"); msg_file_t file = NULL; - sg_storage_size_t write, read, file_size; + sg_size_t write, read, file_size; // Open an non-existing file amounts to create it! file = MSG_file_open(mount, file_name, NULL); @@ -118,11 +118,11 @@ static int host(int argc, char *argv[]){ char* mountname; xbt_dict_t content; char* path; - sg_storage_size_t *size; + sg_size_t *size; xbt_dict_foreach(contents, curs, mountname, content){ XBT_INFO("Print the content of mount point: %s",mountname); xbt_dict_foreach(content,curs2,path,size){ - XBT_INFO("%s size: %"PRIu64" bytes", path,*((sg_storage_size_t*)size)); + XBT_INFO("%s size: %"PRIu64" bytes", path,*((sg_size_t*)size)); } xbt_dict_free(&content); } diff --git a/include/msg/datatypes.h b/include/msg/datatypes.h index 0f5bf3b751..82f5548f56 100644 --- a/include/msg/datatypes.h +++ b/include/msg/datatypes.h @@ -100,7 +100,7 @@ static inline msg_vm_priv_t MSG_vm_priv(msg_vm_t vm){ typedef struct simdata_file *simdata_file_t; typedef struct s_msg_file_info { - sg_storage_size_t size; + sg_size_t size; char* mount_point; char* storageId; char* storage_type; diff --git a/include/msg/msg.h b/include/msg/msg.h index 8b55e686f1..c26b7426d1 100644 --- a/include/msg/msg.h +++ b/include/msg/msg.h @@ -81,24 +81,24 @@ XBT_PUBLIC(const char *) MSG_environment_as_get_model(msg_as_t as); XBT_PUBLIC(xbt_dynar_t) MSG_environment_as_get_hosts(msg_as_t as); /************************** File handling ***********************************/ -XBT_PUBLIC(sg_storage_size_t) MSG_file_read(msg_file_t fd, sg_storage_size_t size); -XBT_PUBLIC(sg_storage_size_t) MSG_file_write(msg_file_t fd, sg_storage_size_t size); +XBT_PUBLIC(sg_size_t) MSG_file_read(msg_file_t fd, sg_size_t size); +XBT_PUBLIC(sg_size_t) MSG_file_write(msg_file_t fd, sg_size_t size); XBT_PUBLIC(msg_file_t) MSG_file_open(const char* mount, const char* path, void* data); XBT_PUBLIC(void*) MSG_file_get_data(msg_file_t fd); XBT_PUBLIC(msg_error_t) MSG_file_set_data(msg_file_t fd, void * data); XBT_PUBLIC(int) MSG_file_close(msg_file_t fd); -XBT_PUBLIC(sg_storage_size_t) MSG_file_get_size(msg_file_t fd); +XBT_PUBLIC(sg_size_t) MSG_file_get_size(msg_file_t fd); XBT_PUBLIC(void) MSG_file_dump(msg_file_t fd); XBT_PUBLIC(int) MSG_file_unlink(msg_file_t fd); XBT_PUBLIC(xbt_dict_t) MSG_file_ls(const char *mount, const char *path); -XBT_PUBLIC(msg_error_t) MSG_file_seek(msg_file_t fd, sg_storage_size_t offset, int whence); +XBT_PUBLIC(msg_error_t) MSG_file_seek(msg_file_t fd, sg_size_t offset, int whence); XBT_PUBLIC(void) __MSG_file_get_info(msg_file_t fd); /************************** Storage handling ***********************************/ XBT_PUBLIC(msg_host_t) MSG_get_storage_by_name(const char *name); XBT_PUBLIC(const char *) MSG_storage_get_name(msg_storage_t storage); -XBT_PUBLIC(sg_storage_size_t) MSG_storage_get_free_size(const char* name); -XBT_PUBLIC(sg_storage_size_t) MSG_storage_get_used_size(const char* name); +XBT_PUBLIC(sg_size_t) MSG_storage_get_free_size(const char* name); +XBT_PUBLIC(sg_size_t) MSG_storage_get_used_size(const char* name); 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(void) MSG_storage_set_property_value(msg_storage_t storage, const char *name, char *value,void_f_pvoid_t free_ctn); @@ -106,7 +106,7 @@ XBT_PUBLIC(xbt_dynar_t) MSG_storages_as_dynar(void); XBT_PUBLIC(msg_error_t) MSG_storage_set_data(msg_storage_t host, void *data); XBT_PUBLIC(void *) MSG_storage_get_data(msg_storage_t storage); XBT_PUBLIC(xbt_dict_t) MSG_storage_get_content(msg_storage_t storage); -XBT_PUBLIC(sg_storage_size_t) MSG_storage_get_size(msg_storage_t storage); +XBT_PUBLIC(sg_size_t) MSG_storage_get_size(msg_storage_t storage); XBT_PUBLIC(msg_error_t) MSG_storage_file_move(msg_file_t fd, msg_host_t dest, char* mount, char* fullname); XBT_PUBLIC(msg_error_t) MSG_storage_file_rename(msg_storage_t storage, const char* src, const char* dest); /************************** AS Router handling ************************************/ diff --git a/include/simgrid/platf.h b/include/simgrid/platf.h index b888225419..9358eba867 100644 --- a/include/simgrid/platf.h +++ b/include/simgrid/platf.h @@ -10,6 +10,8 @@ #define SG_PLATF_H #include +#define __STDC_FORMAT_MACROS +#include typedef void *sg_routing_link_t; /* FIXME:The actual type is model-dependent so use void* instead*/ typedef struct RoutingEdge *sg_routing_edge_t; @@ -93,9 +95,8 @@ typedef xbt_dictelm_t sg_storage_t; static inline char* sg_storage_name(sg_storage_t storage) { return storage->key; } -/* Type for any integer storage size */ -typedef uint64_t sg_storage_size_t; - +/* Type for any simgrid size size */ +typedef uint64_t sg_size_t; /* * Platform creation functions. Instead of passing 123 arguments to the creation functions @@ -252,7 +253,7 @@ typedef struct { const char* content; const char* content_type; xbt_dict_t properties; - sg_storage_size_t size; + sg_size_t size; } s_sg_platf_storage_type_cbarg_t, *sg_platf_storage_type_cbarg_t; #define SG_PLATF_STORAGE_TYPE_INITIALIZER {NULL,NULL,NULL,NULL,NULL} diff --git a/include/simgrid/simix.h b/include/simgrid/simix.h index 8e9db8c2df..911605bc39 100644 --- a/include/simgrid/simix.h +++ b/include/simgrid/simix.h @@ -506,24 +506,24 @@ XBT_PUBLIC(int) simcall_sem_get_capacity(smx_sem_t sem); /***************************** File **********************************/ XBT_PUBLIC(void *) simcall_file_get_data(smx_file_t fd); XBT_PUBLIC(void) simcall_file_set_data(smx_file_t fd, void *data); -XBT_PUBLIC(sg_storage_size_t) simcall_file_read(smx_file_t fd, sg_storage_size_t size); -XBT_PUBLIC(sg_storage_size_t) simcall_file_write(smx_file_t fd, sg_storage_size_t size); +XBT_PUBLIC(sg_size_t) simcall_file_read(smx_file_t fd, sg_size_t size); +XBT_PUBLIC(sg_size_t) simcall_file_write(smx_file_t fd, sg_size_t size); XBT_PUBLIC(smx_file_t) simcall_file_open(const char* storage, const char* path); XBT_PUBLIC(int) simcall_file_close(smx_file_t fd); XBT_PUBLIC(int) simcall_file_unlink(smx_file_t fd); XBT_PUBLIC(xbt_dict_t) simcall_file_ls(const char* mount, const char* path); -XBT_PUBLIC(sg_storage_size_t) simcall_file_get_size(smx_file_t fd); +XBT_PUBLIC(sg_size_t) simcall_file_get_size(smx_file_t fd); XBT_PUBLIC(xbt_dynar_t) simcall_file_get_info(smx_file_t fd); /***************************** Storage **********************************/ -XBT_PUBLIC(sg_storage_size_t) simcall_storage_get_free_size (const char* name); -XBT_PUBLIC(sg_storage_size_t) simcall_storage_get_used_size (const char* name); +XBT_PUBLIC(sg_size_t) simcall_storage_get_free_size (const char* name); +XBT_PUBLIC(sg_size_t) simcall_storage_get_used_size (const char* name); XBT_PUBLIC(xbt_dict_t) simcall_storage_get_properties(smx_storage_t storage); 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); -XBT_PUBLIC(sg_storage_size_t) SIMIX_storage_get_size(smx_storage_t storage); +XBT_PUBLIC(sg_size_t) SIMIX_storage_get_size(smx_storage_t storage); XBT_PUBLIC(void) simcall_storage_file_rename(smx_storage_t storage, const char* src, const char* dest); /************************** AS router **********************************/ XBT_PUBLIC(xbt_dict_t) SIMIX_asr_get_properties(const char *name); diff --git a/src/bindings/java/jmsg_file.c b/src/bindings/java/jmsg_file.c index fb2557ada8..50f1799091 100644 --- a/src/bindings/java/jmsg_file.c +++ b/src/bindings/java/jmsg_file.c @@ -38,13 +38,13 @@ Java_org_simgrid_msg_File_open(JNIEnv *env, jobject jfile, jobject jstorage, job JNIEXPORT jlong JNICALL Java_org_simgrid_msg_File_read(JNIEnv *env, jobject jfile, jlong jsize) { msg_file_t file = jfile_get_native(env, jfile); - return (jlong)MSG_file_read(file, (sg_storage_size_t)jsize); + return (jlong)MSG_file_read(file, (sg_size_t)jsize); } JNIEXPORT jlong JNICALL Java_org_simgrid_msg_File_write(JNIEnv *env, jobject jfile, jlong jsize) { msg_file_t file = jfile_get_native(env, jfile); - return (jlong)MSG_file_write(file, (sg_storage_size_t)jsize); + return (jlong)MSG_file_write(file, (sg_size_t)jsize); } JNIEXPORT void JNICALL Java_org_simgrid_msg_File_close(JNIEnv *env, jobject jfile) { diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index 97bdd5705d..67db839fb5 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -185,7 +185,7 @@ typedef enum { typedef struct ws_params { int ncpus; - long ramsize; + sg_size_t ramsize; int overcommit; /* The size of other states than memory pages, which is out-of-scope of dirty @@ -263,11 +263,11 @@ surf_action_t surf_workstation_execute(surf_resource_t resource, double size); surf_action_t surf_workstation_sleep(surf_resource_t resource, double duration); surf_action_t surf_workstation_open(surf_resource_t workstation, const char* mount, const char* path); surf_action_t surf_workstation_close(surf_resource_t workstation, surf_file_t fd); -surf_action_t surf_workstation_read(surf_resource_t resource, surf_file_t fd, sg_storage_size_t size); -surf_action_t surf_workstation_write(surf_resource_t resource, surf_file_t fd, sg_storage_size_t size); +surf_action_t surf_workstation_read(surf_resource_t resource, surf_file_t fd, sg_size_t size); +surf_action_t surf_workstation_write(surf_resource_t resource, surf_file_t fd, sg_size_t size); xbt_dynar_t surf_workstation_get_info(surf_resource_t resource, surf_file_t fd); -sg_storage_size_t surf_workstation_get_free_size(surf_resource_t resource, const char* name); -sg_storage_size_t surf_workstation_get_used_size(surf_resource_t resource, const char* name); +sg_size_t surf_workstation_get_free_size(surf_resource_t resource, const char* name); +sg_size_t surf_workstation_get_used_size(surf_resource_t resource, const char* name); xbt_dynar_t surf_workstation_get_vms(surf_resource_t resource); void surf_workstation_get_params(surf_resource_t resource, ws_params_t params); void surf_workstation_set_params(surf_resource_t resource, ws_params_t params); @@ -295,7 +295,7 @@ int surf_network_link_is_shared(surf_cpp_resource_t link); double surf_network_link_get_bandwidth(surf_cpp_resource_t link); double surf_network_link_get_latency(surf_cpp_resource_t link); xbt_dict_t surf_storage_get_content(surf_resource_t resource); -sg_storage_size_t surf_storage_get_size(surf_resource_t resource); +sg_size_t surf_storage_get_size(surf_resource_t resource); void surf_storage_rename(surf_resource_t resource, const char* src, const char* dest); void *surf_action_get_data(surf_action_t action); void surf_action_set_data(surf_action_t action, void *data); diff --git a/src/msg/msg_io.c b/src/msg/msg_io.c index 0b816a15e7..0ce1bc7717 100644 --- a/src/msg/msg_io.c +++ b/src/msg/msg_io.c @@ -21,13 +21,13 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_io, msg, /********************************* File **************************************/ void __MSG_file_get_info(msg_file_t fd){ xbt_dynar_t info = simcall_file_get_info(fd->simdata->smx_file); - sg_storage_size_t *psize; + sg_size_t *psize; fd->info->content_type = xbt_dynar_pop_as(info, char *); fd->info->storage_type = xbt_dynar_pop_as(info, char *); fd->info->storageId = xbt_dynar_pop_as(info, char *); fd->info->mount_point = xbt_dynar_pop_as(info, char *); - psize = xbt_dynar_pop_as(info, sg_storage_size_t*); + psize = xbt_dynar_pop_as(info, sg_size_t*); fd->info->size = *psize; xbt_free(psize); xbt_dynar_free_container(&info); @@ -88,7 +88,7 @@ void MSG_file_dump (msg_file_t fd){ * \param fd is a the file descriptor * \return the number of bytes successfully read */ -sg_storage_size_t MSG_file_read(msg_file_t fd, sg_storage_size_t size) +sg_size_t MSG_file_read(msg_file_t fd, sg_size_t size) { return simcall_file_read(fd->simdata->smx_file, size); } @@ -100,7 +100,7 @@ sg_storage_size_t MSG_file_read(msg_file_t fd, sg_storage_size_t size) * \param fd is a the file descriptor * \return the number of bytes successfully write */ -sg_storage_size_t MSG_file_write(msg_file_t fd, sg_storage_size_t size) +sg_size_t MSG_file_write(msg_file_t fd, sg_size_t size) { return simcall_file_write(fd->simdata->smx_file, size); } @@ -161,9 +161,9 @@ int MSG_file_unlink(msg_file_t fd) * \brief Return the size of a file * * \param fd is the file descriptor (#msg_file_t) - * \return the size of the file (as a sg_storage_size_t) + * \return the size of the file (as a sg_size_t) */ -sg_storage_size_t MSG_file_get_size(msg_file_t fd){ +sg_size_t MSG_file_get_size(msg_file_t fd){ return simcall_file_get_size(fd->simdata->smx_file); } @@ -195,7 +195,7 @@ xbt_dict_t MSG_file_ls(const char *mount, const char *path) * Set the file position indicator in the msg_file_t by adding offset bytes * to the position specified by whence (either SEEK_SET, SEEK_CUR, or SEEK_END). */ -msg_error_t MSG_file_seek (msg_file_t fd, sg_storage_size_t offset, int whence) +msg_error_t MSG_file_seek (msg_file_t fd, sg_size_t offset, int whence) { THROW_UNIMPLEMENTED; return MSG_OK; @@ -239,18 +239,18 @@ const char *MSG_storage_get_name(msg_storage_t storage) { /** \ingroup msg_storage_management * \brief Returns the free space size of a storage element * \param name the name of a storage - * \return the free space size of the storage element (as a sg_storage_size_t) + * \return the free space size of the storage element (as a sg_size_t) */ -sg_storage_size_t MSG_storage_get_free_size(const char* name){ +sg_size_t MSG_storage_get_free_size(const char* name){ return simcall_storage_get_free_size(name); } /** \ingroup msg_storage_management * \brief Returns the used space size of a storage element * \param name the name of a storage - * \return the used space size of the storage element (as a sg_storage_size_t) + * \return the used space size of the storage element (as a sg_size_t) */ -sg_storage_size_t MSG_storage_get_used_size(const char* name){ +sg_size_t MSG_storage_get_used_size(const char* name){ return simcall_storage_get_used_size(name); } @@ -344,7 +344,7 @@ xbt_dict_t MSG_storage_get_content(msg_storage_t storage) return SIMIX_storage_get_content(storage); } -sg_storage_size_t MSG_storage_get_size(msg_storage_t storage) +sg_size_t MSG_storage_get_size(msg_storage_t storage) { return SIMIX_storage_get_size(storage); } diff --git a/src/msg/msg_vm.c b/src/msg/msg_vm.c index 0bc20d94f7..a814aa7a58 100644 --- a/src/msg/msg_vm.c +++ b/src/msg/msg_vm.c @@ -21,6 +21,7 @@ #include "msg_private.h" #include "xbt/sysdep.h" #include "xbt/log.h" +#include "simgrid/platf.h" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_vm, msg, "Cloud-oriented parts of the MSG API"); @@ -798,7 +799,7 @@ const double alpha = 0.22L * 1.0E8 / (80L * 1024 * 1024); static void send_migration_data(const char *vm_name, const char *src_pm_name, const char *dst_pm_name, - double size, char *mbox, int stage, int stage2_round, double mig_speed, double xfer_cpu_overhead) + sg_size_t size, char *mbox, int stage, int stage2_round, double mig_speed, double xfer_cpu_overhead) { char *task_name = get_mig_task_name(vm_name, src_pm_name, dst_pm_name, stage); msg_task_t task = MSG_task_create(task_name, 0, size, NULL); @@ -833,9 +834,9 @@ static void send_migration_data(const char *vm_name, const char *src_pm_name, co if (stage == 2){ - XBT_DEBUG("mig-stage%d.%d: sent %f duration %f actual_speed %f (target %f) cpu %f", stage, stage2_round, size, duration, actual_speed, mig_speed, cpu_utilization);} + XBT_DEBUG("mig-stage%d.%d: sent %" PRIu64 " duration %f actual_speed %f (target %f) cpu %f", stage, stage2_round, size, duration, actual_speed, mig_speed, cpu_utilization);} else{ - XBT_DEBUG("mig-stage%d: sent %f duration %f actual_speed %f (target %f) cpu %f", stage, size, duration, actual_speed, mig_speed, cpu_utilization); + XBT_DEBUG("mig-stage%d: sent %" PRIu64 " duration %f actual_speed %f (target %f) cpu %f", stage, size, duration, actual_speed, mig_speed, cpu_utilization); } xbt_free(task_name); @@ -871,18 +872,18 @@ static double get_updated_size(double computed, double dp_rate, double dp_cap) } static double send_stage1(msg_host_t vm, const char *src_pm_name, const char *dst_pm_name, - long ramsize, double mig_speed, double xfer_cpu_overhead, double dp_rate, double dp_cap, double dpt_cpu_overhead) + sg_size_t ramsize, double mig_speed, double xfer_cpu_overhead, double dp_rate, double dp_cap, double dpt_cpu_overhead) { const char *vm_name = MSG_host_get_name(vm); char *mbox = get_mig_mbox_src_dst(vm_name, src_pm_name, dst_pm_name); // const long chunksize = 1024 * 1024 * 100; - const unsigned long chunksize = 1024u * 1024u * 100000; - long remaining = ramsize; + const sg_size_t chunksize = 1024L * 1024 * 100000; + sg_size_t remaining = ramsize; double computed_total = 0; while (remaining > 0) { - long datasize = chunksize; + sg_size_t datasize = chunksize; if (remaining < chunksize) datasize = remaining; @@ -928,7 +929,7 @@ static int migration_tx_fun(int argc, char *argv[]) s_ws_params_t params; simcall_host_get_params(vm, ¶ms); - const long ramsize = params.ramsize; + const sg_size_t ramsize = params.ramsize; const long devsize = params.devsize; const int skip_stage1 = params.skip_stage1; const int skip_stage2 = params.skip_stage2; diff --git a/src/simix/smx_io.c b/src/simix/smx_io.c index f3ba022bfe..9f1585be08 100644 --- a/src/simix/smx_io.c +++ b/src/simix/smx_io.c @@ -71,14 +71,14 @@ void SIMIX_file_set_data(smx_file_t fd, void *data){ } //SIMIX FILE READ -void SIMIX_pre_file_read(smx_simcall_t simcall, smx_file_t fd, sg_storage_size_t size) +void SIMIX_pre_file_read(smx_simcall_t simcall, smx_file_t fd, sg_size_t size) { smx_action_t action = SIMIX_file_read(simcall->issuer, fd, size); xbt_fifo_push(action->simcalls, simcall); simcall->issuer->waiting_action = action; } -smx_action_t SIMIX_file_read(smx_process_t process, smx_file_t fd, sg_storage_size_t size) +smx_action_t SIMIX_file_read(smx_process_t process, smx_file_t fd, sg_size_t size) { smx_action_t action; smx_host_t host = process->smx_host; @@ -106,14 +106,14 @@ smx_action_t SIMIX_file_read(smx_process_t process, smx_file_t fd, sg_storage_si } //SIMIX FILE WRITE -void SIMIX_pre_file_write(smx_simcall_t simcall, smx_file_t fd, sg_storage_size_t size) +void SIMIX_pre_file_write(smx_simcall_t simcall, smx_file_t fd, sg_size_t size) { smx_action_t action = SIMIX_file_write(simcall->issuer, fd, size); xbt_fifo_push(action->simcalls, simcall); simcall->issuer->waiting_action = action; } -smx_action_t SIMIX_file_write(smx_process_t process, smx_file_t fd, sg_storage_size_t size) +smx_action_t SIMIX_file_write(smx_process_t process, smx_file_t fd, sg_size_t size) { smx_action_t action; smx_host_t host = process->smx_host; @@ -268,12 +268,12 @@ smx_action_t SIMIX_file_ls(smx_process_t process, const char* mount, const char return action; } -sg_storage_size_t SIMIX_pre_file_get_size(smx_simcall_t simcall, smx_file_t fd) +sg_size_t SIMIX_pre_file_get_size(smx_simcall_t simcall, smx_file_t fd) { return SIMIX_file_get_size(simcall->issuer, fd); } -sg_storage_size_t SIMIX_file_get_size(smx_process_t process, smx_file_t fd) +sg_size_t SIMIX_file_get_size(smx_process_t process, smx_file_t fd) { smx_host_t host = process->smx_host; return surf_workstation_get_size(host, fd->surf_file); @@ -300,23 +300,23 @@ void SIMIX_storage_file_rename(smx_process_t process, smx_storage_t storage, con return surf_storage_rename(storage, src, dest); } -sg_storage_size_t SIMIX_pre_storage_get_free_size(smx_simcall_t simcall, const char* name) +sg_size_t SIMIX_pre_storage_get_free_size(smx_simcall_t simcall, const char* name) { return SIMIX_storage_get_free_size(simcall->issuer, name); } -sg_storage_size_t SIMIX_storage_get_free_size(smx_process_t process, const char* name) +sg_size_t SIMIX_storage_get_free_size(smx_process_t process, const char* name) { smx_host_t host = process->smx_host; return surf_workstation_get_free_size(host, name); } -sg_storage_size_t SIMIX_pre_storage_get_used_size(smx_simcall_t simcall, const char* name) +sg_size_t SIMIX_pre_storage_get_used_size(smx_simcall_t simcall, const char* name) { return SIMIX_storage_get_used_size(simcall->issuer, name); } -sg_storage_size_t SIMIX_storage_get_used_size(smx_process_t process, const char* name) +sg_size_t SIMIX_storage_get_used_size(smx_process_t process, const char* name) { smx_host_t host = process->smx_host; return surf_workstation_get_used_size(host, name); @@ -368,7 +368,7 @@ xbt_dict_t SIMIX_storage_get_content(smx_storage_t storage){ return surf_storage_get_content(storage); } -sg_storage_size_t SIMIX_storage_get_size(smx_storage_t storage){ +sg_size_t SIMIX_storage_get_size(smx_storage_t storage){ xbt_assert((storage != NULL), "Invalid parameters (simix storage is NULL)"); return surf_storage_get_size(storage); } diff --git a/src/simix/smx_io_private.h b/src/simix/smx_io_private.h index 864656b943..88eee721c0 100644 --- a/src/simix/smx_io_private.h +++ b/src/simix/smx_io_private.h @@ -24,37 +24,37 @@ smx_storage_t SIMIX_storage_create(const char *name, void *storage, void *data); void SIMIX_storage_destroy(void *s); void* SIMIX_pre_file_get_data(smx_simcall_t simcall,smx_file_t fd); void SIMIX_pre_file_set_data(smx_simcall_t simcall, smx_file_t fd, void *data); -void SIMIX_pre_file_read(smx_simcall_t simcall, smx_file_t fd, sg_storage_size_t size); -void SIMIX_pre_file_write(smx_simcall_t simcall,smx_file_t fd, sg_storage_size_t size); +void SIMIX_pre_file_read(smx_simcall_t simcall, smx_file_t fd, sg_size_t size); +void SIMIX_pre_file_write(smx_simcall_t simcall,smx_file_t fd, sg_size_t size); void SIMIX_pre_file_open(smx_simcall_t simcall, const char* mount, const char* path); void SIMIX_pre_file_close(smx_simcall_t simcall, smx_file_t fd); int SIMIX_pre_file_unlink(smx_simcall_t simcall, smx_file_t fd); void SIMIX_pre_file_ls(smx_simcall_t simcall, const char* mount, const char* path); -sg_storage_size_t SIMIX_pre_file_get_size(smx_simcall_t simcall, smx_file_t fd); +sg_size_t SIMIX_pre_file_get_size(smx_simcall_t simcall, smx_file_t fd); xbt_dynar_t SIMIX_pre_file_get_info(smx_simcall_t simcall, smx_file_t fd); void SIMIX_pre_storage_file_rename(smx_simcall_t simcall,smx_storage_t storage, const char* src, const char* dest); void* SIMIX_file_get_data(smx_file_t fd); void SIMIX_file_set_data(smx_file_t fd, void *data); -smx_action_t SIMIX_file_read(smx_process_t process, smx_file_t fd, sg_storage_size_t size); -smx_action_t SIMIX_file_write(smx_process_t process, smx_file_t fd, sg_storage_size_t size); +smx_action_t SIMIX_file_read(smx_process_t process, smx_file_t fd, sg_size_t size); +smx_action_t SIMIX_file_write(smx_process_t process, smx_file_t fd, sg_size_t size); smx_action_t SIMIX_file_open(smx_process_t process, const char* storage, const char* path); smx_action_t SIMIX_file_close(smx_process_t process, smx_file_t fd); int SIMIX_file_unlink(smx_process_t process, smx_file_t fd); smx_action_t SIMIX_file_ls(smx_process_t process, const char *mount, const char *path); -sg_storage_size_t SIMIX_file_get_size(smx_process_t process, smx_file_t fd); +sg_size_t SIMIX_file_get_size(smx_process_t process, smx_file_t fd); xbt_dynar_t SIMIX_file_get_info(smx_process_t process, smx_file_t fd); void SIMIX_storage_file_rename(smx_process_t process, smx_storage_t storage, const char* src, const char* dest); -sg_storage_size_t SIMIX_pre_storage_get_free_size(smx_simcall_t simcall,const char* name); -sg_storage_size_t SIMIX_storage_get_free_size(smx_process_t process,const char* name); +sg_size_t SIMIX_pre_storage_get_free_size(smx_simcall_t simcall,const char* name); +sg_size_t SIMIX_storage_get_free_size(smx_process_t process,const char* name); -sg_storage_size_t SIMIX_pre_storage_get_used_size(smx_simcall_t simcall,const char* name); -sg_storage_size_t SIMIX_storage_get_used_size(smx_process_t process,const char* name); +sg_size_t SIMIX_pre_storage_get_used_size(smx_simcall_t simcall,const char* name); +sg_size_t SIMIX_storage_get_used_size(smx_process_t process,const char* name); xbt_dict_t SIMIX_storage_get_properties(smx_storage_t storage); xbt_dict_t SIMIX_pre_storage_get_properties(smx_simcall_t, smx_storage_t); diff --git a/src/simix/smx_smurf_private.h b/src/simix/smx_smurf_private.h index 89b6d68d2e..742917e02d 100644 --- a/src/simix/smx_smurf_private.h +++ b/src/simix/smx_smurf_private.h @@ -92,7 +92,7 @@ #define TFPTR(n) (n, FPtr, fp, FPtr) #define TCPTR(n) (n, const void*, cp) #define TSIZE(n) (n, size_t, si) -#define TSGSTSIZE(n) (n, sg_storage_size_t, sgstsi) +#define TSGSTSIZE(n) (n, sg_size_t, sgstsi) #define TVOID(n) (n, void) #define TDSPEC(n,t) (n, t, dp, void*) #define TFSPEC(n,t) (n, t, fp, FPtr) @@ -464,7 +464,7 @@ union u_smx_scalar { float f; double d; size_t si; - sg_storage_size_t sgstsi; + sg_size_t sgstsi; void* dp; FPtr fp; const void* cp; diff --git a/src/simix/smx_user.c b/src/simix/smx_user.c index 5c8bfea28c..d0aa664135 100644 --- a/src/simix/smx_user.c +++ b/src/simix/smx_user.c @@ -1419,7 +1419,7 @@ void simcall_file_set_data(smx_file_t fd, void *data) * \ingroup simix_file_management * */ -sg_storage_size_t simcall_file_read(smx_file_t fd, sg_storage_size_t size) +sg_size_t simcall_file_read(smx_file_t fd, sg_size_t size) { return simcall_BODY_file_read(fd, size); } @@ -1428,7 +1428,7 @@ sg_storage_size_t simcall_file_read(smx_file_t fd, sg_storage_size_t size) * \ingroup simix_file_management * */ -sg_storage_size_t simcall_file_write(smx_file_t fd, sg_storage_size_t size) +sg_size_t simcall_file_write(smx_file_t fd, sg_size_t size) { return simcall_BODY_file_write(fd, size); } @@ -1472,7 +1472,7 @@ xbt_dict_t simcall_file_ls(const char* mount, const char* path) * \ingroup simix_file_management * */ -sg_storage_size_t simcall_file_get_size (smx_file_t fd){ +sg_size_t simcall_file_get_size (smx_file_t fd){ return simcall_BODY_file_get_size(fd); } @@ -1498,9 +1498,9 @@ void simcall_storage_file_rename(smx_storage_t storage, const char* src, const * \ingroup simix_storage_management * \brief Returns the free space size on a given storage element. * \param storage name - * \return Return the free space size on a given storage element (as sg_storage_size_t) + * \return Return the free space size on a given storage element (as sg_size_t) */ -sg_storage_size_t simcall_storage_get_free_size (const char* name){ +sg_size_t simcall_storage_get_free_size (const char* name){ return simcall_BODY_storage_get_free_size(name); } @@ -1508,9 +1508,9 @@ sg_storage_size_t simcall_storage_get_free_size (const char* name){ * \ingroup simix_storage_management * \brief Returns the used space size on a given storage element. * \param storage name - * \return Return the used space size on a given storage element (as sg_storage_size_t) + * \return Return the used space size on a given storage element (as sg_size_t) */ -sg_storage_size_t simcall_storage_get_used_size (const char* name){ +sg_size_t simcall_storage_get_used_size (const char* name){ return simcall_BODY_storage_get_used_size(name); } diff --git a/src/surf/network.cpp b/src/surf/network.cpp index 972411261b..e8e886e3ee 100644 --- a/src/surf/network.cpp +++ b/src/surf/network.cpp @@ -248,7 +248,7 @@ void surf_network_model_init_Vegas(void) xbt_cfg_setdefault_double(_sg_cfg_set, "network/weight_S", 8775); } -NetworkCm02Model::NetworkCm02Model() : Model("network"){ +NetworkCm02Model::NetworkCm02Model() : NetworkCm02Model("network"){ } NetworkCm02Model::NetworkCm02Model(string name) : Model(name){ diff --git a/src/surf/storage.cpp b/src/surf/storage.cpp index d0b2766967..72ed082b31 100644 --- a/src/surf/storage.cpp +++ b/src/surf/storage.cpp @@ -2,7 +2,6 @@ #include "surf_private.h" #define __STDC_FORMAT_MACROS -#include extern "C" { XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_storage, surf, @@ -127,7 +126,7 @@ static void storage_parse_storage(sg_platf_storage_cbarg_t storage) (void *) xbt_strdup(storage->type_id)); } -static xbt_dict_t parse_storage_content(char *filename, sg_storage_size_t *used_size) +static xbt_dict_t parse_storage_content(char *filename, sg_size_t *used_size) { *used_size = 0; if ((!filename) || (strcmp(filename, "") == 0)) @@ -144,14 +143,14 @@ static xbt_dict_t parse_storage_content(char *filename, sg_storage_size_t *used_ size_t len = 0; ssize_t read; char path[1024]; - sg_storage_size_t size; + sg_size_t size; while ((read = xbt_getline(&line, &len, file)) != -1) { if (read){ if(sscanf(line,"%s %" SCNu64, path, &size) == 2) { *used_size += size; - sg_storage_size_t *psize = xbt_new(sg_storage_size_t, 1); + sg_size_t *psize = xbt_new(sg_size_t, 1); *psize = size; xbt_dict_set(parse_content,path,psize,NULL); } else { @@ -366,12 +365,12 @@ void StorageModel::updateActionsState(double now, double delta) // For each action of type write double rate = lmm_variable_getvalue(action->p_variable); /* Hack to avoid rounding differences between x86 and x86_64 - * (note that the next sizes are of type sg_storage_size_t). */ + * (note that the next sizes are of type sg_size_t). */ long incr = delta * rate + MAXMIN_PRECISION; action->p_storage->m_usedSize += incr; // disk usage action->p_file->size += incr; // file size - sg_storage_size_t *psize = xbt_new(sg_storage_size_t,1); + sg_size_t *psize = xbt_new(sg_size_t,1); *psize = action->p_file->size; xbt_dict_t content_dict = action->p_storage->p_content; @@ -423,14 +422,14 @@ xbt_dict_t Storage::parseContent(char *filename) size_t len = 0; ssize_t read; char path[1024]; - sg_storage_size_t size; + sg_size_t size; while ((read = xbt_getline(&line, &len, file)) != -1) { if (read){ if(sscanf(line,"%s %" SCNu64, path, &size) == 2) { m_usedSize += size; - sg_storage_size_t *psize = xbt_new(sg_storage_size_t, 1); + sg_size_t *psize = xbt_new(sg_size_t, 1); *psize = size; xbt_dict_set(parse_content,path,psize,NULL); } else { @@ -491,7 +490,7 @@ StorageActionPtr StorageLmm::ls(const char* path) xbt_dict_t ls_dict = xbt_dict_new_homogeneous(xbt_free); char* key; - sg_storage_size_t size = 0; + sg_size_t size = 0; xbt_dict_cursor_t cursor = NULL; xbt_dynar_t dyn = NULL; @@ -509,7 +508,7 @@ StorageActionPtr StorageLmm::ls(const char* path) // file if(xbt_dynar_length(dyn) == 1){ - sg_storage_size_t *psize = xbt_new(sg_storage_size_t, 1); + sg_size_t *psize = xbt_new(sg_size_t, 1); *psize=size; xbt_dict_set(ls_dict, file, psize, NULL); } @@ -531,13 +530,13 @@ StorageActionPtr StorageLmm::ls(const char* path) StorageActionPtr StorageLmm::open(const char* mount, const char* path) { XBT_DEBUG("\tOpen file '%s'",path); - sg_storage_size_t size, *psize; - psize = (sg_storage_size_t*) xbt_dict_get_or_null(p_content, path); + sg_size_t size, *psize; + psize = (sg_size_t*) xbt_dict_get_or_null(p_content, path); // if file does not exist create an empty file if(psize) size = *psize; else { - psize = xbt_new(sg_storage_size_t,1); + psize = xbt_new(sg_size_t,1); size = 0; *psize = size; xbt_dict_set(p_content, path, psize, NULL); @@ -573,7 +572,7 @@ StorageActionPtr StorageLmm::close(surf_file_t fd) return action; } -StorageActionPtr StorageLmm::read(surf_file_t fd, sg_storage_size_t size) +StorageActionPtr StorageLmm::read(surf_file_t fd, sg_size_t size) { if(size > fd->size) size = fd->size; @@ -581,7 +580,7 @@ StorageActionPtr StorageLmm::read(surf_file_t fd, sg_storage_size_t size) return action; } -StorageActionPtr StorageLmm::write(surf_file_t fd, sg_storage_size_t size) +StorageActionPtr StorageLmm::write(surf_file_t fd, sg_size_t size) { char *filename = fd->name; XBT_DEBUG("\tWrite file '%s' size '%" PRIu64 "/%" PRIu64 "'",filename,size,fd->size); @@ -598,9 +597,9 @@ StorageActionPtr StorageLmm::write(surf_file_t fd, sg_storage_size_t size) void StorageLmm::rename(const char *src, const char *dest) { - sg_storage_size_t *psize, *new_psize; - psize = (sg_storage_size_t*) xbt_dict_get_or_null(p_content,src); - new_psize = xbt_new(sg_storage_size_t, 1); + sg_size_t *psize, *new_psize; + psize = (sg_size_t*) xbt_dict_get_or_null(p_content,src); + new_psize = xbt_new(sg_size_t, 1); *new_psize = *psize; if (psize){// src file exists xbt_dict_remove(p_content, src); @@ -619,7 +618,7 @@ xbt_dict_t StorageLmm::getContent() xbt_dict_t content_dict = xbt_dict_new_homogeneous(NULL); xbt_dict_cursor_t cursor = NULL; char *file; - sg_storage_size_t *psize; + sg_size_t *psize; xbt_dict_foreach(p_content, cursor, file, psize){ xbt_dict_set(content_dict,file,psize,NULL); @@ -627,7 +626,7 @@ xbt_dict_t StorageLmm::getContent() return content_dict; } -sg_storage_size_t StorageLmm::getSize(){ +sg_size_t StorageLmm::getSize(){ return m_size; } diff --git a/src/surf/storage.hpp b/src/surf/storage.hpp index bf16cef88b..874bb1a767 100644 --- a/src/surf/storage.hpp +++ b/src/surf/storage.hpp @@ -50,20 +50,20 @@ public: xbt_dict_t p_content; char* p_contentType; - sg_storage_size_t m_size; - sg_storage_size_t m_usedSize; + sg_size_t m_size; + sg_size_t m_usedSize; char * p_typeId; virtual StorageActionPtr open(const char* mount, const char* path)=0; virtual StorageActionPtr close(surf_file_t fd)=0; //virtual StorageActionPtr unlink(surf_file_t fd)=0; virtual StorageActionPtr ls(const char *path)=0; - virtual StorageActionPtr read(surf_file_t fd, sg_storage_size_t size)=0; - virtual StorageActionPtr write(surf_file_t fd, sg_storage_size_t size)=0; + virtual StorageActionPtr read(surf_file_t fd, sg_size_t size)=0; + virtual StorageActionPtr write(surf_file_t fd, sg_size_t size)=0; virtual void rename(const char *src, const char *dest)=0; virtual xbt_dict_t getContent()=0; - virtual sg_storage_size_t getSize()=0; + virtual sg_size_t getSize()=0; xbt_dict_t parseContent(char *filename); @@ -81,9 +81,9 @@ public: //StorageActionPtr unlink(surf_file_t fd); StorageActionPtr ls(const char *path); xbt_dict_t getContent(); - sg_storage_size_t getSize(); - StorageActionPtr read(surf_file_t fd, sg_storage_size_t size);//FIXME:why we have a useless param ptr ?? - StorageActionPtr write(surf_file_t fd, sg_storage_size_t size);//FIXME:why we have a useless param ptr ?? + sg_size_t getSize(); + StorageActionPtr read(surf_file_t fd, sg_size_t size);//FIXME:why we have a useless param ptr ?? + StorageActionPtr write(surf_file_t fd, sg_size_t size);//FIXME:why we have a useless param ptr ?? void rename(const char *src, const char *dest); lmm_constraint_t p_constraintWrite; /* Constraint for maximum write bandwidth*/ @@ -135,7 +135,7 @@ typedef struct s_storage_type { char *content_type; char *type_id; xbt_dict_t properties; - sg_storage_size_t size; + sg_size_t size; } s_storage_type_t, *storage_type_t; typedef struct s_mount { @@ -146,7 +146,7 @@ typedef struct s_mount { typedef struct surf_file { char *name; char *mount; - sg_storage_size_t size; + sg_size_t size; } s_surf_file_t; diff --git a/src/surf/surf_interface.cpp b/src/surf/surf_interface.cpp index b23ea89db2..9f9f50c1dc 100644 --- a/src/surf/surf_interface.cpp +++ b/src/surf/surf_interface.cpp @@ -349,11 +349,11 @@ size_t surf_workstation_get_size(surf_resource_t workstation, surf_file_t fd){ return get_casted_workstation(workstation)->getSize(fd); } -surf_action_t surf_workstation_read(surf_resource_t resource, surf_file_t fd, sg_storage_size_t size){ +surf_action_t surf_workstation_read(surf_resource_t resource, surf_file_t fd, sg_size_t size){ return get_casted_workstation(resource)->read(fd, size); } -surf_action_t surf_workstation_write(surf_resource_t resource, surf_file_t fd, sg_storage_size_t size){ +surf_action_t surf_workstation_write(surf_resource_t resource, surf_file_t fd, sg_size_t size){ return get_casted_workstation(resource)->write(fd, size); } @@ -361,11 +361,11 @@ xbt_dynar_t surf_workstation_get_info(surf_resource_t resource, surf_file_t fd){ return get_casted_workstation(resource)->getInfo(fd); } -sg_storage_size_t surf_workstation_get_free_size(surf_resource_t resource, const char* name){ +sg_size_t surf_workstation_get_free_size(surf_resource_t resource, const char* name){ return get_casted_workstation(resource)->getFreeSize(name); } -sg_storage_size_t surf_workstation_get_used_size(surf_resource_t resource, const char* name){ +sg_size_t surf_workstation_get_used_size(surf_resource_t resource, const char* name){ return get_casted_workstation(resource)->getUsedSize(name); } @@ -433,7 +433,7 @@ xbt_dict_t surf_storage_get_content(surf_resource_t resource){ return dynamic_cast(static_cast(surf_storage_resource_priv(resource)))->getContent(); } -sg_storage_size_t surf_storage_get_size(surf_resource_t resource){ +sg_size_t surf_storage_get_size(surf_resource_t resource){ return dynamic_cast(static_cast(surf_storage_resource_priv(resource)))->getSize(); } diff --git a/src/surf/workstation.cpp b/src/surf/workstation.cpp index 4771d97823..5bf2506acf 100644 --- a/src/surf/workstation.cpp +++ b/src/surf/workstation.cpp @@ -307,13 +307,13 @@ ActionPtr WorkstationCLM03::close(surf_file_t fd) { return st->close(fd); } -ActionPtr WorkstationCLM03::read(surf_file_t fd, sg_storage_size_t size) { +ActionPtr WorkstationCLM03::read(surf_file_t fd, sg_size_t size) { StoragePtr st = findStorageOnMountList(fd->mount); XBT_DEBUG("READ on disk '%s'",st->m_name); return st->read(fd, size); } -ActionPtr WorkstationCLM03::write(surf_file_t fd, sg_storage_size_t size) { +ActionPtr WorkstationCLM03::write(surf_file_t fd, sg_size_t size) { StoragePtr st = findStorageOnMountList(fd->mount); XBT_DEBUG("WRITE on disk '%s'",st->m_name); return st->write(fd, size); @@ -352,17 +352,17 @@ ActionPtr WorkstationCLM03::ls(const char* mount, const char *path){ return st->ls(path); } -sg_storage_size_t WorkstationCLM03::getSize(surf_file_t fd){ +sg_size_t WorkstationCLM03::getSize(surf_file_t fd){ return fd->size; } xbt_dynar_t WorkstationCLM03::getInfo( surf_file_t fd) { StoragePtr st = findStorageOnMountList(fd->mount); - sg_storage_size_t *psize = xbt_new(sg_storage_size_t, 1); + sg_size_t *psize = xbt_new(sg_size_t, 1); *psize = fd->size; xbt_dynar_t info = xbt_dynar_new(sizeof(void*), NULL); - xbt_dynar_push_as(info, sg_storage_size_t *, psize); + xbt_dynar_push_as(info, sg_size_t *, psize); xbt_dynar_push_as(info, void *, fd->mount); xbt_dynar_push_as(info, void *, (void *)st->m_name); xbt_dynar_push_as(info, void *, st->p_typeId); @@ -371,13 +371,13 @@ xbt_dynar_t WorkstationCLM03::getInfo( surf_file_t fd) return info; } -sg_storage_size_t WorkstationCLM03::getFreeSize(const char* name) +sg_size_t WorkstationCLM03::getFreeSize(const char* name) { StoragePtr st = findStorageOnMountList(name); return st->m_size - st->m_usedSize; } -sg_storage_size_t WorkstationCLM03::getUsedSize(const char* name) +sg_size_t WorkstationCLM03::getUsedSize(const char* name) { StoragePtr st = findStorageOnMountList(name); return st->m_usedSize; diff --git a/src/surf/workstation.hpp b/src/surf/workstation.hpp index d3c18ad7a2..dc871bb062 100644 --- a/src/surf/workstation.hpp +++ b/src/surf/workstation.hpp @@ -85,12 +85,12 @@ public: ActionPtr close(surf_file_t fd); int unlink(surf_file_t fd); ActionPtr ls(const char* mount, const char *path); - sg_storage_size_t getSize(surf_file_t fd); - ActionPtr read(surf_file_t fd, sg_storage_size_t size); - ActionPtr write(surf_file_t fd, sg_storage_size_t size); + sg_size_t getSize(surf_file_t fd); + ActionPtr read(surf_file_t fd, sg_size_t size); + ActionPtr write(surf_file_t fd, sg_size_t size); xbt_dynar_t getInfo( surf_file_t fd); - sg_storage_size_t getFreeSize(const char* name); - sg_storage_size_t getUsedSize(const char* name); + sg_size_t getFreeSize(const char* name); + sg_size_t getUsedSize(const char* name); bool isUsed(); //bool isShared(); diff --git a/teshsuite/msg/storage/storage_basic.c b/teshsuite/msg/storage/storage_basic.c index a9d1ebcc23..d2c12975c0 100644 --- a/teshsuite/msg/storage/storage_basic.c +++ b/teshsuite/msg/storage/storage_basic.c @@ -7,8 +7,8 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(storage,"Messages specific for this simulation"); void storage_info(msg_host_t host); void display_storage_properties(msg_storage_t storage); int hsm_put(const char *remote_host, const char *src, const char *dest); -sg_storage_size_t write_local_file(char *dest, sg_storage_size_t file_size); -sg_storage_size_t read_local_file(const char *src); +sg_size_t write_local_file(char *dest, sg_size_t file_size); +sg_size_t read_local_file(const char *src); void display_storage_info(msg_host_t host); void dump_storage_by_name(char *name); void display_storage_content(msg_storage_t storage); @@ -32,8 +32,8 @@ void storage_info(msg_host_t host) { XBT_INFO("Storage name: %s, mount name: %s", storage_name, mount_name); - sg_storage_size_t free_size = MSG_storage_get_free_size(mount_name); - sg_storage_size_t used_size = MSG_storage_get_used_size(mount_name); + sg_size_t free_size = MSG_storage_get_free_size(mount_name); + sg_size_t used_size = MSG_storage_get_used_size(mount_name); XBT_INFO("Free size: %" PRIu64 " bytes", free_size); XBT_INFO("Used size: %" PRIu64 " bytes", used_size); @@ -61,7 +61,7 @@ void display_storage_properties(msg_storage_t storage){ int hsm_put(const char *remote_host, const char *src, const char *dest){ // Read local src file, and return the size that was actually read - sg_storage_size_t read_size = read_local_file(src); + sg_size_t read_size = read_local_file(src); // Send file XBT_INFO("%s sends %" PRIu64 " to %s",MSG_host_get_name(MSG_host_self()),read_size,remote_host); @@ -71,18 +71,18 @@ int hsm_put(const char *remote_host, const char *src, const char *dest){ return 1; } -sg_storage_size_t write_local_file(char *dest, sg_storage_size_t file_size) +sg_size_t write_local_file(char *dest, sg_size_t file_size) { - sg_storage_size_t write; + sg_size_t write; msg_file_t file = MSG_file_open("/sd1",dest, NULL); write = MSG_file_write(file, file_size); MSG_file_close(file); return write; } -sg_storage_size_t read_local_file(const char *src) +sg_size_t read_local_file(const char *src) { - sg_storage_size_t read, file_size; + sg_size_t read, file_size; msg_file_t file = MSG_file_open("/sd1",src, NULL); file_size = MSG_file_get_size(file); @@ -127,7 +127,7 @@ void display_storage_content(msg_storage_t storage){ XBT_INFO("Print the content of the storage element: %s",MSG_storage_get_name(storage)); xbt_dict_cursor_t cursor = NULL; char *file; - sg_storage_size_t *psize; + sg_size_t *psize; xbt_dict_t content = MSG_storage_get_content(storage); if (content){ xbt_dict_foreach(content, cursor, file, psize) @@ -186,7 +186,7 @@ int server(int argc, char *argv[]) else if(!strcmp(task_name,"hsm_put")){// Receive file to save // Write file on local disk char *dest = MSG_task_get_data(to_execute); - sg_storage_size_t size_to_write = (sg_storage_size_t)MSG_task_get_data_size(to_execute); + sg_size_t size_to_write = (sg_size_t)MSG_task_get_data_size(to_execute); write_local_file(dest, size_to_write); }