Files
xen/tools/python/xen/xend/XendSXPDev.py
T
Keir Fraser 63524b0e43 xend: pass-through: Use generic code in pci_opts_list_to_sxp()
Use dev_dict_to_sxp() inside pci_opts_list_to_sxp() now that it is
available.

Signed-off-by: Simon Horman <horms@verge.net.au>
2009-06-17 07:37:26 +01:00

14 lines
369 B
Python

#!/usr/bin/env python
#
# Helper functions for dealing with the sxp representation of devices
import types
def dev_dict_to_sxp(dev):
def f((key, val)):
if isinstance(val, types.ListType):
return map(lambda x: [key, x], val)
return [[key, val]]
dev_sxp = ['dev'] + reduce(lambda x, y: x + y, map(f, dev.items()))
return dev_sxp