Merged in AVyhovanec/nuttx (pull request #564)

FAT. Effectively handles the situation when a new file position is within the current sector.

* Find begin of the next token

* EOL

* revert

* Accelerates the work of the FS with a multitude of operations to write small pieces of data within the current sector.

Approved-by: Gregory Nutt <gnutt@nuttx.org>
This commit is contained in:
Aleksandr Vyhovanec 2018-01-05 20:52:53 +00:00 committed by Gregory Nutt
parent c85bc9e941
commit 8b97ea95c7

View File

@ -1071,10 +1071,13 @@ static off_t fat_seek(FAR struct file *filep, off_t offset, int whence)
* also happen in other situation such as when SEEK_SET is used to assure
* assure sequential access in a multi-threaded environment where there
* may be are multiple users to the file descriptor.
* Effectively handles the situation when a new file position is within
* the current sector.
*/
if (position == filep->f_pos)
if (position / fs->fs_hwsectorsize == filep->f_pos / fs->fs_hwsectorsize)
{
filep->f_pos = position;
return OK;
}