I/O types and functions. More...
Data Structures | |
| struct | file_pair |
Defines | |
| #define | IO_BUFFER_SIZE 8192 |
Functions | |
| void | io_init (void) |
| Initialize the I/O module. | |
| file_pair * | io_open (const char *src_name) |
| Opens a file pair. | |
| void | io_close (file_pair *pair, bool success) |
| Closes the file descriptors and frees possible allocated memory. | |
| size_t | io_read (file_pair *pair, uint8_t *buf, size_t size) |
| Reads from the source file to a buffer. | |
| bool | io_write (const file_pair *pair, const uint8_t *buf, size_t size) |
| Writes a buffer to the destination file. | |
I/O types and functions.
| void io_init | ( | void | ) |
Initialize the I/O module.
| file_pair* io_open | ( | const char * | src_name | ) |
Opens a file pair.
References io_close_src(), io_open_src(), is_empty_filename(), signals_block(), signals_unblock(), file_pair::src_name, and user_abort.
Referenced by coder_run().
| void io_close | ( | file_pair * | pair, | |
| bool | success | |||
| ) |
Closes the file descriptors and frees possible allocated memory.
The success argument determines if source or destination file gets unlinked:
References file_pair::dest_fd, io_close_dest(), io_close_src(), io_copy_attrs(), signals_block(), and signals_unblock().
Referenced by coder_run().
| size_t io_read | ( | file_pair * | pair, | |
| uint8_t * | buf, | |||
| size_t | size | |||
| ) |
Reads from the source file to a buffer.
| pair | File pair having the source file open for reading | |
| buf | Destination buffer to hold the read data | |
| size | Size of the buffer; assumed be smaller than SSIZE_MAX |
References message_error(), file_pair::src_eof, file_pair::src_fd, file_pair::src_name, and user_abort.
Referenced by coder_normal(), coder_passthru(), and coder_run().
| bool io_write | ( | const file_pair * | pair, | |
| const uint8_t * | buf, | |||
| size_t | size | |||
| ) |
Writes a buffer to the destination file.
| pair | File pair having the destination file open for writing | |
| buf | Buffer containing the data to be written | |
| size | Size of the buffer; assumed be smaller than SSIZE_MAX |
References file_pair::dest_fd, file_pair::dest_name, message_error(), and user_abort.
Referenced by coder_normal(), and coder_passthru().
1.6.1