[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 06/28] libxl: qemu_pci_*: Introduce DMPATH local macro, twice
This condenses a number of repetetive calls to libxl__device_model_xs_path. No functional change. Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx> --- v6: New patch. --- tools/libxl/libxl_pci.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c index dc10cb7..2c7a2c6 100644 --- a/tools/libxl/libxl_pci.c +++ b/tools/libxl/libxl_pci.c @@ -966,10 +966,13 @@ static int qemu_pci_add_xenstore(libxl__gc *gc, uint32_t domid, char *state, *vdevfn; uint32_t dm_domid; +#define DMPATH(suffix) \ + libxl__device_model_xs_path(gc, dm_domid, domid, (suffix)) + dm_domid = libxl_get_stubdom_id(CTX, domid); - path = libxl__device_model_xs_path(gc, dm_domid, domid, "/state"); + path = DMPATH("/state"); state = libxl__xs_read(gc, XBT_NULL, path); - path = libxl__device_model_xs_path(gc, dm_domid, domid, "/parameter"); + path = DMPATH("/parameter"); if (pcidev->vdevfn) { libxl__xs_printf(gc, XBT_NULL, path, PCI_BDF_VDEVFN","PCI_OPTIONS, pcidev->domain, pcidev->bus, pcidev->dev, @@ -984,9 +987,9 @@ static int qemu_pci_add_xenstore(libxl__gc *gc, uint32_t domid, libxl__qemu_traditional_cmd(gc, domid, "pci-ins"); rc = libxl__wait_for_device_model_deprecated(gc, domid, NULL, NULL, pci_ins_check, state); - path = libxl__device_model_xs_path(gc, dm_domid, domid, "/parameter"); + path = DMPATH("/parameter"); vdevfn = libxl__xs_read(gc, XBT_NULL, path); - path = libxl__device_model_xs_path(gc, dm_domid, domid, "/state"); + path = DMPATH("/state"); if ( rc < 0 ) LOG(ERROR, "qemu refused to add device: %s", vdevfn); else if ( sscanf(vdevfn, "0x%x", &pcidev->vdevfn) != 1 ) { @@ -995,6 +998,8 @@ static int qemu_pci_add_xenstore(libxl__gc *gc, uint32_t domid, } xs_write(ctx->xsh, XBT_NULL, path, state, strlen(state)); +#undef DMPATH + return rc; } @@ -1307,9 +1312,12 @@ static int qemu_pci_remove_xenstore(libxl__gc *gc, uint32_t domid, dm_domid = libxl_get_stubdom_id(CTX, domid); - path = libxl__device_model_xs_path(gc, dm_domid, domid, "/state"); +#define DMPATH(suffix) \ + libxl__device_model_xs_path(gc, dm_domid, domid, suffix) + + path = DMPATH("/state"); state = libxl__xs_read(gc, XBT_NULL, path); - path = libxl__device_model_xs_path(gc, dm_domid, domid, "/parameter"); + path = DMPATH("/parameter"); libxl__xs_printf(gc, XBT_NULL, path, PCI_BDF, pcidev->domain, pcidev->bus, pcidev->dev, pcidev->func); @@ -1327,9 +1335,11 @@ static int qemu_pci_remove_xenstore(libxl__gc *gc, uint32_t domid, return ERROR_FAIL; } } - path = libxl__device_model_xs_path(gc, dm_domid, domid, "/state"); + path = DMPATH("/state"); xs_write(ctx->xsh, XBT_NULL, path, state, strlen(state)); +#undef DMPATH + return 0; } -- 1.7.10.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |