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-devel

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

To: xen-devel@xxxxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [patch 2/5] xen: xm/blkif ide dev-numbers
From: Jody Belka <lists-xen@xxxxxxxx>
Date: Mon, 31 Jan 2005 23:32:57 +0100
Delivery-date: Mon, 31 Jan 2005 22:35:40 +0000
Envelope-to: xen+James.Bulpin@xxxxxxxxxxxx
List-archive: <http://sourceforge.net/mailarchive/forum.php?forum=xen-devel>
List-help: <mailto:xen-devel-request@lists.sourceforge.net?subject=help>
List-id: List for Xen developers <xen-devel.lists.sourceforge.net>
List-post: <mailto:xen-devel@lists.sourceforge.net>
List-subscribe: <https://lists.sourceforge.net/lists/listinfo/xen-devel>, <mailto:xen-devel-request@lists.sourceforge.net?subject=subscribe>
List-unsubscribe: <https://lists.sourceforge.net/lists/listinfo/xen-devel>, <mailto:xen-devel-request@lists.sourceforge.net?subject=unsubscribe>
Sender: xen-devel-admin@xxxxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.4i
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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [patch 2/5] xen: xm/blkif ide dev-numbers, Jody Belka <=