10 #if defined(__cplusplus) 14 #include "spiffs_config.h" 17 #define SPIFFS_ERR_NOT_MOUNTED -10000 18 #define SPIFFS_ERR_FULL -10001 19 #define SPIFFS_ERR_NOT_FOUND -10002 20 #define SPIFFS_ERR_END_OF_OBJECT -10003 21 #define SPIFFS_ERR_DELETED -10004 22 #define SPIFFS_ERR_NOT_FINALIZED -10005 23 #define SPIFFS_ERR_NOT_INDEX -10006 24 #define SPIFFS_ERR_OUT_OF_FILE_DESCS -10007 25 #define SPIFFS_ERR_FILE_CLOSED -10008 26 #define SPIFFS_ERR_FILE_DELETED -10009 27 #define SPIFFS_ERR_BAD_DESCRIPTOR -10010 28 #define SPIFFS_ERR_IS_INDEX -10011 29 #define SPIFFS_ERR_IS_FREE -10012 30 #define SPIFFS_ERR_INDEX_SPAN_MISMATCH -10013 31 #define SPIFFS_ERR_DATA_SPAN_MISMATCH -10014 32 #define SPIFFS_ERR_INDEX_REF_FREE -10015 33 #define SPIFFS_ERR_INDEX_REF_LU -10016 34 #define SPIFFS_ERR_INDEX_REF_INVALID -10017 35 #define SPIFFS_ERR_INDEX_FREE -10018 36 #define SPIFFS_ERR_INDEX_LU -10019 37 #define SPIFFS_ERR_INDEX_INVALID -10020 38 #define SPIFFS_ERR_NOT_WRITABLE -10021 39 #define SPIFFS_ERR_NOT_READABLE -10022 40 #define SPIFFS_ERR_CONFLICTING_NAME -10023 41 #define SPIFFS_ERR_NOT_CONFIGURED -10024 43 #define SPIFFS_ERR_NOT_A_FS -10025 44 #define SPIFFS_ERR_MOUNTED -10026 45 #define SPIFFS_ERR_ERASE_FAIL -10027 46 #define SPIFFS_ERR_MAGIC_NOT_POSSIBLE -10028 48 #define SPIFFS_ERR_NO_DELETED_BLOCKS -10029 50 #define SPIFFS_ERR_FILE_EXISTS -10030 52 #define SPIFFS_ERR_NOT_A_FILE -10031 53 #define SPIFFS_ERR_RO_NOT_IMPL -10032 54 #define SPIFFS_ERR_RO_ABORTED_OPERATION -10033 55 #define SPIFFS_ERR_PROBE_TOO_FEW_BLOCKS -10034 56 #define SPIFFS_ERR_PROBE_NOT_A_FS -10035 57 #define SPIFFS_ERR_NAME_TOO_LONG -10036 59 #define SPIFFS_ERR_IX_MAP_UNMAPPED -10037 60 #define SPIFFS_ERR_IX_MAP_MAPPED -10038 61 #define SPIFFS_ERR_IX_MAP_BAD_RANGE -10039 63 #define SPIFFS_ERR_SEEK_BOUNDS -10040 66 #define SPIFFS_ERR_INTERNAL -10050 68 #define SPIFFS_ERR_TEST -10100 82 #if SPIFFS_HAL_CALLBACK_EXTRA 91 #else // SPIFFS_HAL_CALLBACK_EXTRA 94 typedef s32_t (*
spiffs_read)(u32_t addr, u32_t size, u8_t *dst);
99 #endif // SPIFFS_HAL_CALLBACK_EXTRA 120 #if SPIFFS_HAL_CALLBACK_EXTRA 122 u32_t arg1, u32_t arg2);
123 #else // SPIFFS_HAL_CALLBACK_EXTRA 125 u32_t arg1, u32_t arg2);
126 #endif // SPIFFS_HAL_CALLBACK_EXTRA 142 #define SPIFFS_DBG(...) \ 145 #ifndef SPIFFS_GC_DBG 146 #define SPIFFS_GC_DBG(...) printf(__VA_ARGS__) 148 #ifndef SPIFFS_CACHE_DBG 149 #define SPIFFS_CACHE_DBG(...) printf(__VA_ARGS__) 151 #ifndef SPIFFS_CHECK_DBG 152 #define SPIFFS_CHECK_DBG(...) printf(__VA_ARGS__) 156 #define SPIFFS_APPEND (1<<0) 157 #define SPIFFS_O_APPEND SPIFFS_APPEND 159 #define SPIFFS_TRUNC (1<<1) 160 #define SPIFFS_O_TRUNC SPIFFS_TRUNC 162 #define SPIFFS_CREAT (1<<2) 163 #define SPIFFS_O_CREAT SPIFFS_CREAT 165 #define SPIFFS_RDONLY (1<<3) 166 #define SPIFFS_O_RDONLY SPIFFS_RDONLY 168 #define SPIFFS_WRONLY (1<<4) 169 #define SPIFFS_O_WRONLY SPIFFS_WRONLY 171 #define SPIFFS_RDWR (SPIFFS_RDONLY | SPIFFS_WRONLY) 172 #define SPIFFS_O_RDWR SPIFFS_RDWR 174 #define SPIFFS_DIRECT (1<<5) 175 #define SPIFFS_O_DIRECT SPIFFS_DIRECT 177 #define SPIFFS_EXCL (1<<6) 178 #define SPIFFS_O_EXCL SPIFFS_EXCL 180 #define SPIFFS_SEEK_SET (0) 181 #define SPIFFS_SEEK_CUR (1) 182 #define SPIFFS_SEEK_END (2) 184 #define SPIFFS_TYPE_FILE (1) 185 #define SPIFFS_TYPE_DIR (2) 186 #define SPIFFS_TYPE_HARD_LINK (3) 187 #define SPIFFS_TYPE_SOFT_LINK (4) 190 #define SPIFFS_LOCK(fs) 193 #ifndef SPIFFS_UNLOCK 194 #define SPIFFS_UNLOCK(fs) 207 #if SPIFFS_SINGLETON == 0 225 #if SPIFFS_FILEHDL_OFFSET 278 #if SPIFFS_CACHE_STATS 302 u8_t name[SPIFFS_OBJ_NAME_LEN];
303 #if SPIFFS_OBJ_META_LEN 304 u8_t meta[SPIFFS_OBJ_META_LEN];
310 u8_t name[SPIFFS_OBJ_NAME_LEN];
314 #if SPIFFS_OBJ_META_LEN 315 u8_t meta[SPIFFS_OBJ_META_LEN];
329 spiffs_page_ix *map_buf;
333 spiffs_span_ix start_spix;
335 spiffs_span_ix end_spix;
342 #if SPIFFS_USE_MAGIC && SPIFFS_USE_MAGIC_LENGTH && SPIFFS_SINGLETON==0 374 #endif // SPIFFS_USE_MAGIC && SPIFFS_USE_MAGIC_LENGTH && SPIFFS_SINGLETON==0 392 u8_t *
fd_space, u32_t fd_space_size,
393 void *cache, u32_t cache_size,
420 spiffs_file
SPIFFS_open(
spiffs *fs,
const char *path, spiffs_flags flags, spiffs_mode mode);
537 #if SPIFFS_OBJ_META_LEN 544 s32_t SPIFFS_update_meta(
spiffs *fs,
const char *name,
const void *meta);
552 s32_t SPIFFS_fupdate_meta(
spiffs *fs, spiffs_file fh,
const void *meta);
736 s32_t SPIFFS_ix_map(
spiffs *fs, spiffs_file fh, spiffs_ix_map *map,
737 u32_t offset, u32_t len, spiffs_page_ix *map_buf);
750 s32_t SPIFFS_ix_unmap(
spiffs *fs, spiffs_file fh);
759 s32_t SPIFFS_ix_remap(
spiffs *fs, spiffs_file fh, u32_t offs);
770 s32_t SPIFFS_bytes_to_ix_map_entries(
spiffs *fs, u32_t bytes);
781 s32_t SPIFFS_ix_map_entries_to_bytes(
spiffs *fs, u32_t map_page_ix_entries);
783 #endif // SPIFFS_IX_MAP 786 #if SPIFFS_TEST_VISUALISATION 791 s32_t SPIFFS_vis(
spiffs *fs);
794 #if SPIFFS_BUFFER_HELP 799 u32_t SPIFFS_buffer_bytes_for_filedescs(
spiffs *fs, u32_t num_descs);
806 u32_t SPIFFS_buffer_bytes_for_cache(
spiffs *fs, u32_t num_pages);
812 #if defined(__cplusplus) s32_t SPIFFS_set_file_callback_func(spiffs *fs, spiffs_file_callback cb_func)
s32_t SPIFFS_close(spiffs *fs, spiffs_file fh)
u32_t size
Definition: spiffs.h:312
s32_t SPIFFS_closedir(spiffs_DIR *d)
spiffs * fs
Definition: spiffs.h:320
spiffs_fileop_type
Definition: spiffs.h:129
u8_t spiffs_obj_type
Definition: spiffs.h:78
u8_t SPIFFS_mounted(spiffs *fs)
u32_t free_blocks
Definition: spiffs.h:259
s32_t SPIFFS_remove(spiffs *fs, const char *path)
u8_t * lu_work
Definition: spiffs.h:247
s32_t SPIFFS_check(spiffs *fs)
s32_t SPIFFS_tell(spiffs *fs, spiffs_file fh)
s32_t SPIFFS_creat(spiffs *fs, const char *path, spiffs_mode mode)
spiffs_obj_id max_erase_count
Definition: spiffs.h:267
s32_t SPIFFS_info(spiffs *fs, u32_t *total, u32_t *used)
u32_t log_block_size
Definition: spiffs.h:219
s32_t SPIFFS_fremove(spiffs *fs, spiffs_file fh)
spiffs_block_ix block
Definition: spiffs.h:321
void * user_data
Definition: spiffs.h:291
u32_t fd_count
Definition: spiffs.h:253
int cursor_obj_lu_entry
Definition: spiffs.h:244
u8_t * work
Definition: spiffs.h:249
spiffs_file_callback file_cb_f
Definition: spiffs.h:287
s32_t SPIFFS_format(spiffs *fs)
spiffs_write hal_write_f
Definition: spiffs.h:204
s32_t SPIFFS_eof(spiffs *fs, spiffs_file fh)
struct spiffs_dirent * SPIFFS_readdir(spiffs_DIR *d, struct spiffs_dirent *e)
spiffs_file SPIFFS_open(spiffs *fs, const char *path, spiffs_flags flags, spiffs_mode mode)
void SPIFFS_clearerr(spiffs *fs)
void(* spiffs_file_callback)(struct spiffs_t *fs, spiffs_fileop_type op, spiffs_obj_id obj_id, spiffs_page_ix pix)
Definition: spiffs.h:139
s32_t(* spiffs_write)(u32_t addr, u32_t size, u8_t *src)
Definition: spiffs.h:96
u16_t spiffs_mode
Definition: spiffs.h:76
spiffs_DIR * SPIFFS_opendir(spiffs *fs, const char *name, spiffs_DIR *d)
spiffs_obj_type type
Definition: spiffs.h:311
u32_t stats_p_deleted
Definition: spiffs.h:263
spiffs_file SPIFFS_open_by_dirent(spiffs *fs, struct spiffs_dirent *e, spiffs_flags flags, spiffs_mode mode)
spiffs_erase hal_erase_f
Definition: spiffs.h:206
s32_t SPIFFS_errno(spiffs *fs)
spiffs_check_type
Definition: spiffs.h:102
spiffs_obj_type type
Definition: spiffs.h:300
u32_t phys_addr
Definition: spiffs.h:212
u8_t cleaning
Definition: spiffs.h:265
spiffs_check_callback check_cb_f
Definition: spiffs.h:285
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_page_ix pix
Definition: spiffs.h:313
s32_t SPIFFS_read(spiffs *fs, spiffs_file fh, void *buf, s32_t len)
void SPIFFS_unmount(spiffs *fs)
spiffs_config cfg
Definition: spiffs.h:233
u8_t * fd_space
Definition: spiffs.h:251
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)
s32_t(* spiffs_read)(u32_t addr, u32_t size, u8_t *dst)
Definition: spiffs.h:94
u32_t size
Definition: spiffs.h:299
spiffs_check_report
Definition: spiffs.h:109
spiffs_block_ix cursor_block_ix
Definition: spiffs.h:242
u16_t spiffs_flags
Definition: spiffs.h:74
s32_t SPIFFS_gc(spiffs *fs, u32_t size)
u32_t phys_erase_block
Definition: spiffs.h:214
u32_t stats_p_allocated
Definition: spiffs.h:261
u32_t log_page_size
Definition: spiffs.h:222
s32_t err_code
Definition: spiffs.h:256
s32_t SPIFFS_fstat(spiffs *fs, spiffs_file fh, spiffs_stat *s)
spiffs_block_ix free_cursor_block_ix
Definition: spiffs.h:238
int free_cursor_obj_lu_entry
Definition: spiffs.h:240
u8_t mounted
Definition: spiffs.h:289
spiffs_read hal_read_f
Definition: spiffs.h:202
s32_t SPIFFS_rename(spiffs *fs, const char *old, const char *newPath)
spiffs_page_ix pix
Definition: spiffs.h:301
spiffs_file SPIFFS_open_by_page(spiffs *fs, spiffs_page_ix page_ix, spiffs_flags flags, spiffs_mode mode)
s16_t spiffs_file
Definition: spiffs.h:72
s32_t(* spiffs_erase)(u32_t addr, u32_t size)
Definition: spiffs.h:98
s32_t SPIFFS_stat(spiffs *fs, const char *path, spiffs_stat *s)
u32_t phys_size
Definition: spiffs.h:209
s32_t SPIFFS_fflush(spiffs *fs, spiffs_file fh)
u32_t config_magic
Definition: spiffs.h:293
int entry
Definition: spiffs.h:322
s32_t SPIFFS_gc_quick(spiffs *fs, u16_t max_free_pages)
spiffs_obj_id obj_id
Definition: spiffs.h:298
u32_t block_count
Definition: spiffs.h:235
spiffs_obj_id obj_id
Definition: spiffs.h:309
void(* spiffs_check_callback)(spiffs_check_type type, spiffs_check_report report, u32_t arg1, u32_t arg2)
Definition: spiffs.h:124