Add support for erofs - #24
Merged
Merged
Conversation
chenxiaolong
force-pushed
the
erofs
branch
3 times, most recently
from
August 28, 2026 01:21
3d91d16 to
3754fb2
Compare
This is built on top of the official erofs-utils project. Unfortunately, unlike e2fsprogs, erofs-utils doesn't really work well when used as a library. There are global variables everywhere and assumptions made based on how the official CLI tools consume the library. This is worked around by just having afsr's ErofsFilesystem take a global lock for its entire lifetime. For unpacking, the process is pretty straight forward. The erofs image is opened and read the same way as fuse.erofs does it. For packing, there is no library API for what mkfs.erofs does, so afsr embeds a copy of that command (like what is already done for mke2fs) and feeds it a tarball of the file contents and metadata. erofs-utils is not cross-platform and makes a lot of Linux-specific assumptions. afsr uses a fork of the project to add the bare minimum needed to allow it to also run on Windows and Mac. erofs-utils' multithreading support is built on top of the pthreads API, so the Windows builds are compiled without support for multithreading. Finally, unlike e2fsprogs, afsr is built on top of the upstream 1.9.4 release of erofs-utils instead of Android's android-17.0.0_r1 tag. Android's fork is based on an old version of erofs-utils that contains several memory safety issues. On Linux, they just make valgrind unhappy, but on Windows, they crash the process. Our fork includes some additional patches to fix other memory safety issues. Fixes: #14 Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
chenxiaolong
added a commit
that referenced
this pull request
Aug 28, 2026
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is built on top of the official erofs-utils project. Unfortunately, unlike e2fsprogs, erofs-utils doesn't really work well when used as a library. There are global variables everywhere and assumptions made based on how the official CLI tools consume the library. This is worked around by just having afsr's
ErofsFilesystemtake a global lock for its entire lifetime.For unpacking, the process is pretty straight forward. The erofs image is opened and read the same way as
fuse.erofsdoes it. For packing, there is no library API for whatmkfs.erofsdoes, so afsr embeds a copy of that command (like what is already done formke2fs) and feeds it a tarball of the file contents and metadata.erofs-utils is not cross-platform and makes a lot of Linux-specific assumptions. afsr uses a fork of the project to add the bare minimum needed to allow it to also run on Windows and Mac. erofs-utils' multithreading support is built on top of the pthreads API, so the Windows builds are compiled without support for multithreading.
Finally, unlike e2fsprogs, afsr is built on top of the upstream 1.9.4 release of erofs-utils instead of Android's
android-17.0.0_r1tag. Android's fork is based on an old version of erofs-utils that contains several memory safety issues. On Linux, they just make valgrind unhappy, but on Windows, they crash the process. Our fork includes some additional patches to fix other memory safety issues.Fixes: #14