Re: [PATCH 1/3] ofpathname: Add partition support to l2of_ide() and l2of_scsi()
On 4/19/20 2:35 AM, John Paul Adrian Glaubitz wrote:
> Currently, only l2of_nvme() supports handling of partitions which
> will print the partition number at the end of an OF path. However,
> this feature is also useful for IDE and SCSI targets as well and
> mandatory for Macintosh systems.
>
> Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
> ---
> scripts/ofpathname | 27 +++++++++++++++++++++++++++
> 1 file changed, 27 insertions(+)
>
> diff --git a/scripts/ofpathname b/scripts/ofpathname
> index c37c6bd..0e58005 100755
> --- a/scripts/ofpathname
> +++ b/scripts/ofpathname
> @@ -519,6 +519,13 @@ l2of_ide()
> if [[ -z $link ]]; then
> err $ERR_NO_SYSFS_DEVINFO
> fi
> +
> + # partition number: N in sd*N
> + local devpart="${DEVICE##*[a-z]}"
> + if [[ $devpart = $DEVICE ]]; then
> + devpart='' # no partition number
> + fi
> +
> cd $link
>
> # get the device number
> @@ -584,6 +591,13 @@ l2of_vd()
> if [[ -z $OF_PATH ]]; then
> err $ERR_NO_OFPATH
> fi
> +
> + # No partition specified.
> + if [[ -z $devpart ]]; then
> + return
> + fi
> +
> + OF_PATH="${OF_PATH}:${devpart}"
> }
>
> #
> @@ -786,6 +800,12 @@ l2of_scsi()
> err $ERR_NOT_CONFIG
> fi
>
> + # partition number: N in sd*N
> + local devpart="${DEVICE##*[a-z]}"
> + if [[ $devpart = $DEVICE ]]; then
> + devpart='' # no partition number
> + fi
> +
> # follow the 'device' link
> local link=`get_link "device"`
> if [[ -z $link ]]; then
> @@ -944,6 +964,13 @@ l2of_scsi()
> OF_PATH=$OF_PATH/sd@$ID,$LUN
> fi
> fi
> +
> + # No partition specified.
> + if [[ -z $devpart ]]; then
> + return
> + fi
> +
> + OF_PATH="${OF_PATH}:${devpart}"
Heads up this may be problematic for pseries lpars. The current behavior is that
regardless of the scsi partition the logical device always translates to the
full underlying disk. I will need to confirm whether OF is going to complain
when the partition number is appended.
-Tyrel
> }
>
> #
>
Reply to: