The losetup provides an -f option to discover an unused loop device. As
implemented, it is racy. The problem is that -f prints the loop device
to stdout only when used standalone. This means a script has to do:
lodev=$(losetup -f)
losetup $lodev $filename
which is racy if another script may be running.
This patch add a new option '-s'. The '-s' option prints device name
if the -f option and a file argument are present. For example: