WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] Fix losetup -f not working on SLES10

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Fix losetup -f not working on SLES10
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 14 Dec 2009 01:45:20 -0800
Delivery-date: Mon, 14 Dec 2009 01:45:51 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1260777381 0
# Node ID 7162eff6d0854112d9b73528937bfb8a9af62c11
# Parent  db8a985693f7ce37d3daee0023266ce8758ddae7
Fix losetup -f not working on SLES10

Signed-off-by: Gary Grebus <gary.grebus@xxxxxxxxxx>
---
 tools/hotplug/Linux/block |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletion(-)

diff -r db8a985693f7 -r 7162eff6d085 tools/hotplug/Linux/block
--- a/tools/hotplug/Linux/block Mon Dec 14 07:55:35 2009 +0000
+++ b/tools/hotplug/Linux/block Mon Dec 14 07:56:21 2009 +0000
@@ -16,6 +16,26 @@ expand_dev() {
   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 @@ mount it read-write in a guest domain."
           done
         fi
 
-        loopdev=$(losetup -f)
+        loopdev=$(find_free_loopback_dev)
         if [ "$loopdev" = '' ]
         then
           release_lock "block"

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Fix losetup -f not working on SLES10, Xen patchbot-unstable <=