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;
}
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);
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);
*/
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
*
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
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)
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;
}
}
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;
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);
SIMCALL_FILE_OPEN,
SIMCALL_FILE_CLOSE,
SIMCALL_FILE_UNLINK,
-SIMCALL_FILE_LS,
SIMCALL_FILE_GET_SIZE,
SIMCALL_FILE_TELL,
SIMCALL_FILE_SEEK,
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;
}
[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",
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);
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;
}
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);
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);
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
*
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);
}
}
}
-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;
}
*/
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
*