Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix EROFS support of TurboOCI-apply #333

Merged
merged 1 commit into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/overlaybd/tar/erofs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ include(FetchContent)
FetchContent_Declare(
erofs-utils
GIT_REPOSITORY https://gitee.com/anolis/erofs-utils.git
GIT_TAG overlaybd-dev-2
GIT_TAG overlaybd-dev-3
)

FetchContent_MakeAvailable(erofs-utils)
Expand All @@ -13,7 +13,7 @@ execute_process(
WORKING_DIRECTORY ${erofs-utils_SOURCE_DIR}
)
execute_process(
COMMAND ./configure --disable-lz4 --without-liblzma --without-libzstd
COMMAND ./configure --disable-lz4 --without-liblzma --without-libzstd --without-uuid
WORKING_DIRECTORY ${erofs-utils_SOURCE_DIR}
)
execute_process(
Expand All @@ -37,7 +37,5 @@ 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})
14 changes: 5 additions & 9 deletions src/overlaybd/tar/erofs/liberofs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "erofs/cache.h"
#include "erofs/block_list.h"
#include "erofs/inode.h"
#include "erofs/config.h"
#include "../../lsmt/file.h"
#include "../../lsmt/index.h"
#include <photon/common/alog.h>
Expand Down Expand Up @@ -449,7 +450,6 @@ int erofs_mkfs(struct erofs_mkfs_cfg *cfg)
err = PTR_ERR(sb_bh);
goto exit;
}
//erofs_uuid_generate(sbi->uuid);
} else {
err = erofs_read_superblock(sbi);
if (err) {
Expand All @@ -475,7 +475,7 @@ int erofs_mkfs(struct erofs_mkfs_cfg *cfg)
goto exit;
}

err = erofs_rebuild_dump_tree(root, cfg->incremental, cfg->ovlfs_strip);
err = erofs_rebuild_dump_tree(root, cfg->incremental);
if (err < 0) {
LOG_ERROR("[erofs] Fail to dump tree.");
goto exit;
Expand Down Expand Up @@ -514,14 +514,8 @@ static int erofs_init_sbi(struct erofs_sb_info *sbi, photon::fs::IFile *fout,
struct erofs_vfops *ops, int blkbits)
{
int err;
struct timeval t;

sbi->blkszbits = (char)blkbits;
err = gettimeofday(&t, NULL);
if (err)
return err;
sbi->build_time = t.tv_sec;
sbi->build_time_nsec = t.tv_usec;
sbi->bdev.ops = ops;
fout->lseek(0, 0);
sbi->devsz = INT64_MAX;
Expand Down Expand Up @@ -614,6 +608,7 @@ int LibErofs::extract_tar(photon::fs::IFile *source, bool meta_only, bool first_
struct erofs_sb_info sbi = {};
struct erofs_tarfile erofstar = {};
struct erofs_mkfs_cfg cfg;
struct erofs_configure *erofs_cfg;
int err;

_target = target;
Expand Down Expand Up @@ -657,7 +652,8 @@ int LibErofs::extract_tar(photon::fs::IFile *source, bool meta_only, bool first_
cfg.sbi = &sbi;
cfg.erofstar = &erofstar;
cfg.incremental = !first_layer;
cfg.ovlfs_strip = true;
erofs_cfg = erofs_get_configure();
erofs_cfg->c_ovlfs_strip = true;

err = erofs_mkfs(&cfg);
if (err) {
Expand Down
Loading