From 6561e07460acc5b38af99aa5e80283dc04953eca Mon Sep 17 00:00:00 2001 From: Steffen Trumtrar Date: Wed, 29 Jul 2020 10:43:53 +0200 Subject: mount: support the sizelimit and offset option for loop devices Starting with linux kernel v5.4 squashfs has a more strict parameter checking implemented. Unlike util-linux mount, busybox never supported the sizelimit option but simply forwards it to the kernel. Since v5.4 mounting will fail with squashfs: Unknown parameter 'sizelimit' Support the sizelimit parameter by setting it in the LOOP_SET_STATUS64 structure before handing it to the kernel. While at it also add support for the offset option, which currently will always be set to 0. function old new delta cut_out_ull_opt - 167 +167 singlemount 1230 1266 +36 set_loop 834 862 +28 losetup_main 479 483 +4 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 3/0 up/down: 235/0) Total: 235 bytes Signed-off-by: Steffen Trumtrar Signed-off-by: Denys Vlasenko --- include/libbb.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/libbb.h b/include/libbb.h index 8c79784..83ecca4 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -1515,7 +1515,8 @@ int del_loop(const char *device) FAST_FUNC; * malloc and return it in *devname. * return value is the opened fd to the loop device, or < on error */ -int set_loop(char **devname, const char *file, unsigned long long offset, unsigned flags) FAST_FUNC; +int set_loop(char **devname, const char *file, unsigned long long offset, + unsigned long long sizelimit, unsigned flags) FAST_FUNC; /* These constants match linux/loop.h (without BB_ prefix): */ #define BB_LO_FLAGS_READ_ONLY 1 #define BB_LO_FLAGS_AUTOCLEAR 4 -- cgit v1.1