From: Jeremy Katz Subject: [PATCH] Support for official xvd major number Date: Thu, 14 Jul 2005 17:15:38 -0400 Message-ID: <1121375739.15645.15.camel@bree.local.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-/ZoIpm0iIfNOvhXDZV9q" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org --=-/ZoIpm0iIfNOvhXDZV9q Content-Type: text/plain Content-Transfer-Encoding: 7bit LANANA has officially assigned the block major of 202 for xvd devices (http://www.lanana.org/docs/device-list/devices-2.6+.txt). Take advantage of knowing this so people don't have to do the mknod on their system. Also, fix up the scsi regex to get sda correct without having to do hacks like sda0. Signed-off-by: Jeremy Katz Jeremy --=-/ZoIpm0iIfNOvhXDZV9q Content-Disposition: attachment; filename=xen-xvd-blkmajor.patch Content-Type: text/x-patch; name=xen-xvd-blkmajor.patch; charset=UTF-8 Content-Transfer-Encoding: 7bit # HG changeset patch # User katzj@bree.local.net # Node ID 974ff5b2329a6e544202b1d6806455abbd8243b8 # Parent b5bf769f2c228a9a00b88b8e62719f58eb58726e * support proper scsi disk name * xvd now has an official lanana assigned major, use it diff -r b5bf769f2c22 -r 974ff5b2329a tools/python/xen/util/blkif.py --- a/tools/python/xen/util/blkif.py Thu Jul 14 21:08:02 2005 +++ b/tools/python/xen/util/blkif.py Thu Jul 14 21:08:57 2005 @@ -24,14 +24,17 @@ log.debug("exception looking up device number for %s: %s", name, ex) pass - 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/sd[a-p]([1-9]|1[0-5])?', n): + return 8 * 256 + 16 * (ord(n[7:8]) - ord('a')) + int(n[8:] or 0) 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 + + if re.match( '/dev/xvd[a-p]([1-9]|1[0-5])?', n): + return 202 * 256 + 16 * (ord(n[8:9]) - ord('a')) + int(n[9:] or 0) # see if this is a hex device number if re.match( '^(0x)?[0-9a-fA-F]+$', name ): --=-/ZoIpm0iIfNOvhXDZV9q Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=-/ZoIpm0iIfNOvhXDZV9q--