Kaynağa Gözat

Merge pull request #470 from renesas/SWFLEX-1517-littlefs-thread-safe-option

Add thread safe wrappers
Christopher Haster 5 yıl önce
ebeveyn
işleme
ce425a56c3
3 değiştirilmiş dosya ile 93 ekleme ve 231 silme
  1. 16 0
      .travis.yml
  2. 66 231
      lfs.c
  3. 11 0
      lfs.h

+ 16 - 0
.travis.yml

@@ -224,6 +224,22 @@ jobs:
     # report-size will compile littlefs and report the size
     script: [*report-size]
 
+  # test compilation in thread-safe mode
+  - stage: test
+    env:
+      - NAME=littlefs-threadsafe
+      - CC="arm-linux-gnueabi-gcc --static -mthumb"
+      - CFLAGS="-Werror -DLFS_THREADSAFE"
+    if: branch !~ -prefix$
+    install:
+      - *install-common
+      - sudo apt-get install
+            gcc-arm-linux-gnueabi
+            libc6-dev-armel-cross
+      - arm-linux-gnueabi-gcc --version
+    # report-size will compile littlefs and report the size
+    script: [*report-size]
+
   # self-host with littlefs-fuse for fuzz test
   - stage: test
     env:

Dosya farkı çok büyük olduğundan ihmal edildi
+ 66 - 231
lfs.c


+ 11 - 0
lfs.h

@@ -9,6 +9,7 @@
 
 #include <stdint.h>
 #include <stdbool.h>
+#include "lfs_util.h"
 
 #ifdef __cplusplus
 extern "C"
@@ -180,6 +181,16 @@ struct lfs_config {
     // are propogated to the user.
     int (*sync)(const struct lfs_config *c);
 
+#ifdef LFS_THREADSAFE
+    // Lock the underlying block device. Negative error codes
+    // are propogated to the user.
+    int (*lock)(const struct lfs_config *c);
+
+    // Unlock the underlying block device. Negative error codes
+    // are propogated to the user.
+    int (*unlock)(const struct lfs_config *c);
+#endif
+
     // Minimum size of a block read. All read operations will be a
     // multiple of this value.
     lfs_size_t read_size;

Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor