mirror of
				https://github.com/eledio-devices/thirdparty-littlefs.git
				synced 2025-10-31 00:32:38 +01:00 
			
		
		
		
	Added internal check of data written to disk
Before, the littlefs relied on the underlying block device to report corruption that occurs when writing data to disk. This requirement is easy to miss or implement incorrectly, since the error detection is only required when a block becomes corrupted, which is very unlikely to happen until late in the block device's lifetime. The littlefs can detect corruption itself by reading back written data. This requires a bit of care to reuse the available buffers, and may rely on checksums to avoid additional RAM requirements. This does have a runtime penalty with the extra read operations, but should make the littlefs much more robust to different implementations.
This commit is contained in:
		
							
								
								
									
										2
									
								
								lfs.h
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								lfs.h
									
									
									
									
									
								
							| @@ -32,7 +32,7 @@ typedef uint32_t lfs_block_t; | ||||
| enum lfs_error { | ||||
|     LFS_ERR_OK      = 0,    // No error | ||||
|     LFS_ERR_IO      = -5,   // Error during device operation | ||||
|     LFS_ERR_CORRUPT = -77,  // Corrupted | ||||
|     LFS_ERR_CORRUPT = -52,  // Corrupted | ||||
|     LFS_ERR_NOENT   = -2,   // No directory entry | ||||
|     LFS_ERR_EXISTS  = -17,  // Entry already exists | ||||
|     LFS_ERR_NOTDIR  = -20,  // Entry is not a dir | ||||
|   | ||||
		Reference in New Issue
	
	Block a user