summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Lebleu <pme.lebleu@gmail.com>2018-05-23 10:55:57 +0200
committerJohn Crispin <john@phrozen.org>2018-05-24 09:40:35 +0200
commit242248cb109d2ffac5962165b7d8f04abfd0e149 (patch)
tree1c47275169579f7ba03b3e94d26dfaf24f4f6b3b
parente24368361db166cf369a19cea773bd54f9d854b1 (diff)
downloadfstools-242248cb109d2ffac5962165b7d8f04abfd0e149.tar.gz
fstools: allow to compress the filesystem
In order to allow the mounting of the filesystem with the zlib compression, a new CMake option (eg: CMAKE_OVL_MOUNT_COMPRESS_ZLIB) has been added. Signed-off-by: Pierre Lebleu <pme.lebleu@gmail.com>
-rw-r--r--CMakeLists.txt4
-rw-r--r--libfstools/overlay.c8
2 files changed, 11 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9e855bd..4844c03 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -52,6 +52,10 @@ INSTALL(FILES libubi/libubi-tiny.h libubi/libubi.h libubi/ubi-media.h
DESTINATION include
)
+IF(DEFINED CMAKE_OVL_MOUNT_COMPRESS_ZLIB)
+ ADD_DEFINITIONS(-DOVL_MOUNT_COMPRESS_ZLIB)
+ENDIF(DEFINED CMAKE_OVL_MOUNT_COMPRESS_ZLIB)
+
ADD_EXECUTABLE(mount_root mount_root.c)
TARGET_LINK_LIBRARIES(mount_root fstools)
INSTALL(TARGETS mount_root RUNTIME DESTINATION sbin)
diff --git a/libfstools/overlay.c b/libfstools/overlay.c
index ebc43f7..068afdc 100644
--- a/libfstools/overlay.c
+++ b/libfstools/overlay.c
@@ -341,7 +341,13 @@ static int overlay_mount_fs(struct volume *v)
return -1;
}
- if (mount(v->blk, "/tmp/overlay", fstype, MS_NOATIME, NULL)) {
+ if (mount(v->blk, "/tmp/overlay", fstype, MS_NOATIME,
+#ifdef OVL_MOUNT_COMPRESS_ZLIB
+ "compr=zlib"
+#else
+ NULL
+#endif
+ )) {
ULOG_ERR("failed to mount -t %s %s /tmp/overlay: %m\n",
fstype, v->blk);
return -1;