mirror of
				https://github.com/eledio-devices/thirdparty-littlefs.git
				synced 2025-10-31 00:32:38 +01:00 
			
		
		
		
	Added size field to entry structure
The size field is redundant, since an entry's size can be determined from the nlen+elen+alen+4. However, as you may have guessed from that expression, calculating the size this way is a bit roundabout and inefficient. Despite its redundancy, it's cheaper to store the size in the entry, though with a minor RAM cost. Note, extra care must now be taken to make sure these size and len fields don't fall out of sync.
This commit is contained in:
		
							
								
								
									
										3
									
								
								lfs.h
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								lfs.h
									
									
									
									
									
								
							| @@ -196,6 +196,7 @@ struct lfs_info { | ||||
| /// littlefs data structures /// | ||||
| typedef struct lfs_entry { | ||||
|     lfs_off_t off; | ||||
|     lfs_size_t size; | ||||
|  | ||||
|     struct lfs_disk_entry { | ||||
|         uint8_t type; | ||||
| @@ -249,8 +250,6 @@ typedef struct lfs_dir { | ||||
| } lfs_dir_t; | ||||
|  | ||||
| typedef struct lfs_superblock { | ||||
|     lfs_off_t off; | ||||
|  | ||||
|     struct lfs_disk_superblock { | ||||
|         uint8_t type; | ||||
|         uint8_t elen; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user