mirror of
				https://github.com/eledio-devices/thirdparty-littlefs.git
				synced 2025-10-31 00:32:38 +01:00 
			
		
		
		
	Changed type info to be retrieved from name tag instead of struct tag
Originally, I had type info encoded in the struct tag. This initially made sense because the type info only directly impacts the struct tag. However this was a case of focusing too much on the details instead of the bigger picture. A more file operations need to figure out the type of a file, but it's only actually a small number of file operations that need to interact with the file's structure. For the common case, providing the type of the file early shortens operations by a full tag access. Additionally, but storing the type in the file name tag, this opens up the struct tag to use those bits for storing more struct descriptions.
This commit is contained in:
		
							
								
								
									
										5
									
								
								lfs.h
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								lfs.h
									
									
									
									
									
								
							| @@ -98,7 +98,7 @@ enum lfs_type { | ||||
|     // file types | ||||
|     LFS_TYPE_REG        = 0x008, | ||||
|     LFS_TYPE_DIR        = 0x010, | ||||
|     LFS_TYPE_SUPERBLOCK = 0x038, | ||||
|     LFS_TYPE_SUPERBLOCK = 0x042, | ||||
|  | ||||
|     // internally used entry structures | ||||
|     LFS_STRUCT_CTZ      = 0x001, | ||||
| @@ -316,8 +316,8 @@ typedef struct lfs_mdir { | ||||
|     uint16_t count; | ||||
|     bool erased; | ||||
|     bool split; | ||||
|     lfs_globals_t globals; | ||||
|     bool stop_at_commit; // TODO hmmm | ||||
|     lfs_globals_t globals; | ||||
| } lfs_mdir_t; | ||||
|  | ||||
| typedef struct lfs_cache { | ||||
| @@ -352,7 +352,6 @@ typedef struct lfs_dir { | ||||
| } lfs_dir_t; | ||||
|  | ||||
| typedef struct lfs_superblock { | ||||
|     lfs_block_t root[2]; | ||||
|     char magic[8]; | ||||
|     uint32_t version; | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user