Skip to content

Commit 0828fd9

Browse files
committed
Reverted LFS3_CKDATACKSUMREADS -> LFS3_CKDATACKSUMS
LFS3_CKDATACKSUMREADS is just too much. The downside is it may not be clear how LFS3_CKDATACKSUMREADS interacts with the future planned LFS3_CKREADS (LFS3_CKREADS implies LFS3_CKDATACKSUMS + LFS3_CKMETAREDUND), but on the flip side you may actually be able to type LFS3_CKDATACKSUMS on the first try.
1 parent 17cefcd commit 0828fd9

File tree

6 files changed

+111
-114
lines changed

6 files changed

+111
-114
lines changed

lfs3.c

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ static inline lfs3_size_t lfs3_ptail_off(const lfs3_t *lfs3) {
742742

743743
// checked read helpers
744744

745-
#ifdef LFS3_CKDATACKSUMREADS
745+
#ifdef LFS3_CKDATACKSUMS
746746
static int lfs3_bd_ckprefix(lfs3_t *lfs3,
747747
lfs3_block_t block, lfs3_size_t off, lfs3_size_t hint,
748748
lfs3_size_t cksize, uint32_t cksum,
@@ -777,7 +777,7 @@ static int lfs3_bd_ckprefix(lfs3_t *lfs3,
777777
}
778778
#endif
779779

780-
#ifdef LFS3_CKDATACKSUMREADS
780+
#ifdef LFS3_CKDATACKSUMS
781781
static int lfs3_bd_cksuffix(lfs3_t *lfs3,
782782
lfs3_block_t block, lfs3_size_t off, lfs3_size_t hint,
783783
lfs3_size_t cksize, uint32_t cksum,
@@ -818,7 +818,7 @@ static int lfs3_bd_cksuffix(lfs3_t *lfs3,
818818
// contributes to the relevant parity/checksum, this may be
819819
// significantly more than the data we actually end up using
820820
//
821-
#ifdef LFS3_CKDATACKSUMREADS
821+
#ifdef LFS3_CKDATACKSUMS
822822
static int lfs3_bd_readck(lfs3_t *lfs3,
823823
lfs3_block_t block, lfs3_size_t off, lfs3_size_t hint,
824824
void *buffer, lfs3_size_t size,
@@ -868,7 +868,7 @@ static int lfs3_bd_readck(lfs3_t *lfs3,
868868
//
869869
// we'd also need to worry about early termination in lfs3_bd_cmp/cmpck
870870

871-
#ifdef LFS3_CKDATACKSUMREADS
871+
#ifdef LFS3_CKDATACKSUMS
872872
static lfs3_scmp_t lfs3_bd_cmpck(lfs3_t *lfs3,
873873
lfs3_block_t block, lfs3_size_t off, lfs3_size_t hint,
874874
const void *buffer, lfs3_size_t size,
@@ -932,7 +932,7 @@ static lfs3_scmp_t lfs3_bd_cmpck(lfs3_t *lfs3,
932932
}
933933
#endif
934934

935-
#if !defined(LFS3_RDONLY) && defined(LFS3_CKDATACKSUMREADS)
935+
#if !defined(LFS3_RDONLY) && defined(LFS3_CKDATACKSUMS)
936936
static int lfs3_bd_cpyck(lfs3_t *lfs3,
937937
lfs3_block_t dst_block, lfs3_size_t dst_off,
938938
lfs3_block_t src_block, lfs3_size_t src_off, lfs3_size_t hint,
@@ -1591,7 +1591,7 @@ static lfs3_ssize_t lfs3_bd_progtag(lfs3_t *lfs3,
15911591
#define LFS3_DATA_ONDISK 0x80000000
15921592
#define LFS3_DATA_ISBPTR 0x40000000
15931593

1594-
#ifdef LFS3_CKDATACKSUMREADS
1594+
#ifdef LFS3_CKDATACKSUMS
15951595
#define LFS3_DATA_ISERASED 0x80000000
15961596
#endif
15971597

@@ -1628,13 +1628,13 @@ static inline lfs3_size_t lfs3_data_size(lfs3_data_t data) {
16281628
return data.size & ~LFS3_DATA_ONDISK & ~LFS3_DATA_ISBPTR;
16291629
}
16301630

1631-
#ifdef LFS3_CKDATACKSUMREADS
1631+
#ifdef LFS3_CKDATACKSUMS
16321632
static inline lfs3_size_t lfs3_data_cksize(lfs3_data_t data) {
16331633
return data.u.disk.cksize & ~LFS3_DATA_ISERASED;
16341634
}
16351635
#endif
16361636

1637-
#ifdef LFS3_CKDATACKSUMREADS
1637+
#ifdef LFS3_CKDATACKSUMS
16381638
static inline uint32_t lfs3_data_cksum(lfs3_data_t data) {
16391639
return data.u.disk.cksum;
16401640
}
@@ -1679,7 +1679,7 @@ static inline lfs3_data_t lfs3_data_slice(lfs3_data_t data,
16791679
// consuming the data
16801680

16811681
// needed in lfs3_data_read and friends
1682-
#ifdef LFS3_CKDATACKSUMREADS
1682+
#ifdef LFS3_CKDATACKSUMS
16831683
static inline bool lfs3_m_isckdatacksums(uint32_t flags);
16841684
#endif
16851685

@@ -1691,11 +1691,11 @@ static lfs3_ssize_t lfs3_data_read(lfs3_t *lfs3, lfs3_data_t *data,
16911691
// on-disk?
16921692
if (lfs3_data_ondisk(*data)) {
16931693
// validating data cksums?
1694-
if (LFS3_IFDEF_CKDATACKSUMREADS(
1694+
if (LFS3_IFDEF_CKDATACKSUMS(
16951695
lfs3_m_isckdatacksums(lfs3->flags)
16961696
&& lfs3_data_isbptr(*data),
16971697
false)) {
1698-
#ifdef LFS3_CKDATACKSUMREADS
1698+
#ifdef LFS3_CKDATACKSUMS
16991699
int err = lfs3_bd_readck(lfs3,
17001700
data->u.disk.block, data->u.disk.off,
17011701
// note our hint includes the full data range
@@ -1798,11 +1798,11 @@ static lfs3_scmp_t lfs3_data_cmp(lfs3_t *lfs3, lfs3_data_t data,
17981798
// on-disk?
17991799
if (lfs3_data_ondisk(data)) {
18001800
// validating data cksums?
1801-
if (LFS3_IFDEF_CKDATACKSUMREADS(
1801+
if (LFS3_IFDEF_CKDATACKSUMS(
18021802
lfs3_m_isckdatacksums(lfs3->flags)
18031803
&& lfs3_data_isbptr(data),
18041804
false)) {
1805-
#ifdef LFS3_CKDATACKSUMREADS
1805+
#ifdef LFS3_CKDATACKSUMS
18061806
int cmp = lfs3_bd_cmpck(lfs3,
18071807
// note the 0 hint, we don't usually use any
18081808
// following data
@@ -1871,11 +1871,11 @@ static int lfs3_bd_progdata(lfs3_t *lfs3,
18711871
// on-disk?
18721872
if (lfs3_data_ondisk(data)) {
18731873
// validating data cksums?
1874-
if (LFS3_IFDEF_CKDATACKSUMREADS(
1874+
if (LFS3_IFDEF_CKDATACKSUMS(
18751875
lfs3_m_isckdatacksums(lfs3->flags)
18761876
&& lfs3_data_isbptr(data),
18771877
false)) {
1878-
#ifdef LFS3_CKDATACKSUMREADS
1878+
#ifdef LFS3_CKDATACKSUMS
18791879
int err = lfs3_bd_cpyck(lfs3, block, off,
18801880
data.u.disk.block, data.u.disk.off, lfs3_data_size(data),
18811881
lfs3_data_size(data),
@@ -2418,7 +2418,7 @@ static void lfs3_bptr_init(lfs3_bptr_t *bptr,
24182418
bptr->d.size = data.size | LFS3_DATA_ONDISK | LFS3_BPTR_ISBPTR;
24192419
bptr->d.u.disk.block = data.u.disk.block;
24202420
bptr->d.u.disk.off = data.u.disk.off;
2421-
#ifdef LFS3_CKDATACKSUMREADS
2421+
#ifdef LFS3_CKDATACKSUMS
24222422
bptr->d.u.disk.cksize = cksize;
24232423
bptr->d.u.disk.cksum = cksum;
24242424
#else
@@ -2430,15 +2430,15 @@ static void lfs3_bptr_init(lfs3_bptr_t *bptr,
24302430

24312431
static inline void lfs3_bptr_discard(lfs3_bptr_t *bptr) {
24322432
bptr->d = LFS3_DATA_NULL();
2433-
#if !defined(LFS3_2BONLY) && !defined(LFS3_CKDATACKSUMREADS)
2433+
#if !defined(LFS3_2BONLY) && !defined(LFS3_CKDATACKSUMS)
24342434
bptr->cksize = 0;
24352435
bptr->cksum = 0;
24362436
#endif
24372437
}
24382438

24392439
#if !defined(LFS3_RDONLY) && !defined(LFS3_2BONLY)
24402440
static inline void lfs3_bptr_claim(lfs3_bptr_t *bptr) {
2441-
#ifdef LFS3_CKDATACKSUMREADS
2441+
#ifdef LFS3_CKDATACKSUMS
24422442
bptr->d.u.disk.cksize &= ~LFS3_BPTR_ISERASED;
24432443
#else
24442444
bptr->cksize &= ~LFS3_BPTR_ISERASED;
@@ -2467,7 +2467,7 @@ static inline lfs3_size_t lfs3_bptr_size(const lfs3_bptr_t *bptr) {
24672467
// messy...
24682468
#if !defined(LFS3_RDONLY) && !defined(LFS3_2BONLY)
24692469
static inline bool lfs3_bptr_iserased(const lfs3_bptr_t *bptr) {
2470-
#ifdef LFS3_CKDATACKSUMREADS
2470+
#ifdef LFS3_CKDATACKSUMS
24712471
return bptr->d.u.disk.cksize & LFS3_BPTR_ISERASED;
24722472
#else
24732473
return bptr->cksize & LFS3_BPTR_ISERASED;
@@ -2477,7 +2477,7 @@ static inline bool lfs3_bptr_iserased(const lfs3_bptr_t *bptr) {
24772477

24782478
#ifndef LFS3_2BONLY
24792479
static inline lfs3_size_t lfs3_bptr_cksize(const lfs3_bptr_t *bptr) {
2480-
#ifdef LFS3_CKDATACKSUMREADS
2480+
#ifdef LFS3_CKDATACKSUMS
24812481
return LFS3_IFDEF_RDONLY(
24822482
bptr->d.u.disk.cksize,
24832483
bptr->d.u.disk.cksize & ~LFS3_BPTR_ISERASED);
@@ -2491,7 +2491,7 @@ static inline lfs3_size_t lfs3_bptr_cksize(const lfs3_bptr_t *bptr) {
24912491

24922492
#ifndef LFS3_2BONLY
24932493
static inline uint32_t lfs3_bptr_cksum(const lfs3_bptr_t *bptr) {
2494-
#ifdef LFS3_CKDATACKSUMREADS
2494+
#ifdef LFS3_CKDATACKSUMS
24952495
return bptr->d.u.disk.cksum;
24962496
#else
24972497
return bptr->cksum;
@@ -2567,15 +2567,15 @@ static int lfs3_data_readbptr(lfs3_t *lfs3, lfs3_data_t *data,
25672567

25682568
// read the cksize, cksum
25692569
err = lfs3_data_readlleb128(lfs3, data,
2570-
LFS3_IFDEF_CKDATACKSUMREADS(
2570+
LFS3_IFDEF_CKDATACKSUMS(
25712571
&bptr->d.u.disk.cksize,
25722572
&bptr->cksize));
25732573
if (err) {
25742574
return err;
25752575
}
25762576

25772577
err = lfs3_data_readle32(lfs3, data,
2578-
LFS3_IFDEF_CKDATACKSUMREADS(
2578+
LFS3_IFDEF_CKDATACKSUMS(
25792579
&bptr->d.u.disk.cksum,
25802580
&bptr->cksum));
25812581
if (err) {
@@ -7347,13 +7347,13 @@ static inline bool lfs3_m_isckparity(uint32_t flags) {
73477347
}
73487348
#endif
73497349

7350-
#ifdef LFS3_CKDATACKSUMREADS
7350+
#ifdef LFS3_CKDATACKSUMS
73517351
static inline bool lfs3_m_isckdatacksums(uint32_t flags) {
73527352
(void)flags;
7353-
#ifdef LFS3_YES_CKDATACKSUMREADS
7353+
#ifdef LFS3_YES_CKDATACKSUMS
73547354
return true;
73557355
#else
7356-
return flags & LFS3_M_CKDATACKSUMREADS;
7356+
return flags & LFS3_M_CKDATACKSUMS;
73577357
#endif
73587358
}
73597359
#endif
@@ -14294,8 +14294,8 @@ static int lfs3_init(lfs3_t *lfs3, uint32_t flags,
1429414294
| LFS3_IFDEF_CKPROGS(LFS3_M_CKPROGS, 0)
1429514295
| LFS3_IFDEF_CKFETCHES(LFS3_M_CKFETCHES, 0)
1429614296
| LFS3_IFDEF_CKMETAPARITY(LFS3_M_CKMETAPARITY, 0)
14297-
| LFS3_IFDEF_CKDATACKSUMREADS(
14298-
LFS3_M_CKDATACKSUMREADS,
14297+
| LFS3_IFDEF_CKDATACKSUMS(
14298+
LFS3_M_CKDATACKSUMS,
1429914299
0))) == 0);
1430014300
// LFS3_M_REVDBG and LFS3_M_REVNOISE are incompatible
1430114301
#if defined(LFS3_REVNOISE) && defined(LFS3_REVDBG)
@@ -15170,8 +15170,8 @@ int lfs3_mount(lfs3_t *lfs3, uint32_t flags,
1517015170
#ifdef LFS3_YES_CKMETAPARITY
1517115171
flags |= LFS3_M_CKMETAPARITY;
1517215172
#endif
15173-
#ifdef LFS3_YES_CKDATACKSUMREADS
15174-
flags |= LFS3_M_CKDATACKSUMREADS;
15173+
#ifdef LFS3_YES_CKDATACKSUMS
15174+
flags |= LFS3_M_CKDATACKSUMS;
1517515175
#endif
1517615176
#ifdef LFS3_YES_MKCONSISTENT
1517715177
flags |= LFS3_M_MKCONSISTENT;
@@ -15200,7 +15200,7 @@ int lfs3_mount(lfs3_t *lfs3, uint32_t flags,
1520015200
| LFS3_IFDEF_CKPROGS(LFS3_M_CKPROGS, 0)
1520115201
| LFS3_IFDEF_CKFETCHES(LFS3_M_CKFETCHES, 0)
1520215202
| LFS3_IFDEF_CKMETAPARITY(LFS3_M_CKMETAPARITY, 0)
15203-
| LFS3_IFDEF_CKDATACKSUMREADS(LFS3_M_CKDATACKSUMREADS, 0)
15203+
| LFS3_IFDEF_CKDATACKSUMS(LFS3_M_CKDATACKSUMS, 0)
1520415204
| LFS3_IFDEF_RDONLY(0, LFS3_M_MKCONSISTENT)
1520515205
| LFS3_IFDEF_RDONLY(0, LFS3_M_LOOKAHEAD)
1520615206
| LFS3_IFDEF_RDONLY(0, LFS3_M_COMPACT)
@@ -15222,7 +15222,7 @@ int lfs3_mount(lfs3_t *lfs3, uint32_t flags,
1522215222
| LFS3_IFDEF_CKPROGS(LFS3_M_CKPROGS, 0)
1522315223
| LFS3_IFDEF_CKFETCHES(LFS3_M_CKFETCHES, 0)
1522415224
| LFS3_IFDEF_CKMETAPARITY(LFS3_M_CKMETAPARITY, 0)
15225-
| LFS3_IFDEF_CKDATACKSUMREADS(LFS3_M_CKDATACKSUMREADS, 0)),
15225+
| LFS3_IFDEF_CKDATACKSUMS(LFS3_M_CKDATACKSUMS, 0)),
1522615226
cfg);
1522715227
if (err) {
1522815228
return err;
@@ -15397,8 +15397,8 @@ int lfs3_format(lfs3_t *lfs3, uint32_t flags,
1539715397
#ifdef LFS3_YES_CKMETAPARITY
1539815398
flags |= LFS3_F_CKMETAPARITY;
1539915399
#endif
15400-
#ifdef LFS3_YES_CKDATACKSUMREADS
15401-
flags |= LFS3_F_CKDATACKSUMREADS;
15400+
#ifdef LFS3_YES_CKDATACKSUMS
15401+
flags |= LFS3_F_CKDATACKSUMS;
1540215402
#endif
1540315403
#ifdef LFS3_YES_CKMETA
1540415404
flags |= LFS3_F_CKMETA;
@@ -15415,7 +15415,7 @@ int lfs3_format(lfs3_t *lfs3, uint32_t flags,
1541515415
| LFS3_IFDEF_CKPROGS(LFS3_F_CKPROGS, 0)
1541615416
| LFS3_IFDEF_CKFETCHES(LFS3_F_CKFETCHES, 0)
1541715417
| LFS3_IFDEF_CKMETAPARITY(LFS3_F_CKMETAPARITY, 0)
15418-
| LFS3_IFDEF_CKDATACKSUMREADS(LFS3_F_CKDATACKSUMREADS, 0)
15418+
| LFS3_IFDEF_CKDATACKSUMS(LFS3_F_CKDATACKSUMS, 0)
1541915419
| LFS3_F_CKMETA
1542015420
| LFS3_F_CKDATA)) == 0);
1542115421

@@ -15427,7 +15427,7 @@ int lfs3_format(lfs3_t *lfs3, uint32_t flags,
1542715427
| LFS3_IFDEF_CKPROGS(LFS3_F_CKPROGS, 0)
1542815428
| LFS3_IFDEF_CKFETCHES(LFS3_F_CKFETCHES, 0)
1542915429
| LFS3_IFDEF_CKMETAPARITY(LFS3_F_CKMETAPARITY, 0)
15430-
| LFS3_IFDEF_CKDATACKSUMREADS(LFS3_F_CKDATACKSUMREADS, 0)),
15430+
| LFS3_IFDEF_CKDATACKSUMS(LFS3_F_CKDATACKSUMS, 0)),
1543115431
cfg);
1543215432
if (err) {
1543315433
return err;
@@ -15489,7 +15489,7 @@ int lfs3_fs_stat(lfs3_t *lfs3, struct lfs3_fsinfo *fsinfo) {
1548915489
| LFS3_IFDEF_CKPROGS(LFS3_I_CKPROGS, 0)
1549015490
| LFS3_IFDEF_CKFETCHES(LFS3_I_CKFETCHES, 0)
1549115491
| LFS3_IFDEF_CKMETAPARITY(LFS3_I_CKMETAPARITY, 0)
15492-
| LFS3_IFDEF_CKDATACKSUMREADS(LFS3_I_CKDATACKSUMREADS, 0)
15492+
| LFS3_IFDEF_CKDATACKSUMS(LFS3_I_CKDATACKSUMS, 0)
1549315493
| LFS3_IFDEF_RDONLY(0, LFS3_I_MKCONSISTENT)
1549415494
| LFS3_IFDEF_RDONLY(0, LFS3_I_LOOKAHEAD)
1549515495
| LFS3_IFDEF_RDONLY(0, LFS3_I_COMPACT)

lfs3.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,8 @@ enum lfs3_type {
184184
#define LFS3_F_CKMETAPARITY \
185185
0x00200000 // Check metadata tag parity bits
186186
#endif
187-
#ifdef LFS3_CKDATACKSUMREADS
188-
#define LFS3_F_CKDATACKSUMREADS \
187+
#ifdef LFS3_CKDATACKSUMS
188+
#define LFS3_F_CKDATACKSUMS \
189189
0x00800000 // Check data checksums on reads
190190
#endif
191191

@@ -218,8 +218,8 @@ enum lfs3_type {
218218
#define LFS3_M_CKMETAPARITY \
219219
0x00200000 // Check metadata tag parity bits
220220
#endif
221-
#ifdef LFS3_CKDATACKSUMREADS
222-
#define LFS3_M_CKDATACKSUMREADS \
221+
#ifdef LFS3_CKDATACKSUMS
222+
#define LFS3_M_CKDATACKSUMS \
223223
0x00800000 // Check data checksums on reads
224224
#endif
225225

@@ -258,9 +258,9 @@ enum lfs3_type {
258258
#define LFS3_I_CKMETAPARITY \
259259
0x00200000 // Mounted with LFS3_M_CKMETAPARITY
260260
#endif
261-
#ifdef LFS3_CKDATACKSUMREADS
262-
#define LFS3_I_CKDATACKSUMREADS \
263-
0x00800000 // Mounted with LFS3_M_CKDATACKSUMREADS
261+
#ifdef LFS3_CKDATACKSUMS
262+
#define LFS3_I_CKDATACKSUMS \
263+
0x00800000 // Mounted with LFS3_M_CKDATACKSUMS
264264
#endif
265265

266266
#ifndef LFS3_RDONLY
@@ -640,7 +640,7 @@ typedef struct lfs3_data {
640640
lfs3_block_t block;
641641
lfs3_size_t off;
642642
// optional context for validating data
643-
#ifdef LFS3_CKDATACKSUMREADS
643+
#ifdef LFS3_CKDATACKSUMS
644644
// sign(cksize)=0 => block not erased
645645
// sign(cksize)=1 => block erased
646646
lfs3_size_t cksize;
@@ -656,7 +656,7 @@ typedef struct lfs3_bptr {
656656
// sign2(size)=0b10 => on-disk data
657657
// sign2(size)=0b11 => block pointer
658658
lfs3_data_t d;
659-
#if !defined(LFS3_2BONLY) && !defined(LFS3_CKDATACKSUMREADS)
659+
#if !defined(LFS3_2BONLY) && !defined(LFS3_CKDATACKSUMS)
660660
// sign(cksize)=0 => block not erased
661661
// sign(cksize)=1 => block erased
662662
lfs3_size_t cksize;

lfs3_util.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
#ifndef LFS3_CKMETAPARITY
4242
#define LFS3_CKMETAPARITY
4343
#endif
44-
#ifndef LFS3_CKDATACKSUMREADS
45-
#define LFS3_CKDATACKSUMREADS
44+
#ifndef LFS3_CKDATACKSUMS
45+
#define LFS3_CKDATACKSUMS
4646
#endif
4747
#ifndef LFS3_GC
4848
#define LFS3_GC
@@ -74,8 +74,8 @@
7474
#ifdef LFS3_YES_CKMETAPARITY
7575
#define LFS3_CKMETAPARITY
7676
#endif
77-
#ifdef LFS3_YES_CKDATACKSUMREADS
78-
#define LFS3_CKDATACKSUMREADS
77+
#ifdef LFS3_YES_CKDATACKSUMS
78+
#define LFS3_CKDATACKSUMS
7979
#endif
8080
#ifdef LFS3_YES_GC
8181
#define LFS3_GC
@@ -245,10 +245,10 @@
245245
#define LFS3_IFDEF_CKMETAPARITY(a, b) (b)
246246
#endif
247247

248-
#ifdef LFS3_CKDATACKSUMREADS
249-
#define LFS3_IFDEF_CKDATACKSUMREADS(a, b) (a)
248+
#ifdef LFS3_CKDATACKSUMS
249+
#define LFS3_IFDEF_CKDATACKSUMS(a, b) (a)
250250
#else
251-
#define LFS3_IFDEF_CKDATACKSUMREADS(a, b) (b)
251+
#define LFS3_IFDEF_CKDATACKSUMS(a, b) (b)
252252
#endif
253253

254254
#ifdef LFS3_GC

0 commit comments

Comments
 (0)