Skip to content

Add time modification support to SPIFFS #3730

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

Closed
wants to merge 2 commits into from
Closed

Add time modification support to SPIFFS #3730

wants to merge 2 commits into from

Conversation

luc-github
Copy link
Contributor

Impact mkspiffs

@igrr
Copy link
Member

igrr commented Oct 22, 2017

Thanks for the PR @luc-github. Do you know if filesystem created with SPIFFS_OBJ_META_LEN set to 0 will be compatible with SPIFFS code built with SPIFFS_OBJ_META_LEN set to 4? In other words, will this PR create an issue for those who already have SPIFFS created using an earlier version of the core?

@luc-github
Copy link
Contributor Author

Hi @igrr yes this PR will break backward compatiblity, need a reformat and it affect mkspiffs - defined by SPIFFS owner and confirmed by my tests

My proposal was originaly for ESP32 (espressif/esp-idf#1061) as no backward yet but as is affect mkspiffs and currently it is used for ESP8266 and ESP32 without discrimination but version ? (igrr/mkspiffs#32)

So after discussing with @me-no-dev, he suggested me to push all PR( ESP8266 / IDF / esp32-arduino, but not mkspiffs) to be a base of further discussion - I think for ESP8266 this PR must come with a 3.0 release not in 2.X if it is even applied but then if we want to apply to ESP32 need to add a compilation flag and a visual result in version to discriminat which mkspiffs is usable with ESP- and which is for ESP32, as some people may use mkspiffs as standalone tool outside of core.

Current PR give visibility of needed changes in ESP8266.
I know you have a lot in your plate - this change is minor in code and break backward support but it also bring nice feature IMHO - sorry to bring more questions than it should

@devyte devyte added this to the 3.0.0 milestone Jan 2, 2018
@luc-github
Copy link
Contributor Author

Any chance this could be implemented before 3.0 ?
This is one year old already 2.5.0 is not yet released and I see 2.6.0 is already planned, so 3.0 projected time would be in 2020 if no intermediate release is added.

Do not get me wrong, the maintainers do a great job but when I suggested 3.0, I was not expecting it would happen 2 years or more after pushing this PR .

@earlephilhower earlephilhower modified the milestones: 3.0.0, 2.6.0 Dec 18, 2018
@earlephilhower
Copy link
Collaborator

Sorry 'bout that. Since it changes the on-flash layout, how do you see this actually being integrated/swapped between? Having people update their Arduino rev but lose all their files isn't a very good experience (and might mean this would have to be at 3.0 since it would be a breaking change). Seems like SPIFFS and other embedded FSes traded saving 100 bytes of header info describing the on-flash format for allowing this kind of flexibility. :(

@luc-github
Copy link
Contributor Author

I know but I do have to ask, if 3.0 in 2020, 3.0 in 2020 will be (if SPIFFS is still used )
I was waiting this PR in ESP8266 to add this feature in my projects to keep ESP8266/ESP32 aligned in identical features, now I have confirmation it won't happen, before very long time - I will drop the feature for ESP8266
Thank you for your great work

@d-a-v
Copy link
Collaborator

d-a-v commented Dec 19, 2018

SPIFFS_OBJ_META_LEN could be switched to a variable, and with autodetection on mount.

@luc-github
Copy link
Contributor Author

luc-github commented Dec 19, 2018

Yes I agree, adding a menu /option to set SPIFFS_OBJ_META_LEN would be great as keeping the compatibility, I am not sure the impact on mount as SPIFFS_OBJ_META_LEN is already set
But in that case mkspiffs is actually the one that would need a big rewrite adding a flexible SPIFFS_OBJ_META_LEN as parameter, if no parameter = 0
And I am guessing such change in mkspiffs would need a modification of SPIFFS core which I understand is not a way to go as need to use SPIFFS as it is for maintainability

earlephilhower added a commit to earlephilhower/Arduino that referenced this pull request Jul 20, 2019
Support the ESP32 File::getLastWrite() call and setting the time on
all filesystems automatically (assuming the system clock has
been set properly and time(NULL) returns the proper time!).

Adds Dir::fileTime() to get the time of a file being listed, similar to
Dir::fileName() and Dir::fileSize().

Adds ::setTimeCallback(time_t (*cb)()) to File, Dir, and FS, allowing
users to override the default timestamp on a per-file, directory, or
filesystem basis.  By default, a simple callback returning time(nullptr)
is implemented.

LittleFS uses the 't' attribute and should be backwards compatible.

SD/SDFS work and include wrappers for obsolete SdFat timestamp callbacks
using the MSDOS time.

SPIFFS has been updated to support either the existing on-flash format
without any timestamps, or a new on-flash format with a flag area and a
timestamp metadata element added.

SPIFFS will try and mount any existing filesystem as non-timestamp, and
continue to write them in the old format.

New filesystems may be formatted to include timestamps (default) or in
the old format, configurable via the SPIFFS.setConfig call.

The SPIFFS work took as starting point all of work of @luc-github in esp8266#3730
and extended it into a backwards compatible mode by doing much surgery
on the SPIFFS library itself and the on-flash format.

Includes an updated SD/listfiles and SPIFFS_time example.
@d-a-v
Copy link
Collaborator

d-a-v commented Sep 26, 2019

Replaced by #6544

@d-a-v d-a-v closed this Sep 26, 2019
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