-
-
Notifications
You must be signed in to change notification settings - Fork 27
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
Make Filesystem owned #31
Comments
I think the issue with the allocation is that littlefs keeps internal pointers to it, so it cannot be moved, which is why a lot of the "normal" APIs require The way I see it the ideal way to deal with that would be to use This seems actually possible in Trussed if the entire trussed |
We indeed can't own the allocation without pinning because the config contains references to the allocation's cache buffers: src/fs.rs#L1189. I tried to take a stab at what a pinned based API would look like in sosthene-nitrokey/littlefs2/pinned. I think the overall approach is sound but this requires pinning the filesystem, the files structures and the dir iteration structures. In trussed this would mean pinning the We could still have perfectly safe callback-based APIs like we currently have, but the pinning specific APIs would enable more use-cases, especially The main issue of the pinning approach, that would make it much more complex, is that the The solutions would be:
|
Lots of the complexity in Trussed’s store implementation comes from the fact that
Filesystem
takes mutable references toAllocation
andStorage
instances, which means that we need three global mutables to get a&mut Filesystem<'static>
. I think this could be simplified ifFilesystem
would take ownership of the allocation and storage. This could be implemented pretty simple:Storage
for&mut Storage
and letFilesystem
take ownership ofS: Storage
. This would make it possible to use either an owned storage implementation or a mutable reference to it.Filesystem::into_inner
.Cow
to also make it possible to use an owned allocation.What do you think?
The text was updated successfully, but these errors were encountered: