mirror of
				https://github.com/eledio-devices/thirdparty-littlefs.git
				synced 2025-11-01 00:38:29 +01:00 
			
		
		
		
	WIP minor change to fix rename issue
This commit is contained in:
		
							
								
								
									
										11
									
								
								lfs.c
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								lfs.c
									
									
									
									
									
								
							| @@ -636,6 +636,12 @@ static int lfs_commit_movescan(lfs_t *lfs, void *p, lfs_entry_t entry) { | |||||||
|         return 0; |         return 0; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     if (lfs_tag_type(entry.tag) == LFS_TYPE_MOVE) { | ||||||
|  |         // TODO need this? | ||||||
|  |         // ignore moves | ||||||
|  |         return 0; | ||||||
|  |     } | ||||||
|  |  | ||||||
|     if (lfs_tag_id(entry.tag) != move->id.from) { |     if (lfs_tag_id(entry.tag) != move->id.from) { | ||||||
|         // ignore non-matching ids |         // ignore non-matching ids | ||||||
|         return 0; |         return 0; | ||||||
| @@ -823,6 +829,9 @@ static int lfs_dir_fetchwith(lfs_t *lfs, | |||||||
|  |  | ||||||
|                     if (lfs_tag_type(tag) == LFS_TYPE_DELETE) { |                     if (lfs_tag_type(tag) == LFS_TYPE_DELETE) { | ||||||
|                         dir->count -= 1; |                         dir->count -= 1; | ||||||
|  |                         if (dir->moveid != -1) { | ||||||
|  |                             //printf("RENAME DEL %d (%d)\n", lfs_tag_id(tag), dir->moveid); | ||||||
|  |                         } | ||||||
|                         if (lfs_tag_id(tag) == dir->moveid) { |                         if (lfs_tag_id(tag) == dir->moveid) { | ||||||
|                             dir->moveid = -1; |                             dir->moveid = -1; | ||||||
|                         } else if (lfs_tag_id(tag) < dir->moveid) { |                         } else if (lfs_tag_id(tag) < dir->moveid) { | ||||||
| @@ -3736,6 +3745,7 @@ int lfs_rename(lfs_t *lfs, const char *oldpath, const char *newpath) { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     // mark as moving |     // mark as moving | ||||||
|  |     //printf("RENAME MOVE %d %d %d\n", oldcwd.pair[0], oldcwd.pair[1], oldid); | ||||||
|     err = lfs_dir_commit(lfs, &oldcwd, &(lfs_entrylist_t){ |     err = lfs_dir_commit(lfs, &oldcwd, &(lfs_entrylist_t){ | ||||||
|             {lfs_mktag(LFS_TYPE_MOVE, oldid, 0)}}); |             {lfs_mktag(LFS_TYPE_MOVE, oldid, 0)}}); | ||||||
|     if (err) { |     if (err) { | ||||||
| @@ -3771,6 +3781,7 @@ int lfs_rename(lfs_t *lfs, const char *oldpath, const char *newpath) { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     // remove old entry |     // remove old entry | ||||||
|  |     //printf("RENAME DELETE %d %d %d\n", oldcwd.pair[0], oldcwd.pair[1], oldid); | ||||||
|     err = lfs_dir_delete(lfs, &oldcwd, oldid); |     err = lfs_dir_delete(lfs, &oldcwd, oldid); | ||||||
|     if (err) { |     if (err) { | ||||||
|         return err; |         return err; | ||||||
|   | |||||||
							
								
								
									
										5
									
								
								lfs.h
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								lfs.h
									
									
									
									
									
								
							| @@ -114,6 +114,11 @@ enum lfs_type { | |||||||
|     LFS_STRUCT_INLINE   = 0x000, |     LFS_STRUCT_INLINE   = 0x000, | ||||||
|     LFS_STRUCT_CTZ      = 0x004, |     LFS_STRUCT_CTZ      = 0x004, | ||||||
|     LFS_STRUCT_DIR      = 0x008, |     LFS_STRUCT_DIR      = 0x008, | ||||||
|  |  | ||||||
|  |     // internal sources | ||||||
|  |     LFS_FROM_REGION     = 0x000, | ||||||
|  |     LFS_FROM_DISK       = 0x001, | ||||||
|  |     LFS_FROM_MOVE       = 0x002, | ||||||
| }; | }; | ||||||
|  |  | ||||||
| // File open flags | // File open flags | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user