File tree Expand file tree Collapse file tree 3 files changed +51
-5
lines changed Expand file tree Collapse file tree 3 files changed +51
-5
lines changed Original file line number Diff line number Diff line change @@ -45,3 +45,31 @@ before_script:
45
45
- sudo chmod a+rw /dev/loop0
46
46
- dd if=/dev/zero bs=512 count=2048 of=disk
47
47
- losetup /dev/loop0 disk
48
+
49
+ deploy :
50
+ # Let before_deploy take over
51
+ provider : script
52
+ script : ' true'
53
+ on :
54
+ branch : master
55
+
56
+ before_deploy :
57
+ - cd $TRAVIS_BUILD_DIR
58
+ # Update tag for version defined in lfs.h
59
+ - LFS_VERSION=$(grep -ox '#define LFS_VERSION .*' lfs.h | cut -d ' ' -f3)
60
+ - LFS_VERSION_MAJOR=$((0xffff & ($LFS_VERSION >> 16)))
61
+ - LFS_VERSION_MINOR=$((0xffff & ($LFS_VERSION >> 0)))
62
+ - LFS_VERSION="v$LFS_VERSION_MAJOR.$LFS_VERSION_MINOR"
63
+ - |
64
+ curl -u $GEKY_BOT -X POST \
65
+ https://api.github.com/repos/$TRAVIS_REPO_SLUG/git/refs \
66
+ -d @- <<< "{
67
+ \"ref\": \"refs/tags/$LFS_VERSION\",
68
+ \"sha\": \"$TRAVIS_COMMIT\"
69
+ }"
70
+ - |
71
+ curl -f -u $GEKY_BOT -X PATCH \
72
+ https://api.github.com/repos/$TRAVIS_REPO_SLUG/git/refs/tags/$LFS_VERSION \
73
+ -d @- <<< "{
74
+ \"sha\": \"$TRAVIS_COMMIT\"
75
+ }"
Original file line number Diff line number Diff line change @@ -2067,7 +2067,7 @@ int lfs_format(lfs_t *lfs, const struct lfs_config *cfg) {
2067
2067
.d .type = LFS_TYPE_SUPERBLOCK ,
2068
2068
.d .elen = sizeof (superblock .d ) - sizeof (superblock .d .magic ) - 4 ,
2069
2069
.d .nlen = sizeof (superblock .d .magic ),
2070
- .d .version = 0x00010001 ,
2070
+ .d .version = LFS_DISK_VERSION ,
2071
2071
.d .magic = {"littlefs" },
2072
2072
.d .block_size = lfs -> cfg -> block_size ,
2073
2073
.d .block_count = lfs -> cfg -> block_count ,
@@ -2140,10 +2140,11 @@ int lfs_mount(lfs_t *lfs, const struct lfs_config *cfg) {
2140
2140
return LFS_ERR_CORRUPT ;
2141
2141
}
2142
2142
2143
- if (superblock .d .version > (0x00010001 | 0x0000ffff )) {
2144
- LFS_ERROR ("Invalid version %d.%d" ,
2145
- 0xffff & (superblock .d .version >> 16 ),
2146
- 0xffff & (superblock .d .version >> 0 ));
2143
+ uint16_t major_version = (0xffff & (superblock .d .version >> 16 ));
2144
+ uint16_t minor_version = (0xffff & (superblock .d .version >> 0 ));
2145
+ if ((major_version != LFS_DISK_VERSION_MAJOR ||
2146
+ minor_version > LFS_DISK_VERSION_MINOR )) {
2147
+ LFS_ERROR ("Invalid version %d.%d" , major_version , minor_version );
2147
2148
return LFS_ERR_INVAL ;
2148
2149
}
2149
2150
Original file line number Diff line number Diff line change 22
22
#include <stdbool.h>
23
23
24
24
25
+ /// Version info ///
26
+
27
+ // Software library version
28
+ // Major (top-nibble), incremented on backwards incompatible changes
29
+ // Minor (bottom-nibble), incremented on feature additions
30
+ #define LFS_VERSION 0x00010002
31
+ #define LFS_VERSION_MAJOR (0xffff & (LFS_VERSION >> 16))
32
+ #define LFS_VERSION_MINOR (0xffff & (LFS_VERSION >> 0))
33
+
34
+ // Version of On-disk data structures
35
+ // Major (top-nibble), incremented on backwards incompatible changes
36
+ // Minor (bottom-nibble), incremented on feature additions
37
+ #define LFS_DISK_VERSION 0x00010001
38
+ #define LFS_DISK_VERSION_MAJOR (0xffff & (LFS_DISK_VERSION >> 16))
39
+ #define LFS_DISK_VERSION_MINOR (0xffff & (LFS_DISK_VERSION >> 0))
40
+
41
+
25
42
/// Definitions ///
26
43
27
44
// Type definitions
You can’t perform that action at this time.
0 commit comments