new file mode 100644
@@ -0,0 +1,23 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2023 Western Digital Corporation or its affiliates.
+#
+# scsi_debug helper functions.
+
+_test_dev_is_dm() {
+ [[ -r "${TEST_DEV_SYSFS}/dm/name" ]]
+}
+
+# Get device file path from the device ID "major:minor".
+_get_dev_path_by_id() {
+ for d in /sys/block/* /sys/block/*/*; do
+ if [[ ! -r "${d}/dev" ]]; then
+ continue
+ fi
+ if [[ "${1}" == "$(<"${d}/dev")" ]]; then
+ echo "/dev/${d##*/}"
+ return 0
+ fi
+ done
+ return 1
+}
@@ -6,6 +6,7 @@
. common/rc
. common/null_blk
+. common/dm
#
# Test requirement check functions
@@ -281,10 +282,6 @@ _find_two_contiguous_seq_zones() {
return 1
}
-_test_dev_is_dm() {
- [[ -r "${TEST_DEV_SYSFS}/dm/name" ]]
-}
-
_require_test_dev_is_logical() {
if ! _test_dev_is_partition && ! _test_dev_is_dm; then
SKIP_REASONS+=("$TEST_DEV is not a logical device")
@@ -307,20 +304,6 @@ _test_dev_has_dm_map() {
return 0
}
-# Get device file path from the device ID "major:minor".
-_get_dev_path_by_id() {
- for d in /sys/block/* /sys/block/*/*; do
- if [[ ! -r "${d}/dev" ]]; then
- continue
- fi
- if [[ "${1}" == "$(<"${d}/dev")" ]]; then
- echo "/dev/${d##*/}"
- return 0
- fi
- done
- return 1
-}
-
# Given sector of TEST_DEV, return the device which contain the sector and
# corresponding sector of the container device.
_get_dev_container_and_sector() {
Create a new script file common/dm and move two helper functions for device-mapper from tests/zbd/rc. Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com> --- common/dm | 23 +++++++++++++++++++++++ tests/zbd/rc | 19 +------------------ 2 files changed, 24 insertions(+), 18 deletions(-) create mode 100644 common/dm