MSG files (msg_file_t) and associated functions, inspired from POSIX.
(msg_file_t) and the functions for managing it.
- See also
- msg_file_t
|
msg_error_t | MSG_file_set_data (msg_file_t fd, void *data) |
| Set the user data of a msg_file_t. More...
|
|
void * | MSG_file_get_data (msg_file_t fd) |
| Return the user data of a msg_file_t. More...
|
|
void | MSG_file_dump (msg_file_t fd) |
| Display information related to a file descriptor. More...
|
|
sg_size_t | MSG_file_read (msg_file_t fd, sg_size_t size) |
| Read a file (local or remote) More...
|
|
sg_size_t | MSG_file_write (msg_file_t fd, sg_size_t size) |
| Write into a file (local or remote) More...
|
|
msg_file_t | MSG_file_open (const char *fullpath, void *data) |
| Opens the file whose name is the string pointed to by path. More...
|
|
int | MSG_file_close (msg_file_t fd) |
| Close the file. More...
|
|
msg_error_t | MSG_file_unlink (msg_file_t fd) |
| Unlink the file pointed by fd. More...
|
|
sg_size_t | MSG_file_get_size (msg_file_t fd) |
| Return the size of a file. More...
|
|
msg_error_t | MSG_file_seek (msg_file_t fd, sg_offset_t offset, int origin) |
| Set the file position indicator in the msg_file_t by adding offset bytes to the position specified by origin (either SEEK_SET, SEEK_CUR, or SEEK_END). More...
|
|
sg_size_t | MSG_file_tell (msg_file_t fd) |
| Returns the current value of the position indicator of the file. More...
|
|
msg_error_t | MSG_file_move (msg_file_t fd, const char *fullpath) |
| Move a file to another location on the same mount point. More...
|
|
msg_error_t | MSG_file_rcopy (msg_file_t file, msg_host_t host, const char *fullpath) |
| Copy a file to another location on a remote host. More...
|
|
msg_error_t | MSG_file_rmove (msg_file_t file, msg_host_t host, const char *fullpath) |
| Move a file to another location on a remote host. More...
|
|
◆ msg_file_t
◆ MSG_file_set_data()
Set the user data of a msg_file_t.
This functions attach data to file.
◆ MSG_file_get_data()
Return the user data of a msg_file_t.
This functions checks whether file is a valid pointer and return the user data associated to file if possible.
◆ MSG_file_dump()
Display information related to a file descriptor.
- Parameters
-
fd | is a the file descriptor |
◆ MSG_file_read()
Read a file (local or remote)
- Parameters
-
size | of the file to read |
fd | is a the file descriptor |
- Returns
- the number of bytes successfully read or -1 if an error occurred
◆ MSG_file_write()
Write into a file (local or remote)
- Parameters
-
size | of the file to write |
fd | is a the file descriptor |
- Returns
- the number of bytes successfully write or -1 if an error occurred
◆ MSG_file_open()
Opens the file whose name is the string pointed to by path.
- Parameters
-
fullpath | is the file location on the storage |
data | user data to attach to the file |
- Returns
- An msg_file_t associated to the file
◆ MSG_file_close()
Close the file.
- Parameters
-
- Returns
- 0 on success or 1 on error
◆ MSG_file_unlink()
Unlink the file pointed by fd.
- Parameters
-
- Returns
- 0 on success or 1 on error
◆ MSG_file_get_size()
Return the size of a file.
- Parameters
-
- Returns
- the size of the file (as a sg_size_t)
◆ MSG_file_seek()
Set the file position indicator in the msg_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) |
- Returns
- If successful, the function returns MSG_OK (=0). Otherwise, it returns MSG_TASK_CANCELED (=8).
◆ MSG_file_tell()
Returns the current value of the position indicator of the file.
- Parameters
-
fd | : file object that identifies the stream |
- Returns
- On success, the current value of the position indicator is returned.
◆ MSG_file_move()
Move a file to another location on the same mount point.
◆ MSG_file_rcopy()
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 MSG_OK. Otherwise, it returns MSG_TASK_CANCELED.
◆ MSG_file_rmove()
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 MSG_OK. Otherwise, it returns MSG_TASK_CANCELED.