mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 02:30:03 +01:00
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>
14 lines
369 B
Python
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
|