-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FATFileSystem: provide working dir_rewind and dir_seek #5503
Conversation
@infinnovation - We will upgrade to ChanFs 0.13a version and |
finfo.lfname = lfname; | ||
finfo.lfsize = NAME_MAX; | ||
#endif // _USE_LFN | ||
res = f_readdir(dh, &finfo); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Return value/error here will not be propagated to application.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only useful thing an application can do after dir_seek() is dir_read(), at which point it will receive an error.
@@ -660,7 +660,24 @@ void FATFileSystem::dir_seek(fs_dir_t dir, off_t offset) { | |||
FATFS_DIR *dh = static_cast<FATFS_DIR*>(dir); | |||
|
|||
lock(); | |||
dh->index = offset; | |||
if (offset < dh->index) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This optimisation assumes that index is monotonic increasing (which appears to be the case in the current version of ChaN FatFs). If not, rewind unconditionally and use an equality test in the while loop.
@deepikabhavnani Although My priority is to have a working rewinddir. |
Thanks for this patch ! As the update is already up, would it be possible to rebase this on top of the updated version ? @deepikabhavnani please advise |
The index field of FATFS_DIR does not encapsulate all the context required to reposition the directory traversal. ChaN provides f_rewinddir() but no directory seek, so rewind if necessary then step through until the desired index is reached.
6d96f82
to
452e290
Compare
@0xc0170 - Patch will require changes (apart from rebase) to be compatible with FAT upgrade, we can go ahead with this fix for old version, and I can update the patch to be compatible with FAT upgrade. This way we can have working API's in both versions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great, thanks for this 👍
LGTM
/morph build |
1 similar comment
/morph build |
Build : SUCCESSBuild number : 539 Triggering tests/morph test |
Exporter Build : SUCCESSBuild number : 155 |
Test : SUCCESSBuild number : 350 |
uvisor CI manually triggered, should be completed soon |
Restart uvisor, as the last one did not report back the status. |
I get (2) compiler warnings when building mbed OS 5.7.2 on ARM_GCC:
I think the right thing to do would be to |
Description
Working implementations of dir_rewind and dir_seek are provided for FATFileSystem,
I believe that this fixes #5440 and obviates the need for API changes proposed in #5441.
Status
READY
Migrations
NO