-
Notifications
You must be signed in to change notification settings - Fork 24
Description
Currently the CLI and the helper functions such as create / list etc support following just several user configured parameters as the littlefs configuration (See _fs_from_args and get_parser).
There are more parameters that may have effect on the created image, hence I think it will be better to add option to pass all arguments (in case not passed, default value from LFSConfig will still persist, hence it won't change existing flow to users).
Example for such case where other parameters make change:
Currently in LFSConfig read_size and prog_size and cache_size are defaults to block_size, and inline_max default to 0.
littlefs-python/src/littlefs/lfs.pyx
Lines 98 to 107 in df195ba
| read_size: int = 0, | |
| prog_size: int = 0, | |
| block_cycles: int = -1, | |
| cache_size: int = 0, | |
| lookahead_size: int = 8, | |
| name_max: int = 255, | |
| file_max: int = 0, | |
| attr_max: int = 0, | |
| metadata_max: int = 0, | |
| inline_max: int = 0, |
littlefs-python/src/littlefs/lfs.pyx
Lines 163 to 169 in df195ba
| self._impl.read_size = read_size if read_size else block_size | |
| self._impl.prog_size = prog_size if prog_size else block_size | |
| self._impl.block_size = block_size | |
| self._impl.block_count = block_count | |
| self._impl.block_cycles = block_cycles | |
| # Cache size, at least as big as read / prog size | |
| self._impl.cache_size = cache_size if cache_size else max(self._impl.read_size, self._impl.prog_size) |
This cause littlefs to inline files when they are in size block/8
https://github.com/littlefs-project/littlefs/blob/adad0fbbcf5382c20978d07f94f9c13be9041c1b/lfs.h#L279-L284
But in case someone created such image with the python and then will run with this image on device with less cache he will have problem.
As I think we don't want to think about all optionall effects, it is better to give option to user to configure everything.
If you agree I can open such PR (fixing both CLI usage and bare python).