[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v7 07/15] libxl: rename vifs to nics
This change renames functions and struct values that used to contain vifs in their names to nics, that provides a more clear name to define network interfaces without referring to the backend that is behind them. This is not a functional change. Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> Signed-off-by: Roger Pau Monne <roger.pau@xxxxxxxxxx> --- tools/libxl/libxl.h | 4 +- tools/libxl/libxl_create.c | 10 ++++---- tools/libxl/libxl_dm.c | 54 ++++++++++++++++++++++---------------------- tools/libxl/libxl_json.c | 8 +++--- tools/libxl/xl_cmdimpl.c | 14 +++++----- tools/libxl/xl_sxp.c | 20 ++++++++-------- 6 files changed, 55 insertions(+), 55 deletions(-) diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h index aef1be5..4b5e1ad 100644 --- a/tools/libxl/libxl.h +++ b/tools/libxl/libxl.h @@ -469,10 +469,10 @@ typedef struct { libxl_domain_create_info c_info; libxl_domain_build_info b_info; - int num_disks, num_vifs, num_pcidevs, num_vfbs, num_vkbs; + int num_disks, num_nics, num_pcidevs, num_vfbs, num_vkbs; libxl_device_disk *disks; - libxl_device_nic *vifs; + libxl_device_nic *nics; libxl_device_pci *pcidevs; libxl_device_vfb *vfbs; libxl_device_vkb *vkbs; diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index b54717a..afeee41 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -39,9 +39,9 @@ void libxl_domain_config_dispose(libxl_domain_config *d_config) libxl_device_disk_dispose(&d_config->disks[i]); free(d_config->disks); - for (i=0; i<d_config->num_vifs; i++) - libxl_device_nic_dispose(&d_config->vifs[i]); - free(d_config->vifs); + for (i=0; i<d_config->num_nics; i++) + libxl_device_nic_dispose(&d_config->nics[i]); + free(d_config->nics); for (i=0; i<d_config->num_pcidevs; i++) libxl_device_pci_dispose(&d_config->pcidevs[i]); @@ -870,8 +870,8 @@ static void domcreate_rebuild_done(libxl__egc *egc, goto error_out; } } - for (i = 0; i < d_config->num_vifs; i++) { - ret = libxl_device_nic_add(ctx, domid, &d_config->vifs[i]); + for (i = 0; i < d_config->num_nics; i++) { + ret = libxl_device_nic_add(ctx, domid, &d_config->nics[i]); if (ret) { LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "cannot add nic %d to domain: %d", i, ret); diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c index 361b77d..06b68b7 100644 --- a/tools/libxl/libxl_dm.c +++ b/tools/libxl/libxl_dm.c @@ -102,10 +102,10 @@ static char ** libxl__build_device_model_args_old(libxl__gc *gc, { const libxl_domain_create_info *c_info = &guest_config->c_info; const libxl_domain_build_info *b_info = &guest_config->b_info; - const libxl_device_nic *vifs = guest_config->vifs; + const libxl_device_nic *nics = guest_config->nics; const libxl_vnc_info *vnc = libxl__dm_vnc(guest_config); const libxl_sdl_info *sdl = dm_sdl(guest_config); - const int num_vifs = guest_config->num_vifs; + const int num_nics = guest_config->num_nics; const char *keymap = dm_keymap(guest_config); int i; flexarray_t *dm_args; @@ -159,7 +159,7 @@ static char ** libxl__build_device_model_args_old(libxl__gc *gc, flexarray_vappend(dm_args, "-k", keymap, NULL); } if (b_info->type == LIBXL_DOMAIN_TYPE_HVM) { - int ioemu_vifs = 0; + int ioemu_nics = 0; int nr_set_cpus = 0; char *s; @@ -214,31 +214,31 @@ static char ** libxl__build_device_model_args_old(libxl__gc *gc, libxl__sprintf(gc, "%s", s), NULL); free(s); - for (i = 0; i < num_vifs; i++) { - if (vifs[i].nictype == LIBXL_NIC_TYPE_IOEMU) { + for (i = 0; i < num_nics; i++) { + if (nics[i].nictype == LIBXL_NIC_TYPE_IOEMU) { char *smac = libxl__sprintf(gc, - LIBXL_MAC_FMT, LIBXL_MAC_BYTES(vifs[i].mac)); + LIBXL_MAC_FMT, LIBXL_MAC_BYTES(nics[i].mac)); const char *ifname = libxl__device_nic_devname(gc, - domid, vifs[i].devid, + domid, nics[i].devid, LIBXL_NIC_TYPE_IOEMU); flexarray_vappend(dm_args, "-net", GCSPRINTF( "nic,vlan=%d,macaddr=%s,model=%s", - vifs[i].devid, smac, vifs[i].model), + nics[i].devid, smac, nics[i].model), "-net", GCSPRINTF( "tap,vlan=%d,ifname=%s,bridge=%s," "script=%s,downscript=%s", - vifs[i].devid, ifname, vifs[i].bridge, + nics[i].devid, ifname, nics[i].bridge, libxl_tapif_script(gc), libxl_tapif_script(gc)), NULL); - ioemu_vifs++; + ioemu_nics++; } } /* If we have no emulated nics, tell qemu not to create any */ - if ( ioemu_vifs == 0 ) { + if ( ioemu_nics == 0 ) { flexarray_vappend(dm_args, "-net", "none", NULL); } if (libxl_defbool_val(b_info->u.hvm.gfx_passthru)) { @@ -330,9 +330,9 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc, const libxl_domain_create_info *c_info = &guest_config->c_info; const libxl_domain_build_info *b_info = &guest_config->b_info; const libxl_device_disk *disks = guest_config->disks; - const libxl_device_nic *vifs = guest_config->vifs; + const libxl_device_nic *nics = guest_config->nics; const int num_disks = guest_config->num_disks; - const int num_vifs = guest_config->num_vifs; + const int num_nics = guest_config->num_nics; const libxl_vnc_info *vnc = libxl__dm_vnc(guest_config); const libxl_sdl_info *sdl = dm_sdl(guest_config); const char *keymap = dm_keymap(guest_config); @@ -409,7 +409,7 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc, } if (b_info->type == LIBXL_DOMAIN_TYPE_HVM) { - int ioemu_vifs = 0; + int ioemu_nics = 0; if (b_info->u.hvm.serial) { flexarray_vappend(dm_args, "-serial", b_info->u.hvm.serial, NULL); @@ -468,30 +468,30 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc, flexarray_append(dm_args, libxl__sprintf(gc, "%d", b_info->max_vcpus)); } - for (i = 0; i < num_vifs; i++) { - if (vifs[i].nictype == LIBXL_NIC_TYPE_IOEMU) { + for (i = 0; i < num_nics; i++) { + if (nics[i].nictype == LIBXL_NIC_TYPE_IOEMU) { char *smac = libxl__sprintf(gc, - LIBXL_MAC_FMT, LIBXL_MAC_BYTES(vifs[i].mac)); + LIBXL_MAC_FMT, LIBXL_MAC_BYTES(nics[i].mac)); const char *ifname = libxl__device_nic_devname(gc, - guest_domid, vifs[i].devid, + guest_domid, nics[i].devid, LIBXL_NIC_TYPE_IOEMU); flexarray_append(dm_args, "-device"); flexarray_append(dm_args, libxl__sprintf(gc, "%s,id=nic%d,netdev=net%d,mac=%s", - vifs[i].model, vifs[i].devid, - vifs[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", - vifs[i].devid, ifname, + nics[i].devid, ifname, libxl_tapif_script(gc), libxl_tapif_script(gc))); - ioemu_vifs++; + ioemu_nics++; } } /* If we have no emulated nics, tell qemu not to create any */ - if ( ioemu_vifs == 0 ) { + if ( ioemu_nics == 0 ) { flexarray_append(dm_args, "-net"); flexarray_append(dm_args, "none"); } @@ -753,8 +753,8 @@ void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state *sdss) dm_config->disks = guest_config->disks; dm_config->num_disks = guest_config->num_disks; - dm_config->vifs = guest_config->vifs; - dm_config->num_vifs = guest_config->num_vifs; + dm_config->nics = guest_config->nics; + dm_config->num_nics = guest_config->num_nics; ret = libxl__domain_create_info_setdefault(gc, &dm_config->c_info); if (ret) goto out; @@ -827,8 +827,8 @@ retry_transaction: if (ret) goto out_free; } - for (i = 0; i < dm_config->num_vifs; i++) { - ret = libxl_device_nic_add(ctx, dm_domid, &dm_config->vifs[i]); + for (i = 0; i < dm_config->num_nics; i++) { + ret = libxl_device_nic_add(ctx, dm_domid, &dm_config->nics[i]); if (ret) goto out_free; } diff --git a/tools/libxl/libxl_json.c b/tools/libxl/libxl_json.c index cd2719a..18f0dfd 100644 --- a/tools/libxl/libxl_json.c +++ b/tools/libxl/libxl_json.c @@ -822,15 +822,15 @@ yajl_gen_status libxl_domain_config_gen_json(yajl_gen hand, if (s != yajl_gen_status_ok) goto out; - s = yajl_gen_string(hand, (const unsigned char *)"vifs", - sizeof("vifs")-1); + s = yajl_gen_string(hand, (const unsigned char *)"nics", + sizeof("nics")-1); if (s != yajl_gen_status_ok) goto out; s = yajl_gen_array_open(hand); if (s != yajl_gen_status_ok) goto out; - for (i = 0; i < p->num_vifs; i++) { - s = libxl_device_nic_gen_json(hand, &p->vifs[i]); + for (i = 0; i < p->num_nics; i++) { + s = libxl_device_nic_gen_json(hand, &p->nics[i]); if (s != yajl_gen_status_ok) goto out; } diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index b3d8b7a..cf56839 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -920,17 +920,17 @@ static void parse_config_data(const char *config_source, } if (!xlu_cfg_get_list (config, "vif", &nics, 0, 0)) { - d_config->num_vifs = 0; - d_config->vifs = NULL; - while ((buf = xlu_cfg_get_listitem (nics, d_config->num_vifs)) != NULL) { + d_config->num_nics = 0; + d_config->nics = NULL; + while ((buf = xlu_cfg_get_listitem (nics, d_config->num_nics)) != NULL) { libxl_device_nic *nic; char *buf2 = strdup(buf); char *p, *p2; - d_config->vifs = (libxl_device_nic *) realloc(d_config->vifs, sizeof (libxl_device_nic) * (d_config->num_vifs+1)); - nic = d_config->vifs + d_config->num_vifs; + d_config->nics = (libxl_device_nic *) realloc(d_config->nics, sizeof (libxl_device_nic) * (d_config->num_nics+1)); + nic = d_config->nics + d_config->num_nics; libxl_device_nic_init(nic); - nic->devid = d_config->num_vifs; + nic->devid = d_config->num_nics; if (default_vifscript) { free(nic->script); @@ -1003,7 +1003,7 @@ static void parse_config_data(const char *config_source, } while ((p = strtok(NULL, ",")) != NULL); skip: free(buf2); - d_config->num_vifs++; + d_config->num_nics++; } } diff --git a/tools/libxl/xl_sxp.c b/tools/libxl/xl_sxp.c index 6e0a389..91f8f75 100644 --- a/tools/libxl/xl_sxp.c +++ b/tools/libxl/xl_sxp.c @@ -175,20 +175,20 @@ void printf_info_sexp(int domid, libxl_domain_config *d_config) printf("\t)\n"); } - for (i = 0; i < d_config->num_vifs; i++) { + for (i = 0; i < d_config->num_nics; i++) { printf("\t(device\n"); printf("\t\t(vif\n"); - if (d_config->vifs[i].ifname) - printf("\t\t\t(vifname %s)\n", d_config->vifs[i].ifname); - printf("\t\t\t(backend_domid %d)\n", d_config->vifs[i].backend_domid); + if (d_config->nics[i].ifname) + printf("\t\t\t(vifname %s)\n", d_config->nics[i].ifname); + printf("\t\t\t(backend_domid %d)\n", d_config->nics[i].backend_domid); printf("\t\t\t(frontend_domid %d)\n", domid); - printf("\t\t\t(devid %d)\n", d_config->vifs[i].devid); - printf("\t\t\t(mtu %d)\n", d_config->vifs[i].mtu); - printf("\t\t\t(model %s)\n", d_config->vifs[i].model); + printf("\t\t\t(devid %d)\n", d_config->nics[i].devid); + printf("\t\t\t(mtu %d)\n", d_config->nics[i].mtu); + printf("\t\t\t(model %s)\n", d_config->nics[i].model); printf("\t\t\t(mac %02x%02x%02x%02x%02x%02x)\n", - d_config->vifs[i].mac[0], d_config->vifs[i].mac[1], - d_config->vifs[i].mac[2], d_config->vifs[i].mac[3], - d_config->vifs[i].mac[4], d_config->vifs[i].mac[5]); + d_config->nics[i].mac[0], d_config->nics[i].mac[1], + d_config->nics[i].mac[2], d_config->nics[i].mac[3], + d_config->nics[i].mac[4], d_config->nics[i].mac[5]); printf("\t\t)\n"); printf("\t)\n"); } -- 1.7.7.5 (Apple Git-26) _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |