Renamed ckcksums -> ckdatacksums
To clarify this only checks data reads, and to makes space for future theoretical ck-operations: - ckmetaredund - likely - ckdataredund - unlikely, expensive - ckmetacksums - unlikely, expensive - ckdatacksums - implemented This also tweaks the relevant mount/format/info flags a bit: LFS_M_CKPROGS 0x00100000 Check progs by reading back progged data LFS_M_CKFETCHES 0x00200000 Check block checksums before first use LFS_M_CKPARITY 0x00400000 Check metadata tag parity bits LFS_M_CKMETAREDUND+ 0x01000000 Check metadata redund blocks on reads LFS_M_CKDATAREDUND* 0x02000000 Check data redund blocks on reads LFS_M_CKMETACKSUMS* 0x04000000 Check metadata checksums on reads LFS_M_CKDATACKSUMS 0x08000000 Check data checksums on reads +Planned *Hypothetical No code changes.
This commit is contained in:
@@ -704,13 +704,13 @@ static int lfsr_bd_set(lfs_t *lfs, lfs_block_t block, lfs_size_t off,
|
||||
|
||||
/// lfsr_ck_t stuff ///
|
||||
|
||||
#ifdef LFS_CKCKSUMS
|
||||
#ifdef LFS_CKDATACKSUMS
|
||||
#define LFSR_CK_NULL() \
|
||||
((lfsr_ck_t){ \
|
||||
.cksize=0})
|
||||
#endif
|
||||
|
||||
#ifdef LFS_CKCKSUMS
|
||||
#ifdef LFS_CKDATACKSUMS
|
||||
#define LFSR_CK_CKSUM(_cksize, _cksum) \
|
||||
((lfsr_ck_t){ \
|
||||
.cksize=_cksize, \
|
||||
@@ -718,7 +718,7 @@ static int lfsr_bd_set(lfs_t *lfs, lfs_block_t block, lfs_size_t off,
|
||||
#endif
|
||||
|
||||
// ck helpers
|
||||
#ifdef LFS_CKCKSUMS
|
||||
#ifdef LFS_CKDATACKSUMS
|
||||
static inline bool lfsr_ck_iscksum(lfsr_ck_t ck) {
|
||||
return ck.cksize != 0;
|
||||
}
|
||||
@@ -750,11 +750,11 @@ static inline lfs_size_t lfsr_tailp_off(const lfsr_tailp_t *tailp) {
|
||||
// checked read helpers
|
||||
|
||||
// needed in lfsr_bd_ckprefix/cksuffix
|
||||
#ifdef LFS_CKCKSUMS
|
||||
static inline bool lfsr_m_isckcksums(uint32_t flags);
|
||||
#ifdef LFS_CKDATACKSUMS
|
||||
static inline bool lfsr_m_isckdatacksums(uint32_t flags);
|
||||
#endif
|
||||
|
||||
#ifdef LFS_CKCKSUMS
|
||||
#ifdef LFS_CKDATACKSUMS
|
||||
static int lfsr_bd_ckprefix(lfs_t *lfs,
|
||||
lfs_block_t block, lfs_size_t off, lfs_size_t hint,
|
||||
lfsr_ck_t ck,
|
||||
@@ -789,7 +789,7 @@ static int lfsr_bd_ckprefix(lfs_t *lfs,
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LFS_CKCKSUMS
|
||||
#ifdef LFS_CKDATACKSUMS
|
||||
static int lfsr_bd_cksuffix(lfs_t *lfs,
|
||||
lfs_block_t block, lfs_size_t off, lfs_size_t hint,
|
||||
lfsr_ck_t ck,
|
||||
@@ -810,7 +810,7 @@ static int lfsr_bd_cksuffix(lfs_t *lfs,
|
||||
|
||||
// do checksums match?
|
||||
if (cksum != ck.cksum) {
|
||||
LFS_ERROR("Found ckcksums mismatch "
|
||||
LFS_ERROR("Found ckdatacksums mismatch "
|
||||
"0x%"PRIx32".%"PRIx32" %"PRId32", "
|
||||
"cksum %08"PRIx32" (!= %08"PRIx32")",
|
||||
block, 0, ck.cksize,
|
||||
@@ -825,7 +825,7 @@ static int lfsr_bd_cksuffix(lfs_t *lfs,
|
||||
|
||||
// checked read functions
|
||||
|
||||
#ifdef LFS_CKCKSUMS
|
||||
#ifdef LFS_CKDATACKSUMS
|
||||
// caching read with parity/checksum checks
|
||||
//
|
||||
// the main downside of checking reads is we need to read all data that
|
||||
@@ -874,13 +874,13 @@ static int lfsr_bd_readck_(lfs_t *lfs,
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LFS_CKCKSUMS
|
||||
#ifdef LFS_CKDATACKSUMS
|
||||
static int lfsr_bd_readck(lfs_t *lfs,
|
||||
lfs_block_t block, lfs_size_t off, lfs_size_t hint,
|
||||
void *buffer, lfs_size_t size,
|
||||
lfsr_ck_t ck) {
|
||||
// check this read?
|
||||
if (lfsr_m_isckcksums(lfs->flags) && lfsr_ck_iscksum(ck)) {
|
||||
if (lfsr_m_isckdatacksums(lfs->flags) && lfsr_ck_iscksum(ck)) {
|
||||
return lfsr_bd_readck_(lfs,
|
||||
block, off, hint,
|
||||
buffer, size,
|
||||
@@ -894,7 +894,7 @@ static int lfsr_bd_readck(lfs_t *lfs,
|
||||
#endif
|
||||
|
||||
// redirect to lfsr_bd_read if not checking reads
|
||||
#ifdef LFS_CKCKSUMS
|
||||
#ifdef LFS_CKDATACKSUMS
|
||||
#define LFSR_BD_READCK(_lfs, _block, _off, _hint, _buffer, _size, _ck) \
|
||||
lfsr_bd_readck(_lfs, _block, _off, _hint, _buffer, _size, _ck)
|
||||
#else
|
||||
@@ -908,7 +908,7 @@ static int lfsr_bd_readck(lfs_t *lfs,
|
||||
//
|
||||
// we'd also need to worry about early termination in lfsr_bd_cmp/cmpck
|
||||
|
||||
#ifdef LFS_CKCKSUMS
|
||||
#ifdef LFS_CKDATACKSUMS
|
||||
static lfs_scmp_t lfsr_bd_cmpck_(lfs_t *lfs,
|
||||
lfs_block_t block, lfs_size_t off, lfs_size_t hint,
|
||||
const void *buffer, lfs_size_t size,
|
||||
@@ -971,13 +971,13 @@ static lfs_scmp_t lfsr_bd_cmpck_(lfs_t *lfs,
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LFS_CKCKSUMS
|
||||
#ifdef LFS_CKDATACKSUMS
|
||||
static lfs_scmp_t lfsr_bd_cmpck(lfs_t *lfs,
|
||||
lfs_block_t block, lfs_size_t off, lfs_size_t hint,
|
||||
const void *buffer, lfs_size_t size,
|
||||
lfsr_ck_t ck) {
|
||||
// check this read?
|
||||
if (lfsr_m_isckcksums(lfs->flags) && lfsr_ck_iscksum(ck)) {
|
||||
if (lfsr_m_isckdatacksums(lfs->flags) && lfsr_ck_iscksum(ck)) {
|
||||
return lfsr_bd_cmpck_(lfs,
|
||||
block, off, hint,
|
||||
buffer, size,
|
||||
@@ -991,7 +991,7 @@ static lfs_scmp_t lfsr_bd_cmpck(lfs_t *lfs,
|
||||
#endif
|
||||
|
||||
// redirect to lfsr_bd_cmp if not checking reads
|
||||
#ifdef LFS_CKCKSUMS
|
||||
#ifdef LFS_CKDATACKSUMS
|
||||
#define LFSR_BD_CMPCK(_lfs, _block, _off, _hint, _buffer, _size, _ck) \
|
||||
lfsr_bd_cmpck(_lfs, _block, _off, _hint, _buffer, _size, _ck)
|
||||
#else
|
||||
@@ -999,7 +999,7 @@ static lfs_scmp_t lfsr_bd_cmpck(lfs_t *lfs,
|
||||
lfsr_bd_cmp(_lfs, _block, _off, _hint, _buffer, _size)
|
||||
#endif
|
||||
|
||||
#ifdef LFS_CKCKSUMS
|
||||
#ifdef LFS_CKDATACKSUMS
|
||||
static int lfsr_bd_cpyck_(lfs_t *lfs,
|
||||
lfs_block_t dst_block, lfs_size_t dst_off,
|
||||
lfs_block_t src_block, lfs_size_t src_off, lfs_size_t hint,
|
||||
@@ -1073,7 +1073,7 @@ static int lfsr_bd_cpyck_(lfs_t *lfs,
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LFS_CKCKSUMS
|
||||
#ifdef LFS_CKDATACKSUMS
|
||||
static int lfsr_bd_cpyck(lfs_t *lfs,
|
||||
lfs_block_t dst_block, lfs_size_t dst_off,
|
||||
lfs_block_t src_block, lfs_size_t src_off, lfs_size_t hint,
|
||||
@@ -1081,7 +1081,7 @@ static int lfsr_bd_cpyck(lfs_t *lfs,
|
||||
lfsr_ck_t ck,
|
||||
uint32_t *cksum, bool align) {
|
||||
// check this read?
|
||||
if (lfsr_m_isckcksums(lfs->flags) && lfsr_ck_iscksum(ck)) {
|
||||
if (lfsr_m_isckdatacksums(lfs->flags) && lfsr_ck_iscksum(ck)) {
|
||||
return lfsr_bd_cpyck_(lfs,
|
||||
dst_block, dst_off,
|
||||
src_block, src_off, hint,
|
||||
@@ -1099,7 +1099,7 @@ static int lfsr_bd_cpyck(lfs_t *lfs,
|
||||
#endif
|
||||
|
||||
// redirect to lfsr_bd_cpy if not checking reads
|
||||
#ifdef LFS_CKCKSUMS
|
||||
#ifdef LFS_CKDATACKSUMS
|
||||
#define LFSR_BD_CPYCK(_lfs, \
|
||||
_dst_block, _dst_off, \
|
||||
_src_block, _src_off, _hint, \
|
||||
@@ -1785,7 +1785,7 @@ static lfs_ssize_t lfsr_bd_progtag(lfs_t *lfs,
|
||||
.size=_size, \
|
||||
.u.buffer=(const void*)(_buffer)})
|
||||
|
||||
#ifdef LFS_CKCKSUMS
|
||||
#ifdef LFS_CKDATACKSUMS
|
||||
#define LFSR_DATA_DISK(_block, _off, _size) \
|
||||
((lfsr_data_t){ \
|
||||
.size=LFSR_DATA_ONDISK | (_size), \
|
||||
@@ -1800,7 +1800,7 @@ static lfs_ssize_t lfsr_bd_progtag(lfs_t *lfs,
|
||||
.u.disk.off=_off})
|
||||
#endif
|
||||
|
||||
#ifdef LFS_CKCKSUMS
|
||||
#ifdef LFS_CKDATACKSUMS
|
||||
#define LFSR_DATA_DISKCKSUM(_block, _off, _size, _cksize, _cksum) \
|
||||
((lfsr_data_t){ \
|
||||
.size=LFSR_DATA_ONDISK | (_size), \
|
||||
@@ -2502,7 +2502,7 @@ static int lfsr_data_readecksum(lfs_t *lfs, lfsr_data_t *data,
|
||||
// unnecessarily duplicate, long story short accessing ck info gets
|
||||
// annoyingly messy...
|
||||
static inline lfs_size_t lfsr_bptr_cksize(const lfsr_bptr_t *bptr) {
|
||||
#ifdef LFS_CKCKSUMS
|
||||
#ifdef LFS_CKDATACKSUMS
|
||||
return bptr->data.u.disk.ck.cksize;
|
||||
#else
|
||||
return bptr->cksize;
|
||||
@@ -2510,7 +2510,7 @@ static inline lfs_size_t lfsr_bptr_cksize(const lfsr_bptr_t *bptr) {
|
||||
}
|
||||
|
||||
static inline uint32_t lfsr_bptr_cksum(const lfsr_bptr_t *bptr) {
|
||||
#ifdef LFS_CKCKSUMS
|
||||
#ifdef LFS_CKDATACKSUMS
|
||||
return bptr->data.u.disk.ck.cksum;
|
||||
#else
|
||||
return bptr->cksum;
|
||||
@@ -2581,7 +2581,7 @@ static int lfsr_data_readbptr(lfs_t *lfs, lfsr_data_t *data,
|
||||
|
||||
// read the cksize, cksum
|
||||
err = lfsr_data_readlleb128(lfs, data,
|
||||
LFS_IFDEF_CKCKSUMS(
|
||||
LFS_IFDEF_CKDATACKSUMS(
|
||||
&bptr->data.u.disk.ck.cksize,
|
||||
&bptr->cksize));
|
||||
if (err) {
|
||||
@@ -2589,7 +2589,7 @@ static int lfsr_data_readbptr(lfs_t *lfs, lfsr_data_t *data,
|
||||
}
|
||||
|
||||
err = lfsr_data_readle32(lfs, data,
|
||||
LFS_IFDEF_CKCKSUMS(
|
||||
LFS_IFDEF_CKDATACKSUMS(
|
||||
&bptr->data.u.disk.ck.cksum,
|
||||
&bptr->cksum));
|
||||
if (err) {
|
||||
@@ -6790,21 +6790,21 @@ static inline bool lfsr_m_isckprogs(uint32_t flags) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LFS_CKFETCHES
|
||||
static inline bool lfsr_m_isckfetches(uint32_t flags) {
|
||||
return flags & LFS_M_CKFETCHES;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LFS_CKPARITY
|
||||
static inline bool lfsr_m_isckparity(uint32_t flags) {
|
||||
return flags & LFS_M_CKPARITY;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LFS_CKCKSUMS
|
||||
static inline bool lfsr_m_isckcksums(uint32_t flags) {
|
||||
return flags & LFS_M_CKCKSUMS;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LFS_CKFETCHES
|
||||
static inline bool lfsr_m_isckfetches(uint32_t flags) {
|
||||
return flags & LFS_M_CKFETCHES;
|
||||
#ifdef LFS_CKDATACKSUMS
|
||||
static inline bool lfsr_m_isckdatacksums(uint32_t flags) {
|
||||
return flags & LFS_M_CKDATACKSUMS;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -11688,7 +11688,7 @@ static int lfsr_file_carve(lfs_t *lfs, lfsr_file_t *file,
|
||||
LFSR_TAG_GROW | LFSR_TAG_SUB | LFSR_TAG_BLOCK,
|
||||
-(bid+1 - pos),
|
||||
LFSR_DATA_BPTR_(
|
||||
LFS_IFDEF_CKCKSUMS(
|
||||
LFS_IFDEF_CKDATACKSUMS(
|
||||
(&(lfsr_bptr_t){
|
||||
.data=left_slice_}),
|
||||
(&(lfsr_bptr_t){
|
||||
@@ -11745,7 +11745,7 @@ static int lfsr_file_carve(lfs_t *lfs, lfsr_file_t *file,
|
||||
tag_,
|
||||
bid+1 - (pos+weight),
|
||||
LFSR_DATA_BPTR_(
|
||||
LFS_IFDEF_CKCKSUMS(
|
||||
LFS_IFDEF_CKDATACKSUMS(
|
||||
(&(lfsr_bptr_t){
|
||||
.data=right_slice_}),
|
||||
(&(lfsr_bptr_t){
|
||||
@@ -11987,10 +11987,10 @@ static int lfsr_file_flush_(lfs_t *lfs, lfsr_file_t *file,
|
||||
}
|
||||
|
||||
bptr.data = LFSR_DATA_DISKCKSUM(block, 0, 0, 0, 0);
|
||||
LFS_IFDEF_CKCKSUMS(
|
||||
LFS_IFDEF_CKDATACKSUMS(
|
||||
bptr.data.u.disk.ck.cksize,
|
||||
bptr.cksize) = 0;
|
||||
LFS_IFDEF_CKCKSUMS(
|
||||
LFS_IFDEF_CKDATACKSUMS(
|
||||
bptr.data.u.disk.ck.cksum,
|
||||
bptr.cksum) = 0;
|
||||
|
||||
@@ -12023,7 +12023,7 @@ static int lfsr_file_flush_(lfs_t *lfs, lfsr_file_t *file,
|
||||
int err = lfsr_bd_prog(lfs, bptr.data.u.disk.block,
|
||||
lfsr_bptr_cksize(&bptr),
|
||||
&buffer[pos_ - pos], d_,
|
||||
LFS_IFDEF_CKCKSUMS(
|
||||
LFS_IFDEF_CKDATACKSUMS(
|
||||
&bptr.data.u.disk.ck.cksum,
|
||||
&bptr.cksum), true);
|
||||
if (err) {
|
||||
@@ -12036,7 +12036,7 @@ static int lfsr_file_flush_(lfs_t *lfs, lfsr_file_t *file,
|
||||
}
|
||||
|
||||
pos_ += d_;
|
||||
LFS_IFDEF_CKCKSUMS(
|
||||
LFS_IFDEF_CKDATACKSUMS(
|
||||
bptr.data.u.disk.ck.cksize,
|
||||
bptr.cksize) += d_;
|
||||
d -= d_;
|
||||
@@ -12098,7 +12098,7 @@ static int lfsr_file_flush_(lfs_t *lfs, lfsr_file_t *file,
|
||||
lfsr_data_slice(bptr_.data,
|
||||
pos_ - (bid_-(weight_-1)),
|
||||
d_),
|
||||
LFS_IFDEF_CKCKSUMS(
|
||||
LFS_IFDEF_CKDATACKSUMS(
|
||||
&bptr.data.u.disk.ck.cksum,
|
||||
&bptr.cksum), true);
|
||||
if (err) {
|
||||
@@ -12111,7 +12111,7 @@ static int lfsr_file_flush_(lfs_t *lfs, lfsr_file_t *file,
|
||||
}
|
||||
|
||||
pos_ += d_;
|
||||
LFS_IFDEF_CKCKSUMS(
|
||||
LFS_IFDEF_CKDATACKSUMS(
|
||||
bptr.data.u.disk.ck.cksize,
|
||||
bptr.cksize) += d_;
|
||||
d -= d_;
|
||||
@@ -12125,7 +12125,7 @@ static int lfsr_file_flush_(lfs_t *lfs, lfsr_file_t *file,
|
||||
int err = lfsr_bd_set(lfs,
|
||||
bptr.data.u.disk.block, lfsr_bptr_cksize(&bptr),
|
||||
0, d,
|
||||
LFS_IFDEF_CKCKSUMS(
|
||||
LFS_IFDEF_CKDATACKSUMS(
|
||||
&bptr.data.u.disk.ck.cksum,
|
||||
&bptr.cksum), true);
|
||||
if (err) {
|
||||
@@ -12138,7 +12138,7 @@ static int lfsr_file_flush_(lfs_t *lfs, lfsr_file_t *file,
|
||||
}
|
||||
|
||||
pos_ += d;
|
||||
LFS_IFDEF_CKCKSUMS(
|
||||
LFS_IFDEF_CKDATACKSUMS(
|
||||
bptr.data.u.disk.ck.cksize,
|
||||
bptr.cksize) += d;
|
||||
}
|
||||
@@ -12149,13 +12149,13 @@ static int lfsr_file_flush_(lfs_t *lfs, lfsr_file_t *file,
|
||||
// up reading more than is strictly necessary.
|
||||
lfs_ssize_t d = lfsr_bptr_cksize(&bptr) % lfs->cfg->prog_size;
|
||||
lfs->pcache.size -= d;
|
||||
LFS_IFDEF_CKCKSUMS(
|
||||
LFS_IFDEF_CKDATACKSUMS(
|
||||
bptr.data.u.disk.ck.cksize,
|
||||
bptr.cksize) -= d;
|
||||
|
||||
// finalize our write
|
||||
int err = lfsr_bd_flush(lfs,
|
||||
LFS_IFDEF_CKCKSUMS(
|
||||
LFS_IFDEF_CKDATACKSUMS(
|
||||
&bptr.data.u.disk.ck.cksum,
|
||||
&bptr.cksum), true);
|
||||
if (err) {
|
||||
@@ -13208,7 +13208,7 @@ static int lfs_init(lfs_t *lfs, uint32_t flags,
|
||||
| LFS_IFDEF_CKPROGS(LFS_M_CKPROGS, 0)
|
||||
| LFS_IFDEF_CKFETCHES(LFS_M_CKFETCHES, 0)
|
||||
| LFS_IFDEF_CKPARITY(LFS_M_CKPARITY, 0)
|
||||
| LFS_IFDEF_CKCKSUMS(LFS_M_CKCKSUMS, 0))) == 0);
|
||||
| LFS_IFDEF_CKDATACKSUMS(LFS_M_CKDATACKSUMS, 0))) == 0);
|
||||
|
||||
// TODO this all needs to be cleaned up
|
||||
lfs->cfg = cfg;
|
||||
@@ -13977,7 +13977,7 @@ int lfsr_mount(lfs_t *lfs, uint32_t flags,
|
||||
| LFS_IFDEF_CKPROGS(LFS_M_CKPROGS, 0)
|
||||
| LFS_IFDEF_CKFETCHES(LFS_M_CKFETCHES, 0)
|
||||
| LFS_IFDEF_CKPARITY(LFS_M_CKPARITY, 0)
|
||||
| LFS_IFDEF_CKCKSUMS(LFS_M_CKCKSUMS, 0)
|
||||
| LFS_IFDEF_CKDATACKSUMS(LFS_M_CKDATACKSUMS, 0)
|
||||
| LFS_M_MTREEONLY
|
||||
| LFS_M_MKCONSISTENT
|
||||
| LFS_M_LOOKAHEAD
|
||||
@@ -14001,7 +14001,7 @@ int lfsr_mount(lfs_t *lfs, uint32_t flags,
|
||||
| LFS_IFDEF_CKPROGS(LFS_M_CKPROGS, 0)
|
||||
| LFS_IFDEF_CKFETCHES(LFS_M_CKFETCHES, 0)
|
||||
| LFS_IFDEF_CKPARITY(LFS_M_CKPARITY, 0)
|
||||
| LFS_IFDEF_CKCKSUMS(LFS_M_CKCKSUMS, 0)),
|
||||
| LFS_IFDEF_CKDATACKSUMS(LFS_M_CKDATACKSUMS, 0)),
|
||||
cfg);
|
||||
if (err) {
|
||||
return err;
|
||||
@@ -14143,7 +14143,7 @@ int lfsr_format(lfs_t *lfs, uint32_t flags,
|
||||
| LFS_IFDEF_CKPROGS(LFS_F_CKPROGS, 0)
|
||||
| LFS_IFDEF_CKFETCHES(LFS_F_CKFETCHES, 0)
|
||||
| LFS_IFDEF_CKPARITY(LFS_F_CKPARITY, 0)
|
||||
| LFS_IFDEF_CKCKSUMS(LFS_F_CKCKSUMS, 0)
|
||||
| LFS_IFDEF_CKDATACKSUMS(LFS_F_CKDATACKSUMS, 0)
|
||||
| LFS_F_MTREEONLY
|
||||
| LFS_F_COMPACT
|
||||
| LFS_F_CKMETA
|
||||
@@ -14157,7 +14157,7 @@ int lfsr_format(lfs_t *lfs, uint32_t flags,
|
||||
| LFS_IFDEF_CKPROGS(LFS_F_CKPROGS, 0)
|
||||
| LFS_IFDEF_CKFETCHES(LFS_F_CKFETCHES, 0)
|
||||
| LFS_IFDEF_CKPARITY(LFS_F_CKPARITY, 0)
|
||||
| LFS_IFDEF_CKCKSUMS(LFS_F_CKCKSUMS, 0)),
|
||||
| LFS_IFDEF_CKDATACKSUMS(LFS_F_CKDATACKSUMS, 0)),
|
||||
cfg);
|
||||
if (err) {
|
||||
return err;
|
||||
@@ -14219,7 +14219,7 @@ int lfsr_fs_stat(lfs_t *lfs, struct lfs_fsinfo *fsinfo) {
|
||||
| LFS_IFDEF_CKPROGS(LFS_I_CKPROGS, 0)
|
||||
| LFS_IFDEF_CKFETCHES(LFS_I_CKFETCHES, 0)
|
||||
| LFS_IFDEF_CKPARITY(LFS_I_CKPARITY, 0)
|
||||
| LFS_IFDEF_CKCKSUMS(LFS_I_CKCKSUMS, 0)
|
||||
| LFS_IFDEF_CKDATACKSUMS(LFS_I_CKDATACKSUMS, 0)
|
||||
| LFS_I_UNCOMPACTED);
|
||||
// some flags we calculate on demand
|
||||
fsinfo->flags |= (lfsr_fs_isinconsistent(lfs)) ? LFS_I_INCONSISTENT : 0;
|
||||
|
||||
@@ -168,8 +168,9 @@ enum lfs_type {
|
||||
#ifdef LFS_CKPARITY
|
||||
#define LFS_F_CKPARITY 0x00400000 // Check metadata tag parity bits
|
||||
#endif
|
||||
#ifdef LFS_CKCKSUMS
|
||||
#define LFS_F_CKCKSUMS 0x00800000 // Check data checksums on reads
|
||||
#ifdef LFS_CKDATACKSUMS
|
||||
#define LFS_F_CKDATACKSUMS \
|
||||
0x08000000 // Check data checksums on reads
|
||||
#endif
|
||||
|
||||
#define LFS_F_MTREEONLY 0x00000800 // Only traverse the mtree
|
||||
@@ -191,8 +192,9 @@ enum lfs_type {
|
||||
#ifdef LFS_CKPARITY
|
||||
#define LFS_M_CKPARITY 0x00400000 // Check metadata tag parity bits
|
||||
#endif
|
||||
#ifdef LFS_CKCKSUMS
|
||||
#define LFS_M_CKCKSUMS 0x00800000 // Check data checksums on reads
|
||||
#ifdef LFS_CKDATACKSUMS
|
||||
#define LFS_M_CKDATACKSUMS \
|
||||
0x08000000 // Check data checksums on reads
|
||||
#endif
|
||||
|
||||
#define LFS_M_MTREEONLY 0x00000800 // Only traverse the mtree
|
||||
@@ -204,20 +206,21 @@ enum lfs_type {
|
||||
#define LFS_M_CKDATA 0x00020000 // Check metadata + data checksums
|
||||
|
||||
// Filesystem info flags
|
||||
#define LFS_I_RDONLY 0x00000001 // Filesystem mounted read only
|
||||
#define LFS_I_FLUSH 0x00000040 // Filesystem mounted with LFS_M_FLUSH
|
||||
#define LFS_I_SYNC 0x00000080 // Filesystem mounted with LFS_M_SYNC
|
||||
#define LFS_I_RDONLY 0x00000001 // Mounted read only
|
||||
#define LFS_I_FLUSH 0x00000040 // Mounted with LFS_M_FLUSH
|
||||
#define LFS_I_SYNC 0x00000080 // Mounted with LFS_M_SYNC
|
||||
#ifdef LFS_CKPROGS
|
||||
#define LFS_I_CKPROGS 0x00100000 // Filesystem mounted with LFS_M_CKPROGS
|
||||
#define LFS_I_CKPROGS 0x00100000 // Mounted with LFS_M_CKPROGS
|
||||
#endif
|
||||
#ifdef LFS_CKFETCHES
|
||||
#define LFS_I_CKFETCHES 0x00200000 // Filesystem mounted with LFS_M_CKFETCHES
|
||||
#define LFS_I_CKFETCHES 0x00200000 // Mounted with LFS_M_CKFETCHES
|
||||
#endif
|
||||
#ifdef LFS_CKPARITY
|
||||
#define LFS_I_CKPARITY 0x00400000 // Filesystem mounted with LFS_M_CKPARITY
|
||||
#define LFS_I_CKPARITY 0x00400000 // Mounted with LFS_M_CKPARITY
|
||||
#endif
|
||||
#ifdef LFS_CKCKSUMS
|
||||
#define LFS_I_CKCKSUMS 0x00800000 // Filesystem mounted with LFS_M_CKCKSUMS
|
||||
#ifdef LFS_CKDATACKSUMS
|
||||
#define LFS_I_CKDATACKSUMS \
|
||||
0x08000000 // Mounted with LFS_M_CKDATACKSUMS
|
||||
#endif
|
||||
|
||||
#define LFS_I_INCONSISTENT \
|
||||
@@ -609,7 +612,7 @@ typedef struct lfsr_omdir {
|
||||
// lfs_block_t tail[2];
|
||||
//} lfs_mdir_t;
|
||||
|
||||
#ifdef LFS_CKCKSUMS
|
||||
#ifdef LFS_CKDATACKSUMS
|
||||
// context for validating data
|
||||
typedef struct lfsr_ck {
|
||||
// cksize=0 => no checksum
|
||||
@@ -629,7 +632,7 @@ typedef struct lfsr_data {
|
||||
struct {
|
||||
lfs_block_t block;
|
||||
lfs_size_t off;
|
||||
#ifdef LFS_CKCKSUMS
|
||||
#ifdef LFS_CKDATACKSUMS
|
||||
lfsr_ck_t ck;
|
||||
#endif
|
||||
} disk;
|
||||
@@ -662,7 +665,7 @@ typedef lfsr_data_t lfsr_sprout_t;
|
||||
|
||||
typedef struct lfsr_bptr {
|
||||
lfsr_data_t data;
|
||||
#ifndef LFS_CKCKSUMS
|
||||
#ifndef LFS_CKDATACKSUMS
|
||||
lfs_size_t cksize;
|
||||
uint32_t cksum;
|
||||
#endif
|
||||
|
||||
+3
-3
@@ -156,10 +156,10 @@ extern "C"
|
||||
#define LFS_IFDEF_CKPARITY(a, b) (b)
|
||||
#endif
|
||||
|
||||
#ifdef LFS_CKCKSUMS
|
||||
#define LFS_IFDEF_CKCKSUMS(a, b) (a)
|
||||
#ifdef LFS_CKDATACKSUMS
|
||||
#define LFS_IFDEF_CKDATACKSUMS(a, b) (a)
|
||||
#else
|
||||
#define LFS_IFDEF_CKCKSUMS(a, b) (b)
|
||||
#define LFS_IFDEF_CKDATACKSUMS(a, b) (b)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
+66
-44
@@ -1346,10 +1346,10 @@ code = '''
|
||||
|
||||
|
||||
|
||||
# Some simple ckcksums tests
|
||||
# Some simple ckdatacksums tests
|
||||
|
||||
# test every single-bit error in a file's data block
|
||||
[cases.test_ck_ckcksums_data]
|
||||
[cases.test_ck_ckdatacksums_data]
|
||||
defines.BADBIT = -1
|
||||
defines.BADBLOCK_BEHAVIOR = [
|
||||
'LFS_EMUBD_BADBLOCK_PROGFLIP',
|
||||
@@ -1357,7 +1357,7 @@ defines.BADBLOCK_BEHAVIOR = [
|
||||
]
|
||||
# this should create a single block file
|
||||
defines.SIZE = 'BLOCK_SIZE'
|
||||
ifdef = 'LFS_CKCKSUMS'
|
||||
ifdef = 'LFS_CKDATACKSUMS'
|
||||
code = '''
|
||||
// first we need to figure out where the data block will actually
|
||||
// end up, fortunately our block randomization is intentionally
|
||||
@@ -1365,8 +1365,8 @@ code = '''
|
||||
|
||||
// format
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | LFS_F_CKCKSUMS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | LFS_M_CKCKSUMS, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | LFS_F_CKDATACKSUMS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | LFS_M_CKDATACKSUMS, CFG) => 0;
|
||||
|
||||
// create a file
|
||||
lfsr_file_t file;
|
||||
@@ -1416,8 +1416,8 @@ code = '''
|
||||
|
||||
// format
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | LFS_F_CKCKSUMS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | LFS_M_CKCKSUMS, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | LFS_F_CKDATACKSUMS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | LFS_M_CKDATACKSUMS, CFG) => 0;
|
||||
|
||||
{
|
||||
// create a file
|
||||
@@ -1445,7 +1445,9 @@ code = '''
|
||||
// remount?
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | LFS_M_CKCKSUMS, CFG) => 0;
|
||||
lfsr_mount(&lfs,
|
||||
LFS_M_RDWR | LFS_M_CKDATACKSUMS,
|
||||
CFG) => 0;
|
||||
}
|
||||
|
||||
// yes reads can fail here
|
||||
@@ -1495,7 +1497,7 @@ code = '''
|
||||
# METHOD=0 => ckprogs
|
||||
# METHOD=1 => ckfetches
|
||||
# METHOD=2 => ckparity
|
||||
# METHOD=3 => ckcksums
|
||||
# METHOD=3 => ckdatacksums
|
||||
defines.METHOD = [0]
|
||||
defines.PERIOD = 10
|
||||
defines.PROTECTED_MROOTANCHOR = [false, true]
|
||||
@@ -1503,7 +1505,7 @@ defines.BADBLOCK_BEHAVIOR = 'LFS_EMUBD_BADBLOCK_PROGFLIP'
|
||||
defines.CKPROGS = 'METHOD == 0'
|
||||
defines.CKFETCHES = 'METHOD == 1'
|
||||
defines.CKPARITY = 'METHOD == 2'
|
||||
defines.CKCKSUMS = 'METHOD == 3'
|
||||
defines.CKDATACKSUMS = 'METHOD == 3'
|
||||
defines.N = [1, 2, 4, 8, 16, 32, 64, 128, 256]
|
||||
defines.SEED = 'range(10)'
|
||||
fuzz = 'SEED'
|
||||
@@ -1511,7 +1513,7 @@ if = [
|
||||
'LFS_IFDEF_CKPROGS(true, !CKPROGS)',
|
||||
'LFS_IFDEF_CKFETCHES(true, !CKFETCHES)',
|
||||
'LFS_IFDEF_CKPARITY(true, !CKPARITY)',
|
||||
'LFS_IFDEF_CKCKSUMS(true, !CKCKSUMS)',
|
||||
'LFS_IFDEF_CKDATACKSUMS(true, !CKDATACKSUMS)',
|
||||
]
|
||||
code = '''
|
||||
// seed our block device with our seed so we have different error
|
||||
@@ -1533,14 +1535,18 @@ code = '''
|
||||
| ((CKPROGS) ? LFS_IFDEF_CKPROGS(LFS_F_CKPROGS, -1) : 0)
|
||||
| ((CKFETCHES) ? LFS_IFDEF_CKFETCHES(LFS_F_CKFETCHES, -1) : 0)
|
||||
| ((CKPARITY) ? LFS_IFDEF_CKPARITY(LFS_F_CKPARITY, -1) : 0)
|
||||
| ((CKCKSUMS) ? LFS_IFDEF_CKCKSUMS(LFS_F_CKCKSUMS, -1) : 0),
|
||||
| ((CKDATACKSUMS)
|
||||
? LFS_IFDEF_CKDATACKSUMS(LFS_F_CKDATACKSUMS, -1)
|
||||
: 0),
|
||||
CFG) => 0;
|
||||
lfsr_mount(&lfs,
|
||||
LFS_M_RDWR
|
||||
| ((CKPROGS) ? LFS_IFDEF_CKPROGS(LFS_M_CKPROGS, -1) : 0)
|
||||
| ((CKFETCHES) ? LFS_IFDEF_CKFETCHES(LFS_M_CKFETCHES, -1) : 0)
|
||||
| ((CKPARITY) ? LFS_IFDEF_CKPARITY(LFS_M_CKPARITY, -1) : 0)
|
||||
| ((CKCKSUMS) ? LFS_IFDEF_CKCKSUMS(LFS_M_CKCKSUMS, -1) : 0),
|
||||
| ((CKDATACKSUMS)
|
||||
? LFS_IFDEF_CKDATACKSUMS(LFS_M_CKDATACKSUMS, -1)
|
||||
: 0),
|
||||
CFG) => 0;
|
||||
|
||||
// set up a simulation to compare against
|
||||
@@ -1561,7 +1567,7 @@ code = '''
|
||||
// types of errors, so we implement errors for each one a
|
||||
// bit differently
|
||||
|
||||
// ckprogs? ckparity? ckcksums?
|
||||
// ckprogs? ckparity? ckdatacksums?
|
||||
if (METHOD == 0 || METHOD == 2 || METHOD == 3) {
|
||||
// mark our badblock as bad
|
||||
lfs_emubd_markbad(CFG, badblock) => 0;
|
||||
@@ -1684,8 +1690,8 @@ code = '''
|
||||
| ((CKPARITY)
|
||||
? LFS_IFDEF_CKPARITY(LFS_M_CKPARITY, -1)
|
||||
: 0)
|
||||
| ((CKCKSUMS)
|
||||
? LFS_IFDEF_CKCKSUMS(LFS_M_CKCKSUMS, -1)
|
||||
| ((CKDATACKSUMS)
|
||||
? LFS_IFDEF_CKDATACKSUMS(LFS_M_CKDATACKSUMS, -1)
|
||||
: 0),
|
||||
CFG) => 0;
|
||||
}
|
||||
@@ -1744,7 +1750,7 @@ corrupt_mounted:;
|
||||
# METHOD=0 => ckprogs
|
||||
# METHOD=1 => ckfetches
|
||||
# METHOD=2 => ckparity
|
||||
# METHOD=3 => ckcksums
|
||||
# METHOD=3 => ckdatacksums
|
||||
defines.METHOD = [0]
|
||||
defines.PERIOD = 10
|
||||
defines.PROTECTED_MROOTANCHOR = [false, true]
|
||||
@@ -1752,7 +1758,7 @@ defines.BADBLOCK_BEHAVIOR = 'LFS_EMUBD_BADBLOCK_PROGFLIP'
|
||||
defines.CKPROGS = 'METHOD == 0'
|
||||
defines.CKFETCHES = 'METHOD == 1'
|
||||
defines.CKPARITY = 'METHOD == 2'
|
||||
defines.CKCKSUMS = 'METHOD == 3'
|
||||
defines.CKDATACKSUMS = 'METHOD == 3'
|
||||
defines.N = [1, 2, 4, 8, 16, 32, 64]
|
||||
defines.SIZE = [
|
||||
'0',
|
||||
@@ -1769,7 +1775,7 @@ if = [
|
||||
'LFS_IFDEF_CKPROGS(true, !CKPROGS)',
|
||||
'LFS_IFDEF_CKFETCHES(true, !CKFETCHES)',
|
||||
'LFS_IFDEF_CKPARITY(true, !CKPARITY)',
|
||||
'LFS_IFDEF_CKCKSUMS(true, !CKCKSUMS)',
|
||||
'LFS_IFDEF_CKDATACKSUMS(true, !CKDATACKSUMS)',
|
||||
'(SIZE*N)/BLOCK_SIZE <= 16',
|
||||
]
|
||||
code = '''
|
||||
@@ -1792,14 +1798,18 @@ code = '''
|
||||
| ((CKPROGS) ? LFS_IFDEF_CKPROGS(LFS_F_CKPROGS, -1) : 0)
|
||||
| ((CKFETCHES) ? LFS_IFDEF_CKFETCHES(LFS_F_CKFETCHES, -1) : 0)
|
||||
| ((CKPARITY) ? LFS_IFDEF_CKPARITY(LFS_F_CKPARITY, -1) : 0)
|
||||
| ((CKCKSUMS) ? LFS_IFDEF_CKCKSUMS(LFS_F_CKCKSUMS, -1) : 0),
|
||||
| ((CKDATACKSUMS)
|
||||
? LFS_IFDEF_CKDATACKSUMS(LFS_F_CKDATACKSUMS, -1)
|
||||
: 0),
|
||||
CFG) => 0;
|
||||
lfsr_mount(&lfs,
|
||||
LFS_M_RDWR
|
||||
| ((CKPROGS) ? LFS_IFDEF_CKPROGS(LFS_M_CKPROGS, -1) : 0)
|
||||
| ((CKFETCHES) ? LFS_IFDEF_CKFETCHES(LFS_M_CKFETCHES, -1) : 0)
|
||||
| ((CKPARITY) ? LFS_IFDEF_CKPARITY(LFS_M_CKPARITY, -1) : 0)
|
||||
| ((CKCKSUMS) ? LFS_IFDEF_CKCKSUMS(LFS_M_CKCKSUMS, -1) : 0),
|
||||
| ((CKDATACKSUMS)
|
||||
? LFS_IFDEF_CKDATACKSUMS(LFS_M_CKDATACKSUMS, -1)
|
||||
: 0),
|
||||
CFG) => 0;
|
||||
|
||||
// set up a simulation to compare against
|
||||
@@ -1821,7 +1831,7 @@ code = '''
|
||||
// types of errors, so we implement errors for each one a
|
||||
// bit differently
|
||||
|
||||
// ckprogs? ckparity? ckcksums?
|
||||
// ckprogs? ckparity? ckdatacksums?
|
||||
if (METHOD == 0 || METHOD == 2 || METHOD == 3) {
|
||||
// mark our badblock as bad
|
||||
lfs_emubd_markbad(CFG, badblock) => 0;
|
||||
@@ -1990,8 +2000,8 @@ code = '''
|
||||
| ((CKPARITY)
|
||||
? LFS_IFDEF_CKPARITY(LFS_M_CKPARITY, -1)
|
||||
: 0)
|
||||
| ((CKCKSUMS)
|
||||
? LFS_IFDEF_CKCKSUMS(LFS_M_CKCKSUMS, -1)
|
||||
| ((CKDATACKSUMS)
|
||||
? LFS_IFDEF_CKDATACKSUMS(LFS_M_CKDATACKSUMS, -1)
|
||||
: 0),
|
||||
CFG) => 0;
|
||||
}
|
||||
@@ -2065,7 +2075,7 @@ corrupt_mounted:;
|
||||
# METHOD=0 => ckprogs
|
||||
# METHOD=1 => ckfetches
|
||||
# METHOD=2 => ckparity
|
||||
# METHOD=3 => ckcksums
|
||||
# METHOD=3 => ckdatacksums
|
||||
defines.METHOD = [0]
|
||||
defines.PERIOD = 10
|
||||
defines.PROTECTED_MROOTANCHOR = [false, true]
|
||||
@@ -2073,7 +2083,7 @@ defines.BADBLOCK_BEHAVIOR = 'LFS_EMUBD_BADBLOCK_PROGFLIP'
|
||||
defines.CKPROGS = 'METHOD == 0'
|
||||
defines.CKFETCHES = 'METHOD == 1'
|
||||
defines.CKPARITY = 'METHOD == 2'
|
||||
defines.CKCKSUMS = 'METHOD == 3'
|
||||
defines.CKDATACKSUMS = 'METHOD == 3'
|
||||
defines.SIZE = [
|
||||
'FILE_BUFFER_SIZE/2',
|
||||
'2*FILE_BUFFER_SIZE',
|
||||
@@ -2095,7 +2105,7 @@ if = [
|
||||
'LFS_IFDEF_CKPROGS(true, !CKPROGS)',
|
||||
'LFS_IFDEF_CKFETCHES(true, !CKFETCHES)',
|
||||
'LFS_IFDEF_CKPARITY(true, !CKPARITY)',
|
||||
'LFS_IFDEF_CKCKSUMS(true, !CKCKSUMS)',
|
||||
'LFS_IFDEF_CKDATACKSUMS(true, !CKDATACKSUMS)',
|
||||
'CHUNK <= SIZE',
|
||||
# this just saves testing time
|
||||
'SIZE <= 4*1024*FRAGMENT_SIZE',
|
||||
@@ -2120,14 +2130,18 @@ code = '''
|
||||
| ((CKPROGS) ? LFS_IFDEF_CKPROGS(LFS_F_CKPROGS, -1) : 0)
|
||||
| ((CKFETCHES) ? LFS_IFDEF_CKFETCHES(LFS_F_CKFETCHES, -1) : 0)
|
||||
| ((CKPARITY) ? LFS_IFDEF_CKPARITY(LFS_F_CKPARITY, -1) : 0)
|
||||
| ((CKCKSUMS) ? LFS_IFDEF_CKCKSUMS(LFS_F_CKCKSUMS, -1) : 0),
|
||||
| ((CKDATACKSUMS)
|
||||
? LFS_IFDEF_CKDATACKSUMS(LFS_F_CKDATACKSUMS, -1)
|
||||
: 0),
|
||||
CFG) => 0;
|
||||
lfsr_mount(&lfs,
|
||||
LFS_M_RDWR
|
||||
| ((CKPROGS) ? LFS_IFDEF_CKPROGS(LFS_M_CKPROGS, -1) : 0)
|
||||
| ((CKFETCHES) ? LFS_IFDEF_CKFETCHES(LFS_M_CKFETCHES, -1) : 0)
|
||||
| ((CKPARITY) ? LFS_IFDEF_CKPARITY(LFS_M_CKPARITY, -1) : 0)
|
||||
| ((CKCKSUMS) ? LFS_IFDEF_CKCKSUMS(LFS_M_CKCKSUMS, -1) : 0),
|
||||
| ((CKDATACKSUMS)
|
||||
? LFS_IFDEF_CKDATACKSUMS(LFS_M_CKDATACKSUMS, -1)
|
||||
: 0),
|
||||
CFG) => 0;
|
||||
|
||||
// create a file
|
||||
@@ -2171,7 +2185,7 @@ code = '''
|
||||
// types of errors, so we implement errors for each one a
|
||||
// bit differently
|
||||
|
||||
// ckprogs? ckparity? ckcksums?
|
||||
// ckprogs? ckparity? ckdatacksums?
|
||||
if (METHOD == 0 || METHOD == 2 || METHOD == 3) {
|
||||
// mark our badblock as bad
|
||||
lfs_emubd_markbad(CFG, badblock) => 0;
|
||||
@@ -2240,8 +2254,8 @@ code = '''
|
||||
| ((CKPARITY)
|
||||
? LFS_IFDEF_CKPARITY(LFS_M_CKPARITY, -1)
|
||||
: 0)
|
||||
| ((CKCKSUMS)
|
||||
? LFS_IFDEF_CKCKSUMS(LFS_M_CKCKSUMS, -1)
|
||||
| ((CKDATACKSUMS)
|
||||
? LFS_IFDEF_CKDATACKSUMS(LFS_M_CKDATACKSUMS, -1)
|
||||
: 0),
|
||||
CFG) => 0;
|
||||
}
|
||||
@@ -2301,7 +2315,7 @@ defines.BADBLOCK = -1
|
||||
# METHOD=0 => ckprogs
|
||||
# METHOD=1 => ckfetches
|
||||
# METHOD=2 => ckparity
|
||||
# METHOD=3 => ckcksums
|
||||
# METHOD=3 => ckdatacksums
|
||||
defines.METHOD = [0]
|
||||
defines.PERIOD = 10
|
||||
defines.PROTECTED_MROOTANCHOR = [false, true]
|
||||
@@ -2309,7 +2323,7 @@ defines.BADBLOCK_BEHAVIOR = 'LFS_EMUBD_BADBLOCK_PROGFLIP'
|
||||
defines.CKPROGS = 'METHOD == 0'
|
||||
defines.CKFETCHES = 'METHOD == 1'
|
||||
defines.CKPARITY = 'METHOD == 2'
|
||||
defines.CKCKSUMS = 'METHOD == 3'
|
||||
defines.CKDATACKSUMS = 'METHOD == 3'
|
||||
defines.N = [1, 2, 4, 8, 16, 32, 64]
|
||||
defines.SIZE = [
|
||||
'0',
|
||||
@@ -2326,7 +2340,7 @@ if = [
|
||||
'LFS_IFDEF_CKPROGS(true, !CKPROGS)',
|
||||
'LFS_IFDEF_CKFETCHES(true, !CKFETCHES)',
|
||||
'LFS_IFDEF_CKPARITY(true, !CKPARITY)',
|
||||
'LFS_IFDEF_CKCKSUMS(true, !CKCKSUMS)',
|
||||
'LFS_IFDEF_CKDATACKSUMS(true, !CKDATACKSUMS)',
|
||||
'(SIZE*N)/BLOCK_SIZE <= 16',
|
||||
]
|
||||
code = '''
|
||||
@@ -2349,14 +2363,18 @@ code = '''
|
||||
| ((CKPROGS) ? LFS_IFDEF_CKPROGS(LFS_F_CKPROGS, -1) : 0)
|
||||
| ((CKFETCHES) ? LFS_IFDEF_CKFETCHES(LFS_F_CKFETCHES, -1) : 0)
|
||||
| ((CKPARITY) ? LFS_IFDEF_CKPARITY(LFS_F_CKPARITY, -1) : 0)
|
||||
| ((CKCKSUMS) ? LFS_IFDEF_CKCKSUMS(LFS_F_CKCKSUMS, -1) : 0),
|
||||
| ((CKDATACKSUMS)
|
||||
? LFS_IFDEF_CKDATACKSUMS(LFS_F_CKDATACKSUMS, -1)
|
||||
: 0),
|
||||
CFG) => 0;
|
||||
lfsr_mount(&lfs,
|
||||
LFS_M_RDWR
|
||||
| ((CKPROGS) ? LFS_IFDEF_CKPROGS(LFS_M_CKPROGS, -1) : 0)
|
||||
| ((CKFETCHES) ? LFS_IFDEF_CKFETCHES(LFS_M_CKFETCHES, -1) : 0)
|
||||
| ((CKPARITY) ? LFS_IFDEF_CKPARITY(LFS_M_CKPARITY, -1) : 0)
|
||||
| ((CKCKSUMS) ? LFS_IFDEF_CKCKSUMS(LFS_M_CKCKSUMS, -1) : 0),
|
||||
| ((CKDATACKSUMS)
|
||||
? LFS_IFDEF_CKDATACKSUMS(LFS_M_CKDATACKSUMS, -1)
|
||||
: 0),
|
||||
CFG) => 0;
|
||||
|
||||
// set up a simulation to compare against
|
||||
@@ -2388,7 +2406,7 @@ code = '''
|
||||
// types of errors, so we implement errors for each one a
|
||||
// bit differently
|
||||
|
||||
// ckprogs? ckparity? ckcksums?
|
||||
// ckprogs? ckparity? ckdatacksums?
|
||||
if (METHOD == 0 || METHOD == 2 || METHOD == 3) {
|
||||
// mark our badblock as bad
|
||||
lfs_emubd_markbad(CFG, badblock) => 0;
|
||||
@@ -2740,7 +2758,7 @@ corrupt_mounted:;
|
||||
# METHOD=0 => ckprogs
|
||||
# METHOD=1 => ckfetches
|
||||
# METHOD=2 => ckparity
|
||||
# METHOD=3 => ckcksums
|
||||
# METHOD=3 => ckdatacksums
|
||||
defines.METHOD = [0]
|
||||
defines.PERIOD = 10
|
||||
defines.PROTECTED_MROOTANCHOR = [false, true]
|
||||
@@ -2748,7 +2766,7 @@ defines.BADBLOCK_BEHAVIOR = 'LFS_EMUBD_BADBLOCK_PROGFLIP'
|
||||
defines.CKPROGS = 'METHOD == 0'
|
||||
defines.CKFETCHES = 'METHOD == 1'
|
||||
defines.CKPARITY = 'METHOD == 2'
|
||||
defines.CKCKSUMS = 'METHOD == 3'
|
||||
defines.CKDATACKSUMS = 'METHOD == 3'
|
||||
defines.N = [1, 2, 4, 8, 16, 32, 64]
|
||||
defines.SIZE = [
|
||||
'0',
|
||||
@@ -2765,7 +2783,7 @@ if = [
|
||||
'LFS_IFDEF_CKPROGS(true, !CKPROGS)',
|
||||
'LFS_IFDEF_CKFETCHES(true, !CKFETCHES)',
|
||||
'LFS_IFDEF_CKPARITY(true, !CKPARITY)',
|
||||
'LFS_IFDEF_CKCKSUMS(true, !CKCKSUMS)',
|
||||
'LFS_IFDEF_CKDATACKSUMS(true, !CKDATACKSUMS)',
|
||||
'(SIZE*N)/BLOCK_SIZE <= 16',
|
||||
]
|
||||
code = '''
|
||||
@@ -2788,14 +2806,18 @@ code = '''
|
||||
| ((CKPROGS) ? LFS_IFDEF_CKPROGS(LFS_F_CKPROGS, -1) : 0)
|
||||
| ((CKFETCHES) ? LFS_IFDEF_CKFETCHES(LFS_F_CKFETCHES, -1) : 0)
|
||||
| ((CKPARITY) ? LFS_IFDEF_CKPARITY(LFS_F_CKPARITY, -1) : 0)
|
||||
| ((CKCKSUMS) ? LFS_IFDEF_CKCKSUMS(LFS_F_CKCKSUMS, -1) : 0),
|
||||
| ((CKDATACKSUMS)
|
||||
? LFS_IFDEF_CKDATACKSUMS(LFS_F_CKDATACKSUMS, -1)
|
||||
: 0),
|
||||
CFG) => 0;
|
||||
lfsr_mount(&lfs,
|
||||
LFS_M_RDWR
|
||||
| ((CKPROGS) ? LFS_IFDEF_CKPROGS(LFS_M_CKPROGS, -1) : 0)
|
||||
| ((CKFETCHES) ? LFS_IFDEF_CKFETCHES(LFS_M_CKFETCHES, -1) : 0)
|
||||
| ((CKPARITY) ? LFS_IFDEF_CKPARITY(LFS_M_CKPARITY, -1) : 0)
|
||||
| ((CKCKSUMS) ? LFS_IFDEF_CKCKSUMS(LFS_M_CKCKSUMS, -1) : 0),
|
||||
| ((CKDATACKSUMS)
|
||||
? LFS_IFDEF_CKDATACKSUMS(LFS_M_CKDATACKSUMS, -1)
|
||||
: 0),
|
||||
CFG) => 0;
|
||||
|
||||
// set up a simulation to compare against
|
||||
@@ -2828,7 +2850,7 @@ code = '''
|
||||
// types of errors, so we implement errors for each one a
|
||||
// bit differently
|
||||
|
||||
// ckprogs? ckparity? ckcksums?
|
||||
// ckprogs? ckparity? ckdatacksums?
|
||||
if (METHOD == 0 || METHOD == 2 || METHOD == 3) {
|
||||
// mark our badblock as bad
|
||||
lfs_emubd_markbad(CFG, badblock) => 0;
|
||||
|
||||
+13
-7
@@ -20,7 +20,7 @@ defines.SYNC = [false, true]
|
||||
defines.CKPROGS = [false, true]
|
||||
defines.CKFETCHES = [false, true]
|
||||
defines.CKPARITY = [false, true]
|
||||
defines.CKCKSUMS = [false, true]
|
||||
defines.CKDATACKSUMS = [false, true]
|
||||
defines.MTREEONLY = [false, true]
|
||||
defines.MKCONSISTENT = [false, true]
|
||||
defines.LOOKAHEAD = [false, true]
|
||||
@@ -31,7 +31,7 @@ if = [
|
||||
'LFS_IFDEF_CKPROGS(true, !CKPROGS)',
|
||||
'LFS_IFDEF_CKFETCHES(true, !CKFETCHES)',
|
||||
'LFS_IFDEF_CKPARITY(true, !CKPARITY)',
|
||||
'LFS_IFDEF_CKCKSUMS(true, !CKCKSUMS)',
|
||||
'LFS_IFDEF_CKDATACKSUMS(true, !CKDATACKSUMS)',
|
||||
'!RDONLY || !MKCONSISTENT',
|
||||
'!RDONLY || !LOOKAHEAD',
|
||||
'!RDONLY || !COMPACT',
|
||||
@@ -48,7 +48,9 @@ code = '''
|
||||
| ((CKPROGS) ? LFS_IFDEF_CKPROGS(LFS_M_CKPROGS, -1) : 0)
|
||||
| ((CKFETCHES) ? LFS_IFDEF_CKFETCHES(LFS_M_CKFETCHES, -1) : 0)
|
||||
| ((CKPARITY) ? LFS_IFDEF_CKPARITY(LFS_M_CKPARITY, -1) : 0)
|
||||
| ((CKCKSUMS) ? LFS_IFDEF_CKCKSUMS(LFS_M_CKCKSUMS, -1) : 0)
|
||||
| ((CKDATACKSUMS)
|
||||
? LFS_IFDEF_CKDATACKSUMS(LFS_M_CKDATACKSUMS, -1)
|
||||
: 0)
|
||||
| ((MTREEONLY) ? LFS_M_MTREEONLY : 0)
|
||||
| ((MKCONSISTENT) ? LFS_M_MKCONSISTENT : 0)
|
||||
| ((LOOKAHEAD) ? LFS_M_LOOKAHEAD : 0)
|
||||
@@ -67,7 +69,9 @@ code = '''
|
||||
| ((CKPROGS) ? LFS_IFDEF_CKPROGS(LFS_I_CKPROGS, -1) : 0)
|
||||
| ((CKFETCHES) ? LFS_IFDEF_CKFETCHES(LFS_I_CKFETCHES, -1) : 0)
|
||||
| ((CKPARITY) ? LFS_IFDEF_CKPARITY(LFS_I_CKPARITY, -1) : 0)
|
||||
| ((CKCKSUMS) ? LFS_IFDEF_CKCKSUMS(LFS_I_CKCKSUMS, -1) : 0)
|
||||
| ((CKDATACKSUMS)
|
||||
? LFS_IFDEF_CKDATACKSUMS(LFS_I_CKDATACKSUMS, -1)
|
||||
: 0)
|
||||
| ((!MKCONSISTENT) ? LFS_I_INCONSISTENT : 0)
|
||||
| ((!LOOKAHEAD) ? LFS_I_CANLOOKAHEAD : 0)
|
||||
| ((!COMPACT) ? LFS_I_UNCOMPACTED : 0)));
|
||||
@@ -82,7 +86,7 @@ code = '''
|
||||
defines.CKPROGS = [false, true]
|
||||
defines.CKFETCHES = [false, true]
|
||||
defines.CKPARITY = [false, true]
|
||||
defines.CKCKSUMS = [false, true]
|
||||
defines.CKDATACKSUMS = [false, true]
|
||||
defines.MTREEONLY = [false, true]
|
||||
defines.COMPACT = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
@@ -91,7 +95,7 @@ if = [
|
||||
'LFS_IFDEF_CKPROGS(true, !CKPROGS)',
|
||||
'LFS_IFDEF_CKFETCHES(true, !CKFETCHES)',
|
||||
'LFS_IFDEF_CKPARITY(true, !CKPARITY)',
|
||||
'LFS_IFDEF_CKCKSUMS(true, !CKCKSUMS)',
|
||||
'LFS_IFDEF_CKDATACKSUMS(true, !CKDATACKSUMS)',
|
||||
'!MTREEONLY || !CKDATA',
|
||||
]
|
||||
code = '''
|
||||
@@ -101,7 +105,9 @@ code = '''
|
||||
| ((CKPROGS) ? LFS_IFDEF_CKPROGS(LFS_F_CKPROGS, -1) : 0)
|
||||
| ((CKFETCHES) ? LFS_IFDEF_CKFETCHES(LFS_F_CKFETCHES, -1) : 0)
|
||||
| ((CKPARITY) ? LFS_IFDEF_CKPARITY(LFS_F_CKPARITY, -1) : 0)
|
||||
| ((CKCKSUMS) ? LFS_IFDEF_CKCKSUMS(LFS_F_CKCKSUMS, -1) : 0)
|
||||
| ((CKDATACKSUMS)
|
||||
? LFS_IFDEF_CKDATACKSUMS(LFS_F_CKDATACKSUMS, -1)
|
||||
: 0)
|
||||
| ((MTREEONLY) ? LFS_M_MTREEONLY : 0)
|
||||
| ((COMPACT) ? LFS_M_COMPACT : 0)
|
||||
| ((CKMETA) ? LFS_M_CKMETA : 0)
|
||||
|
||||
Reference in New Issue
Block a user