l2of_vd() contains the necessary bits to append the partition number
to the resulting OFPATH, but it does not actually extract the partition
number from the logical device path in the first place. This adds the
missing substring extraction of the partition number from the logical
device path so that the partition number is appended to OFPATH when
the logical device is a partition.

Signed-off-by: John Paul Adrian Glaubitz <glaub...@physik.fu-berlin.de>
---
 scripts/ofpathname | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/scripts/ofpathname b/scripts/ofpathname
index 906cee9..cee4dd2 100755
--- a/scripts/ofpathname
+++ b/scripts/ofpathname
@@ -564,6 +564,12 @@ l2of_vd()
         err $ERR_NOT_CONFIG
     fi
 
+    # partition number: N in vd*N
+    local devpart="${DEVICE##*[a-z]}"
+    if [[ $devpart = $DEVICE ]]; then
+        devpart='' # no partition number
+    fi
+
     local link=`get_link "device"`
     if [[ -z $link ]]; then
         err $ERR_NO_SYSFS_DEVINFO
-- 
2.31.0

Reply via email to