littlefs-python 0.10.3__tar.gz → 0.12.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/.github/workflows/deploy.yml +6 -5
  2. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/.github/workflows/run-tests.yml +2 -2
  3. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/PKG-INFO +43 -4
  4. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/README.rst +42 -3
  5. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/README.md +23 -15
  6. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/SPEC.md +4 -3
  7. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/lfs.c +10 -5
  8. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/tests/test_superblocks.toml +52 -1
  9. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/src/littlefs/__init__.py +14 -1
  10. littlefs_python-0.12.0/src/littlefs/__main__.py +312 -0
  11. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/src/littlefs/lfs.c +1325 -1139
  12. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/src/littlefs/lfs.pxd +1 -0
  13. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/src/littlefs/lfs.pyi +1 -0
  14. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/src/littlefs/lfs.pyx +2 -0
  15. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/src/littlefs_python.egg-info/PKG-INFO +43 -4
  16. littlefs_python-0.10.3/src/littlefs/__main__.py +0 -197
  17. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/.gitattributes +0 -0
  18. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/.github/dependabot.yml +0 -0
  19. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/.gitignore +0 -0
  20. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/.gitmodules +0 -0
  21. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/.pre-commit-config.yaml +0 -0
  22. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/.readthedocs.yml +0 -0
  23. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/LICENSE +0 -0
  24. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/MANIFEST.in +0 -0
  25. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/ci/build-wheels.sh +0 -0
  26. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/ci/download_release_files.py +0 -0
  27. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/docs/Makefile +0 -0
  28. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/docs/api/index.rst +0 -0
  29. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/docs/cli.rst +0 -0
  30. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/docs/conf.py +0 -0
  31. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/docs/doc8.ini +0 -0
  32. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/docs/examples/index.rst +0 -0
  33. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/docs/index.rst +0 -0
  34. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/docs/make.bat +0 -0
  35. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/docs/requirements.txt +0 -0
  36. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/docs/usage.rst +0 -0
  37. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/examples/mkfsimg.py +0 -0
  38. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/examples/walk.py +0 -0
  39. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/.git +0 -0
  40. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/.gitattributes +0 -0
  41. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/.github/workflows/post-release.yml +0 -0
  42. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/.github/workflows/release.yml +0 -0
  43. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/.github/workflows/status.yml +0 -0
  44. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/.github/workflows/test.yml +0 -0
  45. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/.gitignore +0 -0
  46. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/DESIGN.md +0 -0
  47. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/LICENSE.md +0 -0
  48. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/Makefile +0 -0
  49. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/bd/lfs_emubd.c +0 -0
  50. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/bd/lfs_emubd.h +0 -0
  51. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/bd/lfs_filebd.c +0 -0
  52. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/bd/lfs_filebd.h +0 -0
  53. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/bd/lfs_rambd.c +0 -0
  54. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/bd/lfs_rambd.h +0 -0
  55. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/benches/bench_dir.toml +0 -0
  56. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/benches/bench_file.toml +0 -0
  57. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/benches/bench_superblock.toml +0 -0
  58. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/lfs.h +0 -0
  59. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/lfs_util.c +0 -0
  60. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/lfs_util.h +0 -0
  61. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/runners/bench_runner.c +0 -0
  62. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/runners/bench_runner.h +0 -0
  63. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/runners/test_runner.c +0 -0
  64. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/runners/test_runner.h +0 -0
  65. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/scripts/bench.py +0 -0
  66. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/scripts/changeprefix.py +0 -0
  67. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/scripts/code.py +0 -0
  68. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/scripts/cov.py +0 -0
  69. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/scripts/data.py +0 -0
  70. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/scripts/perf.py +0 -0
  71. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/scripts/perfbd.py +0 -0
  72. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/scripts/plot.py +0 -0
  73. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/scripts/plotmpl.py +0 -0
  74. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/scripts/prettyasserts.py +0 -0
  75. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/scripts/readblock.py +0 -0
  76. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/scripts/readmdir.py +0 -0
  77. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/scripts/readtree.py +0 -0
  78. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/scripts/stack.py +0 -0
  79. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/scripts/structs.py +0 -0
  80. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/scripts/summary.py +0 -0
  81. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/scripts/tailpipe.py +0 -0
  82. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/scripts/teepipe.py +0 -0
  83. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/scripts/test.py +0 -0
  84. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/scripts/tracebd.py +0 -0
  85. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/scripts/watch.py +0 -0
  86. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/tests/test_alloc.toml +0 -0
  87. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/tests/test_attrs.toml +0 -0
  88. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/tests/test_badblocks.toml +0 -0
  89. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/tests/test_bd.toml +0 -0
  90. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/tests/test_compat.toml +0 -0
  91. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/tests/test_dirs.toml +0 -0
  92. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/tests/test_entries.toml +0 -0
  93. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/tests/test_evil.toml +0 -0
  94. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/tests/test_exhaustion.toml +0 -0
  95. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/tests/test_files.toml +0 -0
  96. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/tests/test_interspersed.toml +0 -0
  97. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/tests/test_move.toml +0 -0
  98. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/tests/test_orphans.toml +0 -0
  99. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/tests/test_paths.toml +0 -0
  100. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/tests/test_powerloss.toml +0 -0
  101. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/tests/test_relocations.toml +0 -0
  102. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/tests/test_seek.toml +0 -0
  103. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/littlefs/tests/test_truncate.toml +0 -0
  104. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/mypy.ini +0 -0
  105. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/pyproject.toml +0 -0
  106. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/requirements.txt +0 -0
  107. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/setup.cfg +0 -0
  108. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/setup.py +0 -0
  109. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/src/littlefs/context.py +0 -0
  110. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/src/littlefs/errors.py +0 -0
  111. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/src/littlefs/py.typed +0 -0
  112. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/src/littlefs_python.egg-info/SOURCES.txt +0 -0
  113. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/src/littlefs_python.egg-info/dependency_links.txt +0 -0
  114. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/src/littlefs_python.egg-info/entry_points.txt +0 -0
  115. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/src/littlefs_python.egg-info/not-zip-safe +0 -0
  116. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/src/littlefs_python.egg-info/requires.txt +0 -0
  117. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/src/littlefs_python.egg-info/top_level.txt +0 -0
  118. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/test/lfs/conftest.py +0 -0
  119. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/test/lfs/test_dir_functions.py +0 -0
  120. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/test/lfs/test_file_functions.py +0 -0
  121. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/test/lfs/test_fs_functions.py +0 -0
  122. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/test/test_attr.py +0 -0
  123. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/test/test_block_count.py +0 -0
  124. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/test/test_directories.py +0 -0
  125. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/test/test_files.py +0 -0
  126. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/test/test_grow.py +0 -0
  127. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/test/test_multiversion.py +0 -0
  128. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/test/test_name_max.py +0 -0
  129. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/test/test_remove_rename.py +0 -0
  130. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/test/test_version.py +0 -0
  131. {littlefs_python-0.10.3 → littlefs_python-0.12.0}/test/test_walk.py +0 -0
