|
|
|
|
|
|
|
|
|
|
xen-devel
[Xen-devel] [PATCH] Fix losetup -f not working on SLES10
Andre,
Does this fix the problem for you?
/gary
Signed-off-by: Gary Grebus <gary.grebus@xxxxxxxxxx>
diff -r b928797213ac tools/hotplug/Linux/block
--- a/tools/hotplug/Linux/block Fri Dec 11 09:17:09 2009 +0000
+++ b/tools/hotplug/Linux/block Fri Dec 11 15:44:43 2009 -0500
@@ -16,6 +16,26 @@
echo -n $dev
}
+find_free_loopback_helper() {
+ local next_devnum=0
+ local busy_devnum
+ while read busy_devnum; do
+ if [ "$next_devnum" != "$busy_devnum" ]; then
+ break
+ fi
+ let next_devnum=$next_devnum+1
+ done
+ echo "/dev/loop${next_devnum}"
+}
+
+# Not all distros have "losetup -f"
+find_free_loopback_dev() {
+ local loopdev
+ loopdev=$(losetup -a | sed -e 's+^/dev/loop++' -e 's/:.*//' |
find_free_loopback_helper)
+ if [ -n "$loopdev" ] && [ -b "$loopdev" ]; then
+ echo "$loopdev"
+ fi
+}
##
# check_sharing device mode
@@ -270,7 +290,7 @@
done
fi
- loopdev=$(losetup -f)
+ loopdev=$(find_free_loopback_dev)
if [ "$loopdev" = '' ]
then
release_lock "block"
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
<Prev in Thread] |
Current Thread |
[Next in Thread> |
- [Xen-devel] [PATCH] Fix losetup -f not working on SLES10,
Gary Grebus <=
|
|
|
|
|