]> www.infradead.org Git - users/sagi/blktests.git/commitdiff
common/rc: introduce _get_pci_from_dev_sysfs
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Fri, 26 May 2023 04:58:41 +0000 (13:58 +0900)
committerShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Fri, 9 Jun 2023 04:53:11 +0000 (13:53 +0900)
To prepare for block/011 test case improvement, add the helper function
which gets PCI device from the given sysfs path of a block device.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
common/rc

index 57e0f422673f511f8a6120564d4f5fa0ae70ab5c..90122c034d332fbf438c40ee654dbeef5cb8af74 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -313,12 +313,16 @@ _require_test_dev_is_pci() {
        return 0
 }
 
-_get_pci_dev_from_blkdev() {
-       readlink -f "$TEST_DEV_SYSFS/device" | \
+_get_pci_from_dev_sysfs() {
+       readlink -f "$1/device" | \
                grep -Eo '[0-9a-f]{4,5}:[0-9a-f]{2}:[0-9a-f]{2}\.[0-9a-f]' | \
                tail -1
 }
 
+_get_pci_dev_from_blkdev() {
+       _get_pci_from_dev_sysfs "$TEST_DEV_SYSFS"
+}
+
 _get_pci_parent_from_blkdev() {
        readlink -f "$TEST_DEV_SYSFS/device" | \
                grep -Eo '[0-9a-f]{4,5}:[0-9a-f]{2}:[0-9a-f]{2}\.[0-9a-f]' | \