[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [patch 2/5] xen: xm/blkif ide dev-numbers



Fix the device number calculation for /dev/hd* device names;
ide device numbering works differently to scsi

Signed-off-by: Jody Belka <knew-xen@xxxxxxxx>


diffstat:
 blkif.py |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)


diff -durN xen.orig/tools/python/xen/xend/server/blkif.py 
xen/tools/python/xen/xend/server/blkif.py
--- xen.orig/tools/python/xen/xend/server/blkif.py      2005-01-30 
00:46:29.000000000 +0100
+++ xen/tools/python/xen/xend/server/blkif.py   2005-01-31 22:08:52.410420992 
+0100
@@ -66,8 +66,11 @@
     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 ):


-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.