Skip to content

Commit ac24d22

Browse files
aescolarcarlescufi
authored andcommitted
native FUSE FS access: Support any libC and fix random crashes
Split the fuse FS driver into 2 parts: A top built in the embedded side, with the embedded libC, and a bottom built in the runner side with the host libC. The error returns are converted to match the host libC. Also, before the host FUSE thread, which is asynchronous to Zephyr was calling directly into the Zephyr filesystem code, which resulted quite often if catastrophic failures or corruption of the Zephyr state. This is now fixed by having the FUSE thread queue requests to a Zephyr thread, which will be handled in the embedded side in a coherent way. This adds a slightly noticeable overhead, but the performance is still acceptable. Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
1 parent e44a952 commit ac24d22

File tree

5 files changed

+810
-369
lines changed

5 files changed

+810
-369
lines changed

subsys/fs/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,12 @@ if(CONFIG_FUSE_FS_ACCESS)
3636
zephyr_include_directories(${FUSE_INCLUDE_DIRS})
3737
if (CONFIG_NATIVE_LIBRARY)
3838
target_link_options(native_simulator INTERFACE "-l${FUSE_LIBRARIES}")
39+
target_sources(native_simulator INTERFACE fuse_fs_access_bottom.c)
40+
target_compile_options(native_simulator INTERFACE "-D_FILE_OFFSET_BITS=64")
3941
else()
4042
zephyr_link_libraries(${FUSE_LIBRARIES})
43+
zephyr_library_sources(fuse_fs_access_bottom.c)
44+
zephyr_library_compile_definitions(_FILE_OFFSET_BITS=64)
4145
endif()
42-
zephyr_library_compile_definitions(_FILE_OFFSET_BITS=64)
4346
zephyr_library_sources(fuse_fs_access.c)
4447
endif()

subsys/fs/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ config FILE_SYSTEM_MKFS
9595
config FUSE_FS_ACCESS
9696
bool "FUSE based access to file system partitions"
9797
depends on ARCH_POSIX
98+
select NATIVE_USE_NSI_ERRNO
9899
help
99100
Expose file system partitions to the host system through FUSE.
100101

0 commit comments

Comments
 (0)