From fb5a144e806900edc6d26992740acf2c117538fa Mon Sep 17 00:00:00 2001 From: Pierre Veyre Date: Tue, 1 Oct 2013 18:22:02 +0200 Subject: [PATCH] Introduce sg_storage_size_t type --- examples/msg/io/file.c | 2 +- examples/msg/io/file_unlink.c | 2 +- include/msg/datatypes.h | 2 +- include/msg/msg.h | 12 +++++++----- include/simgrid/platf.h | 5 ++++- include/simgrid/simix.h | 11 ++++++----- src/msg/msg_io.c | 19 +++++++++---------- src/simix/smx_io.c | 20 ++++++++++---------- src/simix/smx_io_private.h | 20 ++++++++++---------- src/simix/smx_user.c | 14 +++++++------- src/surf/storage.c | 21 ++++++++++----------- src/surf/storage_private.h | 8 ++++---- src/surf/workstation.c | 10 +++++----- 13 files changed, 75 insertions(+), 71 deletions(-) diff --git a/examples/msg/io/file.c b/examples/msg/io/file.c index cf8330e726..7fe3888e1c 100644 --- a/examples/msg/io/file.c +++ b/examples/msg/io/file.c @@ -34,7 +34,7 @@ int host(int argc, char *argv[]) { msg_file_t file = NULL; char* mount = xbt_strdup("/home"); - size_t read,write; + sg_storage_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 ec6ea5b75c..ace947f706 100644 --- a/examples/msg/io/file_unlink.c +++ b/examples/msg/io/file_unlink.c @@ -31,7 +31,7 @@ int host(int argc, char *argv[]) { msg_file_t file = NULL; char* mount = xbt_strdup("/home"); - size_t write; + sg_storage_size_t write; // First open XBT_INFO("\tOpen file '%s'",FILENAME1); diff --git a/include/msg/datatypes.h b/include/msg/datatypes.h index ec37fac7f1..00b7c8f0a0 100644 --- a/include/msg/datatypes.h +++ b/include/msg/datatypes.h @@ -104,7 +104,7 @@ typedef struct msg_vm { typedef struct simdata_file *simdata_file_t; typedef struct s_file_info { - size_t size; + sg_storage_size_t size; char* mount_point; char* storageId; char* storage_type; diff --git a/include/msg/msg.h b/include/msg/msg.h index d907f6a1ae..083d34af56 100644 --- a/include/msg/msg.h +++ b/include/msg/msg.h @@ -13,6 +13,8 @@ #include "simgrid/simix.h" +#include "simgrid/platf.h" + SG_BEGIN_DECL() /** @brief Return code of most MSG functions @@ -79,14 +81,14 @@ 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(size_t) MSG_file_read(size_t size, msg_file_t fd); -XBT_PUBLIC(size_t) MSG_file_write(size_t size, msg_file_t fd); +XBT_PUBLIC(sg_storage_size_t) MSG_file_read(sg_storage_size_t size, msg_file_t fd); +XBT_PUBLIC(sg_storage_size_t) MSG_file_write(sg_storage_size_t size, msg_file_t fd); 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(size_t) MSG_file_get_size(msg_file_t fd); +XBT_PUBLIC(sg_storage_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); @@ -95,8 +97,8 @@ 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(size_t) MSG_storage_get_free_size(const char* name); -XBT_PUBLIC(size_t) MSG_storage_get_used_size(const char* name); +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(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); diff --git a/include/simgrid/platf.h b/include/simgrid/platf.h index 6d0d278850..ff9095d504 100644 --- a/include/simgrid/platf.h +++ b/include/simgrid/platf.h @@ -80,6 +80,9 @@ 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; + /* * Platform creation functions. Instead of passing 123 arguments to the creation functions @@ -236,7 +239,7 @@ typedef struct { const char* content; const char* content_type; xbt_dict_t properties; - size_t size; + sg_storage_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 4d41c7cc0c..3dbbba245d 100644 --- a/include/simgrid/simix.h +++ b/include/simgrid/simix.h @@ -13,6 +13,7 @@ #include "xbt/function_types.h" #include "xbt/parmap.h" #include "xbt/swag.h" +#include "simgrid/platf.h" SG_BEGIN_DECL() @@ -480,18 +481,18 @@ 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(size_t) simcall_file_read(size_t size, smx_file_t fd); -XBT_PUBLIC(size_t) simcall_file_write(size_t size, smx_file_t fd); +XBT_PUBLIC(sg_storage_size_t) simcall_file_read(sg_storage_size_t size, smx_file_t fd); +XBT_PUBLIC(sg_storage_size_t) simcall_file_write(sg_storage_size_t size, smx_file_t fd); 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(size_t) simcall_file_get_size(smx_file_t fd); +XBT_PUBLIC(sg_storage_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(size_t) simcall_storage_get_free_size (const char* name); -XBT_PUBLIC(size_t) simcall_storage_get_used_size (const char* name); +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(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); diff --git a/src/msg/msg_io.c b/src/msg/msg_io.c index 72b8212607..a480212873 100644 --- a/src/msg/msg_io.c +++ b/src/msg/msg_io.c @@ -24,7 +24,7 @@ void __MSG_file_get_info(msg_file_t fd){ 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 *); - fd->info->size = xbt_dynar_pop_as(info, size_t); + fd->info->size = xbt_dynar_pop_as(info, sg_storage_size_t); xbt_dynar_free_container(&info); } @@ -79,7 +79,7 @@ void MSG_file_dump (msg_file_t fd){ * \param fd is a the file descriptor * \return the number of bytes successfully read */ -size_t MSG_file_read(size_t size, msg_file_t fd) +sg_storage_size_t MSG_file_read(sg_storage_size_t size, msg_file_t fd) { return simcall_file_read(size, fd->simdata->smx_file); } @@ -91,7 +91,7 @@ size_t MSG_file_read(size_t size, msg_file_t fd) * \param fd is a the file descriptor * \return the number of bytes successfully write */ -size_t MSG_file_write(size_t size, msg_file_t fd) +sg_storage_size_t MSG_file_write(sg_storage_size_t size, msg_file_t fd) { return simcall_file_write(size, fd->simdata->smx_file); } @@ -147,10 +147,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 size_t) + * \return the size of the file (as a sg_storage_size_t) */ - -size_t MSG_file_get_size(msg_file_t fd){ +sg_storage_size_t MSG_file_get_size(msg_file_t fd){ return simcall_file_get_size(fd->simdata->smx_file); } @@ -218,18 +217,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 size_t) + * \return the free space size of the storage element (as a sg_storage_size_t) */ -size_t MSG_storage_get_free_size(const char* name){ +sg_storage_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 size_t) + * \return the used space size of the storage element (as a sg_storage_size_t) */ -size_t MSG_storage_get_used_size(const char* name){ +sg_storage_size_t MSG_storage_get_used_size(const char* name){ return simcall_storage_get_used_size(name); } diff --git a/src/simix/smx_io.c b/src/simix/smx_io.c index 7dbccac6b4..a657e1b4fc 100644 --- a/src/simix/smx_io.c +++ b/src/simix/smx_io.c @@ -55,7 +55,7 @@ void SIMIX_file_set_data(smx_file_t fd, void *data){ } //SIMIX FILE READ -void SIMIX_pre_file_read(smx_simcall_t simcall, size_t size, +void SIMIX_pre_file_read(smx_simcall_t simcall, sg_storage_size_t size, smx_file_t fd) { smx_action_t action = SIMIX_file_read(simcall->issuer, size, fd); @@ -63,7 +63,7 @@ void SIMIX_pre_file_read(smx_simcall_t simcall, size_t size, simcall->issuer->waiting_action = action; } -smx_action_t SIMIX_file_read(smx_process_t process, size_t size, +smx_action_t SIMIX_file_read(smx_process_t process, sg_storage_size_t size, smx_file_t fd) { smx_action_t action; @@ -95,7 +95,7 @@ smx_action_t SIMIX_file_read(smx_process_t process, size_t size, } //SIMIX FILE WRITE -void SIMIX_pre_file_write(smx_simcall_t simcall, size_t size, +void SIMIX_pre_file_write(smx_simcall_t simcall, sg_storage_size_t size, smx_file_t fd) { smx_action_t action = SIMIX_file_write(simcall->issuer, size, fd); @@ -104,7 +104,7 @@ void SIMIX_pre_file_write(smx_simcall_t simcall, size_t size, } smx_action_t SIMIX_file_write(smx_process_t process, - size_t size, smx_file_t fd) + sg_storage_size_t size, smx_file_t fd) { smx_action_t action; smx_host_t host = process->smx_host; @@ -266,12 +266,12 @@ smx_action_t SIMIX_file_ls(smx_process_t process, const char* mount, const char return action; } -size_t SIMIX_pre_file_get_size(smx_simcall_t simcall, smx_file_t fd) +sg_storage_size_t SIMIX_pre_file_get_size(smx_simcall_t simcall, smx_file_t fd) { return SIMIX_file_get_size(simcall->issuer, fd); } -size_t SIMIX_file_get_size(smx_process_t process, smx_file_t fd) +sg_storage_size_t SIMIX_file_get_size(smx_process_t process, smx_file_t fd) { smx_host_t host = process->smx_host; return surf_workstation_model->extension.workstation.get_size(host, @@ -290,23 +290,23 @@ xbt_dynar_t SIMIX_file_get_info(smx_process_t process, smx_file_t fd) fd->surf_file); } -size_t SIMIX_pre_storage_get_free_size(smx_simcall_t simcall, const char* name) +sg_storage_size_t SIMIX_pre_storage_get_free_size(smx_simcall_t simcall, const char* name) { return SIMIX_storage_get_free_size(simcall->issuer, name); } -size_t SIMIX_storage_get_free_size(smx_process_t process, const char* name) +sg_storage_size_t SIMIX_storage_get_free_size(smx_process_t process, const char* name) { smx_host_t host = process->smx_host; return surf_workstation_model->extension.workstation.get_free_size(host,name); } -size_t SIMIX_pre_storage_get_used_size(smx_simcall_t simcall, const char* name) +sg_storage_size_t SIMIX_pre_storage_get_used_size(smx_simcall_t simcall, const char* name) { return SIMIX_storage_get_used_size(simcall->issuer, name); } -size_t SIMIX_storage_get_used_size(smx_process_t process, const char* name) +sg_storage_size_t SIMIX_storage_get_used_size(smx_process_t process, const char* name) { smx_host_t host = process->smx_host; return surf_workstation_model->extension.workstation.get_used_size(host,name); diff --git a/src/simix/smx_io_private.h b/src/simix/smx_io_private.h index d7c48f697c..c6032e417f 100644 --- a/src/simix/smx_io_private.h +++ b/src/simix/smx_io_private.h @@ -23,22 +23,22 @@ static inline smx_storage_priv_t SIMIX_storage_priv(smx_storage_t storage){ smx_storage_t SIMIX_storage_create(const char *name, void *storage, void *data); 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, size_t size, smx_file_t fd); -void SIMIX_pre_file_write(smx_simcall_t simcall, size_t size, smx_file_t fd); +void SIMIX_pre_file_read(smx_simcall_t simcall, sg_storage_size_t size, smx_file_t fd); +void SIMIX_pre_file_write(smx_simcall_t simcall, sg_storage_size_t size, smx_file_t fd); 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); -size_t SIMIX_pre_file_get_size(smx_simcall_t simcall, smx_file_t fd); +sg_storage_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_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, size_t size, +smx_action_t SIMIX_file_read(smx_process_t process, sg_storage_size_t size, smx_file_t fd); -smx_action_t SIMIX_file_write(smx_process_t process, size_t size, +smx_action_t SIMIX_file_write(smx_process_t process, sg_storage_size_t size, smx_file_t fd); smx_action_t SIMIX_file_open(smx_process_t process, const char* storage, const char* path); @@ -46,14 +46,14 @@ 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); -size_t SIMIX_file_get_size(smx_process_t process, smx_file_t fd); +sg_storage_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); -size_t SIMIX_pre_storage_get_free_size(smx_simcall_t simcall,const char* name); -size_t SIMIX_storage_get_free_size(smx_process_t process,const char* name); +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); -size_t SIMIX_pre_storage_get_used_size(smx_simcall_t simcall,const char* name); -size_t SIMIX_storage_get_used_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); 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_user.c b/src/simix/smx_user.c index 75e467b88d..1492cddfb0 100644 --- a/src/simix/smx_user.c +++ b/src/simix/smx_user.c @@ -1203,7 +1203,7 @@ void simcall_file_set_data(smx_file_t fd, void *data) * \ingroup simix_file_management * */ -size_t simcall_file_read(size_t size, smx_file_t fd) +sg_storage_size_t simcall_file_read(sg_storage_size_t size, smx_file_t fd) { return simcall_BODY_file_read(size, fd); } @@ -1212,7 +1212,7 @@ size_t simcall_file_read(size_t size, smx_file_t fd) * \ingroup simix_file_management * */ -size_t simcall_file_write(size_t size, smx_file_t fd) +sg_storage_size_t simcall_file_write(sg_storage_size_t size, smx_file_t fd) { return simcall_BODY_file_write(size, fd); } @@ -1256,7 +1256,7 @@ xbt_dict_t simcall_file_ls(const char* mount, const char* path) * \ingroup simix_file_management * */ -size_t simcall_file_get_size (smx_file_t fd){ +sg_storage_size_t simcall_file_get_size (smx_file_t fd){ return simcall_BODY_file_get_size(fd); } @@ -1273,9 +1273,9 @@ xbt_dynar_t simcall_file_get_info(smx_file_t fd) * \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 size_t) + * \return Return the free space size on a given storage element (as sg_storage_size_t) */ -size_t simcall_storage_get_free_size (const char* name){ +sg_storage_size_t simcall_storage_get_free_size (const char* name){ return simcall_BODY_storage_get_free_size(name); } @@ -1283,9 +1283,9 @@ 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 size_t) + * \return Return the used space size on a given storage element (as sg_storage_size_t) */ -size_t simcall_storage_get_used_size (const char* name){ +sg_storage_size_t simcall_storage_get_used_size (const char* name){ return simcall_BODY_storage_get_used_size(name); } diff --git a/src/surf/storage.c b/src/surf/storage.c index 3aba270524..9a0a99e3b0 100644 --- a/src/surf/storage.c +++ b/src/surf/storage.c @@ -34,10 +34,10 @@ static xbt_dynar_t storage_list; #define GENERIC_LMM_ACTION(action) action->generic_lmm_action #define GENERIC_ACTION(action) GENERIC_LMM_ACTION(action).generic_action -static xbt_dict_t parse_storage_content(char *filename, size_t *used_size); +static xbt_dict_t parse_storage_content(char *filename, sg_storage_size_t *used_size); static int storage_action_unref(surf_action_t action); static void storage_action_state_set(surf_action_t action, e_surf_action_state_t state); -static surf_action_t storage_action_execute (void *storage, size_t size, e_surf_action_storage_type_t type); +static surf_action_t storage_action_execute (void *storage, sg_storage_size_t size, e_surf_action_storage_type_t type); static surf_action_t storage_action_ls(void *storage, const char* path) { @@ -46,7 +46,7 @@ static surf_action_t storage_action_ls(void *storage, const char* path) xbt_dict_t ls_dict = xbt_dict_new(); char* key; - size_t size = 0; + sg_storage_size_t size = 0; xbt_dict_cursor_t cursor = NULL; xbt_dynar_t dyn = NULL; @@ -86,7 +86,7 @@ static surf_action_t storage_action_open(void *storage, const char* mount, { XBT_DEBUG("\tOpen file '%s'",path); xbt_dict_t content_dict = ((storage_t)storage)->content; - size_t size = (size_t) xbt_dict_get_or_null(content_dict,path); + sg_storage_size_t size = (sg_storage_size_t) xbt_dict_get_or_null(content_dict,path); // if file does not exist create an empty file if(!size){ @@ -124,7 +124,7 @@ static surf_action_t storage_action_close(void *storage, surf_file_t fd) return action; } -static surf_action_t storage_action_read(void *storage, size_t size, +static surf_action_t storage_action_read(void *storage, sg_storage_size_t size, surf_file_t fd) { if(size > fd->size) @@ -133,7 +133,7 @@ static surf_action_t storage_action_read(void *storage, size_t size, return action; } -static surf_action_t storage_action_write(void *storage, size_t size, +static surf_action_t storage_action_write(void *storage, sg_storage_size_t size, surf_file_t fd) { char *filename = fd->name; @@ -149,7 +149,7 @@ static surf_action_t storage_action_write(void *storage, size_t size, return action; } -static surf_action_t storage_action_execute (void *storage, size_t size, e_surf_action_storage_type_t type) +static surf_action_t storage_action_execute (void *storage, sg_storage_size_t size, e_surf_action_storage_type_t type) { surf_action_storage_t action = NULL; storage_t STORAGE = storage; @@ -292,7 +292,7 @@ static void storage_update_actions_state(double now, double delta) // Update the storage content (with file size) double rate = lmm_variable_getvalue(GENERIC_LMM_ACTION(action).variable); /* Hack to avoid rounding differences between x86 and x86_64 - * (note that the next sizes are of type size_t). */ + * (note that the next sizes are of type sg_storage_size_t). */ long incr = delta * rate + MAXMIN_PRECISION; ((storage_t)(action->storage))->used_size += incr; // disk usage ((surf_action_t)action)->file->size += incr; // file size @@ -559,7 +559,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, size_t *used_size) +static xbt_dict_t parse_storage_content(char *filename, sg_storage_size_t *used_size) { *used_size = 0; if ((!filename) || (strcmp(filename, "") == 0)) @@ -576,8 +576,7 @@ static xbt_dict_t parse_storage_content(char *filename, size_t *used_size) size_t len = 0; ssize_t read; char path[1024]; - size_t size; - + sg_storage_size_t size; while ((read = xbt_getline(&line, &len, file)) != -1) { if (read){ diff --git a/src/surf/storage_private.h b/src/surf/storage_private.h index a763c3351a..ee023b417f 100644 --- a/src/surf/storage_private.h +++ b/src/surf/storage_private.h @@ -13,7 +13,7 @@ typedef struct s_storage_type { char *content_type; char *type_id; xbt_dict_t properties; - size_t size; + sg_storage_size_t size; } s_storage_type_t, *storage_type_t; typedef struct s_mount { @@ -24,7 +24,7 @@ typedef struct s_mount { typedef struct surf_file { char *name; char *mount; - size_t size; + sg_storage_size_t size; } s_surf_file_t; typedef struct surf_storage { @@ -35,8 +35,8 @@ typedef struct surf_storage { lmm_constraint_t constraint_read; /* Constraint for maximum write bandwidth*/ xbt_dict_t content; char* content_type; - size_t size; - size_t used_size; + sg_storage_size_t size; + sg_storage_size_t used_size; char *type_id; xbt_dynar_t write_actions; xbt_dict_t properties; diff --git a/src/surf/workstation.c b/src/surf/workstation.c index e328332fee..c4c000bb15 100644 --- a/src/surf/workstation.c +++ b/src/surf/workstation.c @@ -400,7 +400,7 @@ static surf_action_t ws_action_close(void *workstation, surf_file_t fd) return model->extension.storage.close(st, fd); } -static surf_action_t ws_action_read(void *workstation, size_t size, +static surf_action_t ws_action_read(void *workstation, sg_storage_size_t size, surf_file_t fd) { storage_t st = find_storage_on_mount_list(workstation, fd->mount); @@ -409,7 +409,7 @@ static surf_action_t ws_action_read(void *workstation, size_t size, return model->extension.storage.read(st, size, fd); } -static surf_action_t ws_action_write(void *workstation, size_t size, +static surf_action_t ws_action_write(void *workstation, sg_storage_size_t size, surf_file_t fd) { storage_t st = find_storage_on_mount_list(workstation, fd->mount); @@ -456,7 +456,7 @@ static surf_action_t ws_action_ls(void *workstation, const char* mount, return model->extension.storage.ls(st, path); } -static size_t ws_file_get_size(void *workstation, surf_file_t fd) +static sg_storage_size_t ws_file_get_size(void *workstation, surf_file_t fd) { return fd->size; } @@ -474,13 +474,13 @@ static xbt_dynar_t ws_file_get_info(void *workstation, surf_file_t fd) return info; } -static size_t ws_storage_get_free_size(void *workstation,const char* name) +static sg_storage_size_t ws_storage_get_free_size(void *workstation,const char* name) { storage_t st = find_storage_on_mount_list(workstation, name); return st->size - st->used_size; } -static size_t ws_storage_get_used_size(void *workstation,const char* name) +static sg_storage_size_t ws_storage_get_used_size(void *workstation,const char* name) { storage_t st = find_storage_on_mount_list(workstation, name); return st->used_size; -- 2.20.1