#include <stddef.h>
#include <stdint.h>
Go to the source code of this file.
|
typedef int(* | ctr_io_interface_read) (void *io, void *buffer, size_t buffer_size, uint64_t position, size_t count) |
| Pointer to an io interface function used to read. More...
|
|
typedef int(* | ctr_io_interface_write) (void *io, const void *buffer, size_t buffer_size, uint64_t position) |
| Pointer to an io interface function used to write. More...
|
|
typedef int(* | ctr_io_interface_read_sector) (void *io, void *buffer, size_t buffer_size, size_t sector, size_t count) |
| Pointer to an io interface function used to read sectors. More...
|
|
typedef int(* | ctr_io_interface_write_sector) (void *io, const void *buffer, size_t buffer_size, size_t sector) |
| Pointer to an io interface function used to write sectors. More...
|
|
typedef uint64_t(* | ctr_io_interface_disk_size) (void *io) |
| Pointer to an io interface function used to get the size of the disk. More...
|
|
typedef size_t(* | ctr_io_interface_sector_size) (void *io) |
| Pointer to an io interface function used to get the sector size in bytes. More...
|
|
|
int | ctr_io_read (void *io, void *buffer, size_t buffer_size, uint64_t position, size_t count) |
| Reads bytes from the given io interface. More...
|
|
int | ctr_io_write (void *io, const void *buffer, size_t buffer_size, uint64_t position) |
| Writes bytes to the given io interface. More...
|
|
int | ctr_io_read_sector (void *io, void *buffer, size_t buffer_size, size_t sector, size_t count) |
| Reads sectors from the given io interface. More...
|
|
int | ctr_io_write_sector (void *io, const void *buffer, size_t buffer_size, size_t sector) |
| Writes sectors from the given io interface. More...
|
|
uint64_t | ctr_io_disk_size (void *io) |
| Returns the size of the underlying disk for the given io interface. More...
|
|
size_t | ctr_io_sector_size (void *io) |
| Returns the size of the sectors used by the io interface. More...
|
|
typedef uint64_t(* ctr_io_interface_disk_size) (void *io) |
Pointer to an io interface function used to get the size of the disk.
- Returns
- The size of the io interface's underlying disk storage in bytes.
typedef int(* ctr_io_interface_read) (void *io, void *buffer, size_t buffer_size, uint64_t position, size_t count) |
Pointer to an io interface function used to read.
- Parameters
-
[in,out] | io | The io interface to use for reading. |
[out] | buffer | Pointer to the buffer. |
[in] | buffer_size | The size of the buffer in bytes. |
[in] | position | Position/address in the io interface to read from. |
[in] | count | The number of bytes to read. |
- Returns
- 0 upon success, anything else means an error.
typedef int(* ctr_io_interface_read_sector) (void *io, void *buffer, size_t buffer_size, size_t sector, size_t count) |
Pointer to an io interface function used to read sectors.
The definition of a sector is left to the io interface being used. Refer to ctr_io_sector_size as a way to poll how many bytes constitute a sector.
- Parameters
-
[in,out] | io | The io interface to use for reading. |
[out] | buffer | Pointer to the buffer. |
[in] | buffer_size | The size of the buffer in bytes. |
[in] | sector | Sector position in the io interface to read from. |
[in] | count | The number of sectors to read. |
- Returns
- 0 upon success, anything else means an error.
typedef size_t(* ctr_io_interface_sector_size) (void *io) |
Pointer to an io interface function used to get the sector size in bytes.
- Returns
- The size of the io interface's sector size in bytes.
typedef int(* ctr_io_interface_write) (void *io, const void *buffer, size_t buffer_size, uint64_t position) |
Pointer to an io interface function used to write.
- Parameters
-
[in,out] | io | The io interface to use for writing. |
[in] | buffer | Pointer to the buffer. |
[in] | buffer_size | The size of the buffer, and the number of bytes to write. |
[in] | position | Position/address in the io interface to write to. |
- Returns
- 0 upon success, anything else means an error.
typedef int(* ctr_io_interface_write_sector) (void *io, const void *buffer, size_t buffer_size, size_t sector) |
Pointer to an io interface function used to write sectors.
- Parameters
-
[in,out] | io | The io interface to use for writing. |
[in] | buffer | Pointer to the buffer. |
[in] | buffer_size | The size of the buffer, and the number of bytes to write. If the number is not a multiple of the sector size, this function will only write all the full sectors it can, ignoring the end of the buffer that doesn't fit a sector. |
[in] | sector | Sector Position in the io interface to write to. |
- Returns
- 0 upon success, anything else means an error.
uint64_t ctr_io_disk_size |
( |
void * |
io | ) |
|
Returns the size of the underlying disk for the given io interface.
This function uses the virtual table in the io interface given to call the correct function to handle the read request.
- Returns
- The size of the io interface's underlying disk storage in bytes.
int ctr_io_read |
( |
void * |
io, |
|
|
void * |
buffer, |
|
|
size_t |
buffer_size, |
|
|
uint64_t |
position, |
|
|
size_t |
count |
|
) |
| |
Reads bytes from the given io interface.
This function uses the virtual table in the io interface given to call the correct function to handle the read request.
- Parameters
-
[in,out] | io | The io interface to use for reading. |
[out] | buffer | Pointer to the buffer. |
[in] | buffer_size | The size of the buffer in bytes. |
[in] | position | Position/address in the io interface to read from. |
[in] | count | The number of bytes to read. |
- Returns
- 0 upon success, anything else means an error.
int ctr_io_read_sector |
( |
void * |
io, |
|
|
void * |
buffer, |
|
|
size_t |
buffer_size, |
|
|
size_t |
sector, |
|
|
size_t |
count |
|
) |
| |
Reads sectors from the given io interface.
This function uses the virtual table in the io interface given to call the correct function to handle the read sectors request.
The definition of a sector is left to the io interface being used. Refer to ctr_io_sector_size as a way to poll how many bytes constitute a sector.
- Parameters
-
[in,out] | io | The io interface to use for reading. |
[out] | buffer | Pointer to the buffer. |
[in] | buffer_size | The size of the buffer in bytes. |
[in] | sector | Sector position in the io interface to read from. |
[in] | count | The number of sectors to read. |
- Returns
- 0 upon success, anything else means an error.
size_t ctr_io_sector_size |
( |
void * |
io | ) |
|
Returns the size of the sectors used by the io interface.
This function uses the virtual table in the io interface given to call the correct function to handle the read request.
- Returns
- The size of the io interface's sector size in bytes.
int ctr_io_write |
( |
void * |
io, |
|
|
const void * |
buffer, |
|
|
size_t |
buffer_size, |
|
|
uint64_t |
position |
|
) |
| |
Writes bytes to the given io interface.
This function uses the virtual table in the io interface given to call the correct function to handle the write request.
- Parameters
-
[in,out] | io | The io interface to use for writing. |
[in] | buffer | Pointer to the buffer. |
[in] | buffer_size | The size of the buffer, and the number of bytes to write. |
[in] | position | Position/address in the io interface to write to. |
- Returns
- 0 upon success, anything else means an error.
int ctr_io_write_sector |
( |
void * |
io, |
|
|
const void * |
buffer, |
|
|
size_t |
buffer_size, |
|
|
size_t |
sector |
|
) |
| |
Writes sectors from the given io interface.
This function uses the virtual table in the io interface given to call the correct function to handle the write sectors request.
- Parameters
-
[in,out] | io | The io interface to use for writing. |
[in] | buffer | Pointer to the buffer. |
[in] | buffer_size | The size of the buffer, and the number of bytes to write. If the number is not a multiple of the sector size, this function will only write all the full sectors it can, ignoring the end of the buffer that doesn't fit a sector. |
[in] | sector | Sector Position in the io interface to write to. |
- Returns
- 0 upon success, anything else means an error.