From c353d0f0915ccee0aceaa91fdb1534ab5d7b7cb4 Mon Sep 17 00:00:00 2001 From: Pierre Veyre Date: Tue, 1 Apr 2014 10:52:04 +0200 Subject: [PATCH] remove MSG_file_ls() --- examples/msg/io/file_unlink.c | 29 ------------ include/msg/msg.h | 1 - include/simgrid/simix.h | 1 - src/include/surf/surf.h | 11 ----- src/msg/msg_io.c | 24 ---------- src/simix/simcalls.in | 1 - .../simcalls_generated_args_getter_setter.h | 12 ----- src/simix/simcalls_generated_body.c | 16 ------- src/simix/simcalls_generated_case.c | 4 -- src/simix/simcalls_generated_enum.h | 1 - .../simcalls_generated_res_getter_setter.h | 6 --- src/simix/simcalls_generated_string.c | 1 - src/simix/smx_io.c | 44 ------------------- src/simix/smx_io_private.h | 4 -- src/simix/smx_user.c | 8 ---- src/surf/surf_c_bindings.cpp | 4 -- src/surf/workstation_interface.cpp | 6 --- src/surf/workstation_interface.hpp | 10 ----- 18 files changed, 183 deletions(-) diff --git a/examples/msg/io/file_unlink.c b/examples/msg/io/file_unlink.c index 66db92728f..04e7bddc3d 100644 --- a/examples/msg/io/file_unlink.c +++ b/examples/msg/io/file_unlink.c @@ -52,35 +52,6 @@ int host(int argc, char *argv[]) XBT_INFO("\tClose file '%s'",MSG_file_get_name(file)); MSG_file_close(file); -// xbt_dict_t dict_ls; -// char* key; -// surf_stat_t data = NULL; -// xbt_dict_cursor_t cursor = NULL; -// -// dict_ls = MSG_file_ls(mount,"./"); -// XBT_INFO(" ");XBT_INFO("ls ./"); -// xbt_dict_foreach(dict_ls,cursor,key,data){ -// if(data) XBT_INFO("FILE : %s",key); -// else XBT_INFO("DIR : %s",key); -// } -// xbt_dict_free(&dict_ls); -// -// dict_ls = MSG_file_ls(mount,"./doc/simgrid/examples/platforms/"); -// XBT_INFO(" ");XBT_INFO("ls ./doc/simgrid/examples/platforms/"); -// xbt_dict_foreach(dict_ls,cursor,key,data){ -// if(data) XBT_INFO("FILE : %s",key); -// else XBT_INFO("DIR : %s",key); -// } -// xbt_dict_free(&dict_ls); -// -// dict_ls = MSG_file_ls(mount,"./doc/simgrid/examples/msg/"); -// XBT_INFO(" ");XBT_INFO("ls ./doc/simgrid/examples/msg/"); -// xbt_dict_foreach(dict_ls,cursor,key,data){ -// if(data) XBT_INFO("FILE : %s",key); -// else XBT_INFO("DIR : %s",key); -// } -// xbt_dict_free(&dict_ls); - return 0; } diff --git a/include/msg/msg.h b/include/msg/msg.h index ec4eca8226..04e23b2f3f 100644 --- a/include/msg/msg.h +++ b/include/msg/msg.h @@ -90,7 +90,6 @@ XBT_PUBLIC(int) MSG_file_close(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_size_t offset, int origin); XBT_PUBLIC(sg_size_t) MSG_file_tell (msg_file_t fd); XBT_PUBLIC(void) __MSG_file_get_info(msg_file_t fd); diff --git a/include/simgrid/simix.h b/include/simgrid/simix.h index 2013686d05..c5f8f4cdaa 100644 --- a/include/simgrid/simix.h +++ b/include/simgrid/simix.h @@ -493,7 +493,6 @@ XBT_PUBLIC(sg_size_t) simcall_file_write(smx_file_t fd, sg_size_t size, smx_host XBT_PUBLIC(smx_file_t) simcall_file_open(const char* fullpath); 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_size_t) simcall_file_get_size(smx_file_t fd); XBT_PUBLIC(xbt_dynar_t) simcall_file_get_info(smx_file_t fd); XBT_PUBLIC(sg_size_t) simcall_file_tell(smx_file_t fd); diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index 16da53a709..fdcbf87b6c 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -664,17 +664,6 @@ XBT_PUBLIC(xbt_dynar_t) surf_workstation_get_attached_storage_list(surf_resource */ XBT_PUBLIC(int) surf_workstation_unlink(surf_resource_t workstation, surf_file_t fd); -/** - * @brief List directory contents of a path - * @details [long description] - * - * @param workstation The surf workstation - * @param mount The mount point - * @param path The path to the directory - * @return The surf action corresponding to the ls action - */ -XBT_PUBLIC(surf_action_t) surf_workstation_ls(surf_resource_t workstation, const char* mount, const char *path); - /** * @brief Get the size of a file on a workstation * diff --git a/src/msg/msg_io.c b/src/msg/msg_io.c index 9a8b5c4076..5ab29a3a23 100644 --- a/src/msg/msg_io.c +++ b/src/msg/msg_io.c @@ -246,30 +246,6 @@ sg_size_t MSG_file_get_size(msg_file_t fd){ return simcall_file_get_size(priv->simdata->smx_file); } -/** \ingroup msg_file_management - * \brief Search for file - * - * \param mount is the mount point where find the file is located - * \param path the file regex to find - * \return a xbt_dict_t of file where key is the name of file and the - * value the msg_stat_t corresponding to the key - */ -xbt_dict_t MSG_file_ls(const char *mount, const char *path) -{ - xbt_assert(path,"You must set path"); - int size = strlen(path); - if(size && path[size-1] != '/') - { - char *new_path = bprintf("%s/",path); - XBT_DEBUG("Change '%s' for '%s'",path,new_path); - xbt_dict_t dict = simcall_file_ls(mount, new_path); - xbt_free(new_path); - return dict; - } - - return simcall_file_ls(mount, path); -} - /** * \ingroup msg_file_management * \brief Set the file position indicator in the msg_file_t by adding offset bytes diff --git a/src/simix/simcalls.in b/src/simix/simcalls.in index 95711bd847..a2737cf64f 100644 --- a/src/simix/simcalls.in +++ b/src/simix/simcalls.in @@ -113,7 +113,6 @@ file_write False (sg_size_t) (fd, void*, smx_file_t) (size, sg_size_t) (host, vo file_open False (void*, smx_file_t) (fullpath, const char*) file_close False (int) (fd, void*, smx_file_t) file_unlink True (int) (fd, void*, smx_file_t) -file_ls False (void*, xbt_dict_t) (mount, const char*) (path, const char*) file_get_size True (sg_size_t) (fd, void*, smx_file_t) file_tell True (sg_size_t) (fd, void*, smx_file_t) file_seek True (int) (fd, void*, smx_file_t) (offset, sg_size_t) (origin, int) diff --git a/src/simix/simcalls_generated_args_getter_setter.h b/src/simix/simcalls_generated_args_getter_setter.h index b55da6338d..b741de798f 100644 --- a/src/simix/simcalls_generated_args_getter_setter.h +++ b/src/simix/simcalls_generated_args_getter_setter.h @@ -1106,18 +1106,6 @@ static inline smx_file_t simcall_file_unlink__get__fd(smx_simcall_t simcall){ static inline void simcall_file_unlink__set__fd(smx_simcall_t simcall, void* arg){ simcall->args[0].dp = arg; } -static inline const char* simcall_file_ls__get__mount(smx_simcall_t simcall){ - return simcall->args[0].cc; -} -static inline void simcall_file_ls__set__mount(smx_simcall_t simcall, const char* arg){ - simcall->args[0].cc = arg; -} -static inline const char* simcall_file_ls__get__path(smx_simcall_t simcall){ - return simcall->args[1].cc; -} -static inline void simcall_file_ls__set__path(smx_simcall_t simcall, const char* arg){ - simcall->args[1].cc = arg; -} static inline smx_file_t simcall_file_get_size__get__fd(smx_simcall_t simcall){ return (smx_file_t) simcall->args[0].dp; } diff --git a/src/simix/simcalls_generated_body.c b/src/simix/simcalls_generated_body.c index f6f4fdbd2e..82201b6d99 100644 --- a/src/simix/simcalls_generated_body.c +++ b/src/simix/simcalls_generated_body.c @@ -1689,22 +1689,6 @@ } return self->simcall.result.i; } - inline static xbt_dict_t simcall_BODY_file_ls(const char* mount, const char* path) { - smx_process_t self = SIMIX_process_self(); - self->simcall.call = SIMCALL_FILE_LS; - memset(&self->simcall.result, 0, sizeof(self->simcall.result)); - memset(self->simcall.args, 0, sizeof(self->simcall.args)); - self->simcall.args[0].cc = (const char*) mount; - self->simcall.args[1].cc = (const char*) path; - 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 sg_size_t simcall_BODY_file_get_size(smx_file_t fd) { smx_process_t self = SIMIX_process_self(); self->simcall.call = SIMCALL_FILE_GET_SIZE; diff --git a/src/simix/simcalls_generated_case.c b/src/simix/simcalls_generated_case.c index 01ebce1c2e..61fb5998a7 100644 --- a/src/simix/simcalls_generated_case.c +++ b/src/simix/simcalls_generated_case.c @@ -522,10 +522,6 @@ case SIMCALL_FILE_UNLINK: SIMIX_simcall_answer(simcall); break; -case SIMCALL_FILE_LS: - SIMIX_pre_file_ls(simcall , simcall->args[0].cc, simcall->args[1].cc); - break; - case SIMCALL_FILE_GET_SIZE: simcall->result.sgsz = SIMIX_pre_file_get_size(simcall , (smx_file_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 5130bb2a8d..96678904e3 100644 --- a/src/simix/simcalls_generated_enum.h +++ b/src/simix/simcalls_generated_enum.h @@ -112,7 +112,6 @@ SIMCALL_FILE_WRITE, SIMCALL_FILE_OPEN, SIMCALL_FILE_CLOSE, SIMCALL_FILE_UNLINK, -SIMCALL_FILE_LS, SIMCALL_FILE_GET_SIZE, SIMCALL_FILE_TELL, SIMCALL_FILE_SEEK, diff --git a/src/simix/simcalls_generated_res_getter_setter.h b/src/simix/simcalls_generated_res_getter_setter.h index d339060927..a20e7ad9a9 100644 --- a/src/simix/simcalls_generated_res_getter_setter.h +++ b/src/simix/simcalls_generated_res_getter_setter.h @@ -455,12 +455,6 @@ static inline int simcall_file_unlink__get__result(smx_simcall_t simcall){ static inline void simcall_file_unlink__set__result(smx_simcall_t simcall, int result){ simcall->result.i = result; } -static inline xbt_dict_t simcall_file_ls__get__result(smx_simcall_t simcall){ - return (xbt_dict_t) simcall->result.dp; -} -static inline void simcall_file_ls__set__result(smx_simcall_t simcall, void* result){ - simcall->result.dp = result; -} static inline sg_size_t simcall_file_get_size__get__result(smx_simcall_t simcall){ return simcall->result.sgsz; } diff --git a/src/simix/simcalls_generated_string.c b/src/simix/simcalls_generated_string.c index 8ef57bea32..c75900e350 100644 --- a/src/simix/simcalls_generated_string.c +++ b/src/simix/simcalls_generated_string.c @@ -112,7 +112,6 @@ [SIMCALL_FILE_OPEN] = "SIMCALL_FILE_OPEN", [SIMCALL_FILE_CLOSE] = "SIMCALL_FILE_CLOSE", [SIMCALL_FILE_UNLINK] = "SIMCALL_FILE_UNLINK", -[SIMCALL_FILE_LS] = "SIMCALL_FILE_LS", [SIMCALL_FILE_GET_SIZE] = "SIMCALL_FILE_GET_SIZE", [SIMCALL_FILE_TELL] = "SIMCALL_FILE_TELL", [SIMCALL_FILE_SEEK] = "SIMCALL_FILE_SEEK", diff --git a/src/simix/smx_io.c b/src/simix/smx_io.c index 4b5b1f28ca..8abeb2b721 100644 --- a/src/simix/smx_io.c +++ b/src/simix/smx_io.c @@ -210,39 +210,6 @@ int SIMIX_file_unlink(smx_process_t process, smx_file_t fd) return 0; } -//SIMIX FILE LS -void SIMIX_pre_file_ls(smx_simcall_t simcall, - const char* mount, const char* path) -{ - smx_action_t action = SIMIX_file_ls(simcall->issuer, mount, path); - xbt_fifo_push(action->simcalls, simcall); - simcall->issuer->waiting_action = action; -} -smx_action_t SIMIX_file_ls(smx_process_t process, const char* mount, const char *path) -{ - smx_action_t action; - smx_host_t host = process->smx_host; - /* check if the host is active */ - if (surf_resource_get_state(surf_workstation_resource_priv(host)) != SURF_RESOURCE_ON) { - THROWF(host_error, 0, "Host %s failed, you cannot call this function", - sg_host_name(host)); - } - - action = xbt_mallocator_get(simix_global->action_mallocator); - action->type = SIMIX_ACTION_IO; - action->name = NULL; -#ifdef HAVE_TRACING - action->category = NULL; -#endif - - action->io.host = host; - action->io.surf_io = surf_workstation_ls(host,mount,path); - - surf_action_set_data(action->io.surf_io, action); - XBT_DEBUG("Create io action %p", action); - return action; -} - sg_size_t SIMIX_pre_file_get_size(smx_simcall_t simcall, smx_file_t fd) { return SIMIX_file_get_size(simcall->issuer, fd); @@ -401,17 +368,6 @@ void SIMIX_post_io(smx_action_t action) simcall_file_read__set__result(simcall, surf_action_get_cost(action->io.surf_io)); break; - case SIMCALL_FILE_LS: -// xbt_dict_foreach((action->io.surf_io)->ls_dict,cursor,key, src){ -// // if there is a stat we have to duplicate it -// if(src){ -// dst = xbt_new0(s_file_stat_t,1); -// file_stat_copy(src, dst); -// xbt_dict_set((action->io.surf_io)->ls_dict,key,dst,xbt_free); -// } -// } - simcall_file_ls__set__result(simcall, surf_storage_action_get_ls_dict(action->io.surf_io)); - break; default: break; } diff --git a/src/simix/smx_io_private.h b/src/simix/smx_io_private.h index 4ab6974a67..831d4a1efc 100644 --- a/src/simix/smx_io_private.h +++ b/src/simix/smx_io_private.h @@ -27,8 +27,6 @@ void SIMIX_pre_file_write(smx_simcall_t simcall,smx_file_t fd, sg_size_t size, s void SIMIX_pre_file_open(smx_simcall_t simcall, const char* fullpath); 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_size_t SIMIX_pre_file_get_size(smx_simcall_t simcall, smx_file_t fd); sg_size_t SIMIX_pre_file_tell(smx_simcall_t simcall, smx_file_t fd); xbt_dynar_t SIMIX_pre_file_get_info(smx_simcall_t simcall, smx_file_t fd); @@ -40,8 +38,6 @@ smx_action_t SIMIX_file_write(smx_process_t process, smx_file_t fd, sg_size_t si smx_action_t SIMIX_file_open(smx_process_t process, const char* fullpath); 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_size_t SIMIX_file_get_size(smx_process_t process, smx_file_t fd); sg_size_t SIMIX_file_tell(smx_process_t process, smx_file_t fd); xbt_dynar_t SIMIX_file_get_info(smx_process_t process, smx_file_t fd); diff --git a/src/simix/smx_user.c b/src/simix/smx_user.c index c6da787256..6eb533891f 100644 --- a/src/simix/smx_user.c +++ b/src/simix/smx_user.c @@ -1359,14 +1359,6 @@ int simcall_file_unlink(smx_file_t fd) return simcall_BODY_file_unlink(fd); } -/** - * \ingroup simix_file_management - * - */ -xbt_dict_t simcall_file_ls(const char* mount, const char* path) -{ - return simcall_BODY_file_ls(mount, path); -} /** * \ingroup simix_file_management * diff --git a/src/surf/surf_c_bindings.cpp b/src/surf/surf_c_bindings.cpp index b34f4eecfc..8a0fea3c35 100644 --- a/src/surf/surf_c_bindings.cpp +++ b/src/surf/surf_c_bindings.cpp @@ -372,10 +372,6 @@ int surf_workstation_unlink(surf_resource_t workstation, surf_file_t fd){ return get_casted_workstation(workstation)->unlink(fd); } -surf_action_t surf_workstation_ls(surf_resource_t workstation, const char* mount, const char *path){ - return get_casted_workstation(workstation)->ls(mount, path); -} - size_t surf_workstation_get_size(surf_resource_t workstation, surf_file_t fd){ return get_casted_workstation(workstation)->getSize(fd); } diff --git a/src/surf/workstation_interface.cpp b/src/surf/workstation_interface.cpp index dae99c941d..cc7fb44fcd 100644 --- a/src/surf/workstation_interface.cpp +++ b/src/surf/workstation_interface.cpp @@ -292,12 +292,6 @@ int Workstation::unlink(surf_file_t fd) { } } -ActionPtr Workstation::ls(const char* mount, const char *path){ - XBT_DEBUG("LS on mount '%s' and file '%s'", mount, path); - StoragePtr st = findStorageOnMountList(mount); - return st->ls(path); -} - sg_size_t Workstation::getSize(surf_file_t fd){ return fd->size; } diff --git a/src/surf/workstation_interface.hpp b/src/surf/workstation_interface.hpp index 799ee13ac9..da9e455ad6 100644 --- a/src/surf/workstation_interface.hpp +++ b/src/surf/workstation_interface.hpp @@ -281,16 +281,6 @@ public: */ virtual int unlink(surf_file_t fd); - /** - * @brief List directory contents of a path - * @details [long description] - * - * @param mount [description] - * @param path The path to the directory - * @return The StorageAction corresponding to the ls action - */ - virtual ActionPtr ls(const char* mount, const char *path); - /** * @brief Get the size in bytes of the file * -- 2.20.1