basic_block_device class is an interface for a block device.
More...
#include <mn_block_device.hpp>
basic_block_device class is an interface for a block device.
◆ basic_block_device() [1/2]
mn::device::basic_block_device::basic_block_device |
( |
char |
prefix[8] | ) |
|
|
inline |
◆ ~basic_block_device()
virtual mn::device::basic_block_device::~basic_block_device |
( |
| ) |
|
|
virtualdefault |
BlockDevice's destructor.
◆ basic_block_device() [2/2]
◆ erase()
virtual int mn::device::basic_block_device::erase |
( |
uint64_t |
address, |
|
|
uint64_t |
size |
|
) |
| |
|
pure virtual |
Erases blocks on a device.
- Parameters
-
[in] | address | is the address of range that will be erased, must be a multiple of block size |
[in] | size | is the size of erased range, bytes, must be a multiple of block size |
- Returns
- 0 on success, error code otherwise
◆ get_block_size()
virtual size_t mn::device::basic_block_device::get_block_size |
( |
| ) |
const |
|
pure virtual |
◆ get_size()
virtual uint64_t mn::device::basic_block_device::get_size |
( |
| ) |
const |
|
pure virtual |
- Returns
- size of block device, bytes
◆ lock()
virtual void mn::device::basic_block_device::lock |
( |
| ) |
|
|
pure virtual |
Locks the device for exclusive use by current thread.
◆ open()
virtual int mn::device::basic_block_device::open |
( |
| ) |
|
|
pure virtual |
◆ operator=()
◆ read()
virtual int mn::device::basic_block_device::read |
( |
uint64_t |
address, |
|
|
void * |
buffer, |
|
|
size_t |
size |
|
) |
| |
|
pure virtual |
Reads data from a device.
- Parameters
-
[in] | address | is the address of data that will be read, must be a multiple of block size |
[out] | buffer | is the buffer into which the data will be read, must be valid |
[in] | size | is the size of buffer, bytes, must be a multiple of block size |
- Returns
- The size to readed and 0 on error.
◆ stop()
virtual int mn::device::basic_block_device::stop |
( |
| ) |
|
|
pure virtual |
Closes device.
- Precondition
- Device is opened.
- Returns
- 0 on success, error code otherwise
Implements mn::device::basic_device.
◆ synchronize()
virtual int mn::device::basic_block_device::synchronize |
( |
| ) |
|
|
pure virtual |
Synchronizes state of a device, ensuring all cached writes are finished.
- Precondition
- Device is opened.
- Returns
- 0 on success, error code otherwise
◆ unlock()
virtual void mn::device::basic_block_device::unlock |
( |
| ) |
|
|
pure virtual |
Unlocks the device which was previously locked by current thread.
- Warning
- This function must not be called from interrupt context!
◆ write()
virtual int mn::device::basic_block_device::write |
( |
uint64_t |
address, |
|
|
const void * |
buffer, |
|
|
size_t |
size |
|
) |
| |
|
pure virtual |
Writes data to a device.
- Precondition
- address and buffer and size are valid.
-
Selected range is within address space of device.
- Parameters
-
[in] | address | is the address of data that will be written, must be a multiple of block size |
[in] | buffer | is the buffer with data that will be written, must be valid |
[in] | size | is the size of buffer, bytes, must be a multiple of block size |
- Returns
- The size to written and 0 on error.
The documentation for this class was generated from the following file: