Rename config structs to cfg structs

Since this is already going to be a breaking API change, this renames
structs/variables named _config -> _cfg. This is in order to be
consistent with functions such as lfs_file_opencfg.
This commit is contained in:
Christopher Haster
2020-11-23 01:59:59 -06:00
parent 3f6f88778a
commit a549413077
11 changed files with 101 additions and 101 deletions

View File

@@ -39,7 +39,7 @@ lfs_t lfs;
lfs_file_t file; lfs_file_t file;
// configuration of the filesystem is provided by this struct // configuration of the filesystem is provided by this struct
const struct lfs_config cfg = { const struct lfs_cfg cfg = {
// block device operations // block device operations
.read = user_provided_block_device_read, .read = user_provided_block_device_read,
.prog = user_provided_block_device_prog, .prog = user_provided_block_device_prog,

View File

@@ -10,8 +10,8 @@
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
int lfs_filebd_createcfg(const struct lfs_config *cfg, const char *path, int lfs_filebd_createcfg(const struct lfs_cfg *cfg, const char *path,
const struct lfs_filebd_config *bdcfg) { const struct lfs_filebd_cfg *bdcfg) {
LFS_FILEBD_TRACE("lfs_filebd_createcfg(%p {.context=%p, " LFS_FILEBD_TRACE("lfs_filebd_createcfg(%p {.context=%p, "
".read=%p, .prog=%p, .erase=%p, .sync=%p, " ".read=%p, .prog=%p, .erase=%p, .sync=%p, "
".read_size=%"PRIu32", .prog_size=%"PRIu32", " ".read_size=%"PRIu32", .prog_size=%"PRIu32", "
@@ -38,7 +38,7 @@ int lfs_filebd_createcfg(const struct lfs_config *cfg, const char *path,
return 0; return 0;
} }
int lfs_filebd_create(const struct lfs_config *cfg, const char *path) { int lfs_filebd_create(const struct lfs_cfg *cfg, const char *path) {
LFS_FILEBD_TRACE("lfs_filebd_create(%p {.context=%p, " LFS_FILEBD_TRACE("lfs_filebd_create(%p {.context=%p, "
".read=%p, .prog=%p, .erase=%p, .sync=%p, " ".read=%p, .prog=%p, .erase=%p, .sync=%p, "
".read_size=%"PRIu32", .prog_size=%"PRIu32", " ".read_size=%"PRIu32", .prog_size=%"PRIu32", "
@@ -49,13 +49,13 @@ int lfs_filebd_create(const struct lfs_config *cfg, const char *path) {
(void*)(uintptr_t)cfg->erase, (void*)(uintptr_t)cfg->sync, (void*)(uintptr_t)cfg->erase, (void*)(uintptr_t)cfg->sync,
cfg->read_size, cfg->prog_size, cfg->block_size, cfg->block_count, cfg->read_size, cfg->prog_size, cfg->block_size, cfg->block_count,
path); path);
static const struct lfs_filebd_config defaults = {.erase_value=-1}; static const struct lfs_filebd_cfg defaults = {.erase_value=-1};
int err = lfs_filebd_createcfg(cfg, path, &defaults); int err = lfs_filebd_createcfg(cfg, path, &defaults);
LFS_FILEBD_TRACE("lfs_filebd_create -> %d", err); LFS_FILEBD_TRACE("lfs_filebd_create -> %d", err);
return err; return err;
} }
int lfs_filebd_destroy(const struct lfs_config *cfg) { int lfs_filebd_destroy(const struct lfs_cfg *cfg) {
LFS_FILEBD_TRACE("lfs_filebd_destroy(%p)", (void*)cfg); LFS_FILEBD_TRACE("lfs_filebd_destroy(%p)", (void*)cfg);
lfs_filebd_t *bd = cfg->context; lfs_filebd_t *bd = cfg->context;
int err = close(bd->fd); int err = close(bd->fd);
@@ -68,7 +68,7 @@ int lfs_filebd_destroy(const struct lfs_config *cfg) {
return 0; return 0;
} }
int lfs_filebd_read(const struct lfs_config *cfg, lfs_block_t block, int lfs_filebd_read(const struct lfs_cfg *cfg, lfs_block_t block,
lfs_off_t off, void *buffer, lfs_size_t size) { lfs_off_t off, void *buffer, lfs_size_t size) {
LFS_FILEBD_TRACE("lfs_filebd_read(%p, " LFS_FILEBD_TRACE("lfs_filebd_read(%p, "
"0x%"PRIx32", %"PRIu32", %p, %"PRIu32")", "0x%"PRIx32", %"PRIu32", %p, %"PRIu32")",
@@ -105,7 +105,7 @@ int lfs_filebd_read(const struct lfs_config *cfg, lfs_block_t block,
return 0; return 0;
} }
int lfs_filebd_prog(const struct lfs_config *cfg, lfs_block_t block, int lfs_filebd_prog(const struct lfs_cfg *cfg, lfs_block_t block,
lfs_off_t off, const void *buffer, lfs_size_t size) { lfs_off_t off, const void *buffer, lfs_size_t size) {
LFS_FILEBD_TRACE("lfs_filebd_prog(%p, 0x%"PRIx32", %"PRIu32", %p, %"PRIu32")", LFS_FILEBD_TRACE("lfs_filebd_prog(%p, 0x%"PRIx32", %"PRIu32", %p, %"PRIu32")",
(void*)cfg, block, off, buffer, size); (void*)cfg, block, off, buffer, size);
@@ -159,7 +159,7 @@ int lfs_filebd_prog(const struct lfs_config *cfg, lfs_block_t block,
return 0; return 0;
} }
int lfs_filebd_erase(const struct lfs_config *cfg, lfs_block_t block) { int lfs_filebd_erase(const struct lfs_cfg *cfg, lfs_block_t block) {
LFS_FILEBD_TRACE("lfs_filebd_erase(%p, 0x%"PRIx32")", (void*)cfg, block); LFS_FILEBD_TRACE("lfs_filebd_erase(%p, 0x%"PRIx32")", (void*)cfg, block);
lfs_filebd_t *bd = cfg->context; lfs_filebd_t *bd = cfg->context;
@@ -189,7 +189,7 @@ int lfs_filebd_erase(const struct lfs_config *cfg, lfs_block_t block) {
return 0; return 0;
} }
int lfs_filebd_sync(const struct lfs_config *cfg) { int lfs_filebd_sync(const struct lfs_cfg *cfg) {
LFS_FILEBD_TRACE("lfs_filebd_sync(%p)", (void*)cfg); LFS_FILEBD_TRACE("lfs_filebd_sync(%p)", (void*)cfg);
// file sync // file sync
lfs_filebd_t *bd = cfg->context; lfs_filebd_t *bd = cfg->context;

View File

@@ -23,7 +23,7 @@ extern "C"
#endif #endif
// filebd config (optional) // filebd config (optional)
struct lfs_filebd_config { struct lfs_filebd_cfg {
// 8-bit erase value to use for simulating erases. -1 does not simulate // 8-bit erase value to use for simulating erases. -1 does not simulate
// erases, which can speed up testing by avoiding all the extra block-device // erases, which can speed up testing by avoiding all the extra block-device
// operations to store the erase value. // operations to store the erase value.
@@ -33,36 +33,36 @@ struct lfs_filebd_config {
// filebd state // filebd state
typedef struct lfs_filebd { typedef struct lfs_filebd {
int fd; int fd;
const struct lfs_filebd_config *cfg; const struct lfs_filebd_cfg *cfg;
} lfs_filebd_t; } lfs_filebd_t;
// Create a file block device using the geometry in lfs_config // Create a file block device using the geometry in lfs_cfg
int lfs_filebd_create(const struct lfs_config *cfg, const char *path); int lfs_filebd_create(const struct lfs_cfg *cfg, const char *path);
int lfs_filebd_createcfg(const struct lfs_config *cfg, const char *path, int lfs_filebd_createcfg(const struct lfs_cfg *cfg, const char *path,
const struct lfs_filebd_config *bdcfg); const struct lfs_filebd_cfg *bdcfg);
// Clean up memory associated with block device // Clean up memory associated with block device
int lfs_filebd_destroy(const struct lfs_config *cfg); int lfs_filebd_destroy(const struct lfs_cfg *cfg);
// Read a block // Read a block
int lfs_filebd_read(const struct lfs_config *cfg, lfs_block_t block, int lfs_filebd_read(const struct lfs_cfg *cfg, lfs_block_t block,
lfs_off_t off, void *buffer, lfs_size_t size); lfs_off_t off, void *buffer, lfs_size_t size);
// Program a block // Program a block
// //
// The block must have previously been erased. // The block must have previously been erased.
int lfs_filebd_prog(const struct lfs_config *cfg, lfs_block_t block, int lfs_filebd_prog(const struct lfs_cfg *cfg, lfs_block_t block,
lfs_off_t off, const void *buffer, lfs_size_t size); lfs_off_t off, const void *buffer, lfs_size_t size);
// Erase a block // Erase a block
// //
// A block must be erased before being programmed. The // A block must be erased before being programmed. The
// state of an erased block is undefined. // state of an erased block is undefined.
int lfs_filebd_erase(const struct lfs_config *cfg, lfs_block_t block); int lfs_filebd_erase(const struct lfs_cfg *cfg, lfs_block_t block);
// Sync the block device // Sync the block device
int lfs_filebd_sync(const struct lfs_config *cfg); int lfs_filebd_sync(const struct lfs_cfg *cfg);
#ifdef __cplusplus #ifdef __cplusplus

View File

@@ -6,8 +6,8 @@
*/ */
#include "bd/lfs_rambd.h" #include "bd/lfs_rambd.h"
int lfs_rambd_createcfg(const struct lfs_config *cfg, int lfs_rambd_createcfg(const struct lfs_cfg *cfg,
const struct lfs_rambd_config *bdcfg) { const struct lfs_rambd_cfg *bdcfg) {
LFS_RAMBD_TRACE("lfs_rambd_createcfg(%p {.context=%p, " LFS_RAMBD_TRACE("lfs_rambd_createcfg(%p {.context=%p, "
".read=%p, .prog=%p, .erase=%p, .sync=%p, " ".read=%p, .prog=%p, .erase=%p, .sync=%p, "
".read_size=%"PRIu32", .prog_size=%"PRIu32", " ".read_size=%"PRIu32", .prog_size=%"PRIu32", "
@@ -42,7 +42,7 @@ int lfs_rambd_createcfg(const struct lfs_config *cfg,
return 0; return 0;
} }
int lfs_rambd_create(const struct lfs_config *cfg) { int lfs_rambd_create(const struct lfs_cfg *cfg) {
LFS_RAMBD_TRACE("lfs_rambd_create(%p {.context=%p, " LFS_RAMBD_TRACE("lfs_rambd_create(%p {.context=%p, "
".read=%p, .prog=%p, .erase=%p, .sync=%p, " ".read=%p, .prog=%p, .erase=%p, .sync=%p, "
".read_size=%"PRIu32", .prog_size=%"PRIu32", " ".read_size=%"PRIu32", .prog_size=%"PRIu32", "
@@ -51,13 +51,13 @@ int lfs_rambd_create(const struct lfs_config *cfg) {
(void*)(uintptr_t)cfg->read, (void*)(uintptr_t)cfg->prog, (void*)(uintptr_t)cfg->read, (void*)(uintptr_t)cfg->prog,
(void*)(uintptr_t)cfg->erase, (void*)(uintptr_t)cfg->sync, (void*)(uintptr_t)cfg->erase, (void*)(uintptr_t)cfg->sync,
cfg->read_size, cfg->prog_size, cfg->block_size, cfg->block_count); cfg->read_size, cfg->prog_size, cfg->block_size, cfg->block_count);
static const struct lfs_rambd_config defaults = {.erase_value=-1}; static const struct lfs_rambd_cfg defaults = {.erase_value=-1};
int err = lfs_rambd_createcfg(cfg, &defaults); int err = lfs_rambd_createcfg(cfg, &defaults);
LFS_RAMBD_TRACE("lfs_rambd_create -> %d", err); LFS_RAMBD_TRACE("lfs_rambd_create -> %d", err);
return err; return err;
} }
int lfs_rambd_destroy(const struct lfs_config *cfg) { int lfs_rambd_destroy(const struct lfs_cfg *cfg) {
LFS_RAMBD_TRACE("lfs_rambd_destroy(%p)", (void*)cfg); LFS_RAMBD_TRACE("lfs_rambd_destroy(%p)", (void*)cfg);
// clean up memory // clean up memory
lfs_rambd_t *bd = cfg->context; lfs_rambd_t *bd = cfg->context;
@@ -68,7 +68,7 @@ int lfs_rambd_destroy(const struct lfs_config *cfg) {
return 0; return 0;
} }
int lfs_rambd_read(const struct lfs_config *cfg, lfs_block_t block, int lfs_rambd_read(const struct lfs_cfg *cfg, lfs_block_t block,
lfs_off_t off, void *buffer, lfs_size_t size) { lfs_off_t off, void *buffer, lfs_size_t size) {
LFS_RAMBD_TRACE("lfs_rambd_read(%p, " LFS_RAMBD_TRACE("lfs_rambd_read(%p, "
"0x%"PRIx32", %"PRIu32", %p, %"PRIu32")", "0x%"PRIx32", %"PRIu32", %p, %"PRIu32")",
@@ -87,7 +87,7 @@ int lfs_rambd_read(const struct lfs_config *cfg, lfs_block_t block,
return 0; return 0;
} }
int lfs_rambd_prog(const struct lfs_config *cfg, lfs_block_t block, int lfs_rambd_prog(const struct lfs_cfg *cfg, lfs_block_t block,
lfs_off_t off, const void *buffer, lfs_size_t size) { lfs_off_t off, const void *buffer, lfs_size_t size) {
LFS_RAMBD_TRACE("lfs_rambd_prog(%p, " LFS_RAMBD_TRACE("lfs_rambd_prog(%p, "
"0x%"PRIx32", %"PRIu32", %p, %"PRIu32")", "0x%"PRIx32", %"PRIu32", %p, %"PRIu32")",
@@ -114,7 +114,7 @@ int lfs_rambd_prog(const struct lfs_config *cfg, lfs_block_t block,
return 0; return 0;
} }
int lfs_rambd_erase(const struct lfs_config *cfg, lfs_block_t block) { int lfs_rambd_erase(const struct lfs_cfg *cfg, lfs_block_t block) {
LFS_RAMBD_TRACE("lfs_rambd_erase(%p, 0x%"PRIx32")", (void*)cfg, block); LFS_RAMBD_TRACE("lfs_rambd_erase(%p, 0x%"PRIx32")", (void*)cfg, block);
lfs_rambd_t *bd = cfg->context; lfs_rambd_t *bd = cfg->context;
@@ -131,7 +131,7 @@ int lfs_rambd_erase(const struct lfs_config *cfg, lfs_block_t block) {
return 0; return 0;
} }
int lfs_rambd_sync(const struct lfs_config *cfg) { int lfs_rambd_sync(const struct lfs_cfg *cfg) {
LFS_RAMBD_TRACE("lfs_rambd_sync(%p)", (void*)cfg); LFS_RAMBD_TRACE("lfs_rambd_sync(%p)", (void*)cfg);
// sync does nothing because we aren't backed by anything real // sync does nothing because we aren't backed by anything real
(void)cfg; (void)cfg;

View File

@@ -23,7 +23,7 @@ extern "C"
#endif #endif
// rambd config (optional) // rambd config (optional)
struct lfs_rambd_config { struct lfs_rambd_cfg {
// 8-bit erase value to simulate erasing with. -1 indicates no erase // 8-bit erase value to simulate erasing with. -1 indicates no erase
// occurs, which is still a valid block device // occurs, which is still a valid block device
int32_t erase_value; int32_t erase_value;
@@ -35,36 +35,36 @@ struct lfs_rambd_config {
// rambd state // rambd state
typedef struct lfs_rambd { typedef struct lfs_rambd {
uint8_t *buffer; uint8_t *buffer;
const struct lfs_rambd_config *cfg; const struct lfs_rambd_cfg *cfg;
} lfs_rambd_t; } lfs_rambd_t;
// Create a RAM block device using the geometry in lfs_config // Create a RAM block device using the geometry in lfs_cfg
int lfs_rambd_create(const struct lfs_config *cfg); int lfs_rambd_create(const struct lfs_cfg *cfg);
int lfs_rambd_createcfg(const struct lfs_config *cfg, int lfs_rambd_createcfg(const struct lfs_cfg *cfg,
const struct lfs_rambd_config *bdcfg); const struct lfs_rambd_cfg *bdcfg);
// Clean up memory associated with block device // Clean up memory associated with block device
int lfs_rambd_destroy(const struct lfs_config *cfg); int lfs_rambd_destroy(const struct lfs_cfg *cfg);
// Read a block // Read a block
int lfs_rambd_read(const struct lfs_config *cfg, lfs_block_t block, int lfs_rambd_read(const struct lfs_cfg *cfg, lfs_block_t block,
lfs_off_t off, void *buffer, lfs_size_t size); lfs_off_t off, void *buffer, lfs_size_t size);
// Program a block // Program a block
// //
// The block must have previously been erased. // The block must have previously been erased.
int lfs_rambd_prog(const struct lfs_config *cfg, lfs_block_t block, int lfs_rambd_prog(const struct lfs_cfg *cfg, lfs_block_t block,
lfs_off_t off, const void *buffer, lfs_size_t size); lfs_off_t off, const void *buffer, lfs_size_t size);
// Erase a block // Erase a block
// //
// A block must be erased before being programmed. The // A block must be erased before being programmed. The
// state of an erased block is undefined. // state of an erased block is undefined.
int lfs_rambd_erase(const struct lfs_config *cfg, lfs_block_t block); int lfs_rambd_erase(const struct lfs_cfg *cfg, lfs_block_t block);
// Sync the block device // Sync the block device
int lfs_rambd_sync(const struct lfs_config *cfg); int lfs_rambd_sync(const struct lfs_cfg *cfg);
#ifdef __cplusplus #ifdef __cplusplus

View File

@@ -10,8 +10,8 @@
#include <stdlib.h> #include <stdlib.h>
int lfs_testbd_createcfg(const struct lfs_config *cfg, const char *path, int lfs_testbd_createcfg(const struct lfs_cfg *cfg, const char *path,
const struct lfs_testbd_config *bdcfg) { const struct lfs_testbd_cfg *bdcfg) {
LFS_TESTBD_TRACE("lfs_testbd_createcfg(%p {.context=%p, " LFS_TESTBD_TRACE("lfs_testbd_createcfg(%p {.context=%p, "
".read=%p, .prog=%p, .erase=%p, .sync=%p, " ".read=%p, .prog=%p, .erase=%p, .sync=%p, "
".read_size=%"PRIu32", .prog_size=%"PRIu32", " ".read_size=%"PRIu32", .prog_size=%"PRIu32", "
@@ -50,14 +50,14 @@ int lfs_testbd_createcfg(const struct lfs_config *cfg, const char *path,
// create underlying block device // create underlying block device
if (bd->persist) { if (bd->persist) {
bd->u.file.cfg = (struct lfs_filebd_config){ bd->u.file.cfg = (struct lfs_filebd_cfg){
.erase_value = bd->cfg->erase_value, .erase_value = bd->cfg->erase_value,
}; };
int err = lfs_filebd_createcfg(cfg, path, &bd->u.file.cfg); int err = lfs_filebd_createcfg(cfg, path, &bd->u.file.cfg);
LFS_TESTBD_TRACE("lfs_testbd_createcfg -> %d", err); LFS_TESTBD_TRACE("lfs_testbd_createcfg -> %d", err);
return err; return err;
} else { } else {
bd->u.ram.cfg = (struct lfs_rambd_config){ bd->u.ram.cfg = (struct lfs_rambd_cfg){
.erase_value = bd->cfg->erase_value, .erase_value = bd->cfg->erase_value,
.buffer = bd->cfg->buffer, .buffer = bd->cfg->buffer,
}; };
@@ -67,7 +67,7 @@ int lfs_testbd_createcfg(const struct lfs_config *cfg, const char *path,
} }
} }
int lfs_testbd_create(const struct lfs_config *cfg, const char *path) { int lfs_testbd_create(const struct lfs_cfg *cfg, const char *path) {
LFS_TESTBD_TRACE("lfs_testbd_create(%p {.context=%p, " LFS_TESTBD_TRACE("lfs_testbd_create(%p {.context=%p, "
".read=%p, .prog=%p, .erase=%p, .sync=%p, " ".read=%p, .prog=%p, .erase=%p, .sync=%p, "
".read_size=%"PRIu32", .prog_size=%"PRIu32", " ".read_size=%"PRIu32", .prog_size=%"PRIu32", "
@@ -78,13 +78,13 @@ int lfs_testbd_create(const struct lfs_config *cfg, const char *path) {
(void*)(uintptr_t)cfg->erase, (void*)(uintptr_t)cfg->sync, (void*)(uintptr_t)cfg->erase, (void*)(uintptr_t)cfg->sync,
cfg->read_size, cfg->prog_size, cfg->block_size, cfg->block_count, cfg->read_size, cfg->prog_size, cfg->block_size, cfg->block_count,
path); path);
static const struct lfs_testbd_config defaults = {.erase_value=-1}; static const struct lfs_testbd_cfg defaults = {.erase_value=-1};
int err = lfs_testbd_createcfg(cfg, path, &defaults); int err = lfs_testbd_createcfg(cfg, path, &defaults);
LFS_TESTBD_TRACE("lfs_testbd_create -> %d", err); LFS_TESTBD_TRACE("lfs_testbd_create -> %d", err);
return err; return err;
} }
int lfs_testbd_destroy(const struct lfs_config *cfg) { int lfs_testbd_destroy(const struct lfs_cfg *cfg) {
LFS_TESTBD_TRACE("lfs_testbd_destroy(%p)", (void*)cfg); LFS_TESTBD_TRACE("lfs_testbd_destroy(%p)", (void*)cfg);
lfs_testbd_t *bd = cfg->context; lfs_testbd_t *bd = cfg->context;
if (bd->cfg->erase_cycles && !bd->cfg->wear_buffer) { if (bd->cfg->erase_cycles && !bd->cfg->wear_buffer) {
@@ -103,7 +103,7 @@ int lfs_testbd_destroy(const struct lfs_config *cfg) {
} }
/// Internal mapping to block devices /// /// Internal mapping to block devices ///
static int lfs_testbd_rawread(const struct lfs_config *cfg, lfs_block_t block, static int lfs_testbd_rawread(const struct lfs_cfg *cfg, lfs_block_t block,
lfs_off_t off, void *buffer, lfs_size_t size) { lfs_off_t off, void *buffer, lfs_size_t size) {
lfs_testbd_t *bd = cfg->context; lfs_testbd_t *bd = cfg->context;
if (bd->persist) { if (bd->persist) {
@@ -113,7 +113,7 @@ static int lfs_testbd_rawread(const struct lfs_config *cfg, lfs_block_t block,
} }
} }
static int lfs_testbd_rawprog(const struct lfs_config *cfg, lfs_block_t block, static int lfs_testbd_rawprog(const struct lfs_cfg *cfg, lfs_block_t block,
lfs_off_t off, const void *buffer, lfs_size_t size) { lfs_off_t off, const void *buffer, lfs_size_t size) {
lfs_testbd_t *bd = cfg->context; lfs_testbd_t *bd = cfg->context;
if (bd->persist) { if (bd->persist) {
@@ -123,7 +123,7 @@ static int lfs_testbd_rawprog(const struct lfs_config *cfg, lfs_block_t block,
} }
} }
static int lfs_testbd_rawerase(const struct lfs_config *cfg, static int lfs_testbd_rawerase(const struct lfs_cfg *cfg,
lfs_block_t block) { lfs_block_t block) {
lfs_testbd_t *bd = cfg->context; lfs_testbd_t *bd = cfg->context;
if (bd->persist) { if (bd->persist) {
@@ -133,7 +133,7 @@ static int lfs_testbd_rawerase(const struct lfs_config *cfg,
} }
} }
static int lfs_testbd_rawsync(const struct lfs_config *cfg) { static int lfs_testbd_rawsync(const struct lfs_cfg *cfg) {
lfs_testbd_t *bd = cfg->context; lfs_testbd_t *bd = cfg->context;
if (bd->persist) { if (bd->persist) {
return lfs_filebd_sync(cfg); return lfs_filebd_sync(cfg);
@@ -143,7 +143,7 @@ static int lfs_testbd_rawsync(const struct lfs_config *cfg) {
} }
/// block device API /// /// block device API ///
int lfs_testbd_read(const struct lfs_config *cfg, lfs_block_t block, int lfs_testbd_read(const struct lfs_cfg *cfg, lfs_block_t block,
lfs_off_t off, void *buffer, lfs_size_t size) { lfs_off_t off, void *buffer, lfs_size_t size) {
LFS_TESTBD_TRACE("lfs_testbd_read(%p, " LFS_TESTBD_TRACE("lfs_testbd_read(%p, "
"0x%"PRIx32", %"PRIu32", %p, %"PRIu32")", "0x%"PRIx32", %"PRIu32", %p, %"PRIu32")",
@@ -168,7 +168,7 @@ int lfs_testbd_read(const struct lfs_config *cfg, lfs_block_t block,
return err; return err;
} }
int lfs_testbd_prog(const struct lfs_config *cfg, lfs_block_t block, int lfs_testbd_prog(const struct lfs_cfg *cfg, lfs_block_t block,
lfs_off_t off, const void *buffer, lfs_size_t size) { lfs_off_t off, const void *buffer, lfs_size_t size) {
LFS_TESTBD_TRACE("lfs_testbd_prog(%p, " LFS_TESTBD_TRACE("lfs_testbd_prog(%p, "
"0x%"PRIx32", %"PRIu32", %p, %"PRIu32")", "0x%"PRIx32", %"PRIu32", %p, %"PRIu32")",
@@ -217,7 +217,7 @@ int lfs_testbd_prog(const struct lfs_config *cfg, lfs_block_t block,
return 0; return 0;
} }
int lfs_testbd_erase(const struct lfs_config *cfg, lfs_block_t block) { int lfs_testbd_erase(const struct lfs_cfg *cfg, lfs_block_t block) {
LFS_TESTBD_TRACE("lfs_testbd_erase(%p, 0x%"PRIx32")", (void*)cfg, block); LFS_TESTBD_TRACE("lfs_testbd_erase(%p, 0x%"PRIx32")", (void*)cfg, block);
lfs_testbd_t *bd = cfg->context; lfs_testbd_t *bd = cfg->context;
@@ -264,7 +264,7 @@ int lfs_testbd_erase(const struct lfs_config *cfg, lfs_block_t block) {
return 0; return 0;
} }
int lfs_testbd_sync(const struct lfs_config *cfg) { int lfs_testbd_sync(const struct lfs_cfg *cfg) {
LFS_TESTBD_TRACE("lfs_testbd_sync(%p)", (void*)cfg); LFS_TESTBD_TRACE("lfs_testbd_sync(%p)", (void*)cfg);
int err = lfs_testbd_rawsync(cfg); int err = lfs_testbd_rawsync(cfg);
LFS_TESTBD_TRACE("lfs_testbd_sync -> %d", err); LFS_TESTBD_TRACE("lfs_testbd_sync -> %d", err);
@@ -273,7 +273,7 @@ int lfs_testbd_sync(const struct lfs_config *cfg) {
/// simulated wear operations /// /// simulated wear operations ///
lfs_testbd_swear_t lfs_testbd_getwear(const struct lfs_config *cfg, lfs_testbd_swear_t lfs_testbd_getwear(const struct lfs_cfg *cfg,
lfs_block_t block) { lfs_block_t block) {
LFS_TESTBD_TRACE("lfs_testbd_getwear(%p, %"PRIu32")", (void*)cfg, block); LFS_TESTBD_TRACE("lfs_testbd_getwear(%p, %"PRIu32")", (void*)cfg, block);
lfs_testbd_t *bd = cfg->context; lfs_testbd_t *bd = cfg->context;
@@ -286,7 +286,7 @@ lfs_testbd_swear_t lfs_testbd_getwear(const struct lfs_config *cfg,
return bd->wear[block]; return bd->wear[block];
} }
int lfs_testbd_setwear(const struct lfs_config *cfg, int lfs_testbd_setwear(const struct lfs_cfg *cfg,
lfs_block_t block, lfs_testbd_wear_t wear) { lfs_block_t block, lfs_testbd_wear_t wear) {
LFS_TESTBD_TRACE("lfs_testbd_setwear(%p, %"PRIu32")", (void*)cfg, block); LFS_TESTBD_TRACE("lfs_testbd_setwear(%p, %"PRIu32")", (void*)cfg, block);
lfs_testbd_t *bd = cfg->context; lfs_testbd_t *bd = cfg->context;

View File

@@ -44,7 +44,7 @@ typedef uint32_t lfs_testbd_wear_t;
typedef int32_t lfs_testbd_swear_t; typedef int32_t lfs_testbd_swear_t;
// testbd config, this is required for testing // testbd config, this is required for testing
struct lfs_testbd_config { struct lfs_testbd_cfg {
// 8-bit erase value to use for simulating erases. -1 does not simulate // 8-bit erase value to use for simulating erases. -1 does not simulate
// erases, which can speed up testing by avoiding all the extra block-device // erases, which can speed up testing by avoiding all the extra block-device
// operations to store the erase value. // operations to store the erase value.
@@ -73,11 +73,11 @@ typedef struct lfs_testbd {
union { union {
struct { struct {
lfs_filebd_t bd; lfs_filebd_t bd;
struct lfs_filebd_config cfg; struct lfs_filebd_cfg cfg;
} file; } file;
struct { struct {
lfs_rambd_t bd; lfs_rambd_t bd;
struct lfs_rambd_config cfg; struct lfs_rambd_cfg cfg;
} ram; } ram;
} u; } u;
@@ -85,51 +85,51 @@ typedef struct lfs_testbd {
uint32_t power_cycles; uint32_t power_cycles;
lfs_testbd_wear_t *wear; lfs_testbd_wear_t *wear;
const struct lfs_testbd_config *cfg; const struct lfs_testbd_cfg *cfg;
} lfs_testbd_t; } lfs_testbd_t;
/// Block device API /// /// Block device API ///
// Create a test block device using the geometry in lfs_config // Create a test block device using the geometry in lfs_cfg
// //
// Note that filebd is used if a path is provided, if path is NULL // Note that filebd is used if a path is provided, if path is NULL
// testbd will use rambd which can be much faster. // testbd will use rambd which can be much faster.
int lfs_testbd_create(const struct lfs_config *cfg, const char *path); int lfs_testbd_create(const struct lfs_cfg *cfg, const char *path);
int lfs_testbd_createcfg(const struct lfs_config *cfg, const char *path, int lfs_testbd_createcfg(const struct lfs_cfg *cfg, const char *path,
const struct lfs_testbd_config *bdcfg); const struct lfs_testbd_cfg *bdcfg);
// Clean up memory associated with block device // Clean up memory associated with block device
int lfs_testbd_destroy(const struct lfs_config *cfg); int lfs_testbd_destroy(const struct lfs_cfg *cfg);
// Read a block // Read a block
int lfs_testbd_read(const struct lfs_config *cfg, lfs_block_t block, int lfs_testbd_read(const struct lfs_cfg *cfg, lfs_block_t block,
lfs_off_t off, void *buffer, lfs_size_t size); lfs_off_t off, void *buffer, lfs_size_t size);
// Program a block // Program a block
// //
// The block must have previously been erased. // The block must have previously been erased.
int lfs_testbd_prog(const struct lfs_config *cfg, lfs_block_t block, int lfs_testbd_prog(const struct lfs_cfg *cfg, lfs_block_t block,
lfs_off_t off, const void *buffer, lfs_size_t size); lfs_off_t off, const void *buffer, lfs_size_t size);
// Erase a block // Erase a block
// //
// A block must be erased before being programmed. The // A block must be erased before being programmed. The
// state of an erased block is undefined. // state of an erased block is undefined.
int lfs_testbd_erase(const struct lfs_config *cfg, lfs_block_t block); int lfs_testbd_erase(const struct lfs_cfg *cfg, lfs_block_t block);
// Sync the block device // Sync the block device
int lfs_testbd_sync(const struct lfs_config *cfg); int lfs_testbd_sync(const struct lfs_cfg *cfg);
/// Additional extended API for driving test features /// /// Additional extended API for driving test features ///
// Get simulated wear on a given block // Get simulated wear on a given block
lfs_testbd_swear_t lfs_testbd_getwear(const struct lfs_config *cfg, lfs_testbd_swear_t lfs_testbd_getwear(const struct lfs_cfg *cfg,
lfs_block_t block); lfs_block_t block);
// Manually set simulated wear on a given block // Manually set simulated wear on a given block
int lfs_testbd_setwear(const struct lfs_config *cfg, int lfs_testbd_setwear(const struct lfs_cfg *cfg,
lfs_block_t block, lfs_testbd_wear_t wear); lfs_block_t block, lfs_testbd_wear_t wear);

14
lfs.c
View File

@@ -32,7 +32,7 @@
#define LFS_CFG_FILE_MAX(lfs) ((void)lfs, LFS_FILE_MAX) #define LFS_CFG_FILE_MAX(lfs) ((void)lfs, LFS_FILE_MAX)
#define LFS_CFG_ATTR_MAX(lfs) ((void)lfs, LFS_ATTR_MAX) #define LFS_CFG_ATTR_MAX(lfs) ((void)lfs, LFS_ATTR_MAX)
#else #else
// direct config towards dynamic lfs_config struct // direct config towards dynamic lfs_cfg struct
#define LFS_CFG_READ(lfs, block, off, buffer, size) \ #define LFS_CFG_READ(lfs, block, off, buffer, size) \
lfs->cfg->read(lfs->cfg, block, off, buffer, size) lfs->cfg->read(lfs->cfg, block, off, buffer, size)
#define LFS_CFG_PROG(lfs, block, off, buffer, size) \ #define LFS_CFG_PROG(lfs, block, off, buffer, size) \
@@ -62,7 +62,7 @@
#define LFS_FILE_CFG_ATTRS(file) LFS_FILE_ATTRS #define LFS_FILE_CFG_ATTRS(file) LFS_FILE_ATTRS
#define LFS_FILE_CFG_ATTR_COUNT(file) LFS_FILE_ATTR_COUNT #define LFS_FILE_CFG_ATTR_COUNT(file) LFS_FILE_ATTR_COUNT
#else #else
// direct config towards dynamic lfs_config struct // direct config towards dynamic lfs_cfg struct
#define LFS_FILE_CFG_BUFFER(file) file->cfg->buffer #define LFS_FILE_CFG_BUFFER(file) file->cfg->buffer
#define LFS_FILE_CFG_ATTRS(file) file->cfg->attrs #define LFS_FILE_CFG_ATTRS(file) file->cfg->attrs
#define LFS_FILE_CFG_ATTR_COUNT(file) file->cfg->attr_count #define LFS_FILE_CFG_ATTR_COUNT(file) file->cfg->attr_count
@@ -2596,7 +2596,7 @@ int lfs_file_open(lfs_t *lfs, lfs_file_t *file,
LFS_TRACE("lfs_file_open(%p, %p, \"%s\", %x)", LFS_TRACE("lfs_file_open(%p, %p, \"%s\", %x)",
(void*)lfs, (void*)file, path, flags); (void*)lfs, (void*)file, path, flags);
#ifndef LFS_FILE_STATICCFG #ifndef LFS_FILE_STATICCFG
static const struct lfs_file_config defaults = {0}; static const struct lfs_file_cfg defaults = {0};
file->cfg = &defaults; file->cfg = &defaults;
#endif #endif
int err = lfs_file_opencommon(lfs, file, path, flags); int err = lfs_file_opencommon(lfs, file, path, flags);
@@ -2607,7 +2607,7 @@ int lfs_file_open(lfs_t *lfs, lfs_file_t *file,
#if !defined(LFS_FILE_STATICCFG) #if !defined(LFS_FILE_STATICCFG)
int lfs_file_opencfg(lfs_t *lfs, lfs_file_t *file, int lfs_file_opencfg(lfs_t *lfs, lfs_file_t *file,
const char *path, int flags, const char *path, int flags,
const struct lfs_file_config *cfg) { const struct lfs_file_cfg *cfg) {
LFS_TRACE("lfs_file_opencfg(%p, %p, \"%s\", %x, %p {" LFS_TRACE("lfs_file_opencfg(%p, %p, \"%s\", %x, %p {"
".buffer=%p, .attrs=%p, .attr_count=%"PRIu32"})", ".buffer=%p, .attrs=%p, .attr_count=%"PRIu32"})",
(void*)lfs, (void*)file, path, flags, (void*)lfs, (void*)file, path, flags,
@@ -3731,7 +3731,7 @@ int lfs_format(lfs_t *lfs) {
#endif #endif
#if !defined(LFS_STATICCFG) #if !defined(LFS_STATICCFG)
int lfs_formatcfg(lfs_t *lfs, const struct lfs_config *cfg) { int lfs_formatcfg(lfs_t *lfs, const struct lfs_cfg *cfg) {
LFS_TRACE("lfs_formatcfg(%p, %p {.context=%p, " LFS_TRACE("lfs_formatcfg(%p, %p {.context=%p, "
".read=%p, .prog=%p, .erase=%p, .sync=%p, " ".read=%p, .prog=%p, .erase=%p, .sync=%p, "
".read_size=%"PRIu32", .prog_size=%"PRIu32", " ".read_size=%"PRIu32", .prog_size=%"PRIu32", "
@@ -3892,7 +3892,7 @@ int lfs_mount(lfs_t *lfs) {
#endif #endif
#if !defined(LFS_STATICCFG) #if !defined(LFS_STATICCFG)
int lfs_mountcfg(lfs_t *lfs, const struct lfs_config *cfg) { int lfs_mountcfg(lfs_t *lfs, const struct lfs_cfg *cfg) {
LFS_TRACE("lfs_mountcfg(%p, %p {.context=%p, " LFS_TRACE("lfs_mountcfg(%p, %p {.context=%p, "
".read=%p, .prog=%p, .erase=%p, .sync=%p, " ".read=%p, .prog=%p, .erase=%p, .sync=%p, "
".read_size=%"PRIu32", .prog_size=%"PRIu32", " ".read_size=%"PRIu32", .prog_size=%"PRIu32", "
@@ -5008,7 +5008,7 @@ int lfs_migrate(lfs_t *lfs) {
#endif #endif
#if !defined(LFS_STATICCFG) #if !defined(LFS_STATICCFG)
int lfs_migratecfg(lfs_t *lfs, const struct lfs_config *cfg) { int lfs_migratecfg(lfs_t *lfs, const struct lfs_cfg *cfg) {
LFS_TRACE("lfs_migratecfg(%p, %p {.context=%p, " LFS_TRACE("lfs_migratecfg(%p, %p {.context=%p, "
".read=%p, .prog=%p, .erase=%p, .sync=%p, " ".read=%p, .prog=%p, .erase=%p, .sync=%p, "
".read_size=%"PRIu32", .prog_size=%"PRIu32", " ".read_size=%"PRIu32", .prog_size=%"PRIu32", "

30
lfs.h
View File

@@ -127,31 +127,31 @@ enum lfs_whence_flags {
#if !defined(LFS_STATICCFG) #if !defined(LFS_STATICCFG)
// Configuration provided during initialization of the littlefs // Configuration provided during initialization of the littlefs
struct lfs_config { struct lfs_cfg {
// Opaque user provided context that can be used to pass // Opaque user provided context that can be used to pass
// information to the block device operations // information to the block device operations
void *context; void *context;
// Read a region in a block. Negative error codes are propogated // Read a region in a block. Negative error codes are propogated
// to the user. // to the user.
int (*read)(const struct lfs_config *c, lfs_block_t block, int (*read)(const struct lfs_cfg *c, lfs_block_t block,
lfs_off_t off, void *buffer, lfs_size_t size); lfs_off_t off, void *buffer, lfs_size_t size);
// Program a region in a block. The block must have previously // Program a region in a block. The block must have previously
// been erased. Negative error codes are propogated to the user. // been erased. Negative error codes are propogated to the user.
// May return LFS_ERR_CORRUPT if the block should be considered bad. // May return LFS_ERR_CORRUPT if the block should be considered bad.
int (*prog)(const struct lfs_config *c, lfs_block_t block, int (*prog)(const struct lfs_cfg *c, lfs_block_t block,
lfs_off_t off, const void *buffer, lfs_size_t size); lfs_off_t off, const void *buffer, lfs_size_t size);
// Erase a block. A block must be erased before being programmed. // Erase a block. A block must be erased before being programmed.
// The state of an erased block is undefined. Negative error codes // The state of an erased block is undefined. Negative error codes
// are propogated to the user. // are propogated to the user.
// May return LFS_ERR_CORRUPT if the block should be considered bad. // May return LFS_ERR_CORRUPT if the block should be considered bad.
int (*erase)(const struct lfs_config *c, lfs_block_t block); int (*erase)(const struct lfs_cfg *c, lfs_block_t block);
// Sync the state of the underlying block device. Negative error codes // Sync the state of the underlying block device. Negative error codes
// are propogated to the user. // are propogated to the user.
int (*sync)(const struct lfs_config *c); int (*sync)(const struct lfs_cfg *c);
// Minimum size of a block read. All read operations will be a // Minimum size of a block read. All read operations will be a
// multiple of this value. // multiple of this value.
@@ -223,7 +223,7 @@ struct lfs_config {
#else #else
// Static configuration if LFS_STATICCFG is defined, there are defaults // Static configuration if LFS_STATICCFG is defined, there are defaults
// for some of these, but some are required. For full documentation, see // for some of these, but some are required. For full documentation, see
// the lfs_config struct above. // the lfs_cfg struct above.
// Block device operations // Block device operations
int lfs_read(lfs_block_t block, int lfs_read(lfs_block_t block,
@@ -279,7 +279,7 @@ int lfs_sync(void);
#if !defined(LFS_FILE_STATICCFG) #if !defined(LFS_FILE_STATICCFG)
// Optional configuration provided during lfs_file_opencfg // Optional configuration provided during lfs_file_opencfg
struct lfs_file_config { struct lfs_file_cfg {
// Optional statically allocated file buffer. Must be cache_size. // Optional statically allocated file buffer. Must be cache_size.
// By default lfs_malloc is used to allocate this buffer. // By default lfs_malloc is used to allocate this buffer.
void *buffer; void *buffer;
@@ -302,7 +302,7 @@ struct lfs_file_config {
}; };
#else #else
// Static configuration if LFS_FILE_STATICCFG is defined. For full // Static configuration if LFS_FILE_STATICCFG is defined. For full
// documentation, see the lfs_file_config struct above. // documentation, see the lfs_file_cfg struct above.
#ifndef LFS_FILE_BUFFER #ifndef LFS_FILE_BUFFER
#define LFS_FILE_BUFFER NULL #define LFS_FILE_BUFFER NULL
#endif #endif
@@ -393,7 +393,7 @@ typedef struct lfs_file {
lfs_cache_t cache; lfs_cache_t cache;
#ifndef LFS_FILE_STATICCFG #ifndef LFS_FILE_STATICCFG
const struct lfs_file_config *cfg; const struct lfs_file_cfg *cfg;
#endif #endif
} lfs_file_t; } lfs_file_t;
@@ -438,7 +438,7 @@ typedef struct lfs {
} free; } free;
#ifndef LFS_STATICCFG #ifndef LFS_STATICCFG
const struct lfs_config *cfg; const struct lfs_cfg *cfg;
#endif #endif
lfs_size_t name_max; lfs_size_t name_max;
lfs_size_t file_max; lfs_size_t file_max;
@@ -470,7 +470,7 @@ int lfs_format(lfs_t *lfs);
// be zeroed for defaults and backwards compatibility. // be zeroed for defaults and backwards compatibility.
// //
// Returns a negative error code on failure. // Returns a negative error code on failure.
int lfs_formatcfg(lfs_t *lfs, const struct lfs_config *config); int lfs_formatcfg(lfs_t *lfs, const struct lfs_cfg *config);
#endif #endif
#if defined(LFS_STATICCFG) #if defined(LFS_STATICCFG)
@@ -491,7 +491,7 @@ int lfs_mount(lfs_t *lfs);
// be zeroed for defaults and backwards compatibility. // be zeroed for defaults and backwards compatibility.
// //
// Returns a negative error code on failure. // Returns a negative error code on failure.
int lfs_mountcfg(lfs_t *lfs, const struct lfs_config *config); int lfs_mountcfg(lfs_t *lfs, const struct lfs_cfg *config);
#endif #endif
// Unmounts a littlefs // Unmounts a littlefs
@@ -579,7 +579,7 @@ int lfs_file_open(lfs_t *lfs, lfs_file_t *file,
// Returns a negative error code on failure. // Returns a negative error code on failure.
int lfs_file_opencfg(lfs_t *lfs, lfs_file_t *file, int lfs_file_opencfg(lfs_t *lfs, lfs_file_t *file,
const char *path, int flags, const char *path, int flags,
const struct lfs_file_config *config); const struct lfs_file_cfg *config);
#endif #endif
// Close a file // Close a file
@@ -721,7 +721,7 @@ int lfs_fs_traverse(lfs_t *lfs, int (*cb)(void*, lfs_block_t), void *data);
// not leave the filesystem mounted. // not leave the filesystem mounted.
// //
// Returns a negative error code on failure. // Returns a negative error code on failure.
int lfs_migrate(lfs_t *lfs, const struct lfs_config *cfg); int lfs_migrate(lfs_t *lfs, const struct lfs_cfg *cfg);
#endif #endif
#if defined(LFS_MIGRATE) && !defined(LFS_STATICCFG) #if defined(LFS_MIGRATE) && !defined(LFS_STATICCFG)
@@ -737,7 +737,7 @@ int lfs_migrate(lfs_t *lfs, const struct lfs_config *cfg);
// be zeroed for defaults and backwards compatibility. // be zeroed for defaults and backwards compatibility.
// //
// Returns a negative error code on failure. // Returns a negative error code on failure.
int lfs_migratecfg(lfs_t *lfs, const struct lfs_config *cfg); int lfs_migratecfg(lfs_t *lfs, const struct lfs_cfg *cfg);
#endif #endif

View File

@@ -66,7 +66,7 @@ PROLOGUE = """
__attribute__((unused)) lfs_size_t size; __attribute__((unused)) lfs_size_t size;
__attribute__((unused)) int err; __attribute__((unused)) int err;
__attribute__((unused)) const struct lfs_config cfg = { __attribute__((unused)) const struct lfs_cfg cfg = {
.context = &bd, .context = &bd,
.read = lfs_testbd_read, .read = lfs_testbd_read,
.prog = lfs_testbd_prog, .prog = lfs_testbd_prog,
@@ -81,7 +81,7 @@ PROLOGUE = """
.lookahead_size = LFS_LOOKAHEAD_SIZE, .lookahead_size = LFS_LOOKAHEAD_SIZE,
}; };
__attribute__((unused)) const struct lfs_testbd_config bdcfg = { __attribute__((unused)) const struct lfs_testbd_cfg bdcfg = {
.erase_value = LFS_ERASE_VALUE, .erase_value = LFS_ERASE_VALUE,
.erase_cycles = LFS_ERASE_CYCLES, .erase_cycles = LFS_ERASE_CYCLES,
.badblock_behavior = LFS_BADBLOCK_BEHAVIOR, .badblock_behavior = LFS_BADBLOCK_BEHAVIOR,

View File

@@ -170,7 +170,7 @@ code = '''
{'B', buffer+4, 6}, {'B', buffer+4, 6},
{'C', buffer+10, 5}, {'C', buffer+10, 5},
}; };
struct lfs_file_config cfg1 = {.attrs=attrs1, .attr_count=3}; struct lfs_file_cfg cfg1 = {.attrs=attrs1, .attr_count=3};
lfs_file_opencfg(&lfs, &file, "hello/hello", LFS_O_WRONLY, &cfg1) => 0; lfs_file_opencfg(&lfs, &file, "hello/hello", LFS_O_WRONLY, &cfg1) => 0;
memcpy(buffer, "aaaa", 4); memcpy(buffer, "aaaa", 4);
@@ -228,7 +228,7 @@ code = '''
{'B', buffer+4, 9}, {'B', buffer+4, 9},
{'C', buffer+13, 5}, {'C', buffer+13, 5},
}; };
struct lfs_file_config cfg2 = {.attrs=attrs2, .attr_count=3}; struct lfs_file_cfg cfg2 = {.attrs=attrs2, .attr_count=3};
lfs_file_opencfg(&lfs, &file, "hello/hello", LFS_O_RDWR, &cfg2) => 0; lfs_file_opencfg(&lfs, &file, "hello/hello", LFS_O_RDWR, &cfg2) => 0;
memcpy(buffer+4, "fffffffff", 9); memcpy(buffer+4, "fffffffff", 9);
lfs_file_close(&lfs, &file) => 0; lfs_file_close(&lfs, &file) => 0;
@@ -245,7 +245,7 @@ code = '''
{'B', buffer+4, 9}, {'B', buffer+4, 9},
{'C', buffer+13, 5}, {'C', buffer+13, 5},
}; };
struct lfs_file_config cfg3 = {.attrs=attrs3, .attr_count=3}; struct lfs_file_cfg cfg3 = {.attrs=attrs3, .attr_count=3};
lfs_file_opencfg(&lfs, &file, "hello/hello", LFS_O_RDONLY, &cfg3) => 0; lfs_file_opencfg(&lfs, &file, "hello/hello", LFS_O_RDONLY, &cfg3) => 0;
lfs_file_close(&lfs, &file) => 0; lfs_file_close(&lfs, &file) => 0;
@@ -280,7 +280,7 @@ code = '''
{'C', "", 0}, {'C', "", 0},
{'D', "hhhh", 4}, {'D', "hhhh", 4},
}; };
struct lfs_file_config cfg1 = {.attrs=attrs1, .attr_count=3}; struct lfs_file_cfg cfg1 = {.attrs=attrs1, .attr_count=3};
lfs_file_opencfg(&lfs, &file, "hello/hello", LFS_O_WRONLY, &cfg1) => 0; lfs_file_opencfg(&lfs, &file, "hello/hello", LFS_O_WRONLY, &cfg1) => 0;