mirror of
https://github.com/eledio-devices/thirdparty-littlefs.git
synced 2025-11-02 16:14:28 +01:00
Compare commits
1 Commits
v1.6.1
...
license-no
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
76333aeab1 |
69
.travis.yml
69
.travis.yml
@@ -134,46 +134,53 @@ jobs:
|
|||||||
- STAGE=deploy
|
- STAGE=deploy
|
||||||
- NAME=deploy
|
- NAME=deploy
|
||||||
script:
|
script:
|
||||||
# Find version defined in lfs.h
|
# Update tag for version defined in lfs.h
|
||||||
- LFS_VERSION=$(grep -ox '#define LFS_VERSION .*' lfs.h | cut -d ' ' -f3)
|
- LFS_VERSION=$(grep -ox '#define LFS_VERSION .*' lfs.h | cut -d ' ' -f3)
|
||||||
- LFS_VERSION_MAJOR=$((0xffff & ($LFS_VERSION >> 16)))
|
- LFS_VERSION_MAJOR=$((0xffff & ($LFS_VERSION >> 16)))
|
||||||
- LFS_VERSION_MINOR=$((0xffff & ($LFS_VERSION >> 0)))
|
- LFS_VERSION_MINOR=$((0xffff & ($LFS_VERSION >> 0)))
|
||||||
# Grab latests patch from repo tags, default to 0, needs finagling to get past github's pagination api
|
- LFS_VERSION="v$LFS_VERSION_MAJOR.$LFS_VERSION_MINOR"
|
||||||
- PREV_URL=https://api.github.com/repos/$TRAVIS_REPO_SLUG/git/refs/tags/v$LFS_VERSION_MAJOR.$LFS_VERSION_MINOR.
|
- echo "littlefs version $LFS_VERSION"
|
||||||
- PREV_URL=$(curl -f -u "$GEKY_BOT_RELEASES" "$PREV_URL" -I
|
|
||||||
| sed -n '/^Link/{s/.*<\(.*\)>; rel="last"/\1/;p;q0};$q1'
|
|
||||||
|| echo $PREV_URL)
|
|
||||||
- LFS_VERSION_PATCH=$(curl -f -u "$GEKY_BOT_RELEASES" "$PREV_URL"
|
|
||||||
| jq 'map(.ref | match("\\bv.*\\..*\\.(.*)$";"g")
|
|
||||||
.captures[].string | tonumber + 1) | max // 0')
|
|
||||||
# We have our new version
|
|
||||||
- LFS_VERSION="v$LFS_VERSION_MAJOR.$LFS_VERSION_MINOR.$LFS_VERSION_PATCH"
|
|
||||||
- echo "VERSION $LFS_VERSION"
|
|
||||||
- |
|
- |
|
||||||
# Check that we're the most recent commit
|
curl -u $GEKY_BOT_RELEASES -X POST \
|
||||||
CURRENT_COMMIT=$(curl -f -u "$GEKY_BOT_RELEASES" \
|
https://api.github.com/repos/$TRAVIS_REPO_SLUG/git/refs \
|
||||||
https://api.github.com/repos/$TRAVIS_REPO_SLUG/commits/master \
|
-d "{
|
||||||
| jq -re '.sha')
|
\"ref\": \"refs/tags/$LFS_VERSION\",
|
||||||
if [ "$TRAVIS_COMMIT" == "$CURRENT_COMMIT" ]
|
\"sha\": \"$TRAVIS_COMMIT\"
|
||||||
|
}"
|
||||||
|
- |
|
||||||
|
curl -f -u $GEKY_BOT_RELEASES -X PATCH \
|
||||||
|
https://api.github.com/repos/$TRAVIS_REPO_SLUG/git/refs/tags/$LFS_VERSION \
|
||||||
|
-d "{
|
||||||
|
\"sha\": \"$TRAVIS_COMMIT\"
|
||||||
|
}"
|
||||||
|
# Create release notes from commits
|
||||||
|
- LFS_PREV_VERSION="v$LFS_VERSION_MAJOR.$(($LFS_VERSION_MINOR-1))"
|
||||||
|
- |
|
||||||
|
if [ $(git tag -l "$LFS_PREV_VERSION") ]
|
||||||
then
|
then
|
||||||
# Build release notes
|
curl -u $GEKY_BOT_RELEASES -X POST \
|
||||||
PREV=$(git tag --sort=-v:refname -l "v*" | head -1)
|
|
||||||
if [ ! -z "$PREV" ]
|
|
||||||
then
|
|
||||||
echo "PREV $PREV"
|
|
||||||
CHANGES=$'### Changes\n\n'$( \
|
|
||||||
git log --oneline $PREV.. --grep='^Merge' --invert-grep)
|
|
||||||
printf "CHANGES\n%s\n\n" "$CHANGES"
|
|
||||||
fi
|
|
||||||
# Create the release
|
|
||||||
curl -f -u "$GEKY_BOT_RELEASES" -X POST \
|
|
||||||
https://api.github.com/repos/$TRAVIS_REPO_SLUG/releases \
|
https://api.github.com/repos/$TRAVIS_REPO_SLUG/releases \
|
||||||
-d "{
|
-d "{
|
||||||
\"tag_name\": \"$LFS_VERSION\",
|
\"tag_name\": \"$LFS_VERSION\",
|
||||||
\"target_commitish\": \"$TRAVIS_COMMIT\",
|
\"name\": \"$LFS_VERSION\"
|
||||||
\"name\": \"${LFS_VERSION%.0}\",
|
|
||||||
\"body\": $(jq -sR '.' <<< "$CHANGES")
|
|
||||||
}"
|
}"
|
||||||
|
RELEASE=$(
|
||||||
|
curl -f -u $GEKY_BOT_RELEASES \
|
||||||
|
https://api.github.com/repos/$TRAVIS_REPO_SLUG/releases/tags/$LFS_VERSION
|
||||||
|
)
|
||||||
|
CHANGES=$(
|
||||||
|
git log --oneline $LFS_PREV_VERSION.. --grep='^Merge' --invert-grep
|
||||||
|
)
|
||||||
|
curl -f -u $GEKY_BOT_RELEASES -X PATCH \
|
||||||
|
https://api.github.com/repos/$TRAVIS_REPO_SLUG/releases/$(
|
||||||
|
jq -r '.id' <<< "$RELEASE"
|
||||||
|
) \
|
||||||
|
-d "$(
|
||||||
|
jq -s '{
|
||||||
|
"body": ((.[0] // "" | sub("(?<=\n)#+ Changes.*"; ""; "mi"))
|
||||||
|
+ "### Changes\n\n" + .[1])
|
||||||
|
}' <(jq '.body' <<< "$RELEASE") <(jq -sR '.' <<< "$CHANGES")
|
||||||
|
)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Manage statuses
|
# Manage statuses
|
||||||
|
|||||||
3
Makefile
3
Makefile
@@ -25,8 +25,7 @@ ifdef WORD
|
|||||||
override CFLAGS += -m$(WORD)
|
override CFLAGS += -m$(WORD)
|
||||||
endif
|
endif
|
||||||
override CFLAGS += -I.
|
override CFLAGS += -I.
|
||||||
override CFLAGS += -std=c99 -Wall -pedantic
|
override CFLAGS += -std=c99 -Wall -pedantic -Wshadow -Wunused-parameter
|
||||||
override CFLAGS += -Wshadow -Wunused-parameter -Wjump-misses-init
|
|
||||||
|
|
||||||
|
|
||||||
all: $(TARGET)
|
all: $(TARGET)
|
||||||
|
|||||||
@@ -47,24 +47,19 @@ int lfs_emubd_create(const struct lfs_config *cfg, const char *path) {
|
|||||||
|
|
||||||
// Load stats to continue incrementing
|
// Load stats to continue incrementing
|
||||||
snprintf(emu->child, LFS_NAME_MAX, "stats");
|
snprintf(emu->child, LFS_NAME_MAX, "stats");
|
||||||
|
|
||||||
FILE *f = fopen(emu->path, "r");
|
FILE *f = fopen(emu->path, "r");
|
||||||
if (!f && errno != ENOENT) {
|
if (!f) {
|
||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (errno == ENOENT) {
|
size_t res = fread(&emu->stats, sizeof(emu->stats), 1, f);
|
||||||
memset(&emu->stats, 0x0, sizeof(emu->stats));
|
if (res < 1) {
|
||||||
} else {
|
return -errno;
|
||||||
size_t res = fread(&emu->stats, sizeof(emu->stats), 1, f);
|
}
|
||||||
if (res < 1) {
|
|
||||||
return -errno;
|
|
||||||
}
|
|
||||||
|
|
||||||
err = fclose(f);
|
err = fclose(f);
|
||||||
if (err) {
|
if (err) {
|
||||||
return -errno;
|
return -errno;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
271
lfs.c
271
lfs.c
@@ -1373,10 +1373,7 @@ int lfs_file_opencfg(lfs_t *lfs, lfs_file_t *file,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// zero to avoid information leak
|
// zero to avoid information leak
|
||||||
lfs_cache_drop(lfs, &file->cache);
|
lfs_cache_zero(lfs, &file->cache);
|
||||||
if ((file->flags & 3) != LFS_O_RDONLY) {
|
|
||||||
lfs_cache_zero(lfs, &file->cache);
|
|
||||||
}
|
|
||||||
|
|
||||||
// add to list of files
|
// add to list of files
|
||||||
file->next = lfs->files;
|
file->next = lfs->files;
|
||||||
@@ -2058,8 +2055,8 @@ static int lfs_init(lfs_t *lfs, const struct lfs_config *cfg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// zero to avoid information leaks
|
// zero to avoid information leaks
|
||||||
|
lfs_cache_zero(lfs, &lfs->rcache);
|
||||||
lfs_cache_zero(lfs, &lfs->pcache);
|
lfs_cache_zero(lfs, &lfs->pcache);
|
||||||
lfs_cache_drop(lfs, &lfs->rcache);
|
|
||||||
|
|
||||||
// setup lookahead, round down to nearest 32-bits
|
// setup lookahead, round down to nearest 32-bits
|
||||||
LFS_ASSERT(lfs->cfg->lookahead % 32 == 0);
|
LFS_ASSERT(lfs->cfg->lookahead % 32 == 0);
|
||||||
@@ -2096,144 +2093,138 @@ cleanup:
|
|||||||
}
|
}
|
||||||
|
|
||||||
int lfs_format(lfs_t *lfs, const struct lfs_config *cfg) {
|
int lfs_format(lfs_t *lfs, const struct lfs_config *cfg) {
|
||||||
int err = 0;
|
int err = lfs_init(lfs, cfg);
|
||||||
if (true) {
|
if (err) {
|
||||||
err = lfs_init(lfs, cfg);
|
return err;
|
||||||
if (err) {
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
// create free lookahead
|
|
||||||
memset(lfs->free.buffer, 0, lfs->cfg->lookahead/8);
|
|
||||||
lfs->free.off = 0;
|
|
||||||
lfs->free.size = lfs_min(lfs->cfg->lookahead, lfs->cfg->block_count);
|
|
||||||
lfs->free.i = 0;
|
|
||||||
lfs_alloc_ack(lfs);
|
|
||||||
|
|
||||||
// create superblock dir
|
|
||||||
lfs_dir_t superdir;
|
|
||||||
err = lfs_dir_alloc(lfs, &superdir);
|
|
||||||
if (err) {
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
// write root directory
|
|
||||||
lfs_dir_t root;
|
|
||||||
err = lfs_dir_alloc(lfs, &root);
|
|
||||||
if (err) {
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
err = lfs_dir_commit(lfs, &root, NULL, 0);
|
|
||||||
if (err) {
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
lfs->root[0] = root.pair[0];
|
|
||||||
lfs->root[1] = root.pair[1];
|
|
||||||
|
|
||||||
// write superblocks
|
|
||||||
lfs_superblock_t superblock = {
|
|
||||||
.off = sizeof(superdir.d),
|
|
||||||
.d.type = LFS_TYPE_SUPERBLOCK,
|
|
||||||
.d.elen = sizeof(superblock.d) - sizeof(superblock.d.magic) - 4,
|
|
||||||
.d.nlen = sizeof(superblock.d.magic),
|
|
||||||
.d.version = LFS_DISK_VERSION,
|
|
||||||
.d.magic = {"littlefs"},
|
|
||||||
.d.block_size = lfs->cfg->block_size,
|
|
||||||
.d.block_count = lfs->cfg->block_count,
|
|
||||||
.d.root = {lfs->root[0], lfs->root[1]},
|
|
||||||
};
|
|
||||||
superdir.d.tail[0] = root.pair[0];
|
|
||||||
superdir.d.tail[1] = root.pair[1];
|
|
||||||
superdir.d.size = sizeof(superdir.d) + sizeof(superblock.d) + 4;
|
|
||||||
|
|
||||||
// write both pairs to be safe
|
|
||||||
lfs_superblock_tole32(&superblock.d);
|
|
||||||
bool valid = false;
|
|
||||||
for (int i = 0; i < 2; i++) {
|
|
||||||
err = lfs_dir_commit(lfs, &superdir, (struct lfs_region[]){
|
|
||||||
{sizeof(superdir.d), sizeof(superblock.d),
|
|
||||||
&superblock.d, sizeof(superblock.d)}
|
|
||||||
}, 1);
|
|
||||||
if (err && err != LFS_ERR_CORRUPT) {
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
valid = valid || !err;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!valid) {
|
|
||||||
err = LFS_ERR_CORRUPT;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
// sanity check that fetch works
|
|
||||||
err = lfs_dir_fetch(lfs, &superdir, (const lfs_block_t[2]){0, 1});
|
|
||||||
if (err) {
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
lfs_alloc_ack(lfs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// create free lookahead
|
||||||
|
memset(lfs->free.buffer, 0, lfs->cfg->lookahead/8);
|
||||||
|
lfs->free.off = 0;
|
||||||
|
lfs->free.size = lfs_min(lfs->cfg->lookahead, lfs->cfg->block_count);
|
||||||
|
lfs->free.i = 0;
|
||||||
|
lfs_alloc_ack(lfs);
|
||||||
|
|
||||||
|
// create superblock dir
|
||||||
|
lfs_dir_t superdir;
|
||||||
|
err = lfs_dir_alloc(lfs, &superdir);
|
||||||
|
if (err) {
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
// write root directory
|
||||||
|
lfs_dir_t root;
|
||||||
|
err = lfs_dir_alloc(lfs, &root);
|
||||||
|
if (err) {
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
err = lfs_dir_commit(lfs, &root, NULL, 0);
|
||||||
|
if (err) {
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
lfs->root[0] = root.pair[0];
|
||||||
|
lfs->root[1] = root.pair[1];
|
||||||
|
|
||||||
|
// write superblocks
|
||||||
|
lfs_superblock_t superblock = {
|
||||||
|
.off = sizeof(superdir.d),
|
||||||
|
.d.type = LFS_TYPE_SUPERBLOCK,
|
||||||
|
.d.elen = sizeof(superblock.d) - sizeof(superblock.d.magic) - 4,
|
||||||
|
.d.nlen = sizeof(superblock.d.magic),
|
||||||
|
.d.version = LFS_DISK_VERSION,
|
||||||
|
.d.magic = {"littlefs"},
|
||||||
|
.d.block_size = lfs->cfg->block_size,
|
||||||
|
.d.block_count = lfs->cfg->block_count,
|
||||||
|
.d.root = {lfs->root[0], lfs->root[1]},
|
||||||
|
};
|
||||||
|
superdir.d.tail[0] = root.pair[0];
|
||||||
|
superdir.d.tail[1] = root.pair[1];
|
||||||
|
superdir.d.size = sizeof(superdir.d) + sizeof(superblock.d) + 4;
|
||||||
|
|
||||||
|
// write both pairs to be safe
|
||||||
|
lfs_superblock_tole32(&superblock.d);
|
||||||
|
bool valid = false;
|
||||||
|
for (int i = 0; i < 2; i++) {
|
||||||
|
err = lfs_dir_commit(lfs, &superdir, (struct lfs_region[]){
|
||||||
|
{sizeof(superdir.d), sizeof(superblock.d),
|
||||||
|
&superblock.d, sizeof(superblock.d)}
|
||||||
|
}, 1);
|
||||||
|
if (err && err != LFS_ERR_CORRUPT) {
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
valid = valid || !err;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!valid) {
|
||||||
|
err = LFS_ERR_CORRUPT;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
// sanity check that fetch works
|
||||||
|
err = lfs_dir_fetch(lfs, &superdir, (const lfs_block_t[2]){0, 1});
|
||||||
|
if (err) {
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
lfs_alloc_ack(lfs);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
lfs_deinit(lfs);
|
lfs_deinit(lfs);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
int lfs_mount(lfs_t *lfs, const struct lfs_config *cfg) {
|
int lfs_mount(lfs_t *lfs, const struct lfs_config *cfg) {
|
||||||
int err = 0;
|
int err = lfs_init(lfs, cfg);
|
||||||
if (true) {
|
if (err) {
|
||||||
err = lfs_init(lfs, cfg);
|
return err;
|
||||||
if (err) {
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
// setup free lookahead
|
|
||||||
lfs->free.off = 0;
|
|
||||||
lfs->free.size = 0;
|
|
||||||
lfs->free.i = 0;
|
|
||||||
lfs_alloc_ack(lfs);
|
|
||||||
|
|
||||||
// load superblock
|
|
||||||
lfs_dir_t dir;
|
|
||||||
lfs_superblock_t superblock;
|
|
||||||
err = lfs_dir_fetch(lfs, &dir, (const lfs_block_t[2]){0, 1});
|
|
||||||
if (err && err != LFS_ERR_CORRUPT) {
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!err) {
|
|
||||||
err = lfs_bd_read(lfs, dir.pair[0], sizeof(dir.d),
|
|
||||||
&superblock.d, sizeof(superblock.d));
|
|
||||||
lfs_superblock_fromle32(&superblock.d);
|
|
||||||
if (err) {
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
lfs->root[0] = superblock.d.root[0];
|
|
||||||
lfs->root[1] = superblock.d.root[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (err || memcmp(superblock.d.magic, "littlefs", 8) != 0) {
|
|
||||||
LFS_ERROR("Invalid superblock at %d %d", 0, 1);
|
|
||||||
err = LFS_ERR_CORRUPT;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t major_version = (0xffff & (superblock.d.version >> 16));
|
|
||||||
uint16_t minor_version = (0xffff & (superblock.d.version >> 0));
|
|
||||||
if ((major_version != LFS_DISK_VERSION_MAJOR ||
|
|
||||||
minor_version > LFS_DISK_VERSION_MINOR)) {
|
|
||||||
LFS_ERROR("Invalid version %d.%d", major_version, minor_version);
|
|
||||||
err = LFS_ERR_INVAL;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// setup free lookahead
|
||||||
|
lfs->free.off = 0;
|
||||||
|
lfs->free.size = 0;
|
||||||
|
lfs->free.i = 0;
|
||||||
|
lfs_alloc_ack(lfs);
|
||||||
|
|
||||||
|
// load superblock
|
||||||
|
lfs_dir_t dir;
|
||||||
|
lfs_superblock_t superblock;
|
||||||
|
err = lfs_dir_fetch(lfs, &dir, (const lfs_block_t[2]){0, 1});
|
||||||
|
if (err && err != LFS_ERR_CORRUPT) {
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!err) {
|
||||||
|
err = lfs_bd_read(lfs, dir.pair[0], sizeof(dir.d),
|
||||||
|
&superblock.d, sizeof(superblock.d));
|
||||||
|
lfs_superblock_fromle32(&superblock.d);
|
||||||
|
if (err) {
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
lfs->root[0] = superblock.d.root[0];
|
||||||
|
lfs->root[1] = superblock.d.root[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (err || memcmp(superblock.d.magic, "littlefs", 8) != 0) {
|
||||||
|
LFS_ERROR("Invalid superblock at %d %d", 0, 1);
|
||||||
|
err = LFS_ERR_CORRUPT;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t major_version = (0xffff & (superblock.d.version >> 16));
|
||||||
|
uint16_t minor_version = (0xffff & (superblock.d.version >> 0));
|
||||||
|
if ((major_version != LFS_DISK_VERSION_MAJOR ||
|
||||||
|
minor_version > LFS_DISK_VERSION_MINOR)) {
|
||||||
|
LFS_ERROR("Invalid version %d.%d", major_version, minor_version);
|
||||||
|
err = LFS_ERR_INVAL;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
|
||||||
lfs_deinit(lfs);
|
lfs_deinit(lfs);
|
||||||
@@ -2481,11 +2472,7 @@ int lfs_deorphan(lfs_t *lfs) {
|
|||||||
lfs_dir_t cwd = {.d.tail[0] = 0, .d.tail[1] = 1};
|
lfs_dir_t cwd = {.d.tail[0] = 0, .d.tail[1] = 1};
|
||||||
|
|
||||||
// iterate over all directory directory entries
|
// iterate over all directory directory entries
|
||||||
for (int i = 0; i < lfs->cfg->block_count; i++) {
|
while (!lfs_pairisnull(cwd.d.tail)) {
|
||||||
if (lfs_pairisnull(cwd.d.tail)) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int err = lfs_dir_fetch(lfs, &cwd, cwd.d.tail);
|
int err = lfs_dir_fetch(lfs, &cwd, cwd.d.tail);
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
@@ -2514,7 +2501,7 @@ int lfs_deorphan(lfs_t *lfs) {
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!lfs_pairsync(entry.d.u.dir, pdir.d.tail)) {
|
if (!lfs_pairsync(entry.d.u.dir, pdir.d.tail)) {
|
||||||
@@ -2530,7 +2517,7 @@ int lfs_deorphan(lfs_t *lfs) {
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2575,7 +2562,5 @@ int lfs_deorphan(lfs_t *lfs) {
|
|||||||
memcpy(&pdir, &cwd, sizeof(pdir));
|
memcpy(&pdir, &cwd, sizeof(pdir));
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we reached here, we have more directory pairs than blocks in the
|
return 0;
|
||||||
// filesystem... So something must be horribly wrong
|
|
||||||
return LFS_ERR_CORRUPT;
|
|
||||||
}
|
}
|
||||||
|
|||||||
2
lfs.h
2
lfs.h
@@ -21,7 +21,7 @@ extern "C"
|
|||||||
// Software library version
|
// Software library version
|
||||||
// Major (top-nibble), incremented on backwards incompatible changes
|
// Major (top-nibble), incremented on backwards incompatible changes
|
||||||
// Minor (bottom-nibble), incremented on feature additions
|
// Minor (bottom-nibble), incremented on feature additions
|
||||||
#define LFS_VERSION 0x00010006
|
#define LFS_VERSION 0x00010005
|
||||||
#define LFS_VERSION_MAJOR (0xffff & (LFS_VERSION >> 16))
|
#define LFS_VERSION_MAJOR (0xffff & (LFS_VERSION >> 16))
|
||||||
#define LFS_VERSION_MINOR (0xffff & (LFS_VERSION >> 0))
|
#define LFS_VERSION_MINOR (0xffff & (LFS_VERSION >> 0))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user