XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_file, s4u, "S4U files");
int sg_storage_max_file_descriptors = 1024;
+/** @defgroup plugin_filesystem
+ @beginrst
+
+ @endrst
+ */
+
+
namespace simgrid {
namespace s4u {
simgrid::xbt::Extension<Disk, FileSystemDiskExt> FileSystemDiskExt::EXTENSION_ID;
}
/** @brief Write into a file (local or remote)
+ * @ingroup plugin_filesystem
*
* @param size of the file to write
* @return the number of bytes successfully write or -1 if an error occurred
content_.reset(parse_content(content_str));
}
-FileSystemStorageExt::FileSystemStorageExt(simgrid::s4u::Storage* ptr)
+FileSystemStorageExt::FileSystemStorageExt(simgrid::s4u::Storage* ptr) : size_(ptr->get_impl()->size_)
{
content_.reset(parse_content(ptr->get_impl()->content_name_));
- size_ = ptr->get_impl()->size_;
}
std::map<std::string, sg_size_t>* FileSystemDiskExt::parse_content(const std::string& filename)
}
/* **************************** Public interface *************************** */
+/** @brief Initialize the file system plugin.
+ @ingroup plugin_filesystem
+
+ @beginrst
+ See the examples in :ref:`s4u_ex_disk_io`.
+ @endrst
+ */
void sg_storage_file_system_init()
{
sg_storage_max_file_descriptors = 1024;
delete fd;
}
+/** Retrieves the path to the file
+ * @ingroup plugin_filesystem
+ */
const char* sg_file_get_name(sg_file_t fd)
{
xbt_assert((fd != nullptr), "Invalid file descriptor");
return fd->get_path();
}
+/** Retrieves the size of the file
+ * @ingroup plugin_filesystem
+ */
sg_size_t sg_file_get_size(sg_file_t fd)
{
return fd->size();
fd->dump();
}
+/** Retrieves the user data associated with the file
+ * @ingroup plugin_filesystem
+ */
void* sg_file_get_data(sg_file_t fd)
{
return fd->get_data();
}
+/** Changes the user data associated with the file
+ * @ingroup plugin_filesystem
+ */
void sg_file_set_data(sg_file_t fd, void* data)
{
fd->set_data(data);
}
/**
- * @brief Set the file position indicator in the sg_file_t by adding offset bytes
- * to the position specified by origin (either SEEK_SET, SEEK_CUR, or SEEK_END).
+ * @brief Set the file position indicator in the sg_file_t by adding offset bytes to the position specified by origin (either SEEK_SET, SEEK_CUR, or SEEK_END).
+ * @ingroup plugin_filesystem
*
* @param fd : file object that identifies the stream
* @param offset : number of bytes to offset from origin
/**
* @brief Copy a file to another location on a remote host.
+ * @ingroup plugin_filesystem
+ *
* @param file : the file to move
* @param host : the remote host where the file has to be copied
* @param fullpath : the complete path destination on the remote host
/**
* @brief Move a file to another location on a remote host.
+ * @ingroup plugin_filesystem
+ *
* @param file : the file to move
* @param host : the remote host where the file has to be moved
* @param fullpath : the complete path destination on the remote host