linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
To: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org
Cc: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Subject: [PATCH blktests 1/3] common/rc: introduce _get_pci_from_dev_sysfs
Date: Fri, 26 May 2023 13:58:41 +0900	[thread overview]
Message-ID: <20230526045843.168739-2-shinichiro.kawasaki@wdc.com> (raw)
In-Reply-To: <20230526045843.168739-1-shinichiro.kawasaki@wdc.com>

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 | 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



  reply	other threads:[~2023-05-26  4:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-26  4:58 [PATCH blktests 0/3] improve block/011 Shin'ichiro Kawasaki
2023-05-26  4:58 ` Shin'ichiro Kawasaki [this message]
2023-05-26  4:58 ` [PATCH blktests 2/3] block/011: skip when mounted block devices are affected Shin'ichiro Kawasaki
2023-05-26  4:58 ` [PATCH blktests 3/3] block/011: recover test target NVME device capacity Shin'ichiro Kawasaki
2023-06-13 11:35 ` [PATCH blktests 0/3] improve block/011 Shinichiro Kawasaki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230526045843.168739-2-shinichiro.kawasaki@wdc.com \
    --to=shinichiro.kawasaki@wdc.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).