mirror of
				https://github.com/eledio-devices/thirdparty-littlefs.git
				synced 2025-10-31 08:42:40 +01:00 
			
		
		
		
	Changed bd callbacks to use "bd_" prefix
This makes the block-device related operations more clearly block-device related operations, and helps avoid possible conflicts with user provided `lfs_bd_read/prog/erase` functions in the LFS_STATICCFG mode.
This commit is contained in:
		
							
								
								
									
										18
									
								
								lfs.h
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								lfs.h
									
									
									
									
									
								
							| @@ -130,28 +130,28 @@ enum lfs_whence_flags { | ||||
| struct lfs_cfg { | ||||
|     // Opaque user provided context that can be used to pass | ||||
|     // information to the block device operations | ||||
|     void *ctx; | ||||
|     void *bd_ctx; | ||||
|  | ||||
|     // Read a region in a block. Negative error codes are propogated | ||||
|     // to the user. | ||||
|     int (*read)(void *ctx, lfs_block_t block, | ||||
|     int (*bd_read)(void *ctx, lfs_block_t block, | ||||
|             lfs_off_t off, void *buffer, lfs_size_t size); | ||||
|  | ||||
|     // Program a region in a block. The block must have previously | ||||
|     // been erased. Negative error codes are propogated to the user. | ||||
|     // May return LFS_ERR_CORRUPT if the block should be considered bad. | ||||
|     int (*prog)(void *ctx, lfs_block_t block, | ||||
|     int (*bd_prog)(void *ctx, lfs_block_t block, | ||||
|             lfs_off_t off, const void *buffer, lfs_size_t size); | ||||
|  | ||||
|     // Erase a block. A block must be erased before being programmed. | ||||
|     // The state of an erased block is undefined. Negative error codes | ||||
|     // are propogated to the user. | ||||
|     // May return LFS_ERR_CORRUPT if the block should be considered bad. | ||||
|     int (*erase)(void *ctx, lfs_block_t block); | ||||
|     int (*bd_erase)(void *ctx, lfs_block_t block); | ||||
|  | ||||
|     // Sync the state of the underlying block device. Negative error codes | ||||
|     // are propogated to the user. | ||||
|     int (*sync)(void *ctx); | ||||
|     int (*bd_sync)(void *ctx); | ||||
|  | ||||
|     // Minimum size of a block read. All read operations will be a | ||||
|     // multiple of this value. | ||||
| @@ -226,12 +226,12 @@ struct lfs_cfg { | ||||
| // the lfs_cfg struct above. | ||||
|  | ||||
| // Block device operations | ||||
| int lfs_read(lfs_block_t block, | ||||
| int lfs_bd_read(lfs_block_t block, | ||||
|         lfs_off_t off, void *buffer, lfs_size_t size); | ||||
| int lfs_prog(lfs_block_t block, | ||||
| int lfs_bd_prog(lfs_block_t block, | ||||
|         lfs_off_t off, const void *buffer, lfs_size_t size); | ||||
| int lfs_erase(lfs_block_t block); | ||||
| int lfs_sync(void); | ||||
| int lfs_bd_erase(lfs_block_t block); | ||||
| int lfs_bd_sync(void); | ||||
|  | ||||
| // Required configuration | ||||
| #ifndef LFS_READ_SIZE | ||||
|   | ||||
		Reference in New Issue
	
	Block a user