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] xend: pci: find_parent: should return string rather

To: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>, Simon Horman <horms@xxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] xend: pci: find_parent: should return string rather than int
From: "Cui, Dexuan" <dexuan.cui@xxxxxxxxx>
Date: Wed, 17 Jun 2009 19:02:27 +0800
Accept-language: zh-CN, en-US
Acceptlanguage: zh-CN, en-US
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Wed, 17 Jun 2009 04:03:43 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
Importance: high
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcnvOxnwGXkrpz+iTKuhtUcZ+iHY/g==
Thread-topic: [PATCH] xend: pci: find_parent: should return string rather than int
Using changeset 19783: 61ec78692b13, device assignment can't work: 
e.g., in find_the_uppermost_pci_bridge(), 
 parent = dev_parent.find_parent()
...
 dev_parent = PciDevice(parent),
we can see parent['domain'] is int and in PciDevice's __init__, 
int(dev['domain'], 16) would fail:
TypeError: int() can't convert non-string with explicit base

The patch fixes the issue.

Signed-off-by: Dexuan Cui <dexuan.cui@xxxxxxxxx>

diff -r 61ec78692b13 tools/python/xen/util/pci.py
--- a/tools/python/xen/util/pci.py  Wed Jun 17 07:39:27 2009 +0100
+++ b/tools/python/xen/util/pci.py  Wed Jun 17 18:35:31 2009 +0800
@@ -547,12 +547,12 @@ class PciDevice:
             else:
                 dev = {}
                 lst = parent.split(':')
-                dev['domain'] = int(lst[0], 16)
-                dev['bus'] = int(lst[1], 16)
+                dev['domain'] = '%04x' % int(lst[0], 16)
+                dev['bus'] = '%02x' % int(lst[1], 16)
                 lst = lst[2]
                 lst = lst.split('.')
-                dev['slot'] = int(lst[0], 16)
-                dev['func'] = int(lst[1], 16)
+                dev['slot'] = '%02x' % int(lst[0], 16)
+                dev['func'] = '%x' % int(lst[1], 16)
             return dev
         except OSError, (errno, strerr):
             raise PciDeviceParseError('Can not locate the parent of %s',
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>