SPIFFS : FIXES FS corruption against high numbero f current losses, high number of files manipulation. FIXES LOG_BLOCK erasing handlers. FIXES Garbage Collector. Overall, SPIFFS should now be WAY MORE resilient to any form of misbehavior. In case of corrupted filesystem (should still be readable !), spamming 'mem spiffs check' from the client will ensure at least 2 new free 4k blocks each tile (if number of LOG_PAGE available is enough) and in the same pass will move/reorganize the LOG_PAGES of contextual blocks. Yiha

This commit is contained in:
cjbrigato 2019-08-13 15:58:08 +02:00 committed by Philippe Teuwen
commit 961f98c125
8 changed files with 100 additions and 69 deletions

View file

@ -8,7 +8,22 @@
#ifndef SPIFFS_CONFIG_H_
#define SPIFFS_CONFIG_H_
#include "common.h"
// ----------- 8< ------------
// Following includes are for the linux test build of spiffs
// These may/should/must be removed/altered/replaced in your target
//#include <stdio.h>
//#include <stdlib.h>
//
#include "printf.h"
#include "string.h"
#include "flashmem.h"
void Dbprintf(const char *fmt, ...);
//#include <stddef.h>
//#include <unistd.h>
// ----------- >8 ------------
typedef int s32_t;
typedef uint32_t u32_t;
@ -26,7 +41,7 @@ typedef uint8_t u8_t;
#endif
// Set spiffs debug output call for garbage collecting.
#ifndef SPIFFS_GC_DBG
#define SPIFFS_GC_DBG(_f, ...)
#define SPIFFS_GC_DBG(_f, ...) //Dbprintf(_f, ## __VA_ARGS__)
#define SPIFFS_GC_DBGF(str) SPIFFS_GC_DBG(str,NULL)
#endif
// Set spiffs debug output call for caching.
@ -36,7 +51,7 @@ typedef uint8_t u8_t;
#endif
// Set spiffs debug output call for system consistency checks.
#ifndef SPIFFS_CHECK_DBG
#define SPIFFS_CHECK_DBG(_f, ...) //SPIFFS_CHECK_DBG(_f, ## __VA_ARGS__)
#define SPIFFS_CHECK_DBG(_f, ...) //Dbprintf(_f, ## __VA_ARGS__)
#define SPIFFS_CHECK_DBGF(str) SPIFFS_CHECK_DBG(str,NULL)
#endif
// Set spiffs debug output call for all api invocations.