forked from Imagelibrary/littlefs
Moved revision count noise behind ifdef LFS_NOISY
littlefs is intentionally designed to not rely on noise, even with cksum
collisions (hello, perturb bit!). So it makes sense for this to be an
optional feature, even if it's a small one.
Disabling revision count noise by default also helps with testing. The
whole point of revision count noise is to make cksum collisions less
likely, which is a bit counterproductive when that's something we want
to test!
This doesn't really change the revision count encoding:
vvvvrrrr rrrrrrnn nnnnnnnn nnnnnnnn
'-.''----.----''---------.--------'
'------|---------------|---------- 4-bit relocation revision
'---------------|---------- recycle-bits recycle counter
'---------- pseudorandom noise (optional)
I considered moving the recycle-bits down when we're not adding noise,
but the extra logic just isn't worth making the revision count a bit
more human-readable.
---
This saves a small bit of code in the default build, at the cost of some
code for the runtime checks in the LFS_NOISY build. Though I'm hoping
future config work will let users opt-out of these runtime checks:
code stack ctx
before: 38548 2624 640
default after: 38508 (-0.1%) 2624 (+0.0%) 640 (+0.0%)
LFS_NOISY after: 38568 (+0.1%) 2624 (+0.0%) 640 (+0.0%)
Honestly the thing I'm more worried about is using one of our precious
mount flags for this... There's not that many bits left!
This commit is contained in:
32
lfs.c
32
lfs.c
@@ -6888,6 +6888,12 @@ static inline bool lfsr_m_isrdonly(uint32_t flags) {
|
||||
return flags & LFS_M_RDONLY;
|
||||
}
|
||||
|
||||
#ifdef LFS_NOISY
|
||||
static inline bool lfsr_m_isnoisy(uint32_t flags) {
|
||||
return flags & LFS_M_NOISY;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LFS_CKPROGS
|
||||
static inline bool lfsr_m_isckprogs(uint32_t flags) {
|
||||
return flags & LFS_M_CKPROGS;
|
||||
@@ -7198,15 +7204,20 @@ static int lfsr_fs_consumegdelta(lfs_t *lfs, const lfsr_mdir_t *mdir) {
|
||||
// '-.''----.----''---------.--------'
|
||||
// '------|---------------|---------- 4-bit relocation revision
|
||||
// '---------------|---------- recycle-bits recycle counter
|
||||
// '---------- pseudorandom nonce
|
||||
// '---------- pseudorandom noise (optional)
|
||||
|
||||
static inline uint32_t lfsr_rev_init(lfs_t *lfs, uint32_t rev) {
|
||||
(void)lfs;
|
||||
// we really only care about the top revision bits here
|
||||
rev &= ~((1 << 28)-1);
|
||||
// increment revision
|
||||
rev += 1 << 28;
|
||||
// xor in a pseudorandom nonce
|
||||
// xor in pseudorandom noise
|
||||
#ifdef LFS_NOISY
|
||||
if (lfsr_m_isnoisy(lfs->flags)) {
|
||||
rev ^= ((1 << (28-lfs_smax(lfs->recycle_bits, 0)))-1) & lfs->gcksum;
|
||||
}
|
||||
#endif
|
||||
return rev;
|
||||
}
|
||||
|
||||
@@ -7223,8 +7234,12 @@ static inline bool lfsr_rev_needsrelocation(lfs_t *lfs, uint32_t rev) {
|
||||
static inline uint32_t lfsr_rev_inc(lfs_t *lfs, uint32_t rev) {
|
||||
// increment recycle counter/revision
|
||||
rev += 1 << (28-lfs_smax(lfs->recycle_bits, 0));
|
||||
// xor in a pseudorandom nonce
|
||||
// xor in pseudorandom noise
|
||||
#ifdef LFS_NOISY
|
||||
if (lfsr_m_isnoisy(lfs->flags)) {
|
||||
rev ^= ((1 << (28-lfs_smax(lfs->recycle_bits, 0)))-1) & lfs->gcksum;
|
||||
}
|
||||
#endif
|
||||
return rev;
|
||||
}
|
||||
|
||||
@@ -13421,6 +13436,7 @@ static int lfs_init(lfs_t *lfs, uint32_t flags,
|
||||
| LFS_M_RDONLY
|
||||
| LFS_M_FLUSH
|
||||
| LFS_M_SYNC
|
||||
| LFS_IFDEF_NOISY(LFS_M_NOISY, 0)
|
||||
| LFS_IFDEF_CKPROGS(LFS_M_CKPROGS, 0)
|
||||
| LFS_IFDEF_CKFETCHES(LFS_M_CKFETCHES, 0)
|
||||
| LFS_IFDEF_CKPARITY(LFS_M_CKPARITY, 0)
|
||||
@@ -14249,6 +14265,7 @@ int lfsr_mount(lfs_t *lfs, uint32_t flags,
|
||||
| LFS_M_RDONLY
|
||||
| LFS_M_FLUSH
|
||||
| LFS_M_SYNC
|
||||
| LFS_IFDEF_NOISY(LFS_M_NOISY, 0)
|
||||
| LFS_IFDEF_CKPROGS(LFS_M_CKPROGS, 0)
|
||||
| LFS_IFDEF_CKFETCHES(LFS_M_CKFETCHES, 0)
|
||||
| LFS_IFDEF_CKPARITY(LFS_M_CKPARITY, 0)
|
||||
@@ -14262,9 +14279,6 @@ int lfsr_mount(lfs_t *lfs, uint32_t flags,
|
||||
LFS_ASSERT(!lfsr_m_isrdonly(flags) || !lfsr_t_ismkconsistent(flags));
|
||||
LFS_ASSERT(!lfsr_m_isrdonly(flags) || !lfsr_t_islookahead(flags));
|
||||
LFS_ASSERT(!lfsr_m_isrdonly(flags) || !lfsr_t_iscompact(flags));
|
||||
// some flags don't make sense when only traversing the mtree
|
||||
LFS_ASSERT(!lfsr_t_ismtreeonly(flags) || !lfsr_t_islookahead(flags));
|
||||
LFS_ASSERT(!lfsr_t_ismtreeonly(flags) || !lfsr_t_isckdata(flags));
|
||||
|
||||
int err = lfs_init(lfs,
|
||||
flags & (
|
||||
@@ -14272,6 +14286,7 @@ int lfsr_mount(lfs_t *lfs, uint32_t flags,
|
||||
| LFS_M_RDONLY
|
||||
| LFS_M_FLUSH
|
||||
| LFS_M_SYNC
|
||||
| LFS_IFDEF_NOISY(LFS_M_NOISY, 0)
|
||||
| LFS_IFDEF_CKPROGS(LFS_M_CKPROGS, 0)
|
||||
| LFS_IFDEF_CKFETCHES(LFS_M_CKFETCHES, 0)
|
||||
| LFS_IFDEF_CKPARITY(LFS_M_CKPARITY, 0)
|
||||
@@ -14441,18 +14456,18 @@ int lfsr_format(lfs_t *lfs, uint32_t flags,
|
||||
// unknown flags?
|
||||
LFS_ASSERT((flags & ~(
|
||||
LFS_F_RDWR
|
||||
| LFS_IFDEF_NOISY(LFS_F_NOISY, 0)
|
||||
| LFS_IFDEF_CKPROGS(LFS_F_CKPROGS, 0)
|
||||
| LFS_IFDEF_CKFETCHES(LFS_F_CKFETCHES, 0)
|
||||
| LFS_IFDEF_CKPARITY(LFS_F_CKPARITY, 0)
|
||||
| LFS_IFDEF_CKDATACKSUMS(LFS_F_CKDATACKSUMS, 0)
|
||||
| LFS_F_CKMETA
|
||||
| LFS_F_CKDATA)) == 0);
|
||||
// some flags don't make sense when only traversing the mtree
|
||||
LFS_ASSERT(!lfsr_t_ismtreeonly(flags) || !lfsr_t_isckdata(flags));
|
||||
|
||||
int err = lfs_init(lfs,
|
||||
flags & (
|
||||
LFS_F_RDWR
|
||||
| LFS_IFDEF_NOISY(LFS_F_NOISY, 0)
|
||||
| LFS_IFDEF_CKPROGS(LFS_F_CKPROGS, 0)
|
||||
| LFS_IFDEF_CKFETCHES(LFS_F_CKFETCHES, 0)
|
||||
| LFS_IFDEF_CKPARITY(LFS_F_CKPARITY, 0)
|
||||
@@ -14512,6 +14527,7 @@ int lfsr_fs_stat(lfs_t *lfs, struct lfs_fsinfo *fsinfo) {
|
||||
LFS_I_RDONLY
|
||||
| LFS_I_FLUSH
|
||||
| LFS_I_SYNC
|
||||
| LFS_IFDEF_NOISY(LFS_I_NOISY, 0)
|
||||
| LFS_IFDEF_CKPROGS(LFS_I_CKPROGS, 0)
|
||||
| LFS_IFDEF_CKFETCHES(LFS_I_CKFETCHES, 0)
|
||||
| LFS_IFDEF_CKPARITY(LFS_I_CKPARITY, 0)
|
||||
|
||||
9
lfs.h
9
lfs.h
@@ -162,6 +162,9 @@ enum lfs_type {
|
||||
// Filesystem format flags
|
||||
#define LFS_F_MODE 1 // Format's access mode
|
||||
#define LFS_F_RDWR 0 // Format the filesystem as read and write
|
||||
#ifdef LFS_NOISY
|
||||
#define LFS_F_NOISY 0x00000010 // Add noise to revision counts
|
||||
#endif
|
||||
#ifdef LFS_CKPROGS
|
||||
#define LFS_F_CKPROGS 0x00000800 // Check progs by reading back progged data
|
||||
#endif
|
||||
@@ -185,6 +188,9 @@ enum lfs_type {
|
||||
#define LFS_M_RDONLY 1 // Mount the filesystem as read only
|
||||
#define LFS_M_FLUSH 0x00000040 // Open all files with LFS_O_FLUSH
|
||||
#define LFS_M_SYNC 0x00000080 // Open all files with LFS_O_SYNC
|
||||
#ifdef LFS_NOISY
|
||||
#define LFS_M_NOISY 0x00000010 // Add noise to revision counts
|
||||
#endif
|
||||
#ifdef LFS_CKPROGS
|
||||
#define LFS_M_CKPROGS 0x00000800 // Check progs by reading back progged data
|
||||
#endif
|
||||
@@ -210,6 +216,9 @@ enum lfs_type {
|
||||
#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_NOISY
|
||||
#define LFS_I_NOISY 0x00000010 // Mounted with LFS_M_NOISY
|
||||
#endif
|
||||
#ifdef LFS_CKPROGS
|
||||
#define LFS_I_CKPROGS 0x00000800 // Mounted with LFS_M_CKPROGS
|
||||
#endif
|
||||
|
||||
@@ -26,6 +26,9 @@
|
||||
|
||||
// LFS_BIGGEST enables all opt-in features
|
||||
#ifdef LFS_BIGGEST
|
||||
#ifndef LFS_NOISY
|
||||
#define LFS_NOISY
|
||||
#endif
|
||||
#ifndef LFS_CKPROGS
|
||||
#define LFS_CKPROGS
|
||||
#endif
|
||||
@@ -189,6 +192,12 @@ extern "C"
|
||||
|
||||
|
||||
// Some ifdef conveniences
|
||||
#ifdef LFS_NOISY
|
||||
#define LFS_IFDEF_NOISY(a, b) (a)
|
||||
#else
|
||||
#define LFS_IFDEF_NOISY(a, b) (b)
|
||||
#endif
|
||||
|
||||
#ifdef LFS_CKPROGS
|
||||
#define LFS_IFDEF_CKPROGS(a, b) (a)
|
||||
#else
|
||||
|
||||
@@ -57,6 +57,7 @@ FLAGS = [
|
||||
# Filesystem format flags
|
||||
('F', 'MODE', 1, "Format's access mode" ),
|
||||
('^', 'RDWR', 0, "Format the filesystem as read and write" ),
|
||||
('F', 'NOISY', 0x00000010, "Add noise to revision counts" ),
|
||||
('F', 'CKPROGS', 0x00000800, "Check progs by reading back progged data" ),
|
||||
('F', 'CKFETCHES', 0x00001000, "Check block checksums before first use" ),
|
||||
('F', 'CKPARITY', 0x00002000, "Check metadata tag parity bits" ),
|
||||
@@ -72,6 +73,7 @@ FLAGS = [
|
||||
('^', 'RDONLY', 1, "Mount the filesystem as read only" ),
|
||||
('M', 'FLUSH', 0x00000040, "Open all files with LFS_O_FLUSH" ),
|
||||
('M', 'SYNC', 0x00000080, "Open all files with LFS_O_SYNC" ),
|
||||
('M', 'NOISY', 0x00000010, "Add noise to revision counts" ),
|
||||
('M', 'CKPROGS', 0x00000800, "Check progs by reading back progged data" ),
|
||||
('M', 'CKFETCHES', 0x00001000, "Check block checksums before first use" ),
|
||||
('M', 'CKPARITY', 0x00002000, "Check metadata tag parity bits" ),
|
||||
@@ -97,6 +99,7 @@ FLAGS = [
|
||||
('I', 'RDONLY', 0x00000001, "Mounted read only" ),
|
||||
('I', 'FLUSH', 0x00000040, "Mounted with LFS_M_FLUSH" ),
|
||||
('I', 'SYNC', 0x00000080, "Mounted with LFS_M_SYNC" ),
|
||||
('I', 'NOISY', 0x00000010, "Mounted with LFS_M_NOISY" ),
|
||||
('I', 'CKPROGS', 0x00000800, "Mounted with LFS_M_CKPROGS" ),
|
||||
('I', 'CKFETCHES', 0x00001000, "Mounted with LFS_M_CKFETCHES" ),
|
||||
('I', 'CKPARITY', 0x00002000, "Mounted with LFS_M_CKPARITY" ),
|
||||
|
||||
@@ -17,6 +17,7 @@ code = '''
|
||||
defines.RDONLY = [false, true]
|
||||
defines.FLUSH = [false, true]
|
||||
defines.SYNC = [false, true]
|
||||
defines.NOISY = [false, true]
|
||||
defines.CKPROGS = [false, true]
|
||||
defines.CKFETCHES = [false, true]
|
||||
defines.CKPARITY = [false, true]
|
||||
@@ -27,6 +28,7 @@ defines.COMPACT = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
if = [
|
||||
'LFS_IFDEF_NOISY(true, !NOISY)',
|
||||
'LFS_IFDEF_CKPROGS(true, !CKPROGS)',
|
||||
'LFS_IFDEF_CKFETCHES(true, !CKFETCHES)',
|
||||
'LFS_IFDEF_CKPARITY(true, !CKPARITY)',
|
||||
@@ -42,6 +44,7 @@ code = '''
|
||||
((RDONLY) ? LFS_M_RDONLY : LFS_M_RDWR)
|
||||
| ((FLUSH) ? LFS_M_FLUSH : 0)
|
||||
| ((SYNC) ? LFS_M_SYNC : 0)
|
||||
| ((NOISY) ? LFS_IFDEF_NOISY(LFS_M_NOISY, -1) : 0)
|
||||
| ((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)
|
||||
@@ -62,6 +65,7 @@ code = '''
|
||||
((RDONLY) ? LFS_I_RDONLY : 0)
|
||||
| ((FLUSH) ? LFS_I_FLUSH : 0)
|
||||
| ((SYNC) ? LFS_I_SYNC : 0)
|
||||
| ((NOISY) ? LFS_IFDEF_NOISY(LFS_M_NOISY, -1) : 0)
|
||||
| ((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)
|
||||
@@ -82,6 +86,7 @@ code = '''
|
||||
#
|
||||
# these end up passed to mount internally
|
||||
[cases.test_mount_format_flags]
|
||||
defines.NOISY = [false, true]
|
||||
defines.CKPROGS = [false, true]
|
||||
defines.CKFETCHES = [false, true]
|
||||
defines.CKPARITY = [false, true]
|
||||
@@ -89,6 +94,7 @@ defines.CKDATACKSUMS = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
if = [
|
||||
'LFS_IFDEF_NOISY(true, !NOISY)',
|
||||
'LFS_IFDEF_CKPROGS(true, !CKPROGS)',
|
||||
'LFS_IFDEF_CKFETCHES(true, !CKFETCHES)',
|
||||
'LFS_IFDEF_CKPARITY(true, !CKPARITY)',
|
||||
@@ -98,6 +104,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs,
|
||||
LFS_F_RDWR
|
||||
| ((NOISY) ? LFS_IFDEF_NOISY(LFS_F_NOISY, -1) : 0)
|
||||
| ((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)
|
||||
|
||||
@@ -5,12 +5,23 @@ after = ['test_rbyd', 'test_btree']
|
||||
# of the disk for these tests
|
||||
defines.LOOKAHEAD_SIZE = 'BLOCK_COUNT / 8'
|
||||
|
||||
# test with and without revision count noise
|
||||
defines.NOISY = [false, true]
|
||||
defines.F_FLAGS = '''
|
||||
((NOISY) ? LFS_IFDEF_NOISY(LFS_F_NOISY, -1) : 0)
|
||||
'''
|
||||
defines.M_FLAGS = '''
|
||||
((NOISY) ? LFS_IFDEF_NOISY(LFS_M_NOISY, -1) : 0)
|
||||
'''
|
||||
if = 'LFS_IFDEF_NOISY(true, !NOISY)'
|
||||
|
||||
|
||||
# test a single mroot
|
||||
[cases.test_mtree_mroot]
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
|
||||
@@ -20,8 +31,8 @@ defines.N = [1, 3]
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
|
||||
for (lfs_size_t i = 0; i < N; i++) {
|
||||
@@ -43,7 +54,7 @@ code = '''
|
||||
|
||||
|
||||
// check things stay sane after remount
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
for (lfs_size_t i = 0; i < N; i++) {
|
||||
lfsr_data_t data;
|
||||
@@ -62,8 +73,8 @@ defines.N = [1, 3]
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
|
||||
for (lfs_size_t i = 0; i < N; i++) {
|
||||
@@ -88,7 +99,7 @@ code = '''
|
||||
|
||||
|
||||
// check things stay sane after remount
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
for (lfs_size_t i = 0; i < N; i++) {
|
||||
lfsr_data_t data;
|
||||
@@ -107,8 +118,8 @@ defines.N = [5, 5000]
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
|
||||
for (lfs_size_t i = 0; i < N; i++) {
|
||||
@@ -134,7 +145,7 @@ code = '''
|
||||
|
||||
|
||||
// check things stay sane after remount
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
lfsr_mdir_lookup(&lfs, &lfs.mroot, LFSR_TAG_ATTR(1), &data) => 0;
|
||||
lfsr_data_read(&lfs, &data, buffer, 4) => 1;
|
||||
@@ -153,8 +164,8 @@ defines.SIZE = 'BLOCK_SIZE / 4'
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
lfsr_data_t data;
|
||||
|
||||
@@ -197,7 +208,7 @@ code = '''
|
||||
|
||||
// check things stay sane after remount
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// assert mdirs were unininlined
|
||||
assert(lfsr_mtree_weight_(&lfs.mtree) == (1 << lfs.mdir_bits));
|
||||
@@ -228,8 +239,8 @@ defines.SIZE = 'BLOCK_SIZE / 4'
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
lfsr_data_t data;
|
||||
|
||||
@@ -280,7 +291,7 @@ code = '''
|
||||
|
||||
// check things stay sane after remount
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// assert mdirs were unininlined and split
|
||||
assert(lfsr_mtree_weight_(&lfs.mtree) == (2 << lfs.mdir_bits));
|
||||
@@ -313,8 +324,8 @@ defines.SIZE = 'BLOCK_SIZE / 4'
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
lfsr_data_t data;
|
||||
|
||||
@@ -393,7 +404,7 @@ code = '''
|
||||
|
||||
// check things stay sane after remount
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// assert mdir was split correctly
|
||||
assert(lfsr_mtree_weight_(&lfs.mtree) == (3 << lfs.mdir_bits));
|
||||
@@ -438,8 +449,8 @@ defines.FORCE_COMPACTION = [false, true]
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
|
||||
// create entries
|
||||
@@ -488,7 +499,7 @@ code = '''
|
||||
|
||||
// check things stay sane after remount
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// try looking up each entry
|
||||
lfsr_mtree_lookup(&lfs, 0, &mdir) => 0;
|
||||
@@ -520,8 +531,8 @@ fuzz = 'SEED'
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
|
||||
bool sim[N];
|
||||
@@ -589,7 +600,7 @@ code = '''
|
||||
|
||||
// check things stay sane after remount
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// try looking up each entry
|
||||
lfsr_mtree_lookup(&lfs, 0, &mdir) => 0;
|
||||
@@ -624,8 +635,8 @@ defines.SIZE = 'BLOCK_SIZE / 4'
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
lfsr_data_t data;
|
||||
|
||||
@@ -683,7 +694,7 @@ code = '''
|
||||
|
||||
// check things stay sane after remount
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// assert mdir was dropped
|
||||
assert(lfsr_mtree_weight_(&lfs.mtree) == (1 << lfs.mdir_bits));
|
||||
@@ -710,8 +721,8 @@ defines.SIZE = 'BLOCK_SIZE / 4'
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
lfsr_data_t data;
|
||||
|
||||
@@ -771,7 +782,7 @@ code = '''
|
||||
|
||||
// check things stay sane after remount
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// assert mdir was dropped
|
||||
assert(lfsr_mtree_weight_(&lfs.mtree) == (1 << lfs.mdir_bits));
|
||||
@@ -798,8 +809,8 @@ defines.SIZE = 'BLOCK_SIZE / 4'
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
lfsr_data_t data;
|
||||
|
||||
@@ -846,7 +857,7 @@ code = '''
|
||||
|
||||
// check things stay sane after remount
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// assert mdir was dropped
|
||||
assert(lfsr_mtree_weight_(&lfs.mtree) == (1 << lfs.mdir_bits));
|
||||
@@ -869,8 +880,8 @@ defines.SIZE = 'BLOCK_SIZE / 4'
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
lfsr_data_t data;
|
||||
|
||||
@@ -944,7 +955,7 @@ code = '''
|
||||
|
||||
// check things stay sane after remount
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// assert split/drop worked out
|
||||
assert(lfsr_mtree_weight_(&lfs.mtree) == (2 << lfs.mdir_bits));
|
||||
@@ -977,8 +988,8 @@ defines.SIZE = 'BLOCK_SIZE / 4'
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
lfsr_data_t data;
|
||||
|
||||
@@ -1052,7 +1063,7 @@ code = '''
|
||||
|
||||
// check things stay sane after remount
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// assert split/drop worked out
|
||||
assert(lfsr_mtree_weight_(&lfs.mtree) == (2 << lfs.mdir_bits));
|
||||
@@ -1087,8 +1098,8 @@ fuzz = 'SEED'
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
|
||||
bool sim[N];
|
||||
@@ -1182,7 +1193,7 @@ code = '''
|
||||
|
||||
// check things stay sane after remount
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// try looking up each entry
|
||||
lfsr_mtree_lookup(&lfs, 0, &mdir) => 0;
|
||||
@@ -1219,8 +1230,8 @@ defines.BLOCK_RECYCLES = 0
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
lfsr_data_t data;
|
||||
|
||||
@@ -1290,7 +1301,7 @@ code = '''
|
||||
|
||||
// check things stay sane after remount
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// assert mdirs were unininlined
|
||||
assert(lfsr_mtree_weight_(&lfs.mtree) == (1 << lfs.mdir_bits));
|
||||
@@ -1333,8 +1344,8 @@ defines.BLOCK_RECYCLES = 0
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
lfsr_data_t data;
|
||||
|
||||
@@ -1414,7 +1425,7 @@ code = '''
|
||||
|
||||
// check things stay sane after remount
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// assert mdirs were unininlined and split
|
||||
assert(lfsr_mtree_weight_(&lfs.mtree) == (2 << lfs.mdir_bits));
|
||||
@@ -1459,8 +1470,8 @@ defines.BLOCK_RECYCLES = 0
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
lfsr_data_t data;
|
||||
|
||||
@@ -1540,7 +1551,7 @@ code = '''
|
||||
|
||||
// check things stay sane after remount
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// assert mdirs were unininlined and split
|
||||
assert(lfsr_mtree_weight_(&lfs.mtree) == (2 << lfs.mdir_bits));
|
||||
@@ -1585,8 +1596,8 @@ defines.BLOCK_RECYCLES = 0
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
lfsr_data_t data;
|
||||
|
||||
@@ -1629,7 +1640,7 @@ code = '''
|
||||
|
||||
// check things stay sane after remount
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// assert that our rat is still in the mroot
|
||||
lfsr_mtree_lookup(&lfs, (0 << lfs.mdir_bits)+1, &mdir) => 0;
|
||||
@@ -1660,8 +1671,8 @@ defines.PROG_SIZE = 'BLOCK_SIZE'
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
lfsr_data_t data;
|
||||
|
||||
@@ -1738,7 +1749,7 @@ code = '''
|
||||
|
||||
// check things stay sane after remount
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// assert that our rat is still in the mroot
|
||||
lfsr_mtree_lookup(&lfs, (0 << lfs.mdir_bits)+1, &mdir) => 0;
|
||||
@@ -1782,8 +1793,8 @@ defines.BLOCK_RECYCLES = 0
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
lfsr_data_t data;
|
||||
|
||||
@@ -1845,7 +1856,7 @@ code = '''
|
||||
|
||||
// check things stay sane after remount
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// assert that our rat is still in the mroot
|
||||
lfsr_mtree_lookup(&lfs, (0 << lfs.mdir_bits)+1, &mdir) => 0;
|
||||
@@ -1881,8 +1892,8 @@ defines.BLOCK_RECYCLES = 0
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
lfsr_data_t data;
|
||||
|
||||
@@ -1967,7 +1978,7 @@ code = '''
|
||||
|
||||
// check things stay sane after remount
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// assert mdirs were unininlined and split
|
||||
assert(lfsr_mtree_weight_(&lfs.mtree) == (2 << lfs.mdir_bits));
|
||||
@@ -2012,8 +2023,8 @@ defines.BLOCK_RECYCLES = 0
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
lfsr_data_t data;
|
||||
|
||||
@@ -2107,7 +2118,7 @@ code = '''
|
||||
|
||||
// check things stay sane after remount
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// assert mdir was split correctly
|
||||
assert(lfsr_mtree_weight_(&lfs.mtree) == (3 << lfs.mdir_bits));
|
||||
@@ -2156,8 +2167,8 @@ defines.BLOCK_RECYCLES = 0
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
lfsr_data_t data;
|
||||
|
||||
@@ -2226,7 +2237,7 @@ code = '''
|
||||
|
||||
// check things stay sane after remount
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// assert mdir was dropped
|
||||
assert(lfsr_mtree_weight_(&lfs.mtree) == (1 << lfs.mdir_bits));
|
||||
@@ -2255,8 +2266,8 @@ defines.BLOCK_RECYCLES = 0
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
|
||||
// force mroot to compact once, so the second compact below will
|
||||
@@ -2307,7 +2318,7 @@ code = '''
|
||||
|
||||
// check things stay sane after remount
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// assert mdirs were unininlined
|
||||
assert(lfsr_mtree_weight_(&lfs.mtree) == (1 << lfs.mdir_bits));
|
||||
@@ -2340,8 +2351,8 @@ defines.BLOCK_RECYCLES = 0
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
|
||||
// force mroot to compact once, so the second compact below will
|
||||
@@ -2400,7 +2411,7 @@ code = '''
|
||||
|
||||
// check things stay sane after remount
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// assert mdirs were unininlined and split
|
||||
assert(lfsr_mtree_weight_(&lfs.mtree) == (2 << lfs.mdir_bits));
|
||||
@@ -2437,8 +2448,8 @@ fuzz = 'SEED'
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
|
||||
bool sim[N];
|
||||
@@ -2561,7 +2572,7 @@ code = '''
|
||||
|
||||
// check things stay sane after remount
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// try looking up each entry
|
||||
lfsr_mtree_lookup(&lfs, 0, &mdir) => 0;
|
||||
@@ -2593,8 +2604,8 @@ code = '''
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
|
||||
// setup our neighbors
|
||||
@@ -2652,8 +2663,8 @@ code = '''
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
|
||||
// setup our neighbors
|
||||
@@ -2702,8 +2713,8 @@ code = '''
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
|
||||
// setup our neighbors
|
||||
@@ -2754,8 +2765,8 @@ defines.SIZE = 'BLOCK_SIZE / 4'
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
|
||||
// setup our neighbors
|
||||
@@ -2827,8 +2838,8 @@ defines.SIZE = 'BLOCK_SIZE / 4'
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
|
||||
// setup our neighbors
|
||||
@@ -2912,8 +2923,8 @@ defines.BLOCK_RECYCLES = 0
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
|
||||
// setup our neighbors
|
||||
@@ -2970,8 +2981,8 @@ defines.BLOCK_RECYCLES = 0
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
|
||||
// setup our neighbors
|
||||
@@ -3059,8 +3070,8 @@ defines.BLOCK_RECYCLES = 0
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
|
||||
// setup our neighbors
|
||||
@@ -3146,8 +3157,8 @@ defines.SIZE = 'BLOCK_SIZE / 4'
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
|
||||
// setup our neighbors
|
||||
@@ -3248,8 +3259,8 @@ defines.SIZE = 'BLOCK_SIZE / 4'
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
|
||||
// setup our neighbors
|
||||
@@ -3346,8 +3357,8 @@ defines.CKMETA = [false, true]
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
|
||||
// insert at least one entry
|
||||
@@ -3430,7 +3441,7 @@ code = '''
|
||||
|
||||
// check things stay sane after remount
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// assert that our entry is still in the mtree
|
||||
lfsr_mtree_namelookup(&lfs, 0, "a", 1,
|
||||
@@ -3449,8 +3460,8 @@ defines.SIZE = 'BLOCK_SIZE / 4'
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
lfsr_data_t data;
|
||||
|
||||
@@ -3554,7 +3565,7 @@ code = '''
|
||||
|
||||
// check things stay sane after remount
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// assert mdirs were unininlined
|
||||
assert(lfsr_mtree_weight_(&lfs.mtree) == (1 << lfs.mdir_bits));
|
||||
@@ -3582,8 +3593,8 @@ defines.SIZE = 'BLOCK_SIZE / 4'
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
lfsr_data_t data;
|
||||
|
||||
@@ -3695,7 +3706,7 @@ code = '''
|
||||
|
||||
// check things stay sane after remount
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// assert mdirs were unininlined and split
|
||||
assert(lfsr_mtree_weight_(&lfs.mtree) == (2 << lfs.mdir_bits));
|
||||
@@ -3725,8 +3736,8 @@ defines.SIZE = 'BLOCK_SIZE / 4'
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
lfsr_data_t data;
|
||||
|
||||
@@ -3861,7 +3872,7 @@ code = '''
|
||||
|
||||
// check things stay sane after remount
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// assert mdir was split correctly
|
||||
assert(lfsr_mtree_weight_(&lfs.mtree) == (3 << lfs.mdir_bits));
|
||||
@@ -3897,8 +3908,8 @@ defines.BLOCK_RECYCLES = 0
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
|
||||
// insert at least one entry
|
||||
@@ -3993,7 +4004,7 @@ code = '''
|
||||
|
||||
// check things stay sane after remount
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// assert that our entry is still in the mtree
|
||||
lfsr_mtree_namelookup(&lfs, 0, "a", 1,
|
||||
@@ -4013,8 +4024,8 @@ defines.FORCE_COMPACTION = [false, true]
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
|
||||
// create entries
|
||||
@@ -4127,7 +4138,7 @@ code = '''
|
||||
|
||||
// check things stay sane after remount
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// try looking up each entry
|
||||
lfsr_mtree_lookup(&lfs, 0, &mdir) => 0;
|
||||
@@ -4159,8 +4170,8 @@ fuzz = 'SEED'
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
|
||||
bool sim[N];
|
||||
@@ -4293,7 +4304,7 @@ code = '''
|
||||
|
||||
// check things stay sane after remount
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// try looking up each entry
|
||||
lfsr_mtree_lookup(&lfs, 0, &mdir) => 0;
|
||||
@@ -4326,8 +4337,8 @@ code = '''
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
|
||||
uint8_t mptr_buf[LFSR_MPTR_DSIZE];
|
||||
@@ -4385,7 +4396,7 @@ code = '''
|
||||
[cases.test_mtree_magic]
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
|
||||
// check our magic string
|
||||
//
|
||||
@@ -4407,8 +4418,8 @@ defines.BLOCK_RECYCLES = 0
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
lfsr_data_t data;
|
||||
|
||||
@@ -4464,8 +4475,8 @@ defines.PROG_SIZE = 'BLOCK_SIZE'
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
lfsr_format(&lfs, LFS_F_RDWR | F_FLAGS, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
lfsr_data_t data;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user