mirror of
https://github.com/eledio-devices/thirdparty-littlefs.git
synced 2025-11-01 16:14:13 +01:00
Compare commits
1 Commits
omit-isope
...
fix-sanity
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2b804537b0 |
20
lfs.c
20
lfs.c
@@ -425,8 +425,7 @@ static inline void lfs_superblock_tole32(lfs_superblock_t *superblock) {
|
|||||||
superblock->attr_max = lfs_tole32(superblock->attr_max);
|
superblock->attr_max = lfs_tole32(superblock->attr_max);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef LFS_NO_ASSERT
|
static inline bool lfs_mlist_isopen(struct lfs_mlist *head,
|
||||||
static bool lfs_mlist_isopen(struct lfs_mlist *head,
|
|
||||||
struct lfs_mlist *node) {
|
struct lfs_mlist *node) {
|
||||||
for (struct lfs_mlist **p = &head; *p; p = &(*p)->next) {
|
for (struct lfs_mlist **p = &head; *p; p = &(*p)->next) {
|
||||||
if (*p == (struct lfs_mlist*)node) {
|
if (*p == (struct lfs_mlist*)node) {
|
||||||
@@ -436,9 +435,8 @@ static bool lfs_mlist_isopen(struct lfs_mlist *head,
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static void lfs_mlist_remove(lfs_t *lfs, struct lfs_mlist *mlist) {
|
static inline void lfs_mlist_remove(lfs_t *lfs, struct lfs_mlist *mlist) {
|
||||||
for (struct lfs_mlist **p = &lfs->mlist; *p; p = &(*p)->next) {
|
for (struct lfs_mlist **p = &lfs->mlist; *p; p = &(*p)->next) {
|
||||||
if (*p == mlist) {
|
if (*p == mlist) {
|
||||||
*p = (*p)->next;
|
*p = (*p)->next;
|
||||||
@@ -447,7 +445,7 @@ static void lfs_mlist_remove(lfs_t *lfs, struct lfs_mlist *mlist) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void lfs_mlist_append(lfs_t *lfs, struct lfs_mlist *mlist) {
|
static inline void lfs_mlist_append(lfs_t *lfs, struct lfs_mlist *mlist) {
|
||||||
mlist->next = lfs->mlist;
|
mlist->next = lfs->mlist;
|
||||||
lfs->mlist = mlist;
|
lfs->mlist = mlist;
|
||||||
}
|
}
|
||||||
@@ -3618,12 +3616,6 @@ static int lfs_rawformat(lfs_t *lfs, const struct lfs_config *cfg) {
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
// sanity check that fetch works
|
|
||||||
err = lfs_dir_fetch(lfs, &root, (const lfs_block_t[2]){0, 1});
|
|
||||||
if (err) {
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
// force compaction to prevent accidentally mounting any
|
// force compaction to prevent accidentally mounting any
|
||||||
// older version of littlefs that may live on disk
|
// older version of littlefs that may live on disk
|
||||||
root.erased = false;
|
root.erased = false;
|
||||||
@@ -3631,6 +3623,12 @@ static int lfs_rawformat(lfs_t *lfs, const struct lfs_config *cfg) {
|
|||||||
if (err) {
|
if (err) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sanity check that fetch works
|
||||||
|
err = lfs_dir_fetch(lfs, &root, (const lfs_block_t[2]){0, 1});
|
||||||
|
if (err) {
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
|||||||
Reference in New Issue
Block a user