[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] libxl: rename vifs to nics
# HG changeset patch # User Roger Pau Monne <roger.pau@xxxxxxxxxx> # Date 1343295331 -3600 # Node ID ab99fc63a22ea8fc3e73e12560d81326ffdf5636 # Parent fb9a2cd50cab9b7ad4f2dd30d786bc9c574b9f5e 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. Signed-off-by: Roger Pau Monne <roger.pau@xxxxxxxxxx> Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> Committed-by: Ian Campbell <ian.campbell@xxxxxxxxxx> --- diff -r fb9a2cd50cab -r ab99fc63a22e tools/libxl/libxl.h --- a/tools/libxl/libxl.h Wed Jul 25 17:57:22 2012 +0100 +++ b/tools/libxl/libxl.h Thu Jul 26 10:35:31 2012 +0100 @@ -470,10 +470,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 -r fb9a2cd50cab -r ab99fc63a22e tools/libxl/libxl_create.c --- a/tools/libxl/libxl_create.c Wed Jul 25 17:57:22 2012 +0100 +++ b/tools/libxl/libxl_create.c Thu Jul 26 10:35:31 2012 +0100 @@ -39,9 +39,9 @@ void libxl_domain_config_dispose(libxl_d 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]); @@ -873,8 +873,8 @@ static void domcreate_rebuild_done(libxl 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 -r fb9a2cd50cab -r ab99fc63a22e tools/libxl/libxl_dm.c --- a/tools/libxl/libxl_dm.c Wed Jul 25 17:57:22 2012 +0100 +++ b/tools/libxl/libxl_dm.c Thu Jul 26 10:35:31 2012 +0100 @@ -102,10 +102,10 @@ static char ** libxl__build_device_model { 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 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 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 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 } 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 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"); } @@ -620,18 +620,18 @@ static void libxl__dm_vifs_from_hvm_gues libxl_domain_config * const guest_config, libxl_domain_config *dm_config) { - int i, nr = guest_config->num_vifs; + int i, nr = guest_config->num_nics; - GCNEW_ARRAY(dm_config->vifs, nr); + GCNEW_ARRAY(dm_config->nics, nr); for (i=0; i<nr; i++) { - dm_config->vifs[i] = guest_config->vifs[i]; - if (dm_config->vifs[i].ifname) - dm_config->vifs[i].ifname = GCSPRINTF("%s" TAP_DEVICE_SUFFIX, - dm_config->vifs[i].ifname); + dm_config->nics[i] = guest_config->nics[i]; + if (dm_config->nics[i].ifname) + dm_config->nics[i].ifname = GCSPRINTF("%s" TAP_DEVICE_SUFFIX, + dm_config->nics[i].ifname); } - dm_config->num_vifs = nr; + dm_config->num_nics = nr; } static int libxl__vfb_and_vkb_from_hvm_guest_config(libxl__gc *gc, @@ -849,8 +849,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 -r fb9a2cd50cab -r ab99fc63a22e tools/libxl/libxl_json.c --- a/tools/libxl/libxl_json.c Wed Jul 25 17:57:22 2012 +0100 +++ b/tools/libxl/libxl_json.c Thu Jul 26 10:35:31 2012 +0100 @@ -822,15 +822,15 @@ yajl_gen_status libxl_domain_config_gen_ 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 -r fb9a2cd50cab -r ab99fc63a22e tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c Wed Jul 25 17:57:22 2012 +0100 +++ b/tools/libxl/xl_cmdimpl.c Thu Jul 26 10:35:31 2012 +0100 @@ -919,17 +919,17 @@ static void parse_config_data(const char } 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); @@ -1002,7 +1002,7 @@ static void parse_config_data(const char } while ((p = strtok(NULL, ",")) != NULL); skip: free(buf2); - d_config->num_vifs++; + d_config->num_nics++; } } diff -r fb9a2cd50cab -r ab99fc63a22e tools/libxl/xl_sxp.c --- a/tools/libxl/xl_sxp.c Wed Jul 25 17:57:22 2012 +0100 +++ b/tools/libxl/xl_sxp.c Thu Jul 26 10:35:31 2012 +0100 @@ -175,20 +175,20 @@ void printf_info_sexp(int domid, libxl_d 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"); } _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |