forked from Imagelibrary/littlefs
Generated v2 prefixes
This commit is contained in:
21
.github/workflows/test.yml
vendored
21
.github/workflows/test.yml
vendored
@@ -292,6 +292,27 @@ jobs:
|
||||
- name: test-valgrind
|
||||
run: make test TESTFLAGS+="-k --valgrind"
|
||||
|
||||
# test that compilation is warning free under clang
|
||||
clang:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: install
|
||||
run: |
|
||||
# need toml, also pip3 isn't installed by default?
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -qq python3 python3-pip
|
||||
sudo pip3 install toml
|
||||
- name: install-clang
|
||||
run: |
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -qq clang
|
||||
echo "CC=clang" >> $GITHUB_ENV
|
||||
clang --version
|
||||
# no reason to not test again
|
||||
- name: test-clang
|
||||
run: make test TESTFLAGS+="-k"
|
||||
|
||||
# self-host with littlefs-fuse for a fuzz-like test
|
||||
fuse:
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
3
Makefile
3
Makefile
@@ -41,8 +41,7 @@ override CFLAGS += -DLFS2_YES_TRACE
|
||||
endif
|
||||
override CFLAGS += -g3
|
||||
override CFLAGS += -I.
|
||||
override CFLAGS += -std=c99 -Wall -pedantic
|
||||
override CFLAGS += -Wextra -Wshadow -Wjump-misses-init -Wundef
|
||||
override CFLAGS += -std=c99 -Wall -Wextra -pedantic
|
||||
|
||||
ifdef VERBOSE
|
||||
override TESTFLAGS += -v
|
||||
|
||||
@@ -252,7 +252,7 @@ License Identifiers that are here available: http://spdx.org/licenses/
|
||||
[mklfs]: https://github.com/whitecatboard/Lua-RTOS-ESP32/tree/master/components/mklfs/src
|
||||
[Lua RTOS]: https://github.com/whitecatboard/Lua-RTOS-ESP32
|
||||
[Mbed OS]: https://github.com/armmbed/mbed-os
|
||||
[LittleFileSystem]: https://os.mbed.com/docs/mbed-os/v5.12/apis/littlefilesystem.html
|
||||
[LittleFileSystem]: https://os.mbed.com/docs/mbed-os/latest/apis/littlefilesystem.html
|
||||
[SPIFFS]: https://github.com/pellepl/spiffs
|
||||
[Dhara]: https://github.com/dlbeer/dhara
|
||||
[littlefs-python]: https://pypi.org/project/littlefs-python/
|
||||
|
||||
@@ -204,7 +204,7 @@ int lfs2_filebd_sync(const struct lfs2_config *cfg) {
|
||||
// file sync
|
||||
lfs2_filebd_t *bd = cfg->context;
|
||||
#ifdef _WIN32
|
||||
int err = FlushFileBuffers((HANDLE) _get_osfhandle(fd)) ? 0 : -1;
|
||||
int err = FlushFileBuffers((HANDLE) _get_osfhandle(bd->fd)) ? 0 : -1;
|
||||
#else
|
||||
int err = fsync(bd->fd);
|
||||
#endif
|
||||
|
||||
10
lfs2.c
10
lfs2.c
@@ -865,11 +865,6 @@ static int lfs2_dir_traverse(lfs2_t *lfs2,
|
||||
};
|
||||
sp += 1;
|
||||
|
||||
dir = dir;
|
||||
off = off;
|
||||
ptag = ptag;
|
||||
attrs = attrs;
|
||||
attrcount = attrcount;
|
||||
tmask = 0;
|
||||
ttag = 0;
|
||||
begin = 0;
|
||||
@@ -1162,6 +1157,7 @@ static lfs2_stag_t lfs2_dir_fetchmatch(lfs2_t *lfs2,
|
||||
dir->erased = false;
|
||||
break;
|
||||
}
|
||||
return err;
|
||||
}
|
||||
lfs2_pair_fromle32(temptail);
|
||||
}
|
||||
@@ -2998,12 +2994,14 @@ cleanup:
|
||||
return err;
|
||||
}
|
||||
|
||||
#ifndef LFS2_NO_MALLOC
|
||||
static int lfs2_file_rawopen(lfs2_t *lfs2, lfs2_file_t *file,
|
||||
const char *path, int flags) {
|
||||
static const struct lfs2_file_config defaults = {0};
|
||||
int err = lfs2_file_rawopencfg(lfs2, file, path, flags, &defaults);
|
||||
return err;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int lfs2_file_rawclose(lfs2_t *lfs2, lfs2_file_t *file) {
|
||||
#ifndef LFS2_READONLY
|
||||
@@ -4195,7 +4193,7 @@ static int lfs2_rawmount(lfs2_t *lfs2, const struct lfs2_config *cfg) {
|
||||
|
||||
if (superblock.block_size != lfs2->cfg->block_size) {
|
||||
LFS2_ERROR("Invalid block size (%"PRIu32" != %"PRIu32")",
|
||||
superblock.block_count, lfs2->cfg->block_count);
|
||||
superblock.block_size, lfs2->cfg->block_size);
|
||||
err = LFS2_ERR_INVAL;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
4
lfs2.h
4
lfs2.h
@@ -534,8 +534,8 @@ int lfs2_file_open(lfs2_t *lfs2, lfs2_file_t *file,
|
||||
// are values from the enum lfs2_open_flags that are bitwise-ored together.
|
||||
//
|
||||
// The config struct provides additional config options per file as described
|
||||
// above. The config struct must be allocated while the file is open, and the
|
||||
// config struct must be zeroed for defaults and backwards compatibility.
|
||||
// above. The config struct must remain allocated while the file is open, and
|
||||
// the config struct must be zeroed for defaults and backwards compatibility.
|
||||
//
|
||||
// Returns a negative error code on failure.
|
||||
int lfs2_file_opencfg(lfs2_t *lfs2, lfs2_file_t *file,
|
||||
|
||||
10
lfs2_util.h
10
lfs2_util.h
@@ -167,10 +167,9 @@ static inline int lfs2_scmp(uint32_t a, uint32_t b) {
|
||||
|
||||
// Convert between 32-bit little-endian and native order
|
||||
static inline uint32_t lfs2_fromle32(uint32_t a) {
|
||||
#if !defined(LFS2_NO_INTRINSICS) && ( \
|
||||
(defined( BYTE_ORDER ) && defined( ORDER_LITTLE_ENDIAN ) && BYTE_ORDER == ORDER_LITTLE_ENDIAN ) || \
|
||||
#if (defined( BYTE_ORDER ) && defined( ORDER_LITTLE_ENDIAN ) && BYTE_ORDER == ORDER_LITTLE_ENDIAN ) || \
|
||||
(defined(__BYTE_ORDER ) && defined(__ORDER_LITTLE_ENDIAN ) && __BYTE_ORDER == __ORDER_LITTLE_ENDIAN ) || \
|
||||
(defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__))
|
||||
(defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
|
||||
return a;
|
||||
#elif !defined(LFS2_NO_INTRINSICS) && ( \
|
||||
(defined( BYTE_ORDER ) && defined( ORDER_BIG_ENDIAN ) && BYTE_ORDER == ORDER_BIG_ENDIAN ) || \
|
||||
@@ -196,10 +195,9 @@ static inline uint32_t lfs2_frombe32(uint32_t a) {
|
||||
(defined(__BYTE_ORDER ) && defined(__ORDER_LITTLE_ENDIAN ) && __BYTE_ORDER == __ORDER_LITTLE_ENDIAN ) || \
|
||||
(defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__))
|
||||
return __builtin_bswap32(a);
|
||||
#elif !defined(LFS2_NO_INTRINSICS) && ( \
|
||||
(defined( BYTE_ORDER ) && defined( ORDER_BIG_ENDIAN ) && BYTE_ORDER == ORDER_BIG_ENDIAN ) || \
|
||||
#elif (defined( BYTE_ORDER ) && defined( ORDER_BIG_ENDIAN ) && BYTE_ORDER == ORDER_BIG_ENDIAN ) || \
|
||||
(defined(__BYTE_ORDER ) && defined(__ORDER_BIG_ENDIAN ) && __BYTE_ORDER == __ORDER_BIG_ENDIAN ) || \
|
||||
(defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__))
|
||||
(defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
|
||||
return a;
|
||||
#else
|
||||
return (((uint8_t*)&a)[0] << 24) |
|
||||
|
||||
@@ -93,7 +93,7 @@ PROLOGUE = """
|
||||
__attribute__((unused)) lfs2_dir_t dir;
|
||||
__attribute__((unused)) struct lfs2_info info;
|
||||
__attribute__((unused)) char path[1024];
|
||||
__attribute__((unused)) uint8_t buffer[1024];
|
||||
__attribute__((unused)) uint8_t buffer[(1024 > LFS2_BLOCK_SIZE * 4) ? (1024) : (LFS2_BLOCK_SIZE * 4)];
|
||||
__attribute__((unused)) lfs2_size_t size;
|
||||
__attribute__((unused)) int err;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user