[PATCH blktests 1/3] common/rc: introduce _get_pci_from_dev_sysfs
Shin'ichiro Kawasaki
shinichiro.kawasaki at wdc.com
Thu May 25 21:58:41 PDT 2023
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 at wdc.com>
---
common/rc | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/common/rc b/common/rc
index 57e0f42..90122c0 100644
--- 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]' | \
--
2.40.1
More information about the Linux-nvme
mailing list