mirror of
https://github.com/littlefs-project/littlefs.git
synced 2025-12-01 12:20:02 +00:00
rdonly: Fixed various LFS3_RDONLY compile errors
This just fell out-of-sync a bit during the gbmap work. Note we _do_
support LFS3_RDONLY + LFS3_GBMAP, as fetching the gbmap is necessary for
CKMETA to check all metadata. Fortunately this is relatively cheap:
code stack ctx
rdonly: 10716 896 532
rdonly+gbmap: 10988 (+2.5%) 896 (+0.0%) 680 (+27.8%)
Though this does highlight that a sort of LFS3_NO_TRV mode could remove
quite a bit of code.
This commit is contained in:
8
lfs3.c
8
lfs3.c
@ -5202,6 +5202,7 @@ static inline bool lfs3_o_isbshrub(uint32_t flags);
|
||||
// claim all btrees known to the system
|
||||
//
|
||||
// note this doesn't, and can't, include any stack allocated btrees
|
||||
#ifndef LFS3_RDONLY
|
||||
static void lfs3_fs_claimbtree(lfs3_t *lfs3, lfs3_btree_t *btree) {
|
||||
// claim the mtree
|
||||
if (&lfs3->mtree != btree
|
||||
@ -5231,6 +5232,7 @@ static void lfs3_fs_claimbtree(lfs3_t *lfs3, lfs3_btree_t *btree) {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// branch on-disk encoding
|
||||
@ -10807,7 +10809,7 @@ eot:;
|
||||
|
||||
/// Optional on-disk block map ///
|
||||
|
||||
#if !defined(LFS3_RDONLY) && !defined(LFS3_2BONLY) && defined(LFS3_GBMAP)
|
||||
#if !defined(LFS3_2BONLY) && defined(LFS3_GBMAP)
|
||||
static void lfs3_gbmap_init(lfs3_gbmap_t *gbmap) {
|
||||
gbmap->window = 0;
|
||||
gbmap->known = 0;
|
||||
@ -17265,7 +17267,7 @@ failed:;
|
||||
#endif
|
||||
|
||||
// enable the global on-disk block-map
|
||||
#if !defined(LFs3_RDONLY) && defined(LFS3_GBMAP) && !defined(LFS3_YES_GBMAP)
|
||||
#if !defined(LFS3_RDONLY) && defined(LFS3_GBMAP) && !defined(LFS3_YES_GBMAP)
|
||||
int lfs3_fs_mkgbmap(lfs3_t *lfs3) {
|
||||
// do nothing if we already have a gbmap
|
||||
if (lfs3_f_isgbmap(lfs3->flags)) {
|
||||
@ -17324,7 +17326,7 @@ failed:;
|
||||
#endif
|
||||
|
||||
// disable the global on-disk block-map
|
||||
#if !defined(LFs3_RDONLY) && defined(LFS3_GBMAP) && !defined(LFS3_YES_GBMAP)
|
||||
#if !defined(LFS3_RDONLY) && defined(LFS3_GBMAP) && !defined(LFS3_YES_GBMAP)
|
||||
int lfs3_fs_rmgbmap(lfs3_t *lfs3) {
|
||||
// do nothing if we already don't have a gbmap
|
||||
if (!lfs3_f_isgbmap(lfs3->flags)) {
|
||||
|
||||
6
lfs3.h
6
lfs3.h
@ -192,11 +192,11 @@ enum lfs3_type {
|
||||
|
||||
#define LFS3_F_CKMETA 0x00001000 // Check metadata checksums
|
||||
#define LFS3_F_CKDATA 0x00002000 // Check metadata + data checksums
|
||||
#endif
|
||||
|
||||
#ifdef LFS3_GBMAP
|
||||
#define LFS3_F_GBMAP 0x01000000 // Use the global on-disk block-map
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Filesystem mount flags
|
||||
#define LFS3_M_MODE 1 // Mount's access mode
|
||||
@ -1488,7 +1488,7 @@ int lfs3_fs_grow(lfs3_t *lfs3, lfs3_size_t block_count);
|
||||
//
|
||||
// Returns a negative error code on failure. Does nothing if a gbmap
|
||||
// already exists.
|
||||
#if !defined(LFs3_RDONLY) && defined(LFS3_GBMAP) && !defined(LFS3_YES_GBMAP)
|
||||
#if !defined(LFS3_RDONLY) && defined(LFS3_GBMAP) && !defined(LFS3_YES_GBMAP)
|
||||
int lfs3_fs_mkgbmap(lfs3_t *lfs3);
|
||||
#endif
|
||||
|
||||
@ -1496,7 +1496,7 @@ int lfs3_fs_mkgbmap(lfs3_t *lfs3);
|
||||
//
|
||||
// Returns a negative error code on failure. Does nothing if no gbmap
|
||||
// is found.
|
||||
#if !defined(LFs3_RDONLY) && defined(LFS3_GBMAP) && !defined(LFS3_YES_GBMAP)
|
||||
#if !defined(LFS3_RDONLY) && defined(LFS3_GBMAP) && !defined(LFS3_YES_GBMAP)
|
||||
int lfs3_fs_rmgbmap(lfs3_t *lfs3);
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user