[PATCH v6 1/3] common/zoned: add _require_zloop

Johannes Thumshirn
2025-10-17T05:50:18Z

Add _require_zloop() function used by tests that require support for the
zoned loopback block device.

Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
common/zoned | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/common/zoned b/common/zoned
index eed0082a..41697b08 100644
--- a/common/zoned
+++ b/common/zoned
@@ -37,3 +37,11 @@ _zone_capacity() {
grep -Po "cap 0x[[:xdigit:]]+" | cut -d ' ' -f 2)
echo $((size << 9))
}
+
+_require_zloop()
+{
+ modprobe zloop >/dev/null 2>&1
+ if [ ! -c "/dev/zloop-control" ]; then
+ _notrun "This test requires zoned loopback device support"
+ fi
+}
--
2.51.0