Skip to content

Commit

Permalink
Introduce tarerofs I/O API
Browse files Browse the repository at this point in the history
Previously, erofs-utils was integrated into overlaybd by
using the `mkfs.erofs` executable file. It's not optimial
since raw data needs to be dumped first and output data
needs to be write into overlaybd then.

This commit introduces the I/O API in tarerofs, that the data
stream of the:
- output image
- input tar file
can be controlled by the I/O manager.

This also adds block read/write cache support for IFile to
improve the efficiency of making file system images.

Signed-off-by: Hongzhen Luo <[email protected]>
  • Loading branch information
salvete committed Jun 26, 2024
1 parent 27b69e9 commit 652bc76
Show file tree
Hide file tree
Showing 7 changed files with 753 additions and 181 deletions.
3 changes: 3 additions & 0 deletions src/overlaybd/tar/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ target_include_directories(tar_lib PUBLIC
if(BUILD_TESTING)
add_subdirectory(test)
endif()

add_subdirectory(erofs)
target_link_libraries(tar_lib PRIVATE erofs_lib)
43 changes: 43 additions & 0 deletions src/overlaybd/tar/erofs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
include(FetchContent)

FetchContent_Declare(
erofs-utils
GIT_REPOSITORY https://gitee.com/anolis/erofs-utils.git
GIT_TAG overlaybd-dev-2
)

FetchContent_MakeAvailable(erofs-utils)

execute_process(
COMMAND ./autogen.sh
WORKING_DIRECTORY ${erofs-utils_SOURCE_DIR}
)
execute_process(
COMMAND ./configure --disable-lz4 --without-liblzma --without-libzstd
WORKING_DIRECTORY ${erofs-utils_SOURCE_DIR}
)
execute_process(
COMMAND make
WORKING_DIRECTORY ${erofs-utils_SOURCE_DIR}
)

set(EROFS_LIB_INCLUDE_DIR "${erofs-utils_SOURCE_DIR}/include/" CACHE PATH "erofs-utils include path.")
set(EROFS_CONFIG_FILE "${erofs-utils_SOURCE_DIR}/config.h" CACHE PATH "erofs-utils config file.")
set(EROFS_LIB_STATIC "${erofs-utils_SOURCE_DIR}/lib/.libs/liberofs.a" CACHE PATH "erofs-utils static lib.")

file(GLOB EROFS_SOURCE "*.cpp")

add_library(erofs_lib STATIC ${EROFS_SOURCE})

target_include_directories(erofs_lib PRIVATE
${PHOTON_INCLUDE_DIR}
)

target_include_directories(erofs_lib PRIVATE
${EROFS_LIB_INCLUDE_DIR}
)

target_link_libraries(erofs_lib PRIVATE uuid)

target_compile_options(erofs_lib PRIVATE "-include${EROFS_CONFIG_FILE}")
target_link_libraries(erofs_lib PRIVATE ${EROFS_LIB_STATIC})
Loading

0 comments on commit 652bc76

Please sign in to comment.