@@ -11,7 +11,8 @@ jobs:
11
11
  os: [ubuntu-latest, windows-latest, macos-latest]
12
12
 
13
13
  env:
14
- CIBW_SKIP: "cp36-* cp37-* pp* *-win_arm64 *-musllinux_aarch64"
14
+ CIBW_BUILD: "cp37-* cp38-* cp39-* cp310-* cp311-* cp312-* pp37-* pp38-* pp39-* pp310-*"
15
+ CIBW_SKIP: "cp36-* pp* *-win_arm64 *-musllinux_aarch64"
15
16
  CIBW_ARCHS_LINUX: "x86_64 i686 aarch64"
16
17
 
17
18
  steps:
@@ -26,7 +27,7 @@ jobs:
26
27
  platforms: all
27
28
 
28
29
  - name: Build wheels
29
- uses: pypa/cibuildwheel@v2.17.0
30
+ uses: pypa/cibuildwheel@v2.19.1
30
31
 
31
32
  - uses: actions/upload-artifact@v3
32
33
  with:
@@ -46,10 +47,10 @@ jobs:
46
47
  submodules: "recursive"
47
48
 
48
49
  - name: Build wheels
49
- uses: pypa/cibuildwheel@v2.17.0
50
+ uses: pypa/cibuildwheel@v2.19.1
50
51
  env:
