1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-25 01:34:28 +03:00

path_id: rework SAS persistent names

This commit is contained in:
Jeremy Higdon 2008-12-18 13:42:28 +01:00 committed by Kay Sievers
parent b6626d0962
commit 6a481373b4

View File

@ -285,44 +285,46 @@ handle_sas () {
: handle_sas $* : handle_sas $*
local DEV=$1 local DEV=$1
local cil adapter controller_dev local cil adapter controller_dev
local lun
lun=${DEV##*:}
# SAS device # SAS device
sas_host_path="${DEV%%/port*}" sas_end_path="${DEV%%/target*}"
sas_phy_path="${DEV#*/host*/}" sas_host_path="${sas_end_path%%/port*}"
sas_phy_path="${sas_phy_path%%/target*}" sas_phy_path="${sas_end_path#*/host*/}"
sas_phy_id="${sas_phy_path%%/*}" sas_phy_path="${sas_phy_path%%/*}"
sas_phy_id="${sas_phy_id##*port-}" sas_phy_path="${sas_host_path}/${sas_phy_path}"
sas_port_id="${sas_phy_path%%/end_device*}"
sas_port_id="${sas_port_id##*port-}" sas_phy_id=255
sas_end_id="${sas_phy_path##*end_device-}" for phy in $sas_phy_path/phy-*/sas_phy/phy-* ; do
sas_phy_dev="/sys/class/sas_phy/phy-${sas_phy_id}" if [ -d "$phy" ] ; then
if [ -e "$sas_phy_dev/sas_address" ]; then read phy_id < $phy/phy_identifier
read phy_address < $sas_phy_dev/sas_address if [ $phy_id -lt $sas_phy_id ]; then
read phy_id < $sas_phy_dev/phy_identifier sas_phy_id=$phy_id
fi fi
if [ -z "$phy_address" ] ; then fi
done
if [ $sas_phy_id -eq 255 ] ; then
: no initiator address : no initiator address
D= D=
RESULT=1 RESULT=1
return return
fi fi
sas_port_id="${sas_phy_path##*/port-}"
sas_port_dev="/sys/class/sas_port/port-${sas_port_id}" sas_port_dev="/sys/class/sas_port/port-${sas_port_id}"
if [ -e "$sas_port_dev/num_phys" ] ; then if [ -e "$sas_port_dev/num_phys" ] ; then
read phy_port < $sas_port_dev/num_phys read phy_port < $sas_port_dev/num_phys
fi fi
if [ -z "$phy_port" ] ; then
: no initiator address sas_end_id="${sas_end_path##*end_device-}"
D=
RESULT=1
return
fi
sas_phy_address="$phy_address:$phy_port:$phy_id"
sas_end_dev="/sys/class/sas_device/end_device-${sas_end_id}" sas_end_dev="/sys/class/sas_device/end_device-${sas_end_id}"
if [ -e "$sas_end_dev/sas_address" ]; then if [ -e "$sas_end_dev/sas_address" ]; then
read end_address < $sas_end_dev/sas_address read end_address < $sas_end_dev/sas_address
read end_id < $sas_end_dev/phy_identifier read end_id < $sas_end_dev/phy_identifier
fi fi
if [ -z "$end_address" ] ; then if [ -z "$end_address" ] ; then
: no initiator address : no end device address
D= D=
RESULT=1 RESULT=1
return return
@ -330,7 +332,7 @@ handle_sas () {
sas_end_address="$end_address:$end_id" sas_end_address="$end_address:$end_id"
controller_dev="${sas_host_path%/host[0-9]*}" controller_dev="${sas_host_path%/host[0-9]*}"
# SAS devices are always endpoints # SAS devices are always endpoints
d="sas-${sas_phy_address}-${sas_end_address}" d="sas-phy${sas_phy_id}:${phy_port}-${sas_end_address}-lun$lun"
D="$controller_dev" D="$controller_dev"
RESULT=0 RESULT=0
} }