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

@@ -44,7 +44,7 @@ typedef uint32_t lfs_testbd_wear_t;
typedef int32_t lfs_testbd_swear_t;
// 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
// erases, which can speed up testing by avoiding all the extra block-device
// operations to store the erase value.
@@ -73,11 +73,11 @@ typedef struct lfs_testbd {
union {
struct {
lfs_filebd_t bd;
struct lfs_filebd_config cfg;
struct lfs_filebd_cfg cfg;
} file;
struct {
lfs_rambd_t bd;
struct lfs_rambd_config cfg;
struct lfs_rambd_cfg cfg;
} ram;
} u;
@@ -85,51 +85,51 @@ typedef struct lfs_testbd {
uint32_t power_cycles;
lfs_testbd_wear_t *wear;
const struct lfs_testbd_config *cfg;
const struct lfs_testbd_cfg *cfg;
} lfs_testbd_t;
/// 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
// testbd will use rambd which can be much faster.
int lfs_testbd_create(const struct lfs_config *cfg, const char *path);
int lfs_testbd_createcfg(const struct lfs_config *cfg, const char *path,
const struct lfs_testbd_config *bdcfg);
int lfs_testbd_create(const struct lfs_cfg *cfg, const char *path);
int lfs_testbd_createcfg(const struct lfs_cfg *cfg, const char *path,
const struct lfs_testbd_cfg *bdcfg);
// 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
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);
// Program a block
//
// 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);
// Erase a block
//
// A block must be erased before being programmed. The
// 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
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 ///
// 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);
// 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);