51
52
  CIBW_BUILD: ${{ matrix.cibw_build }}
52
- CIBW_SKIP: "cp36-* cp37-*"
53
+ CIBW_SKIP: "cp36-* pp*"
53
54
  CIBW_ARCHS: ${{ matrix.cibw_archs }}
54
55
  CIBW_REPAIR_WHEEL_COMMAND: |
55
56
  echo "Target delocate archs: {delocate_archs}"
@@ -104,7 +105,7 @@ jobs:
104
105
  name: artifact
105
106
  path: dist
106
107
 
107
- - uses: pypa/gh-action-pypi-publish@v1.8.14
108
+ - uses: pypa/gh-action-pypi-publish@v1.9.0
108
109
  with:
109
110
  user: __token__
110
111
  password: ${{ secrets.pypi_api_token }}
@@ -14,8 +14,8 @@ jobs:
14
14
  runs-on: ${{ matrix.os }}
15
15
  strategy:
16
16
  matrix:
17
- os: [ubuntu-latest, macos-latest, windows-latest]
18
- python-version: [3.8, 3.9, "3.10", "3.11"]
17
+ os: [ubuntu-latest, macos-13, windows-latest]
18
+ python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]
19
19
 
20
20
  steps:
21
21
  - uses: actions/checkout@v4
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: littlefs-python
3
- Version: 0.10.3
3
+ Version: 0.12.0
4
4
  Summary: A python wrapper for littlefs
5
5
  Home-page: https://github.com/jrast/littlefs-python
6
6
  Author: Jürg Rast
@@ -94,6 +94,7 @@ from scratch the latest version is recommended.
94
94
  .. csv-table::
95
95
  :header: "LittleFS Version", "Package Version", "LittleFS File System Version"
96
96
 
