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