[OpenWrt-Devel] [PATCH 1/2] fstools: allow to customize the mount option for the overlay

Pierre Lebleu pme.lebleu at gmail.com
Fri May 18 10:07:42 EDT 2018


In order to give some extra options (specific to the filesystem used),
a new CMake option (eg: CMAKE_OVL_MOUNT_OPTION) has been added.

Example: cmake -DCMAKE_OVL_MOUNT_OPTION="compr=zlib"

Signed-off-by: Pierre Lebleu <pme.lebleu at gmail.com>
---
 CMakeLists.txt       | 6 ++++++
 libfstools/overlay.c | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9e855bd..484d716 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -52,6 +52,12 @@ INSTALL(FILES libubi/libubi-tiny.h libubi/libubi.h libubi/ubi-media.h
 	DESTINATION include
 )
 
+IF(DEFINED CMAKE_OVL_MOUNT_OPTION)
+	ADD_DEFINITIONS(-DOVL_MOUNT_OPTION=${CMAKE_OVL_MOUNT_OPTION})
+ELSE(DEFINED CMAKE_OVL_MOUNT_OPTION)
+	ADD_DEFINITIONS(-DOVL_MOUNT_OPTION=NULL)
+ENDIF(DEFINED CMAKE_OVL_MOUNT_OPTION)
+
 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..5d5a985 100644
--- a/libfstools/overlay.c
+++ b/libfstools/overlay.c
@@ -341,7 +341,7 @@ 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, OVL_MOUNT_OPTION)) {
 		ULOG_ERR("failed to mount -t %s %s /tmp/overlay: %m\n",
 		         fstype, v->blk);
 		return -1;
-- 
1.9.1


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
http://lists.infradead.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list