mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-21 10:26:06 +03:00
Make SPIFFS garbage collection publicly available (#5944)
Original issue: https://github.com/esp8266/Arduino/issues/2870
This commit is contained in:
parent
9712170276
commit
f950d53d82
@ -262,6 +262,13 @@ void FS::end() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool FS::gc() {
|
||||||
|
if (!_impl) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return _impl->gc();
|
||||||
|
}
|
||||||
|
|
||||||
bool FS::format() {
|
bool FS::format() {
|
||||||
if (!_impl) {
|
if (!_impl) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -107,7 +107,7 @@ public:
|
|||||||
File openNextFile();
|
File openNextFile();
|
||||||
|
|
||||||
String readString() override;
|
String readString() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
FileImplPtr _p;
|
FileImplPtr _p;
|
||||||
|
|
||||||
@ -181,7 +181,7 @@ public:
|
|||||||
|
|
||||||
bool begin();
|
bool begin();
|
||||||
void end();
|
void end();
|
||||||
|
|
||||||
bool format();
|
bool format();
|
||||||
bool info(FSInfo& info);
|
bool info(FSInfo& info);
|
||||||
|
|
||||||
@ -206,6 +206,8 @@ public:
|
|||||||
bool rmdir(const char* path);
|
bool rmdir(const char* path);
|
||||||
bool rmdir(const String& path);
|
bool rmdir(const String& path);
|
||||||
|
|
||||||
|
bool gc();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
FSImplPtr _impl;
|
FSImplPtr _impl;
|
||||||
};
|
};
|
||||||
|
@ -82,6 +82,7 @@ public:
|
|||||||
virtual bool remove(const char* path) = 0;
|
virtual bool remove(const char* path) = 0;
|
||||||
virtual bool mkdir(const char* path) = 0;
|
virtual bool mkdir(const char* path) = 0;
|
||||||
virtual bool rmdir(const char* path) = 0;
|
virtual bool rmdir(const char* path) = 0;
|
||||||
|
virtual bool gc() { return true; } // May not be implemented in all file systems.
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace fs
|
} // namespace fs
|
||||||
|
@ -208,6 +208,11 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool gc() override
|
||||||
|
{
|
||||||
|
return SPIFFS_gc_quick( &_fs, 0 ) == SPIFFS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class SPIFFSFileImpl;
|
friend class SPIFFSFileImpl;
|
||||||
friend class SPIFFSDirImpl;
|
friend class SPIFFSDirImpl;
|
||||||
@ -290,7 +295,7 @@ protected:
|
|||||||
(void) report;
|
(void) report;
|
||||||
(void) arg1;
|
(void) arg1;
|
||||||
(void) arg2;
|
(void) arg2;
|
||||||
|
|
||||||
// TODO: spiffs doesn't pass any context pointer along with _check_cb,
|
// TODO: spiffs doesn't pass any context pointer along with _check_cb,
|
||||||
// so we can't do anything useful here other than perhaps
|
// so we can't do anything useful here other than perhaps
|
||||||
// feeding the watchdog
|
// feeding the watchdog
|
||||||
|
Loading…
x
Reference in New Issue
Block a user