--- /dev/null
+#!/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
+}
. common/rc
. common/null_blk
+. common/dm
#
# Test requirement check functions
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")
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() {