]> xenbits.xensource.com Git - xen.git/commit
libxl: make libxl__device_list() work correctly for LIBXL__DEVICE_KIND_PCI...
authorPaul Durrant <pdurrant@amazon.com>
Tue, 8 Dec 2020 19:30:11 +0000 (19:30 +0000)
committerWei Liu <wl@xen.org>
Tue, 15 Dec 2020 16:24:23 +0000 (16:24 +0000)
commitfce69998edd7583417c833fe1bf3347efcdc93e7
treef7832cf242d7c4f4daf4016ef8e63410eac58de9
parent6c2590967fec90ec024a3608989b0796a043becf
libxl: make libxl__device_list() work correctly for LIBXL__DEVICE_KIND_PCI...

... devices.

Currently there is an assumption built into libxl__device_list() that device
backends are fully enumarated under the '/libxl' path in xenstore. This is
not the case for PCI backend devices, which are only properly enumerated
under '/local/domain/0/backend'.

This patch adds a new get_path() method to libxl__device_type to allow a
backend implementation (such as PCI) to specify the xenstore path where
devices are enumerated and modifies libxl__device_list() to use this method
if it is available. Also, if the get_num() method is defined then the
from_xenstore() method expects to be passed the backend path without the device
number concatenated, so this issue is also rectified.

Having made libxl__device_list() work correctly, this patch removes the
open-coded libxl_pci_device_pci_list() in favour of an evaluation of the
LIBXL_DEFINE_DEVICE_LIST() macro. This has the side-effect of also defining
libxl_pci_device_pci_list_free() which will be used in subsequent patches.

Signed-off-by: Paul Durrant <pdurrant@amazon.com>
Reviewed-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Acked-by: Wei Liu <wl@xen.org>
tools/include/libxl.h
tools/libs/light/libxl_device.c
tools/libs/light/libxl_internal.h
tools/libs/light/libxl_pci.c