-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
Conversation
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? |
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. |
Any chance this could be implemented before 3.0 ? 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 . |
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. :( |
I know but I do have to ask, if 3.0 in 2020, 3.0 in 2020 will be (if SPIFFS is still used ) |
|
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 |
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.
Replaced by #6544 |
Impact mkspiffs