SimGrid  3.21
Versatile Simulation of Distributed Systems
s4u_FileSystem.cpp File Reference
#include "simgrid/plugins/file_system.h"
#include "simgrid/s4u/Actor.hpp"
#include "src/surf/HostImpl.hpp"
#include "xbt/config.hpp"
#include <algorithm>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/split.hpp>
#include <fstream>
#include <numeric>

Namespaces

 simgrid
 
 simgrid::s4u
 

Functions

 XBT_LOG_NEW_DEFAULT_CATEGORY (s4u_file, "S4U files")
 
static void on_storage_creation (simgrid::s4u::Storage &st)
 
static void on_host_creation (simgrid::s4u::Host &host)
 
void sg_storage_file_system_init ()
 
sg_file_t sg_file_open (const char *fullpath, void *data)
 
sg_size_t sg_file_read (sg_file_t fd, sg_size_t size)
 
sg_size_t sg_file_write (sg_file_t fd, sg_size_t size)
 
void sg_file_close (sg_file_t fd)
 
const char * sg_file_get_name (sg_file_t fd)
 
sg_size_t sg_file_get_size (sg_file_t fd)
 
void sg_file_dump (sg_file_t fd)
 
void * sg_file_get_data (sg_file_t fd)
 
void sg_file_set_data (sg_file_t fd, void *data)
 
void sg_file_seek (sg_file_t fd, sg_offset_t offset, int origin)
 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). More...
 
sg_size_t sg_file_tell (sg_file_t fd)
 
void sg_file_move (sg_file_t fd, const char *fullpath)
 
void sg_file_unlink (sg_file_t fd)
 
int sg_file_rcopy (sg_file_t file, sg_host_t host, const char *fullpath)
 Copy a file to another location on a remote host. More...
 
int sg_file_rmove (sg_file_t file, sg_host_t host, const char *fullpath)
 Move a file to another location on a remote host. More...
 
sg_size_t sg_storage_get_size_free (sg_storage_t st)
 
sg_size_t sg_storage_get_size_used (sg_storage_t st)
 
sg_size_t sg_storage_get_size (sg_storage_t st)
 
xbt_dict_t sg_storage_get_content (sg_storage_t storage)
 
xbt_dict_t sg_host_get_storage_content (sg_host_t host)
 

Variables

int sg_storage_max_file_descriptors = 1024
 

Function Documentation

◆ XBT_LOG_NEW_DEFAULT_CATEGORY()

XBT_LOG_NEW_DEFAULT_CATEGORY ( s4u_file  ,
"S4U files"   
)

◆ on_storage_creation()

static void on_storage_creation ( simgrid::s4u::Storage st)
static

◆ on_host_creation()

static void on_host_creation ( simgrid::s4u::Host host)
static

◆ sg_storage_file_system_init()

void sg_storage_file_system_init ( )

◆ sg_file_open()

sg_file_t sg_file_open ( const char *  fullpath,
void *  data 
)

◆ sg_file_read()

sg_size_t sg_file_read ( sg_file_t  fd,
sg_size_t  size 
)

◆ sg_file_write()

sg_size_t sg_file_write ( sg_file_t  fd,
sg_size_t  size 
)

◆ sg_file_close()

void sg_file_close ( sg_file_t  fd)

◆ sg_file_get_name()

const char* sg_file_get_name ( sg_file_t  fd)

◆ sg_file_get_size()

sg_size_t sg_file_get_size ( sg_file_t  fd)

◆ sg_file_dump()

void sg_file_dump ( sg_file_t  fd)

◆ sg_file_get_data()

void* sg_file_get_data ( sg_file_t  fd)

◆ sg_file_set_data()

void sg_file_set_data ( sg_file_t  fd,
void *  data 
)

◆ sg_file_seek()

void sg_file_seek ( sg_file_t  fd,
sg_offset_t  offset,
int  origin 
)

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).

Parameters
fd: file object that identifies the stream
offset: number of bytes to offset from origin
origin: Position used as reference for the offset. It is specified by one of the following constants defined in <stdio.h> exclusively to be used as arguments for this function (SEEK_SET = beginning of file, SEEK_CUR = current position of the file pointer, SEEK_END = end of file)

◆ sg_file_tell()

sg_size_t sg_file_tell ( sg_file_t  fd)

◆ sg_file_move()

void sg_file_move ( sg_file_t  fd,
const char *  fullpath 
)

◆ sg_file_unlink()

void sg_file_unlink ( sg_file_t  fd)

◆ sg_file_rcopy()

int sg_file_rcopy ( sg_file_t  file,
sg_host_t  host,
const char *  fullpath 
)

Copy a file to another location on a remote host.

Parameters
file: the file to move
host: the remote host where the file has to be copied
fullpath: the complete path destination on the remote host
Returns
If successful, the function returns 0. Otherwise, it returns -1.

◆ sg_file_rmove()

int sg_file_rmove ( sg_file_t  file,
sg_host_t  host,
const char *  fullpath 
)

Move a file to another location on a remote host.

Parameters
file: the file to move
host: the remote host where the file has to be moved
fullpath: the complete path destination on the remote host
Returns
If successful, the function returns 0. Otherwise, it returns -1.

◆ sg_storage_get_size_free()

sg_size_t sg_storage_get_size_free ( sg_storage_t  st)

◆ sg_storage_get_size_used()

sg_size_t sg_storage_get_size_used ( sg_storage_t  st)

◆ sg_storage_get_size()

sg_size_t sg_storage_get_size ( sg_storage_t  st)

◆ sg_storage_get_content()

xbt_dict_t sg_storage_get_content ( sg_storage_t  storage)

◆ sg_host_get_storage_content()

xbt_dict_t sg_host_get_storage_content ( sg_host_t  host)

Variable Documentation

◆ sg_storage_max_file_descriptors

int sg_storage_max_file_descriptors = 1024