@@ -121,7 +121,7 @@ static int lfs_cache_crc(lfs_t *lfs,
121
121
return err ;
122
122
}
123
123
124
- lfs_crc (crc , & c , 1 );
124
+ * crc = lfs_crc (* crc , & c , 1 );
125
125
}
126
126
127
127
return 0 ;
@@ -236,7 +236,7 @@ static int lfs_bd_cmp(lfs_t *lfs, lfs_block_t block,
236
236
return lfs_cache_cmp (lfs , NULL , & lfs -> rcache , block , off , buffer , size );
237
237
}
238
238
239
- static int lfs_bd_crc (lfs_t * lfs , lfs_block_t block ,
239
+ static int lfs_bd_crc32 (lfs_t * lfs , lfs_block_t block ,
240
240
lfs_off_t off , lfs_size_t size , uint32_t * crc ) {
241
241
return lfs_cache_crc (lfs , NULL , & lfs -> rcache , block , off , size , crc );
242
242
}
@@ -562,7 +562,7 @@ static int lfs_commit_attr(lfs_t *lfs, struct lfs_commit *commit,
562
562
563
563
// write out tag
564
564
uint32_t ntag = lfs_tole32 ((tag & 0x7fffffff ) ^ commit -> ptag );
565
- lfs_crc (& commit -> crc , & ntag , sizeof (ntag ));
565
+ commit -> crc = lfs_crc (commit -> crc , & ntag , sizeof (ntag ));
566
566
int err = lfs_bd_prog (lfs , commit -> block , commit -> off ,
567
567
& ntag , sizeof (ntag ));
568
568
if (err ) {
@@ -572,7 +572,7 @@ static int lfs_commit_attr(lfs_t *lfs, struct lfs_commit *commit,
572
572
573
573
if (!(tag & 0x80000000 )) {
574
574
// from memory
575
- lfs_crc (& commit -> crc , buffer , size );
575
+ commit -> crc = lfs_crc (commit -> crc , buffer , size );
576
576
err = lfs_bd_prog (lfs , commit -> block , commit -> off , buffer , size );
577
577
if (err ) {
578
578
return err ;
@@ -588,7 +588,7 @@ static int lfs_commit_attr(lfs_t *lfs, struct lfs_commit *commit,
588
588
return err ;
589
589
}
590
590
591
- lfs_crc (& commit -> crc , & dat , 1 );
591
+ commit -> crc = lfs_crc (commit -> crc , & dat , 1 );
592
592
err = lfs_bd_prog (lfs , commit -> block , commit -> off + i , & dat , 1 );
593
593
if (err ) {
594
594
return err ;
@@ -714,7 +714,7 @@ static int lfs_commit_crc(lfs_t *lfs, struct lfs_commit *commit) {
714
714
// write out crc
715
715
uint32_t footer [2 ];
716
716
footer [0 ] = lfs_tole32 (tag ^ commit -> ptag );
717
- lfs_crc (& commit -> crc , & footer [0 ], sizeof (footer [0 ]));
717
+ commit -> crc = lfs_crc (commit -> crc , & footer [0 ], sizeof (footer [0 ]));
718
718
footer [1 ] = lfs_tole32 (commit -> crc );
719
719
err = lfs_bd_prog (lfs , commit -> block , commit -> off , footer , sizeof (footer ));
720
720
if (err ) {
@@ -731,7 +731,7 @@ static int lfs_commit_crc(lfs_t *lfs, struct lfs_commit *commit) {
731
731
732
732
// successful commit, check checksum to make sure
733
733
uint32_t crc = 0xffffffff ;
734
- err = lfs_bd_crc (lfs , commit -> block , commit -> begin ,
734
+ err = lfs_bd_crc32 (lfs , commit -> block , commit -> begin ,
735
735
commit -> off - lfs_tag_size (tag )- commit -> begin , & crc );
736
736
if (err ) {
737
737
return err ;
@@ -810,7 +810,7 @@ static int32_t lfs_dir_fetchmatch(lfs_t *lfs,
810
810
uint32_t crc = 0xffffffff ;
811
811
812
812
dir -> rev = lfs_tole32 (rev [0 ]);
813
- lfs_crc (& crc , & dir -> rev , sizeof (dir -> rev ));
813
+ crc = lfs_crc (crc , & dir -> rev , sizeof (dir -> rev ));
814
814
dir -> rev = lfs_fromle32 (dir -> rev );
815
815
dir -> off = 0 ;
816
816
@@ -835,7 +835,7 @@ static int32_t lfs_dir_fetchmatch(lfs_t *lfs,
835
835
return err ;
836
836
}
837
837
838
- lfs_crc (& crc , & tag , sizeof (tag ));
838
+ crc = lfs_crc (crc , & tag , sizeof (tag ));
839
839
tag = lfs_fromle32 (tag ) ^ ptag ;
840
840
841
841
// next commit not yet programmed
@@ -879,7 +879,7 @@ static int32_t lfs_dir_fetchmatch(lfs_t *lfs,
879
879
dir -> locals = templocals ;
880
880
crc = 0xffffffff ;
881
881
} else {
882
- err = lfs_bd_crc (lfs , dir -> pair [0 ],
882
+ err = lfs_bd_crc32 (lfs , dir -> pair [0 ],
883
883
off + sizeof (tag ), lfs_tag_size (tag ), & crc );
884
884
if (err ) {
885
885
if (err == LFS_ERR_CORRUPT ) {
@@ -1062,7 +1062,7 @@ static int lfs_dir_compact(lfs_t *lfs,
1062
1062
// write out header
1063
1063
uint32_t crc = 0xffffffff ;
1064
1064
uint32_t rev = lfs_tole32 (dir -> rev );
1065
- lfs_crc (& crc , & rev , sizeof (rev ));
1065
+ crc = lfs_crc (crc , & rev , sizeof (rev ));
1066
1066
err = lfs_bd_prog (lfs , dir -> pair [1 ], 0 , & rev , sizeof (rev ));
1067
1067
if (err ) {
1068
1068
if (err == LFS_ERR_CORRUPT ) {
0 commit comments