mirror of
				https://github.com/eledio-devices/thirdparty-littlefs.git
				synced 2025-10-31 08:42:40 +01:00 
			
		
		
		
	Progressed integration of journaling metadata pairs
- Integrated journaling into lfs_dir_t_ struct and operations, duplicating functions where necessary - Added internal lfs_tag_t and lfs_stag_t - Consolidated lfs_region and lfs_entry structures
This commit is contained in:
		
							
								
								
									
										35
									
								
								lfs.h
									
									
									
									
									
								
							
							
						
						
									
										35
									
								
								lfs.h
									
									
									
									
									
								
							| @@ -107,14 +107,14 @@ enum lfs_type { | |||||||
|     LFS_STRUCT_MOVED    = 0x80, |     LFS_STRUCT_MOVED    = 0x80, | ||||||
|  |  | ||||||
|     // file type |     // file type | ||||||
|     LFS_TYPE_REG_        = 0x020, |     LFS_TYPE_REG_        = 0x040, | ||||||
|     LFS_TYPE_DIR_        = 0x030, |     LFS_TYPE_DIR_        = 0x050, | ||||||
|  |  | ||||||
|     LFS_TYPE_NAME_       = 0x010, |     LFS_TYPE_NAME_       = 0x010, | ||||||
|     LFS_TYPE_MOVE_       = 0x060, |     LFS_TYPE_MOVE_       = 0x080, | ||||||
|     LFS_TYPE_DROP_       = 0x070, |     LFS_TYPE_DROP_       = 0x090, | ||||||
|  |  | ||||||
|     LFS_TYPE_SUPERBLOCK_ = 0x0c0, |     LFS_TYPE_SUPERBLOCK_ = 0x0c8, | ||||||
|     LFS_TYPE_TAIL_       = 0x0d0, |     LFS_TYPE_TAIL_       = 0x0d0, | ||||||
|     LFS_TYPE_CRC_        = 0x0e0, |     LFS_TYPE_CRC_        = 0x0e0, | ||||||
|  |  | ||||||
| @@ -294,9 +294,13 @@ typedef struct lfs_entry { | |||||||
|     } d; |     } d; | ||||||
| } lfs_entry_t; | } lfs_entry_t; | ||||||
|  |  | ||||||
|  | typedef uint32_t lfs_tag_t; | ||||||
|  | typedef int32_t lfs_stag_t; | ||||||
|  |  | ||||||
| typedef struct lfs_entry_ { | typedef struct lfs_entry_ { | ||||||
|     uint32_t tag; |     uint32_t tag; | ||||||
|     union { |     union { | ||||||
|  |         void *buffer; | ||||||
|         lfs_block_t pair[2]; |         lfs_block_t pair[2]; | ||||||
|         struct { |         struct { | ||||||
|             lfs_block_t head; |             lfs_block_t head; | ||||||
| @@ -357,14 +361,20 @@ typedef struct lfs_dir { | |||||||
| } lfs_dir_t; | } lfs_dir_t; | ||||||
|  |  | ||||||
| typedef struct lfs_dir_ { | typedef struct lfs_dir_ { | ||||||
|  |     struct lfs_dir_ *next; | ||||||
|     lfs_block_t pair[2]; |     lfs_block_t pair[2]; | ||||||
|     lfs_block_t tail[2]; |  | ||||||
|  |  | ||||||
|  |     lfs_block_t tail[2]; | ||||||
|     uint32_t rev; |     uint32_t rev; | ||||||
|     lfs_off_t off; |     lfs_off_t off; | ||||||
|     uint32_t etag; |     uint32_t etag; | ||||||
|     uint16_t count; |     uint16_t count; | ||||||
|     bool erased; |     bool erased; | ||||||
|  |     bool split; | ||||||
|  |  | ||||||
|  |     uint16_t id; | ||||||
|  |     lfs_block_t head[2]; | ||||||
|  |     lfs_off_t pos; | ||||||
| } lfs_dir_t_; | } lfs_dir_t_; | ||||||
|  |  | ||||||
| typedef struct lfs_superblock { | typedef struct lfs_superblock { | ||||||
| @@ -381,6 +391,19 @@ typedef struct lfs_superblock { | |||||||
|     } d; |     } d; | ||||||
| } lfs_superblock_t; | } lfs_superblock_t; | ||||||
|  |  | ||||||
|  | typedef struct lfs_superblock_ { | ||||||
|  |     lfs_block_t root[2]; | ||||||
|  |     char magic[8]; | ||||||
|  |     uint32_t version; | ||||||
|  |  | ||||||
|  |     lfs_size_t block_size; | ||||||
|  |     lfs_size_t block_count; | ||||||
|  |  | ||||||
|  |     lfs_size_t inline_size; | ||||||
|  |     lfs_size_t attrs_size; | ||||||
|  |     lfs_size_t name_size; | ||||||
|  | } lfs_superblock_t_; | ||||||
|  |  | ||||||
| typedef struct lfs_free { | typedef struct lfs_free { | ||||||
|     lfs_block_t off; |     lfs_block_t off; | ||||||
|     lfs_block_t size; |     lfs_block_t size; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user