aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoriap10@labyrinth.cl.cam.ac.uk <iap10@labyrinth.cl.cam.ac.uk>2005-02-01 21:59:12 +0000
committeriap10@labyrinth.cl.cam.ac.uk <iap10@labyrinth.cl.cam.ac.uk>2005-02-01 21:59:12 +0000
commit2eb8f64d4ab00206859f777c6779254e7b711cc3 (patch)
tree0259423d7ce84e04ce46fe0d4afd605ccf5ec95c
parentbae735390fe42f0c59dbfbea4cfe9349e074cee2 (diff)
downloadxen-2eb8f64d4ab00206859f777c6779254e7b711cc3.tar.gz
xen-2eb8f64d4ab00206859f777c6779254e7b711cc3.tar.bz2
xen-2eb8f64d4ab00206859f777c6779254e7b711cc3.zip
bitkeeper revision 1.1159.223.56 (41fffbb0baSUSOWVCJ_0NFmEtCmUkw)
Fix the device number calculation for /dev/hd* device names; ide device numbering works differently to scsi Signed-off-by: Jody Belka <knew-xen@pimb.org> Signed-off-by: ian.pratt@cl.cam.ac.uk
-rwxr-xr-xtools/python/xen/xend/server/blkif.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/python/xen/xend/server/blkif.py b/tools/python/xen/xend/server/blkif.py
index b980ebcb72..8a1de09bfc 100755
--- a/tools/python/xen/xend/server/blkif.py
+++ b/tools/python/xen/xend/server/blkif.py
@@ -66,8 +66,11 @@ def blkdev_name_to_number(name):
if re.match( '/dev/sd[a-p]([0-9]|1[0-5])', n):
return 8 * 256 + 16 * (ord(n[7:8]) - ord('a')) + int(n[8:])
- if re.match( '/dev/hd[a-p]([0-9]|[1-5][0-9]|6[0-3])', n):
- return 3 * 256 + 16 * (ord(n[7:8]) - ord('a')) + int(n[8:])
+ if re.match( '/dev/hd[a-t]([1-9]|[1-5][0-9]|6[0-3])?', n):
+ ide_majors = [ 3, 22, 33, 34, 56, 57, 88, 89, 90, 91 ]
+ major = ide_majors[(ord(n[7:8]) - ord('a')) / 2]
+ minor = ((ord(n[7:8]) - ord('a')) % 2) * 64 + int(n[8:] or 0)
+ return major * 256 + minor
# see if this is a hex device number
if re.match( '^(0x)?[0-9a-fA-F]+$', name ):