Rename LITTLEFS to LittleFS to match ESP8266 (#5396)
Fixes: https://github.com/espressif/arduino-esp32/issues/5103
This commit is contained in:
parent
dd25e2b9d6
commit
c8a4010fa6
@ -55,7 +55,7 @@ set(LIBRARY_SRCS
|
|||||||
libraries/FS/src/vfs_api.cpp
|
libraries/FS/src/vfs_api.cpp
|
||||||
libraries/HTTPClient/src/HTTPClient.cpp
|
libraries/HTTPClient/src/HTTPClient.cpp
|
||||||
libraries/HTTPUpdate/src/HTTPUpdate.cpp
|
libraries/HTTPUpdate/src/HTTPUpdate.cpp
|
||||||
libraries/LITTLEFS/src/LITTLEFS.cpp
|
libraries/LittleFS/src/LittleFS.cpp
|
||||||
libraries/NetBIOS/src/NetBIOS.cpp
|
libraries/NetBIOS/src/NetBIOS.cpp
|
||||||
libraries/Preferences/src/Preferences.cpp
|
libraries/Preferences/src/Preferences.cpp
|
||||||
libraries/RainMaker/src/RMaker.cpp
|
libraries/RainMaker/src/RMaker.cpp
|
||||||
@ -140,7 +140,7 @@ set(includedirs
|
|||||||
libraries/FS/src
|
libraries/FS/src
|
||||||
libraries/HTTPClient/src
|
libraries/HTTPClient/src
|
||||||
libraries/HTTPUpdate/src
|
libraries/HTTPUpdate/src
|
||||||
libraries/LITTLEFS/src
|
libraries/LittleFS/src
|
||||||
libraries/NetBIOS/src
|
libraries/NetBIOS/src
|
||||||
libraries/Preferences/src
|
libraries/Preferences/src
|
||||||
libraries/RainMaker/src
|
libraries/RainMaker/src
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include "FS.h"
|
#include "FS.h"
|
||||||
#include <LITTLEFS.h>
|
#include <LittleFS.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
/* You only need to format LITTLEFS the first time you run a
|
/* You only need to format LittleFS the first time you run a
|
||||||
test or else use the LITTLEFS plugin to create a partition
|
test or else use the LITTLEFS plugin to create a partition
|
||||||
https://github.com/lorol/arduino-esp32littlefs-plugin */
|
https://github.com/lorol/arduino-esp32littlefs-plugin */
|
||||||
|
|
||||||
@ -249,30 +249,30 @@ void testFileIO(fs::FS &fs, const char * path){
|
|||||||
|
|
||||||
void setup(){
|
void setup(){
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
if(!LITTLEFS.begin(FORMAT_LITTLEFS_IF_FAILED)){
|
if(!LittleFS.begin(FORMAT_LITTLEFS_IF_FAILED)){
|
||||||
Serial.println("LITTLEFS Mount Failed");
|
Serial.println("LittleFS Mount Failed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
listDir(LITTLEFS, "/", 0);
|
listDir(LittleFS, "/", 0);
|
||||||
createDir(LITTLEFS, "/mydir");
|
createDir(LittleFS, "/mydir");
|
||||||
writeFile(LITTLEFS, "/mydir/hello2.txt", "Hello2");
|
writeFile(LittleFS, "/mydir/hello2.txt", "Hello2");
|
||||||
//writeFile(LITTLEFS, "/mydir/newdir2/newdir3/hello3.txt", "Hello3");
|
//writeFile(LittleFS, "/mydir/newdir2/newdir3/hello3.txt", "Hello3");
|
||||||
writeFile2(LITTLEFS, "/mydir/newdir2/newdir3/hello3.txt", "Hello3");
|
writeFile2(LittleFS, "/mydir/newdir2/newdir3/hello3.txt", "Hello3");
|
||||||
listDir(LITTLEFS, "/", 3);
|
listDir(LittleFS, "/", 3);
|
||||||
deleteFile(LITTLEFS, "/mydir/hello2.txt");
|
deleteFile(LittleFS, "/mydir/hello2.txt");
|
||||||
//deleteFile(LITTLEFS, "/mydir/newdir2/newdir3/hello3.txt");
|
//deleteFile(LittleFS, "/mydir/newdir2/newdir3/hello3.txt");
|
||||||
deleteFile2(LITTLEFS, "/mydir/newdir2/newdir3/hello3.txt");
|
deleteFile2(LittleFS, "/mydir/newdir2/newdir3/hello3.txt");
|
||||||
removeDir(LITTLEFS, "/mydir");
|
removeDir(LittleFS, "/mydir");
|
||||||
listDir(LITTLEFS, "/", 3);
|
listDir(LittleFS, "/", 3);
|
||||||
writeFile(LITTLEFS, "/hello.txt", "Hello ");
|
writeFile(LittleFS, "/hello.txt", "Hello ");
|
||||||
appendFile(LITTLEFS, "/hello.txt", "World!\r\n");
|
appendFile(LittleFS, "/hello.txt", "World!\r\n");
|
||||||
readFile(LITTLEFS, "/hello.txt");
|
readFile(LittleFS, "/hello.txt");
|
||||||
renameFile(LITTLEFS, "/hello.txt", "/foo.txt");
|
renameFile(LittleFS, "/hello.txt", "/foo.txt");
|
||||||
readFile(LITTLEFS, "/foo.txt");
|
readFile(LittleFS, "/foo.txt");
|
||||||
deleteFile(LITTLEFS, "/foo.txt");
|
deleteFile(LittleFS, "/foo.txt");
|
||||||
testFileIO(LITTLEFS, "/test.txt");
|
testFileIO(LittleFS, "/test.txt");
|
||||||
deleteFile(LITTLEFS, "/test.txt");
|
deleteFile(LittleFS, "/test.txt");
|
||||||
|
|
||||||
Serial.println( "Test complete" );
|
Serial.println( "Test complete" );
|
||||||
}
|
}
|
@ -1,8 +1,8 @@
|
|||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include "FS.h"
|
#include "FS.h"
|
||||||
#include <LITTLEFS.h>
|
#include <LittleFS.h>
|
||||||
|
|
||||||
/* You only need to format LITTLEFS the first time you run a
|
/* You only need to format LittleFS the first time you run a
|
||||||
test or else use the LITTLEFS plugin to create a partition
|
test or else use the LITTLEFS plugin to create a partition
|
||||||
https://github.com/lorol/arduino-esp32littlefs-plugin
|
https://github.com/lorol/arduino-esp32littlefs-plugin
|
||||||
|
|
||||||
@ -244,41 +244,41 @@ void setup(){
|
|||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
|
||||||
#ifdef TWOPART
|
#ifdef TWOPART
|
||||||
if(!LITTLEFS.begin(FORMAT_LITTLEFS_IF_FAILED, "/lfs2", 5, "part2")){
|
if(!LittleFS.begin(FORMAT_LITTLEFS_IF_FAILED, "/lfs2", 5, "part2")){
|
||||||
Serial.println("part2 Mount Failed");
|
Serial.println("part2 Mount Failed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
appendFile(LITTLEFS, "/hello0.txt", "World0!\r\n");
|
appendFile(LittleFS, "/hello0.txt", "World0!\r\n");
|
||||||
readFile(LITTLEFS, "/hello0.txt");
|
readFile(LittleFS, "/hello0.txt");
|
||||||
LITTLEFS.end();
|
LittleFS.end();
|
||||||
|
|
||||||
Serial.println( "Done with part2, work with the first lfs partition..." );
|
Serial.println( "Done with part2, work with the first lfs partition..." );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(!LITTLEFS.begin(FORMAT_LITTLEFS_IF_FAILED)){
|
if(!LittleFS.begin(FORMAT_LITTLEFS_IF_FAILED)){
|
||||||
Serial.println("LITTLEFS Mount Failed");
|
Serial.println("LittleFS Mount Failed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Serial.println( "SPIFFS-like write file to new path and delete it w/folders" );
|
Serial.println( "SPIFFS-like write file to new path and delete it w/folders" );
|
||||||
writeFile2(LITTLEFS, "/new1/new2/new3/hello3.txt", "Hello3");
|
writeFile2(LittleFS, "/new1/new2/new3/hello3.txt", "Hello3");
|
||||||
listDir(LITTLEFS, "/", 3);
|
listDir(LittleFS, "/", 3);
|
||||||
deleteFile2(LITTLEFS, "/new1/new2/new3/hello3.txt");
|
deleteFile2(LittleFS, "/new1/new2/new3/hello3.txt");
|
||||||
|
|
||||||
listDir(LITTLEFS, "/", 3);
|
listDir(LittleFS, "/", 3);
|
||||||
createDir(LITTLEFS, "/mydir");
|
createDir(LittleFS, "/mydir");
|
||||||
writeFile(LITTLEFS, "/mydir/hello2.txt", "Hello2");
|
writeFile(LittleFS, "/mydir/hello2.txt", "Hello2");
|
||||||
listDir(LITTLEFS, "/", 1);
|
listDir(LittleFS, "/", 1);
|
||||||
deleteFile(LITTLEFS, "/mydir/hello2.txt");
|
deleteFile(LittleFS, "/mydir/hello2.txt");
|
||||||
removeDir(LITTLEFS, "/mydir");
|
removeDir(LittleFS, "/mydir");
|
||||||
listDir(LITTLEFS, "/", 1);
|
listDir(LittleFS, "/", 1);
|
||||||
writeFile(LITTLEFS, "/hello.txt", "Hello ");
|
writeFile(LittleFS, "/hello.txt", "Hello ");
|
||||||
appendFile(LITTLEFS, "/hello.txt", "World!\r\n");
|
appendFile(LittleFS, "/hello.txt", "World!\r\n");
|
||||||
readFile(LITTLEFS, "/hello.txt");
|
readFile(LittleFS, "/hello.txt");
|
||||||
renameFile(LITTLEFS, "/hello.txt", "/foo.txt");
|
renameFile(LittleFS, "/hello.txt", "/foo.txt");
|
||||||
readFile(LITTLEFS, "/foo.txt");
|
readFile(LittleFS, "/foo.txt");
|
||||||
deleteFile(LITTLEFS, "/foo.txt");
|
deleteFile(LittleFS, "/foo.txt");
|
||||||
testFileIO(LITTLEFS, "/test.txt");
|
testFileIO(LittleFS, "/test.txt");
|
||||||
deleteFile(LITTLEFS, "/test.txt");
|
deleteFile(LittleFS, "/test.txt");
|
||||||
|
|
||||||
Serial.println( "Test complete" );
|
Serial.println( "Test complete" );
|
||||||
}
|
}
|
@ -1,16 +1,16 @@
|
|||||||
#include "FS.h"
|
#include "FS.h"
|
||||||
//#include "SPIFFS.h"
|
//#include "SPIFFS.h"
|
||||||
#include "LITTLEFS.h"
|
#include "LittleFS.h"
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
|
|
||||||
#define SPIFFS LITTLEFS
|
#define SPIFFS LittleFS
|
||||||
|
|
||||||
/* This examples uses "quick re-define" of SPIFFS to run
|
/* This examples uses "quick re-define" of SPIFFS to run
|
||||||
an existing sketch with LITTLEFS instead of SPIFFS
|
an existing sketch with LittleFS instead of SPIFFS
|
||||||
|
|
||||||
You only need to format LITTLEFS the first time you run a
|
You only need to format LittleFS the first time you run a
|
||||||
test or else use the LITTLEFS plugin to create a partition
|
test or else use the LittleFS plugin to create a partition
|
||||||
https://github.com/lorol/arduino-esp32littlefs-plugin */
|
https://github.com/lorol/arduino-esp32littlefs-plugin */
|
||||||
|
|
||||||
#define FORMAT_LITTLEFS_IF_FAILED true
|
#define FORMAT_LITTLEFS_IF_FAILED true
|
||||||
@ -169,7 +169,7 @@ void setup(){
|
|||||||
Serial.println("");
|
Serial.println("");
|
||||||
|
|
||||||
if(!SPIFFS.begin(FORMAT_LITTLEFS_IF_FAILED)){
|
if(!SPIFFS.begin(FORMAT_LITTLEFS_IF_FAILED)){
|
||||||
Serial.println("LITTLEFS Mount Failed");
|
Serial.println("LittleFS Mount Failed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
name=LITTLEFS
|
name=LittleFS
|
||||||
version=2.0.0
|
version=2.0.0
|
||||||
author=
|
author=
|
||||||
maintainer=
|
maintainer=
|
@ -22,7 +22,7 @@ extern "C" {
|
|||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
}
|
}
|
||||||
#include "sdkconfig.h"
|
#include "sdkconfig.h"
|
||||||
#include "LITTLEFS.h"
|
#include "LittleFS.h"
|
||||||
|
|
||||||
#ifdef CONFIG_LITTLEFS_PAGE_SIZE
|
#ifdef CONFIG_LITTLEFS_PAGE_SIZE
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -31,29 +31,29 @@ extern "C" {
|
|||||||
|
|
||||||
using namespace fs;
|
using namespace fs;
|
||||||
|
|
||||||
class LITTLEFSImpl : public VFSImpl
|
class LittleFSImpl : public VFSImpl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LITTLEFSImpl();
|
LittleFSImpl();
|
||||||
virtual ~LITTLEFSImpl() { }
|
virtual ~LittleFSImpl() { }
|
||||||
virtual bool exists(const char* path);
|
virtual bool exists(const char* path);
|
||||||
};
|
};
|
||||||
|
|
||||||
LITTLEFSImpl::LITTLEFSImpl()
|
LittleFSImpl::LittleFSImpl()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LITTLEFSImpl::exists(const char* path)
|
bool LittleFSImpl::exists(const char* path)
|
||||||
{
|
{
|
||||||
File f = open(path, "r");
|
File f = open(path, "r");
|
||||||
return (f == true);
|
return (f == true);
|
||||||
}
|
}
|
||||||
|
|
||||||
LITTLEFSFS::LITTLEFSFS() : FS(FSImplPtr(new LITTLEFSImpl())), partitionLabel_(NULL)
|
LittleFSFS::LittleFSFS() : FS(FSImplPtr(new LittleFSImpl())), partitionLabel_(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
LITTLEFSFS::~LITTLEFSFS()
|
LittleFSFS::~LittleFSFS()
|
||||||
{
|
{
|
||||||
if (partitionLabel_){
|
if (partitionLabel_){
|
||||||
free(partitionLabel_);
|
free(partitionLabel_);
|
||||||
@ -61,7 +61,7 @@ LITTLEFSFS::~LITTLEFSFS()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LITTLEFSFS::begin(bool formatOnFail, const char * basePath, uint8_t maxOpenFiles, const char * partitionLabel)
|
bool LittleFSFS::begin(bool formatOnFail, const char * basePath, uint8_t maxOpenFiles, const char * partitionLabel)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (partitionLabel_){
|
if (partitionLabel_){
|
||||||
@ -74,7 +74,7 @@ bool LITTLEFSFS::begin(bool formatOnFail, const char * basePath, uint8_t maxOpen
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(esp_littlefs_mounted(partitionLabel_)){
|
if(esp_littlefs_mounted(partitionLabel_)){
|
||||||
log_w("LITTLEFS Already Mounted!");
|
log_w("LittleFS Already Mounted!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,38 +91,38 @@ bool LITTLEFSFS::begin(bool formatOnFail, const char * basePath, uint8_t maxOpen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(err != ESP_OK){
|
if(err != ESP_OK){
|
||||||
log_e("Mounting LITTLEFS failed! Error: %d", err);
|
log_e("Mounting LittleFS failed! Error: %d", err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_impl->mountpoint(basePath);
|
_impl->mountpoint(basePath);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LITTLEFSFS::end()
|
void LittleFSFS::end()
|
||||||
{
|
{
|
||||||
if(esp_littlefs_mounted(partitionLabel_)){
|
if(esp_littlefs_mounted(partitionLabel_)){
|
||||||
esp_err_t err = esp_vfs_littlefs_unregister(partitionLabel_);
|
esp_err_t err = esp_vfs_littlefs_unregister(partitionLabel_);
|
||||||
if(err){
|
if(err){
|
||||||
log_e("Unmounting LITTLEFS failed! Error: %d", err);
|
log_e("Unmounting LittleFS failed! Error: %d", err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_impl->mountpoint(NULL);
|
_impl->mountpoint(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LITTLEFSFS::format()
|
bool LittleFSFS::format()
|
||||||
{
|
{
|
||||||
disableCore0WDT();
|
disableCore0WDT();
|
||||||
esp_err_t err = esp_littlefs_format(partitionLabel_);
|
esp_err_t err = esp_littlefs_format(partitionLabel_);
|
||||||
enableCore0WDT();
|
enableCore0WDT();
|
||||||
if(err){
|
if(err){
|
||||||
log_e("Formatting LITTLEFS failed! Error: %d", err);
|
log_e("Formatting LittleFS failed! Error: %d", err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t LITTLEFSFS::totalBytes()
|
size_t LittleFSFS::totalBytes()
|
||||||
{
|
{
|
||||||
size_t total,used;
|
size_t total,used;
|
||||||
if(esp_littlefs_info(partitionLabel_, &total, &used)){
|
if(esp_littlefs_info(partitionLabel_, &total, &used)){
|
||||||
@ -131,7 +131,7 @@ size_t LITTLEFSFS::totalBytes()
|
|||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t LITTLEFSFS::usedBytes()
|
size_t LittleFSFS::usedBytes()
|
||||||
{
|
{
|
||||||
size_t total,used;
|
size_t total,used;
|
||||||
if(esp_littlefs_info(partitionLabel_, &total, &used)){
|
if(esp_littlefs_info(partitionLabel_, &total, &used)){
|
||||||
@ -140,5 +140,5 @@ size_t LITTLEFSFS::usedBytes()
|
|||||||
return used;
|
return used;
|
||||||
}
|
}
|
||||||
|
|
||||||
LITTLEFSFS LITTLEFS;
|
LittleFSFS LittleFS;
|
||||||
#endif
|
#endif
|
@ -19,11 +19,11 @@
|
|||||||
namespace fs
|
namespace fs
|
||||||
{
|
{
|
||||||
|
|
||||||
class LITTLEFSFS : public FS
|
class LittleFSFS : public FS
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LITTLEFSFS();
|
LittleFSFS();
|
||||||
~LITTLEFSFS();
|
~LittleFSFS();
|
||||||
bool begin(bool formatOnFail=false, const char * basePath="/littlefs", uint8_t maxOpenFiles=10, const char * partitionLabel="spiffs");
|
bool begin(bool formatOnFail=false, const char * basePath="/littlefs", uint8_t maxOpenFiles=10, const char * partitionLabel="spiffs");
|
||||||
bool format();
|
bool format();
|
||||||
size_t totalBytes();
|
size_t totalBytes();
|
||||||
@ -36,7 +36,7 @@ private:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern fs::LITTLEFSFS LITTLEFS;
|
extern fs::LittleFSFS LittleFS;
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Reference in New Issue
Block a user