Skip to contentSkip to conversation

erofs-utils: fsck: add --extract=X support to extract to path X

PATCH New Gao Xiang 1 participant 1 message Jan 20, 2022

lore
Share & tools
lore

Gao Xiang

author
#0 lore raw

PATCH v2 1/1 erofs-utils: fsck: add --extract=X support to extract to path X

From: Igor Ostapenko <[email protected]>

Add support to extract directories, regular files and symlinks. Allocation for extract_path is done only once, then the buffer is reused.

Raw and compressed data chunks are handled with a unified function to avoid code duplication, compressed data is verified linearly (with EROFS_GET_BLOCKS_FIEMAP) instead of lookback, as it's problematic to extract data when looking backwards.

---
changes since v1:
- use tar-like options;
- derive ns timestamps.

 configure.ac |   3 +-
 fsck/main.c  | 570 +++++++++++++++++++++++++++++++++++++--------------
 mkfs/main.c  |   2 +-
 3 files changed, 419 insertions(+), 156 deletions(-)
configure.ac +2 -1
index a5de291c69d4..fa917e6337d2 100644
@@ -188,7 +188,8 @@ AC_CHECK_FUNCS(m4_flatten([
 	strerror
 	strrchr
 	strtoull
-	tmpfile64]))
+	tmpfile64
+	utimensat]))
 
 # Configure debug mode
 AS_IF([test "x$enable_debug" != "xno"], [], [
fsck/main.c +416 -154

689 lines not on this page · raw message

mkfs/main.c +1 -1
index 9eb696a2bc65..c755da1b519c 100644
@@ -595,7 +595,7 @@ int main(int argc, char **argv)
 	err = lstat64(cfg.c_src_path, &st);
 	if (err)
 		return 1;
-	if ((st.st_mode & S_IFMT) != S_IFDIR) {
+	if (!S_ISDIR(st.st_mode)) {
 		erofs_err("root of the filesystem is not a directory - %s",
 			  cfg.c_src_path);
 		usage();
Signature · 1 line
2.20.1