*/
XBT_PUBLIC(int) surf_host_unlink(sg_host_t host, surf_file_t fd);
-/**
- * @brief Get the size of a file on a host
- *
- * @param host The surf host
- * @param fd The file descriptor
- *
- * @return The size in bytes of the file
- */
-XBT_PUBLIC(size_t) surf_host_get_size(sg_host_t host, surf_file_t fd);
-
/**
* @brief Get the current position of the file descriptor
*
*/
XBT_PUBLIC(int) surf_host_file_seek(sg_host_t host, surf_file_t fd, sg_offset_t offset, int origin);
-/**
- * @brief Get the size in bytes of a storage
- *
- * @param resource The surf storage
- * @return The size in bytes of the storage
- */
-XBT_PUBLIC(sg_size_t) surf_storage_get_size(surf_storage_t resource);
-
-/**
- * @brief Get the available size in bytes of a storage
- *
- * @param resource The surf storage
- * @return The available size in bytes of the storage
- */
-XBT_PUBLIC(sg_size_t) surf_storage_get_free_size(surf_storage_t resource);
-
-/**
- * @brief Get the size in bytes of a storage
- *
- * @param resource The surf storage
- * @return The used size in bytes of the storage
- */
-XBT_PUBLIC(sg_size_t) surf_storage_get_used_size(surf_storage_t resource);
-
-/** @brief return the properties set associated to that storage */
-XBT_PUBLIC(xbt_dict_t) surf_storage_get_properties(surf_storage_t resource);
-
/**
* @brief [brief description]
* @details [long description]
*/
XBT_PUBLIC(surf_file_t) surf_storage_action_get_file(surf_action_t action);
-/**
- * @brief Get the result dictionary of an ls action
- *
- * @param action The surf storage action
- * @return The dictionry listing a path
- */
-XBT_PUBLIC(xbt_dict_t) surf_storage_action_get_ls_dict(surf_action_t action);
-
-
-/**
- * @brief Get the host the storage is attached to
- *
- * @param resource The surf storage
- * @return The host name
- * may not exist.
- */
-XBT_PUBLIC(const char*) surf_storage_get_host(surf_storage_t resource);
-XBT_PUBLIC(const char*) surf_storage_get_name(surf_storage_t resource);
-
/** @} */
/**************************************/
#include "simgrid/s4u/Host.hpp"
#include "simgrid/s4u/Storage.hpp"
+#include "src/surf/FileImpl.hpp"
#include "src/surf/StorageImpl.hpp"
#include <mc/mc.h>
sg_size_t SIMIX_file_get_size(smx_actor_t process, smx_file_t fd)
{
- sg_host_t host = process->host;
- return surf_host_get_size(host, fd->surf_file);
+ return fd->surf_file->size();
}
sg_size_t simcall_HANDLER_file_tell(smx_simcall_t simcall, smx_file_t fd)
sg_size_t SIMIX_file_tell(smx_actor_t process, smx_file_t fd)
{
- sg_host_t host = process->host;
- return surf_host_file_tell(host, fd->surf_file);
+ return fd->surf_file->tell();
}
int simcall_HANDLER_file_seek(smx_simcall_t simcall, smx_file_t fd, sg_offset_t offset, int origin)
}
}
-sg_size_t HostImpl::getSize(surf_file_t fd)
-{
- return fd->size();
-}
-
-sg_size_t HostImpl::fileTell(surf_file_t fd)
-{
- return fd->tell();
-}
-
int HostImpl::fileSeek(surf_file_t fd, sg_offset_t offset, int origin)
{
switch (origin) {
*/
virtual int unlink(surf_file_t fd);
- /**
- * @brief Get the size in bytes of the file
- *
- * @param fd The file descriptor to read
- * @return The size in bytes of the file
- */
- virtual sg_size_t getSize(surf_file_t fd);
-
/**
* @brief Read a file
*
*/
virtual Action* write(surf_file_t fd, sg_size_t size);
- /**
- * @brief Get the current position of the file descriptor
- *
- * @param fd The file descriptor
- * @return The current position of the file descriptor
- */
- virtual sg_size_t fileTell(surf_file_t fd);
-
/**
* @brief Set the position indicator associated with the file descriptor to a new position
* @details [long description]
return host->pimpl_->unlink(fd);
}
-size_t surf_host_get_size(sg_host_t host, surf_file_t fd){
- return host->pimpl_->getSize(fd);
-}
-
surf_action_t surf_host_read(sg_host_t host, surf_file_t fd, sg_size_t size){
return host->pimpl_->read(fd, size);
}
return host->pimpl_->write(fd, size);
}
-size_t surf_host_file_tell(sg_host_t host, surf_file_t fd){
- return host->pimpl_->fileTell(fd);
-}
-
int surf_host_file_seek(sg_host_t host, surf_file_t fd,
sg_offset_t offset, int origin){
return host->pimpl_->fileSeek(fd, offset, origin);
return host->pimpl_->fileMove(fd, fullpath);
}
-sg_size_t surf_storage_get_size(surf_storage_t resource)
-{
- return static_cast<simgrid::surf::StorageImpl*>(resource)->size_;
-}
-
-sg_size_t surf_storage_get_free_size(surf_storage_t resource)
-{
- return static_cast<simgrid::surf::StorageImpl*>(resource)->getFreeSize();
-}
-
-sg_size_t surf_storage_get_used_size(surf_storage_t resource)
-{
- return static_cast<simgrid::surf::StorageImpl*>(resource)->getUsedSize();
-}
-
-xbt_dict_t surf_storage_get_properties(surf_storage_t resource)
-{
- return static_cast<simgrid::surf::StorageImpl*>(resource)->getProperties();
-}
-
-const char* surf_storage_get_host(surf_storage_t resource)
-{
- return static_cast<simgrid::surf::StorageImpl*>(resource)->attach_.c_str();
-}
-
-const char* surf_storage_get_name(surf_storage_t resource)
-{
- return static_cast<simgrid::surf::StorageImpl*>(resource)->cname();
-}
-
void surf_cpu_action_set_bound(surf_action_t action, double bound) {
static_cast<simgrid::surf::CpuAction*>(action)->setBound(bound);
}