Skip to content

Commit c8a4010

Browse files
authored
Rename LITTLEFS to LittleFS to match ESP8266 (#5396)
Fixes: #5103
1 parent dd25e2b commit c8a4010

19 files changed

+80
-80
lines changed

Diff for: CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ set(LIBRARY_SRCS
5555
libraries/FS/src/vfs_api.cpp
5656
libraries/HTTPClient/src/HTTPClient.cpp
5757
libraries/HTTPUpdate/src/HTTPUpdate.cpp
58-
libraries/LITTLEFS/src/LITTLEFS.cpp
58+
libraries/LittleFS/src/LittleFS.cpp
5959
libraries/NetBIOS/src/NetBIOS.cpp
6060
libraries/Preferences/src/Preferences.cpp
6161
libraries/RainMaker/src/RMaker.cpp
@@ -140,7 +140,7 @@ set(includedirs
140140
libraries/FS/src
141141
libraries/HTTPClient/src
142142
libraries/HTTPUpdate/src
143-
libraries/LITTLEFS/src
143+
libraries/LittleFS/src
144144
libraries/NetBIOS/src
145145
libraries/Preferences/src
146146
libraries/RainMaker/src

Diff for: libraries/LITTLEFS/examples/LITTLEFS_PlatformIO/src/main.cpp renamed to libraries/LittleFS/examples/LITTLEFS_PlatformIO/src/main.cpp

+23-23
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#include <Arduino.h>
22
#include "FS.h"
3-
#include <LITTLEFS.h>
3+
#include <LittleFS.h>
44
#include <time.h>
55

6-
/* You only need to format LITTLEFS the first time you run a
6+
/* You only need to format LittleFS the first time you run a
77
test or else use the LITTLEFS plugin to create a partition
88
https://github.com/lorol/arduino-esp32littlefs-plugin */
99

@@ -249,30 +249,30 @@ void testFileIO(fs::FS &fs, const char * path){
249249

250250
void setup(){
251251
Serial.begin(115200);
252-
if(!LITTLEFS.begin(FORMAT_LITTLEFS_IF_FAILED)){
253-
Serial.println("LITTLEFS Mount Failed");
252+
if(!LittleFS.begin(FORMAT_LITTLEFS_IF_FAILED)){
253+
Serial.println("LittleFS Mount Failed");
254254
return;
255255
}
256256

257-
listDir(LITTLEFS, "/", 0);
258-
createDir(LITTLEFS, "/mydir");
259-
writeFile(LITTLEFS, "/mydir/hello2.txt", "Hello2");
260-
//writeFile(LITTLEFS, "/mydir/newdir2/newdir3/hello3.txt", "Hello3");
261-
writeFile2(LITTLEFS, "/mydir/newdir2/newdir3/hello3.txt", "Hello3");
262-
listDir(LITTLEFS, "/", 3);
263-
deleteFile(LITTLEFS, "/mydir/hello2.txt");
264-
//deleteFile(LITTLEFS, "/mydir/newdir2/newdir3/hello3.txt");
265-
deleteFile2(LITTLEFS, "/mydir/newdir2/newdir3/hello3.txt");
266-
removeDir(LITTLEFS, "/mydir");
267-
listDir(LITTLEFS, "/", 3);
268-
writeFile(LITTLEFS, "/hello.txt", "Hello ");
269-
appendFile(LITTLEFS, "/hello.txt", "World!\r\n");
270-
readFile(LITTLEFS, "/hello.txt");
271-
renameFile(LITTLEFS, "/hello.txt", "/foo.txt");
272-
readFile(LITTLEFS, "/foo.txt");
273-
deleteFile(LITTLEFS, "/foo.txt");
274-
testFileIO(LITTLEFS, "/test.txt");
275-
deleteFile(LITTLEFS, "/test.txt");
257+
listDir(LittleFS, "/", 0);
258+
createDir(LittleFS, "/mydir");
259+
writeFile(LittleFS, "/mydir/hello2.txt", "Hello2");
260+
//writeFile(LittleFS, "/mydir/newdir2/newdir3/hello3.txt", "Hello3");
261+
writeFile2(LittleFS, "/mydir/newdir2/newdir3/hello3.txt", "Hello3");
262+
listDir(LittleFS, "/", 3);
263+
deleteFile(LittleFS, "/mydir/hello2.txt");
264+
//deleteFile(LittleFS, "/mydir/newdir2/newdir3/hello3.txt");
265+
deleteFile2(LittleFS, "/mydir/newdir2/newdir3/hello3.txt");
266+
removeDir(LittleFS, "/mydir");
267+
listDir(LittleFS, "/", 3);
268+
writeFile(LittleFS, "/hello.txt", "Hello ");
269+
appendFile(LittleFS, "/hello.txt", "World!\r\n");
270+
readFile(LittleFS, "/hello.txt");
271+
renameFile(LittleFS, "/hello.txt", "/foo.txt");
272+
readFile(LittleFS, "/foo.txt");
273+
deleteFile(LittleFS, "/foo.txt");
274+
testFileIO(LittleFS, "/test.txt");
275+
deleteFile(LittleFS, "/test.txt");
276276

277277
Serial.println( "Test complete" );
278278
}

Diff for: libraries/LITTLEFS/examples/LITTLEFS_test/LITTLEFS_test.ino renamed to libraries/LittleFS/examples/LITTLEFS_test/LITTLEFS_test.ino

+26-26
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#include <Arduino.h>
22
#include "FS.h"
3-
#include <LITTLEFS.h>
3+
#include <LittleFS.h>
44

5-
/* You only need to format LITTLEFS the first time you run a
5+
/* You only need to format LittleFS the first time you run a
66
test or else use the LITTLEFS plugin to create a partition
77
https://github.com/lorol/arduino-esp32littlefs-plugin
88
@@ -244,41 +244,41 @@ void setup(){
244244
Serial.begin(115200);
245245

246246
#ifdef TWOPART
247-
if(!LITTLEFS.begin(FORMAT_LITTLEFS_IF_FAILED, "/lfs2", 5, "part2")){
247+
if(!LittleFS.begin(FORMAT_LITTLEFS_IF_FAILED, "/lfs2", 5, "part2")){
248248
Serial.println("part2 Mount Failed");
249249
return;
250250
}
251-
appendFile(LITTLEFS, "/hello0.txt", "World0!\r\n");
252-
readFile(LITTLEFS, "/hello0.txt");
253-
LITTLEFS.end();
251+
appendFile(LittleFS, "/hello0.txt", "World0!\r\n");
252+
readFile(LittleFS, "/hello0.txt");
253+
LittleFS.end();
254254

255255
Serial.println( "Done with part2, work with the first lfs partition..." );
256256
#endif
257257

258-
if(!LITTLEFS.begin(FORMAT_LITTLEFS_IF_FAILED)){
259-
Serial.println("LITTLEFS Mount Failed");
258+
if(!LittleFS.begin(FORMAT_LITTLEFS_IF_FAILED)){
259+
Serial.println("LittleFS Mount Failed");
260260
return;
261261
}
262262
Serial.println( "SPIFFS-like write file to new path and delete it w/folders" );
263-
writeFile2(LITTLEFS, "/new1/new2/new3/hello3.txt", "Hello3");
264-
listDir(LITTLEFS, "/", 3);
265-
deleteFile2(LITTLEFS, "/new1/new2/new3/hello3.txt");
263+
writeFile2(LittleFS, "/new1/new2/new3/hello3.txt", "Hello3");
264+
listDir(LittleFS, "/", 3);
265+
deleteFile2(LittleFS, "/new1/new2/new3/hello3.txt");
266266

267-
listDir(LITTLEFS, "/", 3);
268-
createDir(LITTLEFS, "/mydir");
269-
writeFile(LITTLEFS, "/mydir/hello2.txt", "Hello2");
270-
listDir(LITTLEFS, "/", 1);
271-
deleteFile(LITTLEFS, "/mydir/hello2.txt");
272-
removeDir(LITTLEFS, "/mydir");
273-
listDir(LITTLEFS, "/", 1);
274-
writeFile(LITTLEFS, "/hello.txt", "Hello ");
275-
appendFile(LITTLEFS, "/hello.txt", "World!\r\n");
276-
readFile(LITTLEFS, "/hello.txt");
277-
renameFile(LITTLEFS, "/hello.txt", "/foo.txt");
278-
readFile(LITTLEFS, "/foo.txt");
279-
deleteFile(LITTLEFS, "/foo.txt");
280-
testFileIO(LITTLEFS, "/test.txt");
281-
deleteFile(LITTLEFS, "/test.txt");
267+
listDir(LittleFS, "/", 3);
268+
createDir(LittleFS, "/mydir");
269+
writeFile(LittleFS, "/mydir/hello2.txt", "Hello2");
270+
listDir(LittleFS, "/", 1);
271+
deleteFile(LittleFS, "/mydir/hello2.txt");
272+
removeDir(LittleFS, "/mydir");
273+
listDir(LittleFS, "/", 1);
274+
writeFile(LittleFS, "/hello.txt", "Hello ");
275+
appendFile(LittleFS, "/hello.txt", "World!\r\n");
276+
readFile(LittleFS, "/hello.txt");
277+
renameFile(LittleFS, "/hello.txt", "/foo.txt");
278+
readFile(LittleFS, "/foo.txt");
279+
deleteFile(LittleFS, "/foo.txt");
280+
testFileIO(LittleFS, "/test.txt");
281+
deleteFile(LittleFS, "/test.txt");
282282

283283
Serial.println( "Test complete" );
284284
}

Diff for: libraries/LITTLEFS/examples/LITTLEFS_time/LITTLEFS_time.ino renamed to libraries/LittleFS/examples/LITTLEFS_time/LITTLEFS_time.ino

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
#include "FS.h"
22
//#include "SPIFFS.h"
3-
#include "LITTLEFS.h"
3+
#include "LittleFS.h"
44
#include <time.h>
55
#include <WiFi.h>
66

7-
#define SPIFFS LITTLEFS
7+
#define SPIFFS LittleFS
88

99
/* This examples uses "quick re-define" of SPIFFS to run
10-
an existing sketch with LITTLEFS instead of SPIFFS
10+
an existing sketch with LittleFS instead of SPIFFS
1111
12-
You only need to format LITTLEFS the first time you run a
13-
test or else use the LITTLEFS plugin to create a partition
12+
You only need to format LittleFS the first time you run a
13+
test or else use the LittleFS plugin to create a partition
1414
https://github.com/lorol/arduino-esp32littlefs-plugin */
1515

1616
#define FORMAT_LITTLEFS_IF_FAILED true
@@ -169,7 +169,7 @@ void setup(){
169169
Serial.println("");
170170

171171
if(!SPIFFS.begin(FORMAT_LITTLEFS_IF_FAILED)){
172-
Serial.println("LITTLEFS Mount Failed");
172+
Serial.println("LittleFS Mount Failed");
173173
return;
174174
}
175175

Diff for: libraries/LITTLEFS/library.properties renamed to libraries/LittleFS/library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name=LITTLEFS
1+
name=LittleFS
22
version=2.0.0
33
author=
44
maintainer=

Diff for: libraries/LITTLEFS/src/LITTLEFS.cpp renamed to libraries/LittleFS/src/LittleFS.cpp

+18-18
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ extern "C" {
2222
#include <dirent.h>
2323
}
2424
#include "sdkconfig.h"
25-
#include "LITTLEFS.h"
25+
#include "LittleFS.h"
2626

2727
#ifdef CONFIG_LITTLEFS_PAGE_SIZE
2828
extern "C" {
@@ -31,37 +31,37 @@ extern "C" {
3131

3232
using namespace fs;
3333

34-
class LITTLEFSImpl : public VFSImpl
34+
class LittleFSImpl : public VFSImpl
3535
{
3636
public:
37-
LITTLEFSImpl();
38-
virtual ~LITTLEFSImpl() { }
37+
LittleFSImpl();
38+
virtual ~LittleFSImpl() { }
3939
virtual bool exists(const char* path);
4040
};
4141

42-
LITTLEFSImpl::LITTLEFSImpl()
42+
LittleFSImpl::LittleFSImpl()
4343
{
4444
}
4545

46-
bool LITTLEFSImpl::exists(const char* path)
46+
bool LittleFSImpl::exists(const char* path)
4747
{
4848
File f = open(path, "r");
4949
return (f == true);
5050
}
5151

52-
LITTLEFSFS::LITTLEFSFS() : FS(FSImplPtr(new LITTLEFSImpl())), partitionLabel_(NULL)
52+
LittleFSFS::LittleFSFS() : FS(FSImplPtr(new LittleFSImpl())), partitionLabel_(NULL)
5353
{
5454
}
5555

56-
LITTLEFSFS::~LITTLEFSFS()
56+
LittleFSFS::~LittleFSFS()
5757
{
5858
if (partitionLabel_){
5959
free(partitionLabel_);
6060
partitionLabel_ = NULL;
6161
}
6262
}
6363

64-
bool LITTLEFSFS::begin(bool formatOnFail, const char * basePath, uint8_t maxOpenFiles, const char * partitionLabel)
64+
bool LittleFSFS::begin(bool formatOnFail, const char * basePath, uint8_t maxOpenFiles, const char * partitionLabel)
6565
{
6666

6767
if (partitionLabel_){
@@ -74,7 +74,7 @@ bool LITTLEFSFS::begin(bool formatOnFail, const char * basePath, uint8_t maxOpen
7474
}
7575

7676
if(esp_littlefs_mounted(partitionLabel_)){
77-
log_w("LITTLEFS Already Mounted!");
77+
log_w("LittleFS Already Mounted!");
7878
return true;
7979
}
8080

@@ -91,38 +91,38 @@ bool LITTLEFSFS::begin(bool formatOnFail, const char * basePath, uint8_t maxOpen
9191
}
9292
}
9393
if(err != ESP_OK){
94-
log_e("Mounting LITTLEFS failed! Error: %d", err);
94+
log_e("Mounting LittleFS failed! Error: %d", err);
9595
return false;
9696
}
9797
_impl->mountpoint(basePath);
9898
return true;
9999
}
100100

101-
void LITTLEFSFS::end()
101+
void LittleFSFS::end()
102102
{
103103
if(esp_littlefs_mounted(partitionLabel_)){
104104
esp_err_t err = esp_vfs_littlefs_unregister(partitionLabel_);
105105
if(err){
106-
log_e("Unmounting LITTLEFS failed! Error: %d", err);
106+
log_e("Unmounting LittleFS failed! Error: %d", err);
107107
return;
108108
}
109109
_impl->mountpoint(NULL);
110110
}
111111
}
112112

113-
bool LITTLEFSFS::format()
113+
bool LittleFSFS::format()
114114
{
115115
disableCore0WDT();
116116
esp_err_t err = esp_littlefs_format(partitionLabel_);
117117
enableCore0WDT();
118118
if(err){
119-
log_e("Formatting LITTLEFS failed! Error: %d", err);
119+
log_e("Formatting LittleFS failed! Error: %d", err);
120120
return false;
121121
}
122122
return true;
123123
}
124124

125-
size_t LITTLEFSFS::totalBytes()
125+
size_t LittleFSFS::totalBytes()
126126
{
127127
size_t total,used;
128128
if(esp_littlefs_info(partitionLabel_, &total, &used)){
@@ -131,7 +131,7 @@ size_t LITTLEFSFS::totalBytes()
131131
return total;
132132
}
133133

134-
size_t LITTLEFSFS::usedBytes()
134+
size_t LittleFSFS::usedBytes()
135135
{
136136
size_t total,used;
137137
if(esp_littlefs_info(partitionLabel_, &total, &used)){
@@ -140,5 +140,5 @@ size_t LITTLEFSFS::usedBytes()
140140
return used;
141141
}
142142

143-
LITTLEFSFS LITTLEFS;
143+
LittleFSFS LittleFS;
144144
#endif

Diff for: libraries/LITTLEFS/src/LITTLEFS.h renamed to libraries/LittleFS/src/LittleFS.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
namespace fs
2020
{
2121

22-
class LITTLEFSFS : public FS
22+
class LittleFSFS : public FS
2323
{
2424
public:
25-
LITTLEFSFS();
26-
~LITTLEFSFS();
25+
LittleFSFS();
26+
~LittleFSFS();
2727
bool begin(bool formatOnFail=false, const char * basePath="/littlefs", uint8_t maxOpenFiles=10, const char * partitionLabel="spiffs");
2828
bool format();
2929
size_t totalBytes();
@@ -36,7 +36,7 @@ class LITTLEFSFS : public FS
3636

3737
}
3838

39-
extern fs::LITTLEFSFS LITTLEFS;
39+
extern fs::LittleFSFS LittleFS;
4040

4141

4242
#endif

0 commit comments

Comments
 (0)