Changed most references to crc/csum -> cksum

The reason for this is to move away from the idea that littlefs is
strictly bound to CRCs and make the code more welcoming to other
checksum types, such as SHA256, etc.

Of course, changing the name doesn't really do anything. littlefs
actually _is_ strictly bound to CRCs in a couple ways that other
filesystems aren't. These would need to have workarounds for other
checksum types:

- We leverage the parity-preserving nature of (some) CRCs to not have
  to also calculate the parity of metadata in rbyd commits.

- We leverage the linearity of CRCs to retroactively flip the
  perturb bit in the cksum tag without needing to recalculate the
  checksum. Though the fact we need to do this is because of how we
  use parity above, so this may just not be needed for non-CRC
  checksums.

- The plans for global-CRCs (not yet implemented) rely heavily on the
  mathematical properties of CRC polynomials. This doesn't mean
  global-CRCs can't work with other checksums, you would just need to
  find a different type of polynomial.
This commit is contained in:
Christopher Haster
2023-08-07 13:32:38 -05:00
parent dc3b7d435e
commit 7031d6e1b3
7 changed files with 359 additions and 359 deletions
+2 -2
View File
@@ -353,7 +353,7 @@ typedef struct lfsr_rbyd {
// off>=block_size => rbyd not erased/needs compaction
lfs_off_t trunk;
lfs_off_t off;
uint32_t crc;
uint32_t cksum;
// note this lines up with arrays of redundant blocks in lfsr_mdir_t
lfs_block_t block;
} lfsr_rbyd_t;
@@ -395,7 +395,7 @@ typedef struct lfsr_mdir {
lfs_size_t weight;
lfs_off_t trunk;
lfs_off_t off;
uint32_t crc;
uint32_t cksum;
lfs_block_t blocks[2];
} m;
struct {