|
@@ -8,14 +8,6 @@
|
|
|
#include "spiffs.h"
|
|
|
#include "spiffs_nucleus.h"
|
|
|
|
|
|
-#if SPIFFS_FILEHDL_OFFSET
|
|
|
-#define SPIFFS_FH_OFFS(fs, fh) ((fh) != 0 ? ((fh) + (fs)->cfg.fh_ix_offset) : 0)
|
|
|
-#define SPIFFS_FH_UNOFFS(fs, fh) ((fh) != 0 ? ((fh) - (fs)->cfg.fh_ix_offset) : 0)
|
|
|
-#else
|
|
|
-#define SPIFFS_FH_OFFS(fs, fh) (fh)
|
|
|
-#define SPIFFS_FH_UNOFFS(fs, fh) (fh)
|
|
|
-#endif
|
|
|
-
|
|
|
#if SPIFFS_CACHE == 1
|
|
|
static s32_t spiffs_fflush_cache(spiffs *fs, spiffs_file fh);
|
|
|
#endif
|
|
@@ -69,6 +61,7 @@ s32_t SPIFFS_format(spiffs *fs) {
|
|
|
#if SPIFFS_USE_MAGIC && SPIFFS_USE_MAGIC_LENGTH && SPIFFS_SINGLETON==0
|
|
|
|
|
|
s32_t SPIFFS_probe_fs(spiffs_config *config) {
|
|
|
+ SPIFFS_API_DBG("%s\n", __func__);
|
|
|
s32_t res = spiffs_probe(config);
|
|
|
return res;
|
|
|
}
|
|
@@ -79,11 +72,23 @@ s32_t SPIFFS_mount(spiffs *fs, spiffs_config *config, u8_t *work,
|
|
|
u8_t *fd_space, u32_t fd_space_size,
|
|
|
void *cache, u32_t cache_size,
|
|
|
spiffs_check_callback check_cb_f) {
|
|
|
+ SPIFFS_API_DBG("%s "
|
|
|
+ " sz:"_SPIPRIi " logpgsz:"_SPIPRIi " logblksz:"_SPIPRIi " perasz:"_SPIPRIi
|
|
|
+ " addr:"_SPIPRIad
|
|
|
+ " fdsz:"_SPIPRIi " cachesz:"_SPIPRIi
|
|
|
+ "\n",
|
|
|
+ __func__,
|
|
|
+ SPIFFS_CFG_PHYS_SZ(fs),
|
|
|
+ SPIFFS_CFG_LOG_PAGE_SZ(fs),
|
|
|
+ SPIFFS_CFG_LOG_BLOCK_SZ(fs),
|
|
|
+ SPIFFS_CFG_PHYS_ERASE_SZ(fs),
|
|
|
+ SPIFFS_CFG_PHYS_ADDR(fs),
|
|
|
+ fd_space_size, cache_size);
|
|
|
void *user_data;
|
|
|
SPIFFS_LOCK(fs);
|
|
|
user_data = fs->user_data;
|
|
|
memset(fs, 0, sizeof(spiffs));
|
|
|
- memcpy(&fs->cfg, config, sizeof(spiffs_config));
|
|
|
+ _SPIFFS_MEMCPY(&fs->cfg, config, sizeof(spiffs_config));
|
|
|
fs->user_data = user_data;
|
|
|
fs->block_count = SPIFFS_CFG_PHYS_SZ(fs) / SPIFFS_CFG_LOG_BLOCK_SZ(fs);
|
|
|
fs->work = &work[0];
|
|
@@ -148,6 +153,7 @@ s32_t SPIFFS_mount(spiffs *fs, spiffs_config *config, u8_t *work,
|
|
|
}
|
|
|
|
|
|
void SPIFFS_unmount(spiffs *fs) {
|
|
|
+ SPIFFS_API_DBG("%s\n", __func__);
|
|
|
if (!SPIFFS_CHECK_CFG(fs) || !SPIFFS_CHECK_MOUNT(fs)) return;
|
|
|
SPIFFS_LOCK(fs);
|
|
|
u32_t i;
|
|
@@ -171,10 +177,12 @@ s32_t SPIFFS_errno(spiffs *fs) {
|
|
|
}
|
|
|
|
|
|
void SPIFFS_clearerr(spiffs *fs) {
|
|
|
+ SPIFFS_API_DBG("%s\n", __func__);
|
|
|
fs->err_code = SPIFFS_OK;
|
|
|
}
|
|
|
|
|
|
s32_t SPIFFS_creat(spiffs *fs, const char *path, spiffs_mode mode) {
|
|
|
+ SPIFFS_API_DBG("%s '%s'\n", __func__, path);
|
|
|
#if SPIFFS_READ_ONLY
|
|
|
(void)fs; (void)path; (void)mode;
|
|
|
return SPIFFS_ERR_RO_NOT_IMPL;
|
|
@@ -199,6 +207,7 @@ s32_t SPIFFS_creat(spiffs *fs, const char *path, spiffs_mode mode) {
|
|
|
}
|
|
|
|
|
|
spiffs_file SPIFFS_open(spiffs *fs, const char *path, spiffs_flags flags, spiffs_mode mode) {
|
|
|
+ SPIFFS_API_DBG("%s '%s' "_SPIPRIfl "\n", __func__, path, flags);
|
|
|
(void)mode;
|
|
|
SPIFFS_API_CHECK_CFG(fs);
|
|
|
SPIFFS_API_CHECK_MOUNT(fs);
|
|
@@ -279,6 +288,7 @@ spiffs_file SPIFFS_open(spiffs *fs, const char *path, spiffs_flags flags, spiffs
|
|
|
}
|
|
|
|
|
|
spiffs_file SPIFFS_open_by_dirent(spiffs *fs, struct spiffs_dirent *e, spiffs_flags flags, spiffs_mode mode) {
|
|
|
+ SPIFFS_API_DBG("%s '%s':"_SPIPRIid " "_SPIPRIfl "\n", __func__, e->name, e->obj_id, flags);
|
|
|
SPIFFS_API_CHECK_CFG(fs);
|
|
|
SPIFFS_API_CHECK_MOUNT(fs);
|
|
|
SPIFFS_LOCK(fs);
|
|
@@ -311,6 +321,7 @@ spiffs_file SPIFFS_open_by_dirent(spiffs *fs, struct spiffs_dirent *e, spiffs_fl
|
|
|
}
|
|
|
|
|
|
spiffs_file SPIFFS_open_by_page(spiffs *fs, spiffs_page_ix page_ix, spiffs_flags flags, spiffs_mode mode) {
|
|
|
+ SPIFFS_API_DBG("%s "_SPIPRIpg " "_SPIPRIfl "\n", __func__, page_ix, flags);
|
|
|
SPIFFS_API_CHECK_CFG(fs);
|
|
|
SPIFFS_API_CHECK_MOUNT(fs);
|
|
|
SPIFFS_LOCK(fs);
|
|
@@ -411,6 +422,7 @@ static s32_t spiffs_hydro_read(spiffs *fs, spiffs_file fh, void *buf, s32_t len)
|
|
|
}
|
|
|
|
|
|
s32_t SPIFFS_read(spiffs *fs, spiffs_file fh, void *buf, s32_t len) {
|
|
|
+ SPIFFS_API_DBG("%s "_SPIPRIfd " "_SPIPRIi "\n", __func__, fh, len);
|
|
|
s32_t res = spiffs_hydro_read(fs, fh, buf, len);
|
|
|
if (res == SPIFFS_ERR_END_OF_OBJECT) {
|
|
|
res = 0;
|
|
@@ -444,6 +456,7 @@ static s32_t spiffs_hydro_write(spiffs *fs, spiffs_fd *fd, void *buf, u32_t offs
|
|
|
#endif // !SPIFFS_READ_ONLY
|
|
|
|
|
|
s32_t SPIFFS_write(spiffs *fs, spiffs_file fh, void *buf, s32_t len) {
|
|
|
+ SPIFFS_API_DBG("%s "_SPIPRIfd " "_SPIPRIi "\n", __func__, fh, len);
|
|
|
#if SPIFFS_READ_ONLY
|
|
|
(void)fs; (void)fh; (void)buf; (void)len;
|
|
|
return SPIFFS_ERR_RO_NOT_IMPL;
|
|
@@ -468,7 +481,6 @@ s32_t SPIFFS_write(spiffs *fs, spiffs_file fh, void *buf, s32_t len) {
|
|
|
if ((fd->flags & SPIFFS_O_APPEND)) {
|
|
|
fd->fdoffset = fd->size == SPIFFS_UNDEFINED_LEN ? 0 : fd->size;
|
|
|
}
|
|
|
-
|
|
|
offset = fd->fdoffset;
|
|
|
|
|
|
#if SPIFFS_CACHE_WR
|
|
@@ -502,7 +514,7 @@ s32_t SPIFFS_write(spiffs *fs, spiffs_file fh, void *buf, s32_t len) {
|
|
|
offset + len > fd->cache_page->offset + SPIFFS_CFG_LOG_PAGE_SZ(fs)) // writing beyond cache page
|
|
|
{
|
|
|
// boundary violation, write back cache first and allocate new
|
|
|
- SPIFFS_CACHE_DBG("CACHE_WR_DUMP: dumping cache page "_SPIPRIpg" for fd "_SPIPRIfd":"_SPIPRIid", boundary viol, offs:"_SPIPRIi" size:"_SPIPRIi"\n",
|
|
|
+ SPIFFS_CACHE_DBG("CACHE_WR_DUMP: dumping cache page "_SPIPRIi" for fd "_SPIPRIfd":"_SPIPRIid", boundary viol, offs:"_SPIPRIi" size:"_SPIPRIi"\n",
|
|
|
fd->cache_page->ix, fd->file_nbr, fd->obj_id, fd->cache_page->offset, fd->cache_page->size);
|
|
|
res = spiffs_hydro_write(fs, fd,
|
|
|
spiffs_get_cache_page(fs, spiffs_get_cache(fs), fd->cache_page->ix),
|
|
@@ -520,19 +532,30 @@ s32_t SPIFFS_write(spiffs *fs, spiffs_file fh, void *buf, s32_t len) {
|
|
|
if (fd->cache_page) {
|
|
|
fd->cache_page->offset = offset;
|
|
|
fd->cache_page->size = 0;
|
|
|
- SPIFFS_CACHE_DBG("CACHE_WR_ALLO: allocating cache page "_SPIPRIpg" for fd "_SPIPRIfd":"_SPIPRIid"\n",
|
|
|
+ SPIFFS_CACHE_DBG("CACHE_WR_ALLO: allocating cache page "_SPIPRIi" for fd "_SPIPRIfd":"_SPIPRIid"\n",
|
|
|
fd->cache_page->ix, fd->file_nbr, fd->obj_id);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (fd->cache_page) {
|
|
|
u32_t offset_in_cpage = offset - fd->cache_page->offset;
|
|
|
- SPIFFS_CACHE_DBG("CACHE_WR_WRITE: storing to cache page "_SPIPRIpg" for fd "_SPIPRIfd":"_SPIPRIid", offs "_SPIPRIi":"_SPIPRIi" len "_SPIPRIi"\n",
|
|
|
+ SPIFFS_CACHE_DBG("CACHE_WR_WRITE: storing to cache page "_SPIPRIi" for fd "_SPIPRIfd":"_SPIPRIid", offs "_SPIPRIi":"_SPIPRIi" len "_SPIPRIi"\n",
|
|
|
fd->cache_page->ix, fd->file_nbr, fd->obj_id,
|
|
|
offset, offset_in_cpage, len);
|
|
|
spiffs_cache *cache = spiffs_get_cache(fs);
|
|
|
u8_t *cpage_data = spiffs_get_cache_page(fs, cache, fd->cache_page->ix);
|
|
|
- memcpy(&cpage_data[offset_in_cpage], buf, len);
|
|
|
+#ifdef _SPIFFS_TEST
|
|
|
+ {
|
|
|
+ intptr_t __a1 = (u8_t*)&cpage_data[offset_in_cpage]-(u8_t*)cache;
|
|
|
+ intptr_t __a2 = (u8_t*)&cpage_data[offset_in_cpage]+len-(u8_t*)cache;
|
|
|
+ intptr_t __b = sizeof(spiffs_cache) + cache->cpage_count * (sizeof(spiffs_cache_page) + SPIFFS_CFG_LOG_PAGE_SZ(fs));
|
|
|
+ if (__a1 > __b || __a2 > __b) {
|
|
|
+ printf("FATAL OOB: CACHE_WR: memcpy to cache buffer ixs:%4ld..%4ld of %4ld\n", __a1, __a2, __b);
|
|
|
+ ERREXIT();
|
|
|
+ }
|
|
|
+ }
|
|
|
+#endif
|
|
|
+ _SPIFFS_MEMCPY(&cpage_data[offset_in_cpage], buf, len);
|
|
|
fd->cache_page->size = MAX(fd->cache_page->size, offset_in_cpage + len);
|
|
|
fd->fdoffset += len;
|
|
|
SPIFFS_UNLOCK(fs);
|
|
@@ -548,7 +571,7 @@ s32_t SPIFFS_write(spiffs *fs, spiffs_file fh, void *buf, s32_t len) {
|
|
|
// big write, no need to cache it - but first check if there is a cached write already
|
|
|
if (fd->cache_page) {
|
|
|
// write back cache first
|
|
|
- SPIFFS_CACHE_DBG("CACHE_WR_DUMP: dumping cache page "_SPIPRIpg" for fd "_SPIPRIfd":"_SPIPRIid", big write, offs:"_SPIPRIi" size:"_SPIPRIi"\n",
|
|
|
+ SPIFFS_CACHE_DBG("CACHE_WR_DUMP: dumping cache page "_SPIPRIi" for fd "_SPIPRIfd":"_SPIPRIid", big write, offs:"_SPIPRIi" size:"_SPIPRIi"\n",
|
|
|
fd->cache_page->ix, fd->file_nbr, fd->obj_id, fd->cache_page->offset, fd->cache_page->size);
|
|
|
res = spiffs_hydro_write(fs, fd,
|
|
|
spiffs_get_cache_page(fs, spiffs_get_cache(fs), fd->cache_page->ix),
|
|
@@ -572,6 +595,7 @@ s32_t SPIFFS_write(spiffs *fs, spiffs_file fh, void *buf, s32_t len) {
|
|
|
}
|
|
|
|
|
|
s32_t SPIFFS_lseek(spiffs *fs, spiffs_file fh, s32_t offs, int whence) {
|
|
|
+ SPIFFS_API_DBG("%s "_SPIPRIfd " "_SPIPRIi " %s\n", __func__, fh, offs, (const char* []){"SET","CUR","END","???"}[MIN(whence,3)]);
|
|
|
SPIFFS_API_CHECK_CFG(fs);
|
|
|
SPIFFS_API_CHECK_MOUNT(fs);
|
|
|
SPIFFS_LOCK(fs);
|
|
@@ -586,24 +610,26 @@ s32_t SPIFFS_lseek(spiffs *fs, spiffs_file fh, s32_t offs, int whence) {
|
|
|
spiffs_fflush_cache(fs, fh);
|
|
|
#endif
|
|
|
|
|
|
- s32_t fileSize = fd->size == SPIFFS_UNDEFINED_LEN ? 0 : fd->size;
|
|
|
+ s32_t file_size = fd->size == SPIFFS_UNDEFINED_LEN ? 0 : fd->size;
|
|
|
|
|
|
switch (whence) {
|
|
|
case SPIFFS_SEEK_CUR:
|
|
|
offs = fd->fdoffset+offs;
|
|
|
break;
|
|
|
case SPIFFS_SEEK_END:
|
|
|
- offs = fileSize + offs;
|
|
|
+ offs = file_size + offs;
|
|
|
break;
|
|
|
}
|
|
|
-
|
|
|
- if ((offs > fileSize)) {
|
|
|
- fd->fdoffset = fileSize;
|
|
|
+ if (offs < 0) {
|
|
|
+ SPIFFS_API_CHECK_RES_UNLOCK(fs, SPIFFS_ERR_SEEK_BOUNDS);
|
|
|
+ }
|
|
|
+ if (offs > file_size) {
|
|
|
+ fd->fdoffset = file_size;
|
|
|
res = SPIFFS_ERR_END_OF_OBJECT;
|
|
|
}
|
|
|
SPIFFS_API_CHECK_RES_UNLOCK(fs, res);
|
|
|
|
|
|
- spiffs_span_ix data_spix = offs / SPIFFS_DATA_PAGE_SIZE(fs);
|
|
|
+ spiffs_span_ix data_spix = (offs > 0 ? (offs-1) : 0) / SPIFFS_DATA_PAGE_SIZE(fs);
|
|
|
spiffs_span_ix objix_spix = SPIFFS_OBJ_IX_ENTRY_SPAN_IX(fs, data_spix);
|
|
|
if (fd->cursor_objix_spix != objix_spix) {
|
|
|
spiffs_page_ix pix;
|
|
@@ -621,6 +647,7 @@ s32_t SPIFFS_lseek(spiffs *fs, spiffs_file fh, s32_t offs, int whence) {
|
|
|
}
|
|
|
|
|
|
s32_t SPIFFS_remove(spiffs *fs, const char *path) {
|
|
|
+ SPIFFS_API_DBG("%s '%s'\n", __func__, path);
|
|
|
#if SPIFFS_READ_ONLY
|
|
|
(void)fs; (void)path;
|
|
|
return SPIFFS_ERR_RO_NOT_IMPL;
|
|
@@ -663,6 +690,7 @@ s32_t SPIFFS_remove(spiffs *fs, const char *path) {
|
|
|
}
|
|
|
|
|
|
s32_t SPIFFS_fremove(spiffs *fs, spiffs_file fh) {
|
|
|
+ SPIFFS_API_DBG("%s "_SPIPRIfd "\n", __func__, fh);
|
|
|
#if SPIFFS_READ_ONLY
|
|
|
(void)fs; (void)fh;
|
|
|
return SPIFFS_ERR_RO_NOT_IMPL;
|
|
@@ -716,13 +744,14 @@ static s32_t spiffs_stat_pix(spiffs *fs, spiffs_page_ix pix, spiffs_file fh, spi
|
|
|
s->pix = pix;
|
|
|
strncpy((char *)s->name, (char *)objix_hdr.name, SPIFFS_OBJ_NAME_LEN);
|
|
|
#if SPIFFS_OBJ_META_LEN
|
|
|
- memcpy(s->meta, objix_hdr.meta, SPIFFS_OBJ_META_LEN);
|
|
|
+ _SPIFFS_MEMCPY(s->meta, objix_hdr.meta, SPIFFS_OBJ_META_LEN);
|
|
|
#endif
|
|
|
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
s32_t SPIFFS_stat(spiffs *fs, const char *path, spiffs_stat *s) {
|
|
|
+ SPIFFS_API_DBG("%s '%s'\n", __func__, path);
|
|
|
SPIFFS_API_CHECK_CFG(fs);
|
|
|
SPIFFS_API_CHECK_MOUNT(fs);
|
|
|
if (strlen(path) > SPIFFS_OBJ_NAME_LEN - 1) {
|
|
@@ -744,6 +773,7 @@ s32_t SPIFFS_stat(spiffs *fs, const char *path, spiffs_stat *s) {
|
|
|
}
|
|
|
|
|
|
s32_t SPIFFS_fstat(spiffs *fs, spiffs_file fh, spiffs_stat *s) {
|
|
|
+ SPIFFS_API_DBG("%s "_SPIPRIfd "\n", __func__, fh);
|
|
|
SPIFFS_API_CHECK_CFG(fs);
|
|
|
SPIFFS_API_CHECK_MOUNT(fs);
|
|
|
SPIFFS_LOCK(fs);
|
|
@@ -785,7 +815,7 @@ static s32_t spiffs_fflush_cache(spiffs *fs, spiffs_file fh) {
|
|
|
fd->cache_page = spiffs_cache_page_get_by_fd(fs, fd);
|
|
|
}
|
|
|
if (fd->cache_page) {
|
|
|
- SPIFFS_CACHE_DBG("CACHE_WR_DUMP: dumping cache page "_SPIPRIpg" for fd "_SPIPRIfd":"_SPIPRIid", flush, offs:"_SPIPRIi" size:"_SPIPRIi"\n",
|
|
|
+ SPIFFS_CACHE_DBG("CACHE_WR_DUMP: dumping cache page "_SPIPRIi" for fd "_SPIPRIfd":"_SPIPRIid", flush, offs:"_SPIPRIi" size:"_SPIPRIi"\n",
|
|
|
fd->cache_page->ix, fd->file_nbr, fd->obj_id, fd->cache_page->offset, fd->cache_page->size);
|
|
|
res = spiffs_hydro_write(fs, fd,
|
|
|
spiffs_get_cache_page(fs, spiffs_get_cache(fs), fd->cache_page->ix),
|
|
@@ -803,6 +833,7 @@ static s32_t spiffs_fflush_cache(spiffs *fs, spiffs_file fh) {
|
|
|
#endif
|
|
|
|
|
|
s32_t SPIFFS_fflush(spiffs *fs, spiffs_file fh) {
|
|
|
+ SPIFFS_API_DBG("%s "_SPIPRIfd "\n", __func__, fh);
|
|
|
(void)fh;
|
|
|
SPIFFS_API_CHECK_CFG(fs);
|
|
|
SPIFFS_API_CHECK_MOUNT(fs);
|
|
@@ -819,6 +850,7 @@ s32_t SPIFFS_fflush(spiffs *fs, spiffs_file fh) {
|
|
|
}
|
|
|
|
|
|
s32_t SPIFFS_close(spiffs *fs, spiffs_file fh) {
|
|
|
+ SPIFFS_API_DBG("%s "_SPIPRIfd "\n", __func__, fh);
|
|
|
SPIFFS_API_CHECK_CFG(fs);
|
|
|
SPIFFS_API_CHECK_MOUNT(fs);
|
|
|
|
|
@@ -839,6 +871,7 @@ s32_t SPIFFS_close(spiffs *fs, spiffs_file fh) {
|
|
|
}
|
|
|
|
|
|
s32_t SPIFFS_rename(spiffs *fs, const char *old_path, const char *new_path) {
|
|
|
+ SPIFFS_API_DBG("%s %s %s\n", __func__, old_path, new_path);
|
|
|
#if SPIFFS_READ_ONLY
|
|
|
(void)fs; (void)old_path; (void)new_path;
|
|
|
return SPIFFS_ERR_RO_NOT_IMPL;
|
|
@@ -965,6 +998,7 @@ s32_t SPIFFS_fupdate_meta(spiffs *fs, spiffs_file fh, const void *meta) {
|
|
|
#endif // SPIFFS_OBJ_META_LEN
|
|
|
|
|
|
spiffs_DIR *SPIFFS_opendir(spiffs *fs, const char *name, spiffs_DIR *d) {
|
|
|
+ SPIFFS_API_DBG("%s\n", __func__);
|
|
|
(void)name;
|
|
|
|
|
|
if (!SPIFFS_CHECK_CFG((fs))) {
|
|
@@ -1013,7 +1047,7 @@ static s32_t spiffs_read_dir_v(
|
|
|
e->size = objix_hdr.size == SPIFFS_UNDEFINED_LEN ? 0 : objix_hdr.size;
|
|
|
e->pix = pix;
|
|
|
#if SPIFFS_OBJ_META_LEN
|
|
|
- memcpy(e->meta, objix_hdr.meta, SPIFFS_OBJ_META_LEN);
|
|
|
+ _SPIFFS_MEMCPY(e->meta, objix_hdr.meta, SPIFFS_OBJ_META_LEN);
|
|
|
#endif
|
|
|
return SPIFFS_OK;
|
|
|
}
|
|
@@ -1021,6 +1055,7 @@ static s32_t spiffs_read_dir_v(
|
|
|
}
|
|
|
|
|
|
struct spiffs_dirent *SPIFFS_readdir(spiffs_DIR *d, struct spiffs_dirent *e) {
|
|
|
+ SPIFFS_API_DBG("%s\n", __func__);
|
|
|
if (!SPIFFS_CHECK_MOUNT(d->fs)) {
|
|
|
d->fs->err_code = SPIFFS_ERR_NOT_MOUNTED;
|
|
|
return 0;
|
|
@@ -1055,12 +1090,14 @@ struct spiffs_dirent *SPIFFS_readdir(spiffs_DIR *d, struct spiffs_dirent *e) {
|
|
|
}
|
|
|
|
|
|
s32_t SPIFFS_closedir(spiffs_DIR *d) {
|
|
|
+ SPIFFS_API_DBG("%s\n", __func__);
|
|
|
SPIFFS_API_CHECK_CFG(d->fs);
|
|
|
SPIFFS_API_CHECK_MOUNT(d->fs);
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
s32_t SPIFFS_check(spiffs *fs) {
|
|
|
+ SPIFFS_API_DBG("%s\n", __func__);
|
|
|
#if SPIFFS_READ_ONLY
|
|
|
(void)fs;
|
|
|
return SPIFFS_ERR_RO_NOT_IMPL;
|
|
@@ -1084,6 +1121,7 @@ s32_t SPIFFS_check(spiffs *fs) {
|
|
|
}
|
|
|
|
|
|
s32_t SPIFFS_info(spiffs *fs, u32_t *total, u32_t *used) {
|
|
|
+ SPIFFS_API_DBG("%s\n", __func__);
|
|
|
s32_t res = SPIFFS_OK;
|
|
|
SPIFFS_API_CHECK_CFG(fs);
|
|
|
SPIFFS_API_CHECK_MOUNT(fs);
|
|
@@ -1108,6 +1146,7 @@ s32_t SPIFFS_info(spiffs *fs, u32_t *total, u32_t *used) {
|
|
|
}
|
|
|
|
|
|
s32_t SPIFFS_gc_quick(spiffs *fs, u16_t max_free_pages) {
|
|
|
+ SPIFFS_API_DBG("%s "_SPIPRIi "\n", __func__, max_free_pages);
|
|
|
#if SPIFFS_READ_ONLY
|
|
|
(void)fs; (void)max_free_pages;
|
|
|
return SPIFFS_ERR_RO_NOT_IMPL;
|
|
@@ -1127,6 +1166,7 @@ s32_t SPIFFS_gc_quick(spiffs *fs, u16_t max_free_pages) {
|
|
|
|
|
|
|
|
|
s32_t SPIFFS_gc(spiffs *fs, u32_t size) {
|
|
|
+ SPIFFS_API_DBG("%s "_SPIPRIi "\n", __func__, size);
|
|
|
#if SPIFFS_READ_ONLY
|
|
|
(void)fs; (void)size;
|
|
|
return SPIFFS_ERR_RO_NOT_IMPL;
|
|
@@ -1145,6 +1185,7 @@ s32_t SPIFFS_gc(spiffs *fs, u32_t size) {
|
|
|
}
|
|
|
|
|
|
s32_t SPIFFS_eof(spiffs *fs, spiffs_file fh) {
|
|
|
+ SPIFFS_API_DBG("%s "_SPIPRIfd "\n", __func__, fh);
|
|
|
s32_t res;
|
|
|
SPIFFS_API_CHECK_CFG(fs);
|
|
|
SPIFFS_API_CHECK_MOUNT(fs);
|
|
@@ -1168,6 +1209,7 @@ s32_t SPIFFS_eof(spiffs *fs, spiffs_file fh) {
|
|
|
}
|
|
|
|
|
|
s32_t SPIFFS_tell(spiffs *fs, spiffs_file fh) {
|
|
|
+ SPIFFS_API_DBG("%s "_SPIPRIfd "\n", __func__, fh);
|
|
|
s32_t res;
|
|
|
SPIFFS_API_CHECK_CFG(fs);
|
|
|
SPIFFS_API_CHECK_MOUNT(fs);
|
|
@@ -1191,6 +1233,7 @@ s32_t SPIFFS_tell(spiffs *fs, spiffs_file fh) {
|
|
|
}
|
|
|
|
|
|
s32_t SPIFFS_set_file_callback_func(spiffs *fs, spiffs_file_callback cb_func) {
|
|
|
+ SPIFFS_API_DBG("%s\n", __func__);
|
|
|
SPIFFS_LOCK(fs);
|
|
|
fs->file_cb_f = cb_func;
|
|
|
SPIFFS_UNLOCK(fs);
|
|
@@ -1201,6 +1244,7 @@ s32_t SPIFFS_set_file_callback_func(spiffs *fs, spiffs_file_callback cb_func) {
|
|
|
|
|
|
s32_t SPIFFS_ix_map(spiffs *fs, spiffs_file fh, spiffs_ix_map *map,
|
|
|
u32_t offset, u32_t len, spiffs_page_ix *map_buf) {
|
|
|
+ SPIFFS_API_DBG("%s "_SPIPRIfd " "_SPIPRIi " "_SPIPRIi "\n", __func__, fh, offset, len);
|
|
|
s32_t res;
|
|
|
SPIFFS_API_CHECK_CFG(fs);
|
|
|
SPIFFS_API_CHECK_MOUNT(fs);
|
|
@@ -1233,6 +1277,7 @@ s32_t SPIFFS_ix_map(spiffs *fs, spiffs_file fh, spiffs_ix_map *map,
|
|
|
}
|
|
|
|
|
|
s32_t SPIFFS_ix_unmap(spiffs *fs, spiffs_file fh) {
|
|
|
+ SPIFFS_API_DBG("%s "_SPIPRIfd "\n", __func__, fh);
|
|
|
s32_t res;
|
|
|
SPIFFS_API_CHECK_CFG(fs);
|
|
|
SPIFFS_API_CHECK_MOUNT(fs);
|
|
@@ -1255,6 +1300,7 @@ s32_t SPIFFS_ix_unmap(spiffs *fs, spiffs_file fh) {
|
|
|
}
|
|
|
|
|
|
s32_t SPIFFS_ix_remap(spiffs *fs, spiffs_file fh, u32_t offset) {
|
|
|
+ SPIFFS_API_DBG("%s "_SPIPRIfd " "_SPIPRIi "\n", __func__, fh, offset);
|
|
|
s32_t res = SPIFFS_OK;
|
|
|
SPIFFS_API_CHECK_CFG(fs);
|
|
|
SPIFFS_API_CHECK_MOUNT(fs);
|