mirror of
				https://github.com/eledio-devices/thirdparty-littlefs.git
				synced 2025-10-31 16:14:16 +01:00 
			
		
		
		
	Tweaked thread-safe implementation
- Stayed on non-system include for lfs_util.h for now - Named internal functions "lfs_functionraw" - Merged lfs_fs_traverseraw - Added LFS_LOCK/UNLOCK macros - Changed LFS_THREADSAFE from 1/0 to defined/undefined to match LFS_READONLY
This commit is contained in:
		
							
								
								
									
										4
									
								
								lfs.h
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								lfs.h
									
									
									
									
									
								
							| @@ -9,7 +9,7 @@ | |||||||
|  |  | ||||||
| #include <stdint.h> | #include <stdint.h> | ||||||
| #include <stdbool.h> | #include <stdbool.h> | ||||||
| #include <lfs_util.h> | #include "lfs_util.h" | ||||||
|  |  | ||||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||||
| extern "C" | extern "C" | ||||||
| @@ -174,7 +174,7 @@ struct lfs_config { | |||||||
|     // are propogated to the user. |     // are propogated to the user. | ||||||
|     int (*sync)(const struct lfs_config *c); |     int (*sync)(const struct lfs_config *c); | ||||||
|  |  | ||||||
| #if LFS_THREADSAFE | #ifdef LFS_THREADSAFE | ||||||
|     // Lock the underlying block device. Negative error codes |     // Lock the underlying block device. Negative error codes | ||||||
|     // are propogated to the user. |     // are propogated to the user. | ||||||
|     int (*lock)(const struct lfs_config *c); |     int (*lock)(const struct lfs_config *c); | ||||||
|   | |||||||
| @@ -43,11 +43,6 @@ extern "C" | |||||||
| { | { | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| // Enables thread-safe wrappers using the lock/unlock callbacks in lfs_config |  | ||||||
| #ifndef LFS_THREADSAFE |  | ||||||
| #define LFS_THREADSAFE 0 |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| // Macros, may be replaced by system specific wrappers. Arguments to these | // Macros, may be replaced by system specific wrappers. Arguments to these | ||||||
| // macros must not have side-effects as the macros can be removed for a smaller | // macros must not have side-effects as the macros can be removed for a smaller | ||||||
| // code footprint | // code footprint | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user