ia64/xen-unstable

changeset 3599:0ebbb4b2bbdc

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
author iap10@labyrinth.cl.cam.ac.uk
date Tue Feb 01 21:59:12 2005 +0000 (2005-02-01)
parents f86bdb0a8573
children 11b95fad5f5d 17e50d7ed675
files tools/python/xen/xend/server/blkif.py
line diff
     1.1 --- a/tools/python/xen/xend/server/blkif.py	Tue Feb 01 21:55:39 2005 +0000
     1.2 +++ b/tools/python/xen/xend/server/blkif.py	Tue Feb 01 21:59:12 2005 +0000
     1.3 @@ -66,8 +66,11 @@ def blkdev_name_to_number(name):
     1.4      if re.match( '/dev/sd[a-p]([0-9]|1[0-5])', n):
     1.5          return 8 * 256 + 16 * (ord(n[7:8]) - ord('a')) + int(n[8:])
     1.6  
     1.7 -    if re.match( '/dev/hd[a-p]([0-9]|[1-5][0-9]|6[0-3])', n):
     1.8 -        return 3 * 256 + 16 * (ord(n[7:8]) - ord('a')) + int(n[8:])        
     1.9 +    if re.match( '/dev/hd[a-t]([1-9]|[1-5][0-9]|6[0-3])?', n):
    1.10 +        ide_majors = [ 3, 22, 33, 34, 56, 57, 88, 89, 90, 91 ]
    1.11 +        major = ide_majors[(ord(n[7:8]) - ord('a')) / 2]
    1.12 +        minor = ((ord(n[7:8]) - ord('a')) % 2) * 64 + int(n[8:] or 0)
    1.13 +        return major * 256 + minor
    1.14  
    1.15      # see if this is a hex device number
    1.16      if re.match( '^(0x)?[0-9a-fA-F]+$', name ):