SimGrid: File Management Functions

SimGrid 3.10 Versatile Simulation of Distributed Systems

- Home page
- Online documentation
- Dev's Corner

All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Typedefs | Functions
File Management Functions
MSG

This section describes the file structure of MSG (msg_file_t) and the functions for managing it. It is based on POSIX functions. More...

## Typedefs
typedef struct msg_file * | msg_file_t
| File datatype.You should consider this as an opaque object.

## Functions
msg_error_t | MSG_file_set_data (msg_file_t fd, void *data)
| Set the user data of a msg_file_t.
void * | MSG_file_get_data (msg_file_t fd)
| Return the user data of a msg_file_t.
void | MSG_file_dump (msg_file_t fd)
| Display information related to a file descriptor.
sg_storage_size_t | MSG_file_read (msg_file_t fd, sg_storage_size_t size)
| Read a file.
sg_storage_size_t | MSG_file_write (msg_file_t fd, sg_storage_size_t size)
| Write into a file.
msg_file_t | MSG_file_open (const char *mount, const char *fullname, void *data)
| Opens the file whose name is the string pointed to by path.
int | MSG_file_close (msg_file_t fd)
| Close the file.
int | MSG_file_unlink (msg_file_t fd)
| Unlink the file pointed by fd.
sg_storage_size_t | MSG_file_get_size (msg_file_t fd)
| Return the size of a file.
xbt_dict_t | MSG_file_ls (const char *mount, const char *path)
| Search for file.

## Detailed Description

This section describes the file structure of MSG (msg_file_t) and the functions for managing it. It is based on POSIX functions.

(msg_file_t) and the functions for managing it.

See Also
  msg_file_t

## Function Documentation

msg_error_t MSG_file_set_data | ( | msg_file_t | fd,
|  | void * | data
| ) |  |

Set the user data of a msg_file_t.

This functions checks whether some data has already been associated to file or not and attach data to file if it is possible.

void* MSG_file_get_data | ( | msg_file_t | fd | ) |

Return the user data of a msg_file_t.

This functions checks whether file is a valid pointer or not and return the user data associated to file if it is possible.

void MSG_file_dump | ( | msg_file_t | fd | ) |

Display information related to a file descriptor.

Parameters

  fd | is a the file descriptor

sg_storage_size_t MSG_file_read | ( | msg_file_t | fd,
|  | sg_storage_size_t | size
| ) |  |

Read a file.

Parameters

  size | of the file to read
  fd | is a the file descriptor

Returns
  the number of bytes successfully read

sg_storage_size_t MSG_file_write | ( | msg_file_t | fd,
|  | sg_storage_size_t | size
| ) |  |

Write into a file.

Parameters

  size | of the file to write
  fd | is a the file descriptor

Returns
  the number of bytes successfully write

msg_file_t MSG_file_open | ( | const char * | mount,
|  | const char * | fullname,
|  | void * | data
| ) |  |

Opens the file whose name is the string pointed to by path.

Parameters

  mount | is the mount point where find the file is located
  fullname | is the file location on the storage
  data | user data to attach to the file

Returns
  An msg_file_t associated to the file

int MSG_file_close | ( | msg_file_t | fd | ) |

Close the file.

Parameters

  fd | is the file to close

Returns
  0 on success or 1 on error

int MSG_file_unlink | ( | msg_file_t | fd | ) |

Unlink the file pointed by fd.

Parameters

  fd | is the file descriptor (msg_file_t)

Returns
  0 on success or 1 on error

sg_storage_size_t MSG_file_get_size | ( | msg_file_t | fd | ) |

Return the size of a file.

Parameters

  fd | is the file descriptor (msg_file_t)

Returns
  the size of the file (as a sg_storage_size_t)

xbt_dict_t MSG_file_ls | ( | const char * | mount,
|  | const char * | path
| ) |  |

Search for file.

Parameters

  mount | is the mount point where find the file is located
  path | the file regex to find

Returns
  a xbt_dict_t of file where key is the name of file and the value the msg_stat_t corresponding to the key