Skip to content

Commit

Permalink
Added error correction limits to config documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
geky committed Oct 30, 2024
1 parent 6e661e3 commit fb666a0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ramrsbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ int ramrsbd_create(const struct lfs_config *cfg,
* bd->cfg->ecc_size))
== 0);

// There's only 255 non-zero elements in GF(256), so ramrsbd is limited
// to at most 255 byte codewords
LFS_ASSERT(bd->cfg->code_size <= 255);

// Make sure the requested error correction is possible
LFS_ASSERT(bd->cfg->error_correction <= 0
|| (lfs_size_t)bd->cfg->error_correction <= bd->cfg->ecc_size/2);
Expand Down
4 changes: 4 additions & 0 deletions ramrsbd.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,15 @@ extern "C"
struct ramrsbd_config {
// Size of a codeword in bytes.
//
// Limited to at most 255 bytes (non-zero elements in GF(256)).
//
// Note code_size = read_size and prog_size + ecc_size.
lfs_size_t code_size;

// Size of the error-correcting code in bytes.
//
// ramrsbd can reliably correct up to floor(ecc_size/2) byte errors.
//
// Note code_size = read_size and prog_size + ecc_size.
lfs_size_t ecc_size;

Expand Down

0 comments on commit fb666a0

Please sign in to comment.