Skip to content
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

Added SPIFFS_truncate function #218

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

davctv
Copy link

@davctv davctv commented Jul 28, 2018

Hi,

this pull request should solve issue

#107
and
#217

I used SPIFFS_remove function as a template. Complete test not already done, but I think it shuold be ok.

thanks

@davctv
Copy link
Author

davctv commented Jul 30, 2018

Hi,

I'm not an expert of Pull request (this is my first one), but I don't know why it failed the check..I modified the type of length parameter from __off_t to u32_t

Any suggestion to solve is appreciated.

Thanks.

@Squonk42
Copy link

99% of the code in SPIFFS_truncate() is common with SPIFFS_remove(), except for the additional length argument and parameters passed internally to spiffs_object_truncate(), so I suggest to write a common internal function SPIFFS_truncate_or_remove() with both length and remove_object flag as arguments and passed to spiffs_object_truncate() as-is, that is called from SPIFFS_remove() and SPIFFS_truncate() stubs instead.

I think having a SPIFFS_ftrunctate() similar to SPIFFS_fremove() (i.e., with a file handle instead of a path) could also be done the same way with little extra efforts.

@milamber-ls
Copy link

any update when this pull request will be accepted?

@davctv
Copy link
Author

davctv commented Nov 27, 2018

Hi @milamber-ls,

In my opinion @pellepl is not updating anymore the project (maybe he is working on the new version). Since you are using it for esp32 I think you could import the spiffs in "components" folder of your project and modify the source code with my edits.

@milamber-ls
Copy link

Thank you @davctv ! This is what I did and it works nicely. The problem in this situation is that every time that I am updating edp-idf I have to go and apply these changes all over again. Every time. From the esp-idf point of view they cant accept the request into esp-idf if this request is not accepted first. catch 22.

@VikOlliver
Copy link

Is SPIFFS truncate still in limbo?

@igrr
Copy link
Contributor

igrr commented Mar 17, 2022

Now implemented and merged in #278 + #287.

@VikOlliver
Copy link

Thanks, I'll get my project out of mothballs and try it out. Probably suffering from a little "bit rot" by now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants