debuggers.hg

changeset 22819:02c0af2bf280

tools/hotplug/Linux: allow hardlinked files for block device images

tools/hotplug/Linux/block change for this losetup -a output:
(inode 12 is listed twice due to hardlinks)

/dev/loop0: [0809]:139267 (/abuild/vdisk-sles11_2-disk0)
/dev/loop1: [0809]:139266 (/abuild/vdisk-sles11_1-disk1)
/dev/loop3: [0809]:139267 (/abuild/vdisk-sles11_2-disk0)
/dev/loop5: [0809]:139273 (/abuild/vdisk-sles11_5-disk1)
/dev/loop8: [0809]:12 (/abuild/bootiso-xenpaging-sles11_5.iso)
/dev/loop10: [0809]:12 (/abuild/bootiso-xenpaging-sles11_4.iso)
/dev/loop11: [0809]:139271 (/abuild/vdisk-sles11_4-disk0)

Without this change, $dev would contain /dev/loop8\n/dev/loop10
Applies to 4.0 and 4.1

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
author Olaf Hering <olaf@aepfle.de>
date Mon Jan 17 18:05:52 2011 +0000 (2011-01-17)
parents 654563af359f
children 96441daf4a5b
files tools/hotplug/Linux/block
line diff
     1.1 --- a/tools/hotplug/Linux/block	Mon Jan 17 17:55:12 2011 +0000
     1.2 +++ b/tools/hotplug/Linux/block	Mon Jan 17 18:05:52 2011 +0000
     1.3 @@ -279,8 +279,8 @@ mount it read-write in a guest domain."
     1.4              fatal "Unable to lookup $file: dev: $dev inode: $inode"
     1.5            fi
     1.6  
     1.7 -          shared_list=$(losetup -a | grep ' \[0*'${dev}'\]:'${inode} |
     1.8 -                cut -d : -f 1)
     1.9 +          shared_list=$(losetup -a |
    1.10 +                sed -n -e "s@^\([^:]\+\)\(:[[:blank:]]\[${dev}\]:${inode}[[:blank:]](${file})\)@\1@p" )
    1.11            for dev in "$shared_list"
    1.12            do
    1.13              if [ -n "$dev" ]