mirror of
				https://github.com/eledio-devices/thirdparty-littlefs.git
				synced 2025-10-31 16:14:16 +01:00 
			
		
		
		
	Added possibility to open multiple files with LFS_NO_MALLOC enabled.
This commit is contained in:
		
				
					committed by
					
						 Christopher Haster
						Christopher Haster
					
				
			
			
				
	
			
			
			
						parent
						
							f94d233deb
						
					
				
				
					commit
					97711d78c4
				
			
							
								
								
									
										7
									
								
								lfs.c
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								lfs.c
									
									
									
									
									
								
							| @@ -1283,7 +1283,7 @@ static int lfs_ctz_traverse(lfs_t *lfs, | ||||
|  | ||||
| /// Top level file operations /// | ||||
| int lfs_file_open(lfs_t *lfs, lfs_file_t *file, | ||||
|         const char *path, int flags) { | ||||
|         const char *path, int flags, void *file_buffer) { | ||||
|     // deorphan if we haven't yet, needed at most once after poweron | ||||
|     if ((flags & 3) != LFS_O_RDONLY && !lfs->deorphaned) { | ||||
|         int err = lfs_deorphan(lfs); | ||||
| @@ -1340,7 +1340,10 @@ int lfs_file_open(lfs_t *lfs, lfs_file_t *file, | ||||
|     } | ||||
|  | ||||
|     // allocate buffer if needed | ||||
|     if (lfs->cfg->file_buffer) { | ||||
|     file->cache.block = 0xffffffff; | ||||
|     if (file_buffer) { | ||||
|         file->cache.buffer = file_buffer; | ||||
|     } else if (lfs->cfg->file_buffer) { | ||||
|         if (lfs->files) { | ||||
|             // already in use | ||||
|             return LFS_ERR_NOMEM; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user