Generated v2 prefixes

This commit is contained in:
geky-bot
2022-11-10 21:10:59 +00:00
8 changed files with 35 additions and 19 deletions

View File

@@ -292,6 +292,27 @@ jobs:
- name: test-valgrind - name: test-valgrind
run: make test TESTFLAGS+="-k --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 # self-host with littlefs-fuse for a fuzz-like test
fuse: fuse:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04

View File

@@ -41,8 +41,7 @@ override CFLAGS += -DLFS2_YES_TRACE
endif endif
override CFLAGS += -g3 override CFLAGS += -g3
override CFLAGS += -I. override CFLAGS += -I.
override CFLAGS += -std=c99 -Wall -pedantic override CFLAGS += -std=c99 -Wall -Wextra -pedantic
override CFLAGS += -Wextra -Wshadow -Wjump-misses-init -Wundef
ifdef VERBOSE ifdef VERBOSE
override TESTFLAGS += -v override TESTFLAGS += -v

View File

@@ -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 [mklfs]: https://github.com/whitecatboard/Lua-RTOS-ESP32/tree/master/components/mklfs/src
[Lua RTOS]: https://github.com/whitecatboard/Lua-RTOS-ESP32 [Lua RTOS]: https://github.com/whitecatboard/Lua-RTOS-ESP32
[Mbed OS]: https://github.com/armmbed/mbed-os [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 [SPIFFS]: https://github.com/pellepl/spiffs
[Dhara]: https://github.com/dlbeer/dhara [Dhara]: https://github.com/dlbeer/dhara
[littlefs-python]: https://pypi.org/project/littlefs-python/ [littlefs-python]: https://pypi.org/project/littlefs-python/

View File

@@ -204,7 +204,7 @@ int lfs2_filebd_sync(const struct lfs2_config *cfg) {
// file sync // file sync
lfs2_filebd_t *bd = cfg->context; lfs2_filebd_t *bd = cfg->context;
#ifdef _WIN32 #ifdef _WIN32
int err = FlushFileBuffers((HANDLE) _get_osfhandle(fd)) ? 0 : -1; int err = FlushFileBuffers((HANDLE) _get_osfhandle(bd->fd)) ? 0 : -1;
#else #else
int err = fsync(bd->fd); int err = fsync(bd->fd);
#endif #endif

10
lfs2.c
View File

@@ -865,11 +865,6 @@ static int lfs2_dir_traverse(lfs2_t *lfs2,
}; };
sp += 1; sp += 1;
dir = dir;
off = off;
ptag = ptag;
attrs = attrs;
attrcount = attrcount;
tmask = 0; tmask = 0;
ttag = 0; ttag = 0;
begin = 0; begin = 0;
@@ -1162,6 +1157,7 @@ static lfs2_stag_t lfs2_dir_fetchmatch(lfs2_t *lfs2,
dir->erased = false; dir->erased = false;
break; break;
} }
return err;
} }
lfs2_pair_fromle32(temptail); lfs2_pair_fromle32(temptail);
} }
@@ -2998,12 +2994,14 @@ cleanup:
return err; return err;
} }
#ifndef LFS2_NO_MALLOC
static int lfs2_file_rawopen(lfs2_t *lfs2, lfs2_file_t *file, static int lfs2_file_rawopen(lfs2_t *lfs2, lfs2_file_t *file,
const char *path, int flags) { const char *path, int flags) {
static const struct lfs2_file_config defaults = {0}; static const struct lfs2_file_config defaults = {0};
int err = lfs2_file_rawopencfg(lfs2, file, path, flags, &defaults); int err = lfs2_file_rawopencfg(lfs2, file, path, flags, &defaults);
return err; return err;
} }
#endif
static int lfs2_file_rawclose(lfs2_t *lfs2, lfs2_file_t *file) { static int lfs2_file_rawclose(lfs2_t *lfs2, lfs2_file_t *file) {
#ifndef LFS2_READONLY #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) { if (superblock.block_size != lfs2->cfg->block_size) {
LFS2_ERROR("Invalid block size (%"PRIu32" != %"PRIu32")", 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; err = LFS2_ERR_INVAL;
goto cleanup; goto cleanup;
} }

4
lfs2.h
View File

@@ -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. // are values from the enum lfs2_open_flags that are bitwise-ored together.
// //
// The config struct provides additional config options per file as described // 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 // above. The config struct must remain allocated while the file is open, and
// config struct must be zeroed for defaults and backwards compatibility. // the config struct must be zeroed for defaults and backwards compatibility.
// //
// Returns a negative error code on failure. // Returns a negative error code on failure.
int lfs2_file_opencfg(lfs2_t *lfs2, lfs2_file_t *file, int lfs2_file_opencfg(lfs2_t *lfs2, lfs2_file_t *file,

View File

@@ -167,10 +167,9 @@ static inline int lfs2_scmp(uint32_t a, uint32_t b) {
// Convert between 32-bit little-endian and native order // Convert between 32-bit little-endian and native order
static inline uint32_t lfs2_fromle32(uint32_t a) { static inline uint32_t lfs2_fromle32(uint32_t a) {
#if !defined(LFS2_NO_INTRINSICS) && ( \ #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 ) || \
(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; return a;
#elif !defined(LFS2_NO_INTRINSICS) && ( \ #elif !defined(LFS2_NO_INTRINSICS) && ( \
(defined( BYTE_ORDER ) && defined( ORDER_BIG_ENDIAN ) && BYTE_ORDER == ORDER_BIG_ENDIAN ) || \ (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 ) || \
(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); return __builtin_bswap32(a);
#elif !defined(LFS2_NO_INTRINSICS) && ( \ #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 ) || \
(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; return a;
#else #else
return (((uint8_t*)&a)[0] << 24) | return (((uint8_t*)&a)[0] << 24) |

View File

@@ -93,7 +93,7 @@ PROLOGUE = """
__attribute__((unused)) lfs2_dir_t dir; __attribute__((unused)) lfs2_dir_t dir;
__attribute__((unused)) struct lfs2_info info; __attribute__((unused)) struct lfs2_info info;
__attribute__((unused)) char path[1024]; __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)) lfs2_size_t size;
__attribute__((unused)) int err; __attribute__((unused)) int err;