提交 9e48ee80 编写于 作者: A Antonio Cardace 提交者: Jakub Kicinski

selftests: refactor get_netdev_name function

As pointed out by Michal Kubecek, getting the name
with the previous approach was racy, it's better
and easier to get the name of the device with this
patch's approach.

Essentialy the function doesn't need to exist
anymore as it's a simple 'ls' command.
Signed-off-by: NAntonio Cardace <acardace@redhat.com>
Signed-off-by: NJakub Kicinski <kuba@kernel.org>
上级 fbb8531e
......@@ -20,23 +20,6 @@ function cleanup {
trap cleanup EXIT
function get_netdev_name {
local -n old=$1
new=$(ls /sys/class/net)
for netdev in $new; do
for check in $old; do
[ $netdev == $check ] && break
done
if [ $netdev != $check ]; then
echo $netdev
break
fi
done
}
function check {
local code=$1
local str=$2
......@@ -65,5 +48,6 @@ function make_netdev {
fi
echo $NSIM_ID > /sys/bus/netdevsim/new_device
echo `get_netdev_name old_netdevs`
# get new device name
ls /sys/bus/netdevsim/devices/netdevsim${NSIM_ID}/net/
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册