mirror of
				https://github.com/eledio-devices/thirdparty-littlefs.git
				synced 2025-10-31 00:32:38 +01:00 
			
		
		
		
	Added tests for global state stealing
State stealing is a tricky part of managing the xored-globals. When removing a metadata-pair from the metadata chain, whichever metadata-pair does the removing is also responsible for stealing the removed metadata-pair's global delta and incorporating it into it's own global delta. Otherwise the global state would become corrupted.
This commit is contained in:
		
							
								
								
									
										2
									
								
								lfs.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								lfs.c
									
									
									
									
									
								
							| @@ -2513,7 +2513,6 @@ int lfs_remove(lfs_t *lfs, const char *path) { | ||||
|         lfs_globaldeorphaned(lfs, true); | ||||
|  | ||||
|         // steal state | ||||
|         // TODO test for global state stealing? | ||||
|         cwd.tail[0] = dir.tail[0]; | ||||
|         cwd.tail[1] = dir.tail[1]; | ||||
|         lfs_globalxor(&lfs->locals, &dir.locals); | ||||
| @@ -2626,7 +2625,6 @@ int lfs_rename(lfs_t *lfs, const char *oldpath, const char *newpath) { | ||||
|         lfs_globaldeorphaned(lfs, true); | ||||
|  | ||||
|         // steal state | ||||
|         // TODO test for global state stealing? | ||||
|         newcwd.tail[0] = prevdir.tail[0]; | ||||
|         newcwd.tail[1] = prevdir.tail[1]; | ||||
|         lfs_globalxor(&lfs->locals, &prevdir.locals); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user