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 6/8] xend: pass-through: Use common parsing code in p

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [patch 6/8] xend: pass-through: Use common parsing code in parse_pci_configuration()
From: Simon Horman <horms@xxxxxxxxxxxx>
Date: Tue, 16 Jun 2009 23:00:55 +1000
Cc: Masaki Kanno <kanno.masaki@xxxxxxxxxxxxxx>, Dexuan Cui <dexuan.cui@xxxxxxxxx>
Delivery-date: Tue, 16 Jun 2009 06:17:23 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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>
References: <20090616130049.981995120@xxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: quilt/0.46-1
This will be re-used in subsequent patches.

Cc: Dexuan Cui <dexuan.cui@xxxxxxxxx>
Cc: Masaki Kanno <kanno.masaki@xxxxxxxxxxxxxx>
Signed-off-by: Simon Horman <horms@xxxxxxxxxxxx>

Index: xen-unstable.hg/tools/python/xen/xm/main.py
===================================================================
--- xen-unstable.hg.orig/tools/python/xen/xm/main.py    2009-06-16 
22:46:20.000000000 +1000
+++ xen-unstable.hg/tools/python/xen/xm/main.py 2009-06-16 22:53:51.000000000 
+1000
@@ -2489,36 +2489,16 @@ def parse_pci_configuration(args, state,
     dom = args[0]
     pci_dev_str = args[1]
     if len(args) == 3:
-        vslot = args[2]
-    else:
-        vslot = AUTO_PHP_SLOT_STR
-    pci=['pci']
-    pci_match = re.match(r"((?P<domain>[0-9a-fA-F]{1,4})[:,])?" + \
-            r"(?P<bus>[0-9a-fA-F]{1,2})[:,]" + \
-            r"(?P<slot>[0-9a-fA-F]{1,2})[.,]" + \
-            r"(?P<func>[0-7])$", pci_dev_str)
-    if pci_match == None:
-        raise OptionError("Invalid argument: %s %s" % (pci_dev_str, vslot))
-    pci_dev_info = pci_match.groupdict('0')
-
-    try:
-        pci_bdf =['dev', ['domain', '0x'+ pci_dev_info['domain']], \
-                ['bus', '0x'+ pci_dev_info['bus']],
-                ['slot', '0x'+ pci_dev_info['slot']],
-                ['func', '0x'+ pci_dev_info['func']],
-                ['vslot', '0x%x' % int(vslot, 16)]]
-    except:
-        raise OptionError("Invalid argument: %s %s" % (pci_dev_str, vslot))
+        pci_dev_str += '@' + args[2]
+    if len(opts) > 0:
+        pci_dev_str += ',' + serialise_pci_opts(opts)
 
     try:
-        check_pci_opts(opts)
+        pci_dev = parse_pci_name_extended(pci_dev_str)
     except PciDeviceParseError, ex:
         raise OptionError(str(ex))
 
-    pci.append(sxp.merge(pci_bdf, pci_opts_list_to_sxp(opts)))
-    pci.append(['state', state])
-
-    return (dom, pci)
+    return (dom, pci_convert_dict_to_sxp(pci_dev, state))
 
 def xm_pci_attach(args):
     config_pci_opts = []

-- 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel