emubd: Dropped lfs_emubd_cksum/bdcksum

One of these was missed during the crc -> cksum rename, so it wouldn't
have even linked correctly. Rather than fixing it I'm just going to drop
these functions.

At some point they were useful for debugging, but with emubd's disk
mirroring and dbgblock.py, it's both easier and more reliable to
find checksums with external scripts.
This commit is contained in:
Christopher Haster
2024-08-11 23:48:47 -05:00
parent 6e2af5bf80
commit a59d7c9954
2 changed files with 0 additions and 61 deletions
-54
View File
@@ -999,60 +999,6 @@ int lfs_emubd_seed(const struct lfs_config *cfg, uint32_t seed) {
return 0;
}
static int lfs_emubd_rawcksum(const struct lfs_config *cfg,
lfs_block_t block, uint32_t *cksum) {
lfs_emubd_t *bd = cfg->context;
// check if block is valid
LFS_ASSERT(block < cfg->block_count);
// checksum the block
uint32_t cksum_ = 0;
const lfs_emubd_block_t *b = bd->blocks[block];
if (b) {
cksum_ = lfs_crc32c(cksum_, b->data, cfg->block_size);
} else {
uint8_t erase_value = (bd->cfg->erase_value != -1)
? bd->cfg->erase_value
: 0;
for (lfs_size_t i = 0; i < cfg->block_size; i++) {
cksum_ = lfs_crc32c(cksum_, &erase_value, 1);
}
}
*cksum = cksum_;
return 0;
}
int lfs_emubd_cksum(const struct lfs_config *cfg,
lfs_block_t block, uint32_t *cksum) {
LFS_EMUBD_TRACE("lfs_emubd_cksum(%p, %"PRIu32", %p)",
(void*)cfg, block, cksum);
int err = lfs_emubd_rawcksum(cfg, block, cksum);
LFS_EMUBD_TRACE("lfs_emubd_cksum -> %d", err);
return err;
}
int lfs_emubd_bdcrc(const struct lfs_config *cfg, uint32_t *cksum) {
LFS_EMUBD_TRACE("lfs_emubd_bdcksum(%p, %p)", (void*)cfg, cksum);
uint32_t cksum_ = 0;
for (lfs_block_t i = 0; i < cfg->block_count; i++) {
uint32_t i_cksum;
int err = lfs_emubd_rawcksum(cfg, i, &i_cksum);
if (err) {
LFS_EMUBD_TRACE("lfs_emubd_bdcksum -> %d", err);
return err;
}
cksum_ = lfs_crc32c(cksum_, &i_cksum, sizeof(uint32_t));
}
*cksum = cksum_;
LFS_EMUBD_TRACE("lfs_emubd_bdcksum -> %d", 0);
return 0;
}
lfs_emubd_sio_t lfs_emubd_readed(const struct lfs_config *cfg) {
LFS_EMUBD_TRACE("lfs_emubd_readed(%p)", (void*)cfg);
lfs_emubd_t *bd = cfg->context;
-7
View File
@@ -193,13 +193,6 @@ int lfs_emubd_sync(const struct lfs_config *cfg);
// Set the current prng state
int lfs_emubd_seed(const struct lfs_config *cfg, uint32_t seed);
// A checksum of a block for debugging purposes
int lfs_emubd_cksum(const struct lfs_config *cfg,
lfs_block_t block, uint32_t *cksum);
// A checksum of the entire block device for debugging purposes
int lfs_emubd_bdcksum(const struct lfs_config *cfg, uint32_t *cksum);
// Get total amount of bytes read
lfs_emubd_sio_t lfs_emubd_readed(const struct lfs_config *cfg);