HAL_Linux: fixed storage bug in Linux too

This commit is contained in:
Andrew Tridgell 2014-09-11 18:57:23 +10:00
parent 74525cad89
commit d238ff7c5d
2 changed files with 9 additions and 9 deletions

View File

@ -90,10 +90,10 @@ void LinuxStorage::_storage_open(void)
void LinuxStorage::_mark_dirty(uint16_t loc, uint16_t length)
{
uint16_t end = loc + length;
while (loc < end) {
uint8_t line = (loc >> LINUX_STORAGE_LINE_SHIFT);
_dirty_mask |= 1 << line;
loc += LINUX_STORAGE_LINE_SIZE;
for (uint8_t line=loc>>LINUX_STORAGE_LINE_SHIFT;
line <= end>>LINUX_STORAGE_LINE_SHIFT;
line++) {
_dirty_mask |= 1U << line;
}
}

View File

@ -83,11 +83,11 @@ void LinuxStorage::_storage_open(void)
void LinuxStorage::_mark_dirty(uint16_t loc, uint16_t length)
{
uint16_t end = loc + length;
while (loc < end) {
uint8_t line = (loc >> LINUX_STORAGE_LINE_SHIFT);
_dirty_mask |= 1 << line;
loc += LINUX_STORAGE_LINE_SIZE;
}
for (uint8_t line=loc>>LINUX_STORAGE_LINE_SHIFT;
line <= end>>LINUX_STORAGE_LINE_SHIFT;
line++) {
_dirty_mask |= 1U << line;
}
}
void LinuxStorage::read_block(void *dst, uint16_t loc, size_t n)