mirror of
https://github.com/eledio-devices/thirdparty-littlefs.git
synced 2025-11-02 08:48:29 +01:00
Compare commits
1 Commits
lfs-util-i
...
patch-rele
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c8be114e77 |
26
.travis.yml
26
.travis.yml
@@ -248,34 +248,30 @@ jobs:
|
|||||||
-m "Generated v$LFS_VERSION_MAJOR prefixes")
|
-m "Generated v$LFS_VERSION_MAJOR prefixes")
|
||||||
git reset --hard
|
git reset --hard
|
||||||
# Update major version branches (vN and vN-prefix)
|
# Update major version branches (vN and vN-prefix)
|
||||||
git push https://$GEKY_BOT_RELEASES@github.com/$TRAVIS_REPO_SLUG.git \
|
git push --atomic https://$GEKY_BOT_RELEASES@github.com/$TRAVIS_REPO_SLUG.git \
|
||||||
v$LFS_VERSION_MAJOR \
|
v$LFS_VERSION_MAJOR \
|
||||||
v$LFS_VERSION_MAJOR-prefix
|
v$LFS_VERSION_MAJOR-prefix
|
||||||
# Create patch version tag (vN.N.N)
|
|
||||||
curl -f -u "$GEKY_BOT_RELEASES" -X POST \
|
|
||||||
https://api.github.com/repos/$TRAVIS_REPO_SLUG/git/refs \
|
|
||||||
-d "{
|
|
||||||
\"ref\": \"refs/tags/$LFS_VERSION\",
|
|
||||||
\"sha\": \"$TRAVIS_COMMIT\"
|
|
||||||
}"
|
|
||||||
# Create minor release?
|
|
||||||
[[ "$LFS_VERSION" == *.0 ]] || exit 0
|
|
||||||
# Build release notes
|
# Build release notes
|
||||||
PREV=$(git tag --sort=-v:refname -l "v*.0" | head -1)
|
PREV=$(git tag --sort=-v:refname -l "v*" | head -1)
|
||||||
if [ ! -z "$PREV" ]
|
if [ ! -z "$PREV" ]
|
||||||
then
|
then
|
||||||
echo "PREV $PREV"
|
echo "PREV $PREV"
|
||||||
CHANGES=$'### Changes\n\n'$( \
|
CHANGES=$(git log --oneline $PREV.. --grep='^Merge' --invert-grep)
|
||||||
git log --oneline $PREV.. --grep='^Merge' --invert-grep)
|
|
||||||
printf "CHANGES\n%s\n\n" "$CHANGES"
|
printf "CHANGES\n%s\n\n" "$CHANGES"
|
||||||
fi
|
fi
|
||||||
# Create the release
|
case ${GEKY_BOT_DRAFT:-minor} in
|
||||||
|
true) DRAFT=true ;;
|
||||||
|
minor) DRAFT=$(jq -R 'endswith(".0")' <<< "$LFS_VERSION") ;;
|
||||||
|
false) DRAFT=false ;;
|
||||||
|
esac
|
||||||
|
# Create the release and patch version tag (vN.N.N)
|
||||||
curl -f -u "$GEKY_BOT_RELEASES" -X POST \
|
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\",
|
||||||
\"name\": \"${LFS_VERSION%.0}\",
|
\"name\": \"${LFS_VERSION%.0}\",
|
||||||
\"draft\": true,
|
\"target_commitish\": \"$TRAVIS_COMMIT\",
|
||||||
|
\"draft\": $DRAFT,
|
||||||
\"body\": $(jq -sR '.' <<< "$CHANGES")
|
\"body\": $(jq -sR '.' <<< "$CHANGES")
|
||||||
}" #"
|
}" #"
|
||||||
SCRIPT
|
SCRIPT
|
||||||
|
|||||||
1
lfs.c
1
lfs.c
@@ -5,6 +5,7 @@
|
|||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
#include "lfs.h"
|
#include "lfs.h"
|
||||||
|
#include "lfs_util.h"
|
||||||
|
|
||||||
|
|
||||||
/// Caching block device operations ///
|
/// Caching block device operations ///
|
||||||
|
|||||||
22
lfs.h
22
lfs.h
@@ -7,7 +7,8 @@
|
|||||||
#ifndef LFS_H
|
#ifndef LFS_H
|
||||||
#define LFS_H
|
#define LFS_H
|
||||||
|
|
||||||
#include "lfs_util.h"
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C"
|
||||||
@@ -65,6 +66,25 @@ typedef uint32_t lfs_block_t;
|
|||||||
#define LFS_ATTR_MAX 1022
|
#define LFS_ATTR_MAX 1022
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Possible error codes, these are negative to allow
|
||||||
|
// valid positive return values
|
||||||
|
enum lfs_error {
|
||||||
|
LFS_ERR_OK = 0, // No error
|
||||||
|
LFS_ERR_IO = -5, // Error during device operation
|
||||||
|
LFS_ERR_CORRUPT = -84, // Corrupted
|
||||||
|
LFS_ERR_NOENT = -2, // No directory entry
|
||||||
|
LFS_ERR_EXIST = -17, // Entry already exists
|
||||||
|
LFS_ERR_NOTDIR = -20, // Entry is not a dir
|
||||||
|
LFS_ERR_ISDIR = -21, // Entry is a dir
|
||||||
|
LFS_ERR_NOTEMPTY = -39, // Dir is not empty
|
||||||
|
LFS_ERR_BADF = -9, // Bad file number
|
||||||
|
LFS_ERR_FBIG = -27, // File too large
|
||||||
|
LFS_ERR_INVAL = -22, // Invalid parameter
|
||||||
|
LFS_ERR_NOSPC = -28, // No space left on device
|
||||||
|
LFS_ERR_NOMEM = -12, // No more memory available
|
||||||
|
LFS_ERR_NOATTR = -61, // No data/attr available
|
||||||
|
LFS_ERR_NAMETOOLONG = -36, // File name too long
|
||||||
|
};
|
||||||
|
|
||||||
// File types
|
// File types
|
||||||
enum lfs_type {
|
enum lfs_type {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
#include "lfs_util.h"
|
#include "lfs_util.h"
|
||||||
|
|
||||||
// Only compile if user does not provide custom config
|
// Only compile if user does not provide custom config
|
||||||
#ifndef LFS_UTIL
|
#ifndef LFS_CONFIG
|
||||||
|
|
||||||
|
|
||||||
// Software CRC implementation with small lookup table
|
// Software CRC implementation with small lookup table
|
||||||
|
|||||||
43
lfs_util.h
43
lfs_util.h
@@ -3,21 +3,20 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 2017, Arm Limited. All rights reserved.
|
* Copyright (c) 2017, Arm Limited. All rights reserved.
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*
|
|
||||||
* Can be overridden by users with their own configuration by defining
|
|
||||||
* LFS_UTIL as a header file (-DLFS_UTIL=my_lfs_util.h)
|
|
||||||
*
|
|
||||||
* If LFS_UTIL is defined, none of the default definitions will be
|
|
||||||
* emitted and must be provided by the user's header file. To start, I would
|
|
||||||
* suggest copying lfs_util.h and modifying as needed.
|
|
||||||
*/
|
*/
|
||||||
#ifndef LFS_UTIL_H
|
#ifndef LFS_UTIL_H
|
||||||
#define LFS_UTIL_H
|
#define LFS_UTIL_H
|
||||||
|
|
||||||
#ifdef LFS_UTIL
|
// Users can override lfs_util.h with their own configuration by defining
|
||||||
|
// LFS_CONFIG as a header file to include (-DLFS_CONFIG=lfs_config.h).
|
||||||
|
//
|
||||||
|
// If LFS_CONFIG is used, none of the default utils will be emitted and must be
|
||||||
|
// provided by the config file. To start, I would suggest copying lfs_util.h
|
||||||
|
// and modifying as needed.
|
||||||
|
#ifdef LFS_CONFIG
|
||||||
#define LFS_STRINGIZE(x) LFS_STRINGIZE2(x)
|
#define LFS_STRINGIZE(x) LFS_STRINGIZE2(x)
|
||||||
#define LFS_STRINGIZE2(x) #x
|
#define LFS_STRINGIZE2(x) #x
|
||||||
#include LFS_STRINGIZE(LFS_UTIL)
|
#include LFS_STRINGIZE(LFS_CONFIG)
|
||||||
#else
|
#else
|
||||||
|
|
||||||
// System includes
|
// System includes
|
||||||
@@ -45,28 +44,6 @@ extern "C"
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Possible error codes, these are negative to allow valid positive
|
|
||||||
// return values. May be redefined to system error codes as long as
|
|
||||||
// they are negative.
|
|
||||||
enum lfs_error {
|
|
||||||
LFS_ERR_OK = 0, // No error
|
|
||||||
LFS_ERR_IO = -5, // Error during device operation
|
|
||||||
LFS_ERR_CORRUPT = -84, // Corrupted
|
|
||||||
LFS_ERR_NOENT = -2, // No directory entry
|
|
||||||
LFS_ERR_EXIST = -17, // Entry already exists
|
|
||||||
LFS_ERR_NOTDIR = -20, // Entry is not a dir
|
|
||||||
LFS_ERR_ISDIR = -21, // Entry is a dir
|
|
||||||
LFS_ERR_NOTEMPTY = -39, // Dir is not empty
|
|
||||||
LFS_ERR_BADF = -9, // Bad file number
|
|
||||||
LFS_ERR_FBIG = -27, // File too large
|
|
||||||
LFS_ERR_INVAL = -22, // Invalid parameter
|
|
||||||
LFS_ERR_NOSPC = -28, // No space left on device
|
|
||||||
LFS_ERR_NOMEM = -12, // No more memory available
|
|
||||||
LFS_ERR_NOATTR = -61, // No data/attr available
|
|
||||||
LFS_ERR_NAMETOOLONG = -36, // File name too long
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// Macros, may be replaced by system specific wrappers. Arguments to these
|
// Macros, may be replaced by system specific wrappers. Arguments to these
|
||||||
// macros must not have side-effects as the macros can be removed for a smaller
|
// macros must not have side-effects as the macros can be removed for a smaller
|
||||||
// code footprint
|
// code footprint
|
||||||
@@ -169,8 +146,8 @@ static inline uint32_t lfs_popc(uint32_t a) {
|
|||||||
|
|
||||||
// Find the sequence comparison of a and b, this is the distance
|
// Find the sequence comparison of a and b, this is the distance
|
||||||
// between a and b ignoring overflow
|
// between a and b ignoring overflow
|
||||||
static inline int32_t lfs_scmp(uint32_t a, uint32_t b) {
|
static inline int lfs_scmp(uint32_t a, uint32_t b) {
|
||||||
return (int32_t)(uint32_t)(a - b);
|
return (int)(unsigned)(a - b);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert between 32-bit little-endian and native order
|
// Convert between 32-bit little-endian and native order
|
||||||
|
|||||||
Reference in New Issue
Block a user