97
+ 2.9.0, v0.11.X, 2.0 / 2.1 [#f1]_
97
98
  2.9.0, v0.10.X, 2.0 / 2.1 [#f1]_
98
99
  2.8.0, 0.8.X-0.9.X, 2.0 / 2.1 [#f1]_
99
100
  2.7.0, 0.7.X, 2.0 / 2.1 [#f1]_
@@ -112,10 +113,48 @@ This is as simple as it can be::
112
113
  At the moment wheels (which require no build) are provided for the following platforms,
113
114
  on other platforms the source package is used and a compiler is required:
114
115
 
115
- + Linux: Python 3.8 - 3.12 / x86_64, arm64
116
- + MacOS: Python 3.8 - 3.12 / x86_64, arm64
117
- + Windows: Python 3.8 - 3.12 / 32- & 64-bit
116
+ + Linux: Python 3.7 - 3.12 / x86_64, arm64
117
+ + MacOS: Python 3.7 - 3.12 / x86_64, arm64
118
+ + Windows: Python 3.7 - 3.12 / 32- & 64-bit
118
119
 
120
+ CLI
121
+ ===
122
+ littlefs-python comes bundled with a command-line tool, ``littlefs-python``, that can be used to create and extract littlefs binary images.
123
+
124
+ .. code:: console
125
+
126
+ $ littlefs-python --help
127
+ usage: littlefs-python [-h] [--version] {create,extract,list} ...
128
+
129
+ Create, extract and inspect LittleFS filesystem images. Use one of the
130
+ commands listed below, the '-h' / '--help' option can be used on each command
131
+ to learn more about the usage.
132
+
133
+ optional arguments:
134
+ -h, --help show this help message and exit
135
+ --version show program's version number and exit
136
+
137
+ Available Commands:
138
+ {create,extract,list}
139
+ create Create LittleFS image from file/directory contents.
140
+ extract Extract LittleFS image contents to a directory.
141
+ list List LittleFS image contents.
142
+
143
+ To create a littlefs binary image:
144
+
145
+ .. code:: console
146
+
147
+ # Creates a 1-megabyte "lfs.bin" containing README.rst
148
+ $ littlefs-python create README.rst lfs.bin --fs-size=1mb --block-size=4096
149
+
150
+ # Creates a 1-megabyte "lfs.bin" containing the contents of the examples/ folder
151
+ $ littlefs-python create examples lfs.bin --fs-size=1mb --block-size=4096
152
+
153
+ To extract the contents of a littlefs binary image:
154
+
155
+ .. code:: console
156
+
157
+ $ littlefs-python extract lfs.bin output/ --block-size=4096
119
158
 
120
159
  Development Setup
121
160
  =================
@@ -70,6 +70,7 @@ from scratch the latest version is recommended.
70
70
  .. csv-table::
71
71
  :header: "LittleFS Version", "Package Version", "LittleFS File System Version"
72
72
 
73
+ 2.9.0, v0.11.X, 2.0 / 2.1 [#f1]_
73
74
  2.9.0, v0.10.X, 2.0 / 2.1 [#f1]_
74
75
  2.8.0, 0.8.X-0.9.X, 2.0 / 2.1 [#f1]_
75
76
  2.7.0, 0.7.X, 2.0 / 2.1 [#f1]_
@@ -88,10 +89,48 @@ This is as simple as it can be::
88
89
  At the moment wheels (which require no build) are provided for the following platforms,
89
90
  on other platforms the source package is used and a compiler is required:
90
91
 
91
- + Linux: Python 3.8 - 3.12 / x86_64, arm64
92
- + MacOS: Python 3.8 - 3.12 / x86_64, arm64
93
- + Windows: Python 3.8 - 3.12 / 32- & 64-bit
92
+ + Linux: Python 3.7 - 3.12 / x86_64, arm64
93
+ + MacOS: Python 3.7 - 3.12 / x86_64, arm64
94
+ + Windows: Python 3.7 - 3.12 / 32- & 64-bit
94
95
 
96
+ CLI
97
+ ===
98
+ littlefs-python comes bundled with a command-line tool, ``littlefs-python``, that can be used to create and extract littlefs binary images.
99
+
100
+ .. code:: console
101
+
102
+ $ littlefs-python --help
103
+ usage: littlefs-python [-h] [--version] {create,extract,list} ...
104
+
105
+ Create, extract and inspect LittleFS filesystem images. Use one of the
106
+ commands listed below, the '-h' / '--help' option can be used on each command
107
+ to learn more about the usage.
108
+
109
+ optional arguments:
110
+ -h, --help show this help message and exit
111
+ --version show program's version number and exit
112
+
113
+ Available Commands:
114
+ {create,extract,list}
115
+ create Create LittleFS image from file/directory contents.
116
+ extract Extract LittleFS image contents to a directory.
117
+ list List LittleFS image contents.
118
+
119
+ To create a littlefs binary image:
120
+
121
+ .. code:: console
122
+
123
+ # Creates a 1-megabyte "lfs.bin" containing README.rst
124
+ $ littlefs-python create README.rst lfs.bin --fs-size=1mb --block-size=4096
125
+
126
+ # Creates a 1-megabyte "lfs.bin" containing the contents of the examples/ folder
127
+ $ littlefs-python create examples lfs.bin --fs-size=1mb --block-size=4096
128
+
129
+ To extract the contents of a littlefs binary image:
130
+
131
+ .. code:: console
132
+
133
+ $ littlefs-python extract lfs.bin output/ --block-size=4096
95
134
 
96
135
  Development Setup
97
136
  =================
@@ -231,11 +231,25 @@ License Identifiers that are here available: http://spdx.org/licenses/
231
231
  to use littlefs in a Rust-friendly API, reaping the benefits of Rust's memory
232
232
  safety and other guarantees.
233
233
 
234
+ - [nim-littlefs] - A Nim wrapper and API for littlefs. Includes a fuse
235
+ implementation based on [littlefs-fuse]
236
+
237
+ - [chamelon] - A pure-OCaml implementation of (most of) littlefs, designed for
238
+ use with the MirageOS library operating system project. It is interoperable
239
+ with the reference implementation, with some caveats.
240
+
234
241
  - [littlefs-disk-img-viewer] - A memory-efficient web application for viewing
235
242
  littlefs disk images in your web browser.
236
243
 
237
- - [mklfs] - A command line tool built by the [Lua RTOS] guys for making
238
- littlefs images from a host PC. Supports Windows, Mac OS, and Linux.
244
+ - [mklfs] - A command line tool for creating littlefs images. Used in the Lua
245
+ RTOS ecosystem.
246
+
247
+ - [mklittlefs] - A command line tool for creating littlefs images. Used in the
248
+ ESP8266 and RP2040 ecosystem.
249
+
250
+ - [pico-littlefs-usb] - An interface for littlefs that emulates a FAT12
251
+ filesystem over USB. Allows mounting littlefs on a host PC without additional
252
+ drivers.
239
253
 
240
254
  - [Mbed OS] - The easiest way to get started with littlefs is to jump into Mbed
241
255
  which already has block device drivers for most forms of embedded storage.
@@ -254,27 +268,21 @@ License Identifiers that are here available: http://spdx.org/licenses/
254
268
  for microcontroller-scale devices. Due to limitations of FAT it can't provide
255
269
  power-loss resilience, but it does allow easy interop with PCs.
256
270
 
257
- - [chamelon] - A pure-OCaml implementation of (most of) littlefs, designed for
258
- use with the MirageOS library operating system project. It is interoperable
259
- with the reference implementation, with some caveats.
260
-
261
- - [nim-littlefs] - A Nim wrapper and API for littlefs. Includes a fuse
262
- implementation based on [littlefs-fuse]
263
-
264
271
  [BSD-3-Clause]: https://spdx.org/licenses/BSD-3-Clause.html
265
- [littlefs-disk-img-viewer]: https://github.com/tniessen/littlefs-disk-img-viewer
266
272
  [littlefs-fuse]: https://github.com/geky/littlefs-fuse
267
273
  [FUSE]: https://github.com/libfuse/libfuse
268
274
  [littlefs-js]: https://github.com/geky/littlefs-js
269
275
  [littlefs-js-demo]:http://littlefs.geky.net/demo.html
276
+ [littlefs-python]: https://pypi.org/project/littlefs-python/
277
+ [littlefs2-rust]: https://crates.io/crates/littlefs2
278
+ [nim-littlefs]: https://github.com/Graveflo/nim-littlefs
279
+ [chamelon]: https://github.com/yomimono/chamelon
280
+ [littlefs-disk-img-viewer]: https://github.com/tniessen/littlefs-disk-img-viewer
270
281
  [mklfs]: https://github.com/whitecatboard/Lua-RTOS-ESP32/tree/master/components/mklfs/src
271
- [Lua RTOS]: https://github.com/whitecatboard/Lua-RTOS-ESP32
282
+ [mklittlefs]: https://github.com/earlephilhower/mklittlefs
283
+ [pico-littlefs-usb]: https://github.com/oyama/pico-littlefs-usb
272
284
  [Mbed OS]: https://github.com/armmbed/mbed-os
273
285
  [LittleFileSystem]: https://os.mbed.com/docs/mbed-os/latest/apis/littlefilesystem.html
274
286
  [SPIFFS]: https://github.com/pellepl/spiffs
275
287
  [Dhara]: https://github.com/dlbeer/dhara
276
288
  [ChaN's FatFs]: http://elm-chan.org/fsw/ff/00index_e.html
277
- [littlefs-python]: https://pypi.org/project/littlefs-python/
278
- [littlefs2-rust]: https://crates.io/crates/littlefs2
279
- [chamelon]: https://github.com/yomimono/chamelon
280
- [nim-littlefs]: https://github.com/Graveflo/nim-littlefs
@@ -441,9 +441,10 @@ Superblock fields:
441
441
 
442
442
  7. **Attr max (32-bits)** - Maximum size of file attributes in bytes.
443
443
 
444
- The superblock must always be the first entry (id 0) in a metadata pair as well
445
- as be the first entry written to the block. This means that the superblock
446
- entry can be read from a device using offsets alone.
444
+ The superblock must always be the first entry (id 0) in the metadata pair, and
445
+ the name tag must always be the first tag in the metadata pair. This makes it
446
+ so that the magic string "littlefs" will always reside at offset=8 in a valid
447
+ littlefs superblock.
447
448
 
448
449
  ---
449
450
  #### `0x2xx` LFS_TYPE_STRUCT
@@ -2191,7 +2191,8 @@ static int lfs_dir_splittingcompact(lfs_t *lfs, lfs_mdir_t *dir,
2191
2191
  // we can do, we'll error later if we've become frozen
2192
2192
  LFS_WARN("Unable to expand superblock");
2193
2193
  } else {
2194
- end = begin;
2194
+ // duplicate the superblock entry into the new superblock
2195
+ end = 1;
2195
2196
  }
2196
2197
  }
2197
2198
  }
@@ -2358,7 +2359,9 @@ fixmlist:;
2358
2359
 
2359
2360
  while (d->id >= d->m.count && d->m.split) {
2360
2361
  // we split and id is on tail now
2361
- d->id -= d->m.count;
2362
+ if (lfs_pair_cmp(d->m.tail, lfs->root) != 0) {
2363
+ d->id -= d->m.count;
2364
+ }
2362
2365
  int err = lfs_dir_fetch(lfs, &d->m, d->m.tail);
2363
2366
  if (err) {
2364
2367
  return err;
@@ -4466,6 +4469,7 @@ static int lfs_mount_(lfs_t *lfs, const struct lfs_config *cfg) {
4466
4469
  // found older minor version? set an in-device only bit in the
4467
4470
  // gstate so we know we need to rewrite the superblock before
4468
4471
  // the first write
4472
+ bool needssuperblock = false;
4469
4473
  if (minor_version < lfs_fs_disk_version_minor(lfs)) {
4470
4474
  LFS_DEBUG("Found older minor version "
4471
4475
  "v%"PRIu16".%"PRIu16" < v%"PRIu16".%"PRIu16,
@@ -4473,10 +4477,11 @@ static int lfs_mount_(lfs_t *lfs, const struct lfs_config *cfg) {
4473
4477
  minor_version,
4474
4478
  lfs_fs_disk_version_major(lfs),
4475
4479
  lfs_fs_disk_version_minor(lfs));
4476
- // note this bit is reserved on disk, so fetching more gstate
4477
- // will not interfere here
4478
- lfs_fs_prepsuperblock(lfs, true);
4480
+ needssuperblock = true;
4479
4481
  }
4482
+ // note this bit is reserved on disk, so fetching more gstate
4483
+ // will not interfere here
4484
+ lfs_fs_prepsuperblock(lfs, needssuperblock);
4480
4485
 
4481
4486
  // check superblock configuration
4482
4487
  if (superblock.name_max) {
@@ -14,6 +14,24 @@ code = '''
14
14
  lfs_unmount(&lfs) => 0;
15
15
  '''
16
16
 
17
+ # make sure the magic string "littlefs" is always at offset=8
18
+ [cases.test_superblocks_magic]
19
+ code = '''
20
+ lfs_t lfs;
21
+ lfs_format(&lfs, cfg) => 0;
22
+
23
+ // check our magic string
24
+ //
25
+ // note if we lose power we may not have the magic string in both blocks!
26
+ // but we don't lose power in this test so we can assert the magic string
27
+ // is present in both
28
+ uint8_t magic[lfs_max(16, READ_SIZE)];
29
+ cfg->read(cfg, 0, 0, magic, lfs_max(16, READ_SIZE)) => 0;
30
+ assert(memcmp(&magic[8], "littlefs", 8) == 0);
31
+ cfg->read(cfg, 1, 0, magic, lfs_max(16, READ_SIZE)) => 0;
32
+ assert(memcmp(&magic[8], "littlefs", 8) == 0);
33
+ '''
34
+
17
35
  # mount/unmount from interpretting a previous superblock block_count
18
36
  [cases.test_superblocks_mount_unknown_block_count]
19
37
  code = '''
@@ -28,7 +46,6 @@ code = '''
28
46
  lfs_unmount(&lfs) => 0;
29
47
  '''
30
48
 
31
-
32
49
  # reentrant format
33
50
  [cases.test_superblocks_reentrant_format]
34
51
  reentrant = true
@@ -135,6 +152,39 @@ code = '''
135
152
  lfs_unmount(&lfs) => 0;
136
153
  '''
137
154
 
155
+ # make sure the magic string "littlefs" is always at offset=8
156
+ [cases.test_superblocks_magic_expand]
157
+ defines.BLOCK_CYCLES = [32, 33, 1]
158
+ defines.N = [10, 100, 1000]
159
+ code = '''
160
+ lfs_t lfs;
161
+ lfs_format(&lfs, cfg) => 0;
162
+ lfs_mount(&lfs, cfg) => 0;
163
+ for (int i = 0; i < N; i++) {
164
+ lfs_file_t file;
165
+ lfs_file_open(&lfs, &file, "dummy",
166
+ LFS_O_WRONLY | LFS_O_CREAT | LFS_O_EXCL) => 0;
167
+ lfs_file_close(&lfs, &file) => 0;
168
+ struct lfs_info info;
169
+ lfs_stat(&lfs, "dummy", &info) => 0;
170
+ assert(strcmp(info.name, "dummy") == 0);
171
+ assert(info.type == LFS_TYPE_REG);
172
+ lfs_remove(&lfs, "dummy") => 0;
173
+ }
174
+ lfs_unmount(&lfs) => 0;
175
+
176
+ // check our magic string
177
+ //
178
+ // note if we lose power we may not have the magic string in both blocks!
179
+ // but we don't lose power in this test so we can assert the magic string
180
+ // is present in both
181
+ uint8_t magic[lfs_max(16, READ_SIZE)];
182
+ cfg->read(cfg, 0, 0, magic, lfs_max(16, READ_SIZE)) => 0;
183
+ assert(memcmp(&magic[8], "littlefs", 8) == 0);
184
+ cfg->read(cfg, 1, 0, magic, lfs_max(16, READ_SIZE)) => 0;
185
+ assert(memcmp(&magic[8], "littlefs", 8) == 0);
186
+ '''
187
+
138
188
  # expanding superblock with power cycle
139
189
  [cases.test_superblocks_expand_power_cycle]
140
190
  defines.BLOCK_CYCLES = [32, 33, 1]
@@ -221,6 +271,7 @@ code = '''
221
271
  lfs_unmount(&lfs) => 0;
222
272
  '''
223
273
 
274
+
224
275
  # mount with unknown block_count
225
276
  [cases.test_superblocks_unknown_blocks]
226
277
  code = '''
@@ -72,6 +72,10 @@ class LittleFS:
72
72
  def block_count(self) -> int:
73
73
  return self.fs.block_count
74
74
 
75
+ @property
76
+ def used_block_count(self) -> int:
77
+ return lfs.fs_size(self.fs)
78
+
75
79
  @property
76
80
  def context(self) -> "UserContext":
77
81
  """User context of the file system"""
@@ -98,8 +102,14 @@ class LittleFS:
98
102
  return lfs.fs_mkconsistent(self.fs)
99
103
 
100
104
  def fs_grow(self, block_count: int) -> int:
105
+ """WARNING: does not modify underlying ``self.context``.
106
+
107
+ Must be done externally.
108
+ """
101
109
  if block_count < self.block_count:
102
- raise ValueError(f"Supplied block_count='{block_count}' cannot be smaller than current block_count {self.block_count}")
110
+ raise ValueError(
111
+ f"Supplied block_count='{block_count}' cannot be smaller than current block_count {self.block_count}"
112
+ )
103
113
 
104
114
  return lfs.fs_grow(self.fs, block_count)
105
115
 
@@ -107,6 +117,9 @@ class LittleFS:
107
117
  """Get the status of the filesystem"""
108
118
  return lfs.fs_stat(self.fs)
109
119
 
120
+ def fs_gc(self):
121
+ return lfs.fs_gc(self.fs)
122
+
110
123
  def open(
111
124
  self, fname: str, mode="r", buffering: int = -1, encoding: str = None, errors: str = None, newline: str = None
112
125
  ) -> IO: