[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v2 2/2] libxl: fix line wrapping issues introduced by automatic replacement
Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- tools/libxl/libxl.c | 55 ++++++++++++++++++++++------------------------- tools/libxl/libxl_dm.c | 57 ++++++++++++++++++++++--------------------------- tools/libxl/libxl_pci.c | 33 ++++++++++++++-------------- 3 files changed, 66 insertions(+), 79 deletions(-) diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 3c05e4e..2bfae07 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -1374,8 +1374,8 @@ static void disk_eject_xswatch_callback(libxl__egc *egc, libxl__ev_xswatch *w, libxl_device_disk *disk = &ev->u.disk_eject.disk; backend = libxl__xs_read(gc, XBT_NULL, - GCSPRINTF("%.*s/backend", - (int)strlen(wpath)-6, wpath)); + GCSPRINTF("%.*s/backend", (int)strlen(wpath)-6, + wpath)); sscanf(backend, "/local/domain/%d/backend/%" TOSTRING(BACKEND_STRING_SIZE) @@ -1693,8 +1693,7 @@ static void devices_destroy_cb(libxl__egc *egc, LOGE(ERROR, "xs_rm failed for %s", dom_path); xs_rm(ctx->xsh, XBT_NULL, libxl__xs_libxl_path(gc, domid)); - xs_rm(ctx->xsh, XBT_NULL, GCSPRINTF( - "/local/domain/%d/hvmloader", domid)); + xs_rm(ctx->xsh, XBT_NULL, GCSPRINTF( "/local/domain/%d/hvmloader", domid)); /* This is async operation, we already hold CTX lock */ lock = libxl__lock_domain_userdata(gc, domid); @@ -1940,13 +1939,13 @@ int libxl_vncviewer_exec(libxl_ctx *ctx, uint32_t domid, int autopass) port = atoi(vnc_port) - 5900; vnc_listen = libxl__xs_read(gc, XBT_NULL, - GCSPRINTF( - "/local/domain/%d/console/vnc-listen", domid)); + GCSPRINTF("/local/domain/%d/console/vnc-listen", + domid)); if ( autopass ) vnc_pass = libxl__xs_read(gc, XBT_NULL, - GCSPRINTF( - "/local/domain/%d/console/vnc-pass", domid)); + GCSPRINTF("/local/domain/%d/console/vnc-pass", + domid)); if ( NULL == vnc_listen ) vnc_listen = "localhost"; @@ -2747,8 +2746,8 @@ int libxl_vdev_to_device_disk(libxl_ctx *ctx, uint32_t domid, goto out; } path = libxl__xs_read(gc, XBT_NULL, - GCSPRINTF("%s/device/vbd/%d/backend", - dompath, devid)); + GCSPRINTF("%s/device/vbd/%d/backend", dompath, + devid)); if (!path) goto out; @@ -2773,7 +2772,7 @@ static int libxl__append_disk_list_of_type(libxl__gc *gc, int initial_disks = *ndisks; be_path = GCSPRINTF("%s/backend/%s/%d", - libxl__xs_get_dompath(gc, 0), type, domid); + libxl__xs_get_dompath(gc, 0), type, domid); dir = libxl__xs_directory(gc, XBT_NULL, be_path, &n); if (dir && n) { libxl_device_disk *tmp; @@ -3365,8 +3364,7 @@ void libxl__device_nic_add(libxl__egc *egc, uint32_t domid, } flexarray_append(back, "mac"); - flexarray_append(back,GCSPRINTF( - LIBXL_MAC_FMT, LIBXL_MAC_BYTES(nic->mac))); + flexarray_append(back,GCSPRINTF(LIBXL_MAC_FMT, LIBXL_MAC_BYTES(nic->mac))); if (nic->ip) { flexarray_append(back, "ip"); flexarray_append(back, libxl__strdup(gc, nic->ip)); @@ -3517,8 +3515,8 @@ int libxl_devid_to_device_nic(libxl_ctx *ctx, uint32_t domid, goto out; path = libxl__xs_read(gc, XBT_NULL, - GCSPRINTF("%s/device/vif/%d/backend", - dompath, devid)); + GCSPRINTF("%s/device/vif/%d/backend", dompath, + devid)); if (!path) goto out; @@ -3543,8 +3541,8 @@ static int libxl__append_nic_list_of_type(libxl__gc *gc, libxl_device_nic *pnic = NULL, *pnic_end = NULL; int rc; - be_path = GCSPRINTF("%s/backend/%s/%d", - libxl__xs_get_dompath(gc, 0), type, domid); + be_path = GCSPRINTF("%s/backend/%s/%d", libxl__xs_get_dompath(gc, 0), + type, domid); dir = libxl__xs_directory(gc, XBT_NULL, be_path, &n); if (dir && n) { libxl_device_nic *tmp; @@ -3911,10 +3909,9 @@ int libxl_device_channel_getinfo(libxl_ctx *ctx, uint32_t domid, channelinfo->devid = channel->devid; fe_path = GCSPRINTF("%s/device/console/%d", dompath, - channelinfo->devid + 1); + channelinfo->devid + 1); channelinfo->backend = xs_read(ctx->xsh, XBT_NULL, - GCSPRINTF("%s/backend", - fe_path), NULL); + GCSPRINTF("%s/backend", fe_path), NULL); if (!channelinfo->backend) { GC_FREE; return ERROR_FAIL; @@ -4752,8 +4749,7 @@ int libxl_set_memory_target(libxl_ctx *ctx, uint32_t domid, retry_transaction: t = xs_transaction_start(ctx->xsh); - target = libxl__xs_read(gc, t, GCSPRINTF( - "%s/memory/target", dompath)); + target = libxl__xs_read(gc, t, GCSPRINTF("%s/memory/target", dompath)); if (!target && !domid) { if (!xs_transaction_end(ctx->xsh, t, 1)) goto out_no_transaction; @@ -4776,8 +4772,7 @@ retry_transaction: goto out; } } - memmax = libxl__xs_read(gc, t, GCSPRINTF( - "%s/memory/static-max", dompath)); + memmax = libxl__xs_read(gc, t, GCSPRINTF("%s/memory/static-max", dompath)); if (!memmax) { LOGE(ERROR, "cannot get memory info from %s/memory/static-max", dompath); @@ -4792,8 +4787,8 @@ retry_transaction: goto out; } - videoram_s = libxl__xs_read(gc, t, GCSPRINTF( - "%s/memory/videoram", dompath)); + videoram_s = libxl__xs_read(gc, t, GCSPRINTF("%s/memory/videoram", + dompath)); videoram = videoram_s ? atoi(videoram_s) : 0; if (relative) { @@ -4883,10 +4878,10 @@ static int libxl__get_memory_target(libxl__gc *gc, uint32_t domid, char *dompath = libxl__xs_get_dompath(gc, domid); uint32_t target_memkb, max_memkb; - target = libxl__xs_read(gc, XBT_NULL, GCSPRINTF( - "%s/memory/target", dompath)); - static_max = libxl__xs_read(gc, XBT_NULL, GCSPRINTF( - "%s/memory/static-max", dompath)); + target = libxl__xs_read(gc, XBT_NULL, GCSPRINTF("%s/memory/target", + dompath)); + static_max = libxl__xs_read(gc, XBT_NULL, + GCSPRINTF("%s/memory/static-max", dompath)); rc = ERROR_FAIL; if ((!target || !static_max) && !domid) { diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c index ca39f41..a4934df 100644 --- a/tools/libxl/libxl_dm.c +++ b/tools/libxl/libxl_dm.c @@ -442,8 +442,7 @@ static int libxl__build_device_model_args_old(libxl__gc *gc, } vncarg = vnc->listen; } else { - vncarg = GCSPRINTF("%s:%d", vnc->listen, - vnc->display); + vncarg = GCSPRINTF("%s:%d", vnc->listen, vnc->display); } } else vncarg = GCSPRINTF("127.0.0.1:%d", vnc->display); @@ -517,8 +516,7 @@ static int libxl__build_device_model_args_old(libxl__gc *gc, if (b_info->video_memkb) { flexarray_vappend(dm_args, "-videoram", - GCSPRINTF("%d", - libxl__sizekb_to_mb(b_info->video_memkb)), + GCSPRINTF("%d", libxl__sizekb_to_mb(b_info->video_memkb)), NULL); } @@ -683,8 +681,7 @@ static char *dm_spice_options(libxl__gc *gc, return NULL; } } - opt = GCSPRINTF("port=%d,tls-port=%d", - spice->port, spice->tls_port); + opt = GCSPRINTF("port=%d,tls-port=%d", spice->port, spice->tls_port); if (spice->host) opt = GCSPRINTF("%s,addr=%s", opt, spice->host); if (libxl_defbool_val(spice->disable_ticketing)) @@ -692,18 +689,17 @@ static char *dm_spice_options(libxl__gc *gc, else opt = GCSPRINTF("%s,password=%s", opt, spice->passwd); opt = GCSPRINTF("%s,agent-mouse=%s", opt, - libxl_defbool_val(spice->agent_mouse) ? "on" : "off"); + libxl_defbool_val(spice->agent_mouse) ? "on" : "off"); if (!libxl_defbool_val(spice->clipboard_sharing)) opt = GCSPRINTF("%s,disable-copy-paste", opt); if (spice->image_compression) opt = GCSPRINTF("%s,image-compression=%s", opt, - spice->image_compression); + spice->image_compression); if (spice->streaming_video) - opt = GCSPRINTF("%s,streaming-video=%s", opt, - spice->streaming_video); + opt = GCSPRINTF("%s,streaming-video=%s", opt, spice->streaming_video); return opt; } @@ -860,8 +856,7 @@ static int libxl__build_device_model_args_new(libxl__gc *gc, } vncarg = vnc->listen; } else { - vncarg = GCSPRINTF("%s:%d", vnc->listen, - vnc->display); + vncarg = GCSPRINTF("%s:%d", vnc->listen, vnc->display); } } else vncarg = GCSPRINTF("127.0.0.1:%d", vnc->display); @@ -1029,8 +1024,9 @@ static int libxl__build_device_model_args_new(libxl__gc *gc, if (b_info->u.hvm.spice.usbredirection >= 0 && b_info->u.hvm.spice.usbredirection < 5) { for (i = 1; i <= b_info->u.hvm.spice.usbredirection; i++) - flexarray_vappend(dm_args, "-chardev", GCSPRINTF( - "spicevmc,name=usbredir,id=usbrc%d", i), "-device", + flexarray_vappend(dm_args, "-chardev", + GCSPRINTF("spicevmc,name=usbredir,id=usbrc%d", i), + "-device", GCSPRINTF("usb-redir,chardev=usbrc%d," "id=usbrc%d", i, i), NULL); } else { @@ -1052,31 +1048,30 @@ static int libxl__build_device_model_args_new(libxl__gc *gc, nr_set_cpus = libxl_bitmap_count_set(&b_info->avail_vcpus); flexarray_append(dm_args, GCSPRINTF("%d,maxcpus=%d", - nr_set_cpus, - b_info->max_vcpus)); + nr_set_cpus, + b_info->max_vcpus)); } else - flexarray_append(dm_args, GCSPRINTF("%d", - b_info->max_vcpus)); + flexarray_append(dm_args, GCSPRINTF("%d", b_info->max_vcpus)); } for (i = 0; i < num_nics; i++) { if (nics[i].nictype == LIBXL_NIC_TYPE_VIF_IOEMU) { - char *smac = GCSPRINTF( - LIBXL_MAC_FMT, LIBXL_MAC_BYTES(nics[i].mac)); + char *smac = GCSPRINTF(LIBXL_MAC_FMT, + LIBXL_MAC_BYTES(nics[i].mac)); const char *ifname = libxl__device_nic_devname(gc, guest_domid, nics[i].devid, LIBXL_NIC_TYPE_VIF_IOEMU); flexarray_append(dm_args, "-device"); flexarray_append(dm_args, GCSPRINTF("%s,id=nic%d,netdev=net%d,mac=%s", - nics[i].model, nics[i].devid, - nics[i].devid, smac)); + nics[i].model, nics[i].devid, + nics[i].devid, smac)); flexarray_append(dm_args, "-netdev"); - flexarray_append(dm_args, GCSPRINTF( - "type=tap,id=net%d,ifname=%s," - "script=%s,downscript=%s", - nics[i].devid, ifname, - libxl_tapif_script(gc), - libxl_tapif_script(gc))); + flexarray_append(dm_args, + GCSPRINTF("type=tap,id=net%d,ifname=%s," + "script=%s,downscript=%s", + nics[i].devid, ifname, + libxl_tapif_script(gc), + libxl_tapif_script(gc))); ioemu_nics++; } } @@ -1640,7 +1635,7 @@ static void spawn_stub_launch_dm(libxl__egc *egc, char *name; case STUBDOM_CONSOLE_LOGGING: name = GCSPRINTF("qemu-dm-%s", - libxl_domid_to_name(ctx, guest_domid)); + libxl_domid_to_name(ctx, guest_domid)); ret = libxl_create_logfile(ctx, name, &filename); if (ret) goto out; console[i].output = GCSPRINTF("file:%s", filename); @@ -1828,9 +1823,7 @@ void libxl__spawn_local_dm(libxl__egc *egc, libxl__dm_spawn_state *dmss) * unless we're running qemu-traditional and vNUMA is not * configured. */ libxl__xs_write(gc, XBT_NULL, - GCSPRINTF( - "%s/hvmloader/allow-memory-relocate", - path), + GCSPRINTF("%s/hvmloader/allow-memory-relocate", path), "%d", b_info->device_model_version==LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL && !libxl__vnuma_configured(b_info)); diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c index bb49e88..206b300 100644 --- a/tools/libxl/libxl_pci.c +++ b/tools/libxl/libxl_pci.c @@ -327,7 +327,7 @@ static int get_all_assigned_devices(libxl__gc *gc, libxl_device_pci **list, int for(j = 0; j < ndev; j++) { devpath = GCSPRINTF("/local/domain/0/backend/pci/%s/0/dev-%u", - domlist[i], j); + domlist[i], j); bdf = libxl__xs_read(gc, XBT_NULL, devpath); if ( bdf ) { unsigned dom, bus, dev, func; @@ -382,7 +382,7 @@ static int sysfs_write_bdf(libxl__gc *gc, const char * sysfs_path, } buf = GCSPRINTF(PCI_BDF, pcidev->domain, pcidev->bus, - pcidev->dev, pcidev->func); + pcidev->dev, pcidev->func); rc = write(fd, buf, strlen(buf)); /* Annoying to have two if's, but we need the errno */ if (rc < 0) @@ -667,8 +667,8 @@ static int pciback_dev_is_assigned(libxl__gc *gc, libxl_device_pci *pcidev) } spath = GCSPRINTF(SYSFS_PCIBACK_DRIVER"/"PCI_BDF, - pcidev->domain, pcidev->bus, - pcidev->dev, pcidev->func); + pcidev->domain, pcidev->bus, + pcidev->dev, pcidev->func); rc = lstat(spath, &st); if( rc == 0 ) @@ -729,10 +729,10 @@ static void pci_assignable_driver_path_write(libxl__gc *gc, char *path; path = GCSPRINTF(PCIBACK_INFO_PATH"/"PCI_BDF_XSPATH"/driver_path", - pcidev->domain, - pcidev->bus, - pcidev->dev, - pcidev->func); + pcidev->domain, + pcidev->bus, + pcidev->dev, + pcidev->func); if ( libxl__xs_write(gc, XBT_NULL, path, "%s", driver_path) < 0 ) { LOGE(WARN, "Write of %s to node %s failed.", driver_path, path); } @@ -758,10 +758,10 @@ static void pci_assignable_driver_path_remove(libxl__gc *gc, /* Remove the xenstore entry */ xs_rm(ctx->xsh, XBT_NULL, GCSPRINTF(PCIBACK_INFO_PATH "/" PCI_BDF_XSPATH, - pcidev->domain, - pcidev->bus, - pcidev->dev, - pcidev->func) ); + pcidev->domain, + pcidev->bus, + pcidev->dev, + pcidev->func) ); } static int libxl__device_pci_assignable_add(libxl__gc *gc, @@ -1032,7 +1032,7 @@ static int do_pci_add(libxl__gc *gc, uint32_t domid, libxl_device_pci *pcidev, i } sysfs_path = GCSPRINTF(SYSFS_PCI_DEV"/"PCI_BDF"/resource", pcidev->domain, - pcidev->bus, pcidev->dev, pcidev->func); + pcidev->bus, pcidev->dev, pcidev->func); f = fopen(sysfs_path, "r"); start = end = flags = size = 0; irq = 0; @@ -1382,7 +1382,7 @@ static int do_pci_remove(libxl__gc *gc, uint32_t domid, assert(type == LIBXL_DOMAIN_TYPE_PV); char *sysfs_path = GCSPRINTF(SYSFS_PCI_DEV"/"PCI_BDF"/resource", pcidev->domain, - pcidev->bus, pcidev->dev, pcidev->func); + pcidev->bus, pcidev->dev, pcidev->func); FILE *f = fopen(sysfs_path, "r"); unsigned int start = 0, end = 0, flags = 0, size = 0; int irq = 0; @@ -1418,7 +1418,7 @@ static int do_pci_remove(libxl__gc *gc, uint32_t domid, fclose(f); skip1: sysfs_path = GCSPRINTF(SYSFS_PCI_DEV"/"PCI_BDF"/irq", pcidev->domain, - pcidev->bus, pcidev->dev, pcidev->func); + pcidev->bus, pcidev->dev, pcidev->func); f = fopen(sysfs_path, "r"); if (f == NULL) { LOGE(ERROR, "Couldn't open %s", sysfs_path); @@ -1626,8 +1626,7 @@ int libxl__grant_vga_iomem_permission(libxl__gc *gc, const uint32_t domid, libxl_device_pci *pcidev = &d_config->pcidevs[i]; char *pci_device_class_path = GCSPRINTF(SYSFS_PCI_DEV"/"PCI_BDF"/class", - pcidev->domain, pcidev->bus, pcidev->dev, - pcidev->func); + pcidev->domain, pcidev->bus, pcidev->dev, pcidev->func); int read_items; unsigned long pci_device_class; -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |