mirror of https://github.com/ARMmbed/mbed-os.git
bd: Adopted the sync function in the util block devices
parent
3f5d618c89
commit
a4f8af9d5b
|
@ -84,6 +84,18 @@ int ChainingBlockDevice::deinit()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ChainingBlockDevice::sync()
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < _bd_count; i++) {
|
||||||
|
int err = _bds[i]->sync();
|
||||||
|
if (err) {
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int ChainingBlockDevice::read(void *b, bd_addr_t addr, bd_size_t size)
|
int ChainingBlockDevice::read(void *b, bd_addr_t addr, bd_size_t size)
|
||||||
{
|
{
|
||||||
MBED_ASSERT(is_valid_read(addr, size));
|
MBED_ASSERT(is_valid_read(addr, size));
|
||||||
|
|
|
@ -85,6 +85,12 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual int deinit();
|
virtual int deinit();
|
||||||
|
|
||||||
|
/** Ensure data on storage is in sync with the driver
|
||||||
|
*
|
||||||
|
* @return 0 on success or a negative error code on failure
|
||||||
|
*/
|
||||||
|
virtual int sync();
|
||||||
|
|
||||||
/** Read blocks from a block device
|
/** Read blocks from a block device
|
||||||
*
|
*
|
||||||
* @param buffer Buffer to write blocks to
|
* @param buffer Buffer to write blocks to
|
||||||
|
|
|
@ -53,6 +53,11 @@ int ExhaustibleBlockDevice::deinit()
|
||||||
return _bd->deinit();
|
return _bd->deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ExhaustibleBlockDevice::sync()
|
||||||
|
{
|
||||||
|
return _bd->sync();
|
||||||
|
}
|
||||||
|
|
||||||
int ExhaustibleBlockDevice::read(void *buffer, bd_addr_t addr, bd_size_t size)
|
int ExhaustibleBlockDevice::read(void *buffer, bd_addr_t addr, bd_size_t size)
|
||||||
{
|
{
|
||||||
return _bd->read(buffer, addr, size);
|
return _bd->read(buffer, addr, size);
|
||||||
|
|
|
@ -70,6 +70,12 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual int deinit();
|
virtual int deinit();
|
||||||
|
|
||||||
|
/** Ensure data on storage is in sync with the driver
|
||||||
|
*
|
||||||
|
* @return 0 on success or a negative error code on failure
|
||||||
|
*/
|
||||||
|
virtual int sync();
|
||||||
|
|
||||||
/** Read blocks from a block device
|
/** Read blocks from a block device
|
||||||
*
|
*
|
||||||
* @param buffer Buffer to read blocks into
|
* @param buffer Buffer to read blocks into
|
||||||
|
|
|
@ -234,6 +234,11 @@ int MBRBlockDevice::deinit()
|
||||||
return _bd->deinit();
|
return _bd->deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int MBRBlockDevice::sync()
|
||||||
|
{
|
||||||
|
return _bd->sync();
|
||||||
|
}
|
||||||
|
|
||||||
int MBRBlockDevice::read(void *b, bd_addr_t addr, bd_size_t size)
|
int MBRBlockDevice::read(void *b, bd_addr_t addr, bd_size_t size)
|
||||||
{
|
{
|
||||||
MBED_ASSERT(is_valid_read(addr, size));
|
MBED_ASSERT(is_valid_read(addr, size));
|
||||||
|
|
|
@ -139,6 +139,12 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual int deinit();
|
virtual int deinit();
|
||||||
|
|
||||||
|
/** Ensure data on storage is in sync with the driver
|
||||||
|
*
|
||||||
|
* @return 0 on success or a negative error code on failure
|
||||||
|
*/
|
||||||
|
virtual int sync();
|
||||||
|
|
||||||
/** Read blocks from a block device
|
/** Read blocks from a block device
|
||||||
*
|
*
|
||||||
* @param buffer Buffer to read blocks into
|
* @param buffer Buffer to read blocks into
|
||||||
|
|
|
@ -51,6 +51,11 @@ int ObservingBlockDevice::deinit()
|
||||||
return _bd->deinit();
|
return _bd->deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ObservingBlockDevice::sync()
|
||||||
|
{
|
||||||
|
return _bd->sync();
|
||||||
|
}
|
||||||
|
|
||||||
int ObservingBlockDevice::read(void *buffer, bd_addr_t addr, bd_size_t size)
|
int ObservingBlockDevice::read(void *buffer, bd_addr_t addr, bd_size_t size)
|
||||||
{
|
{
|
||||||
return _bd->read(buffer, addr, size);
|
return _bd->read(buffer, addr, size);
|
||||||
|
|
|
@ -56,6 +56,12 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual int deinit();
|
virtual int deinit();
|
||||||
|
|
||||||
|
/** Ensure data on storage is in sync with the driver
|
||||||
|
*
|
||||||
|
* @return 0 on success or a negative error code on failure
|
||||||
|
*/
|
||||||
|
virtual int sync();
|
||||||
|
|
||||||
/** Read blocks from a block device
|
/** Read blocks from a block device
|
||||||
*
|
*
|
||||||
* @param buffer Buffer to read blocks into
|
* @param buffer Buffer to read blocks into
|
||||||
|
|
|
@ -35,6 +35,11 @@ int ProfilingBlockDevice::deinit()
|
||||||
return _bd->deinit();
|
return _bd->deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ProfilingBlockDevice::sync()
|
||||||
|
{
|
||||||
|
return _bd->sync();
|
||||||
|
}
|
||||||
|
|
||||||
int ProfilingBlockDevice::read(void *b, bd_addr_t addr, bd_size_t size)
|
int ProfilingBlockDevice::read(void *b, bd_addr_t addr, bd_size_t size)
|
||||||
{
|
{
|
||||||
int err = _bd->read(b, addr, size);
|
int err = _bd->read(b, addr, size);
|
||||||
|
|
|
@ -71,6 +71,12 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual int deinit();
|
virtual int deinit();
|
||||||
|
|
||||||
|
/** Ensure data on storage is in sync with the driver
|
||||||
|
*
|
||||||
|
* @return 0 on success or a negative error code on failure
|
||||||
|
*/
|
||||||
|
virtual int sync();
|
||||||
|
|
||||||
/** Read blocks from a block device
|
/** Read blocks from a block device
|
||||||
*
|
*
|
||||||
* @param buffer Buffer to read blocks into
|
* @param buffer Buffer to read blocks into
|
||||||
|
|
|
@ -45,6 +45,11 @@ int ReadOnlyBlockDevice::deinit()
|
||||||
return _bd->deinit();
|
return _bd->deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ReadOnlyBlockDevice::sync()
|
||||||
|
{
|
||||||
|
return _bd->sync();
|
||||||
|
}
|
||||||
|
|
||||||
int ReadOnlyBlockDevice::read(void *buffer, bd_addr_t addr, bd_size_t size)
|
int ReadOnlyBlockDevice::read(void *buffer, bd_addr_t addr, bd_size_t size)
|
||||||
{
|
{
|
||||||
return _bd->read(buffer, addr, size);
|
return _bd->read(buffer, addr, size);
|
||||||
|
|
|
@ -49,6 +49,12 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual int deinit();
|
virtual int deinit();
|
||||||
|
|
||||||
|
/** Ensure data on storage is in sync with the driver
|
||||||
|
*
|
||||||
|
* @return 0 on success or a negative error code on failure
|
||||||
|
*/
|
||||||
|
virtual int sync();
|
||||||
|
|
||||||
/** Read blocks from a block device
|
/** Read blocks from a block device
|
||||||
*
|
*
|
||||||
* @param buffer Buffer to read blocks into
|
* @param buffer Buffer to read blocks into
|
||||||
|
|
|
@ -64,6 +64,11 @@ int SlicingBlockDevice::deinit()
|
||||||
return _bd->deinit();
|
return _bd->deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int SlicingBlockDevice::sync()
|
||||||
|
{
|
||||||
|
return _bd->sync();
|
||||||
|
}
|
||||||
|
|
||||||
int SlicingBlockDevice::read(void *b, bd_addr_t addr, bd_size_t size)
|
int SlicingBlockDevice::read(void *b, bd_addr_t addr, bd_size_t size)
|
||||||
{
|
{
|
||||||
MBED_ASSERT(is_valid_read(addr, size));
|
MBED_ASSERT(is_valid_read(addr, size));
|
||||||
|
|
|
@ -77,6 +77,12 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual int deinit();
|
virtual int deinit();
|
||||||
|
|
||||||
|
/** Ensure data on storage is in sync with the driver
|
||||||
|
*
|
||||||
|
* @return 0 on success or a negative error code on failure
|
||||||
|
*/
|
||||||
|
virtual int sync();
|
||||||
|
|
||||||
/** Read blocks from a block device
|
/** Read blocks from a block device
|
||||||
*
|
*
|
||||||
* @param buffer Buffer to read blocks into
|
* @param buffer Buffer to read blocks into
|
||||||
|
|
Loading…
Reference in New Issue