mirror of
				https://github.com/eledio-devices/thirdparty-littlefs.git
				synced 2025-10-31 08:42:40 +01:00 
			
		
		
		
	Simplified config
Before, the lfs had multiple paths to determine config options: - lfs_config struct passed during initialization - lfs_bd_info struct passed during block device initialization - compile time options This allowed different developers to provide their own needs to the filesystem, such as the block device capabilities and the higher level user's own tweaks. However, this comes with additional complexity and action required when the configurations are incompatible. For now, this has been reduced to all information (including block device function pointers) being passed through the lfs_config struct. We just defer more complicated handling of configuration options to the top level user. This simplifies configuration handling and gives the top level user the responsibility to handle configuration, which they probably would have wanted to do anyways.
This commit is contained in:
		| @@ -6,42 +6,42 @@ rm -rf blocks | ||||
|  | ||||
| echo "--- Basic formatting ---" | ||||
| tests/test.py << TEST | ||||
|     lfs_format(&lfs, &config) => 0; | ||||
|     lfs_format(&lfs, &cfg) => 0; | ||||
| TEST | ||||
|  | ||||
| echo "--- Invalid superblocks ---" | ||||
| ln -f -s /dev/null blocks/0 | ||||
| ln -f -s /dev/null blocks/1 | ||||
| tests/test.py << TEST | ||||
|     lfs_format(&lfs, &config) => LFS_ERROR_CORRUPT; | ||||
|     lfs_format(&lfs, &cfg) => LFS_ERROR_CORRUPT; | ||||
| TEST | ||||
| rm blocks/0 blocks/1 | ||||
|  | ||||
| echo "--- Basic mounting ---" | ||||
| tests/test.py << TEST | ||||
|     lfs_format(&lfs, &config) => 0; | ||||
|     lfs_format(&lfs, &cfg) => 0; | ||||
| TEST | ||||
| tests/test.py << TEST | ||||
|     lfs_mount(&lfs, &config) => 0; | ||||
|     lfs_mount(&lfs, &cfg) => 0; | ||||
|     lfs_unmount(&lfs) => 0; | ||||
| TEST | ||||
|  | ||||
| echo "--- Invalid mount ---" | ||||
| tests/test.py << TEST | ||||
|     lfs_format(&lfs, &config) => 0; | ||||
|     lfs_format(&lfs, &cfg) => 0; | ||||
| TEST | ||||
| rm blocks/0 blocks/1 | ||||
| tests/test.py << TEST | ||||
|     lfs_mount(&lfs, &config) => LFS_ERROR_CORRUPT; | ||||
|     lfs_mount(&lfs, &cfg) => LFS_ERROR_CORRUPT; | ||||
| TEST | ||||
|  | ||||
| echo "--- Valid corrupt mount ---" | ||||
| tests/test.py << TEST | ||||
|     lfs_format(&lfs, &config) => 0; | ||||
|     lfs_format(&lfs, &cfg) => 0; | ||||
| TEST | ||||
| rm blocks/0 | ||||
| tests/test.py << TEST | ||||
|     lfs_mount(&lfs, &config) => 0; | ||||
|     lfs_mount(&lfs, &cfg) => 0; | ||||
|     lfs_unmount(&lfs) => 0; | ||||
| TEST | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user