Skip to contentSkip to conversation

Blkif regular expression fix

PATCH New Michal Novotny 1 participant 1 message Mar 5, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Blkif regular expression fix

Hello everybody,
I have created a patch for blkif.py to support only hd[a-t] devices from 1 to 63. There was missing $ sign at the end of the regular expression and therefore even hda100 was able to be attached but not working correctly. Anyway hda989898 was able to be mounted but it crashed guest kernel. This patch solves this issue...

Michal

tools/python/xen/util/blkif.py renamed from tools/python/xen/util/blkif.py.bz475433 +1 -1
diff -up xen-3.1.0-src/tools/python/xen/util/blkif.py.bz475433 xen-3.1.0-src/tools/python/xen/util/blkif.py
@@ -29,7 +29,7 @@ def blkdev_name_to_number(name):
 
     if re.match( '/dev/sd[a-p]([1-9]|1[0-5])?$', n):
         devnum = 8 * 256 + 16 * (ord(n[7:8]) - ord('a')) + int(n[8:] or 0)
-    elif re.match( '/dev/hd[a-t]([1-9]|[1-5][0-9]|6[0-3])?', n):
+    elif 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)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel