[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 06/13] libxl: rename aodevs to multidev
To be consistent with the new function naming, rename libxl__ao_devices to libxl__multidev and all variables aodevs to multidev. No functional change. Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx> --- tools/libxl/libxl_create.c | 30 +++++++++--------- tools/libxl/libxl_device.c | 68 +++++++++++++++++++++--------------------- tools/libxl/libxl_dm.c | 30 +++++++++--------- tools/libxl/libxl_internal.h | 26 ++++++++-------- 4 files changed, 77 insertions(+), 77 deletions(-) diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index 5275373..5f0d26f 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -599,10 +599,10 @@ static void domcreate_bootloader_done(libxl__egc *egc, libxl__bootloader_state *bl, int rc); -static void domcreate_launch_dm(libxl__egc *egc, libxl__ao_devices *aodevs, +static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *aodevs, int ret); -static void domcreate_attach_pci(libxl__egc *egc, libxl__ao_devices *aodevs, +static void domcreate_attach_pci(libxl__egc *egc, libxl__multidev *aodevs, int ret); static void domcreate_console_available(libxl__egc *egc, @@ -909,10 +909,10 @@ static void domcreate_rebuild_done(libxl__egc *egc, store_libxl_entry(gc, domid, &d_config->b_info); - libxl__multidev_begin(ao, &dcs->aodevs); - dcs->aodevs.callback = domcreate_launch_dm; - libxl__add_disks(egc, ao, domid, d_config, &dcs->aodevs); - libxl__multidev_prepared(egc, &dcs->aodevs, 0); + libxl__multidev_begin(ao, &dcs->multidev); + dcs->multidev.callback = domcreate_launch_dm; + libxl__add_disks(egc, ao, domid, d_config, &dcs->multidev); + libxl__multidev_prepared(egc, &dcs->multidev, 0); return; @@ -921,10 +921,10 @@ static void domcreate_rebuild_done(libxl__egc *egc, domcreate_complete(egc, dcs, ret); } -static void domcreate_launch_dm(libxl__egc *egc, libxl__ao_devices *aodevs, +static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev, int ret) { - libxl__domain_create_state *dcs = CONTAINER_OF(aodevs, *dcs, aodevs); + libxl__domain_create_state *dcs = CONTAINER_OF(multidev, *dcs, multidev); STATE_AO_GC(dcs->ao); int i; @@ -1039,14 +1039,14 @@ static void domcreate_devmodel_started(libxl__egc *egc, /* Plug nic interfaces */ if (d_config->num_nics > 0) { /* Attach nics */ - libxl__multidev_begin(ao, &dcs->aodevs); - dcs->aodevs.callback = domcreate_attach_pci; - libxl__add_nics(egc, ao, domid, d_config, &dcs->aodevs); - libxl__multidev_prepared(egc, &dcs->aodevs, 0); + libxl__multidev_begin(ao, &dcs->multidev); + dcs->multidev.callback = domcreate_attach_pci; + libxl__add_nics(egc, ao, domid, d_config, &dcs->multidev); + libxl__multidev_prepared(egc, &dcs->multidev, 0); return; } - domcreate_attach_pci(egc, &dcs->aodevs, 0); + domcreate_attach_pci(egc, &dcs->multidev, 0); return; error_out: @@ -1054,10 +1054,10 @@ error_out: domcreate_complete(egc, dcs, ret); } -static void domcreate_attach_pci(libxl__egc *egc, libxl__ao_devices *aodevs, +static void domcreate_attach_pci(libxl__egc *egc, libxl__multidev *multidev, int ret) { - libxl__domain_create_state *dcs = CONTAINER_OF(aodevs, *dcs, aodevs); + libxl__domain_create_state *dcs = CONTAINER_OF(multidev, *dcs, multidev); STATE_AO_GC(dcs->ao); int i; libxl_ctx *ctx = CTX; diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c index 27fbd21..9fc63f1 100644 --- a/tools/libxl/libxl_device.c +++ b/tools/libxl/libxl_device.c @@ -403,13 +403,13 @@ void libxl__prepare_ao_device(libxl__ao *ao, libxl__ao_device *aodev) /* multidev */ -void libxl__multidev_begin(libxl__ao *ao, libxl__ao_devices *aodevs) +void libxl__multidev_begin(libxl__ao *ao, libxl__multidev *multidev) { AO_GC; - aodevs->ao = ao; - aodevs->array = 0; - aodevs->used = aodevs->allocd = 0; + multidev->ao = ao; + multidev->array = 0; + multidev->used = multidev->allocd = 0; /* We allocate an aodev to represent the operation of preparing * all of the other operations. This operation is completed when @@ -422,25 +422,25 @@ void libxl__multidev_begin(libxl__ao *ao, libxl__ao_devices *aodevs) * (iii) we have a nice consistent way to deal with any * error that might occur while deciding what to initiate */ - aodevs->preparation = libxl__multidev_prepare(aodevs); + multidev->preparation = libxl__multidev_prepare(multidev); } static void multidev_one_callback(libxl__egc *egc, libxl__ao_device *aodev); -libxl__ao_device *libxl__multidev_prepare(libxl__ao_devices *aodevs) { - STATE_AO_GC(aodevs->ao); +libxl__ao_device *libxl__multidev_prepare(libxl__multidev *multidev) { + STATE_AO_GC(multidev->ao); libxl__ao_device *aodev; GCNEW(aodev); - aodev->aodevs = aodevs; + aodev->multidev = multidev; aodev->callback = multidev_one_callback; libxl__prepare_ao_device(ao, aodev); - if (aodevs->used >= aodevs->allocd) { - aodevs->allocd = aodevs->used * 2 + 5; - GCREALLOC_ARRAY(aodevs->array, aodevs->allocd); + if (multidev->used >= multidev->allocd) { + multidev->allocd = multidev->used * 2 + 5; + GCREALLOC_ARRAY(multidev->array, multidev->allocd); } - aodevs->array[aodevs->used++] = aodev; + multidev->array[multidev->used++] = aodev; return aodev; } @@ -448,28 +448,28 @@ libxl__ao_device *libxl__multidev_prepare(libxl__ao_devices *aodevs) { static void multidev_one_callback(libxl__egc *egc, libxl__ao_device *aodev) { STATE_AO_GC(aodev->ao); - libxl__ao_devices *aodevs = aodev->aodevs; + libxl__multidev *multidev = aodev->multidev; int i, error = 0; aodev->active = 0; - for (i = 0; i < aodevs->used; i++) { - if (aodevs->array[i]->active) + for (i = 0; i < multidev->used; i++) { + if (multidev->array[i]->active) return; - if (aodevs->array[i]->rc) - error = aodevs->array[i]->rc; + if (multidev->array[i]->rc) + error = multidev->array[i]->rc; } - aodevs->callback(egc, aodevs, error); + multidev->callback(egc, multidev, error); return; } -void libxl__multidev_prepared(libxl__egc *egc, libxl__ao_devices *aodevs, - int rc) +void libxl__multidev_prepared(libxl__egc *egc, + libxl__multidev *multidev, int rc) { - aodevs->preparation->rc = rc; - multidev_one_callback(egc, aodevs->preparation); + multidev->preparation->rc = rc; + multidev_one_callback(egc, multidev->preparation); } /******************************************************************************/ @@ -486,12 +486,12 @@ void libxl__multidev_prepared(libxl__egc *egc, libxl__ao_devices *aodevs, #define DEFINE_DEVICES_ADD(type) \ void libxl__add_##type##s(libxl__egc *egc, libxl__ao *ao, uint32_t domid, \ libxl_domain_config *d_config, \ - libxl__ao_devices *aodevs) \ + libxl__multidev *multidev) \ { \ AO_GC; \ int i; \ for (i = 0; i < d_config->num_##type##s; i++) { \ - libxl__ao_device *aodev = libxl__multidev_prepare(aodevs); \ + libxl__ao_device *aodev = libxl__multidev_prepare(multidev); \ libxl__device_##type##_add(egc, domid, &d_config->type##s[i], \ aodev); \ } \ @@ -532,8 +532,8 @@ out: /* Callback for device destruction */ -static void devices_remove_callback(libxl__egc *egc, libxl__ao_devices *aodevs, - int rc); +static void devices_remove_callback(libxl__egc *egc, + libxl__multidev *multidev, int rc); void libxl__devices_destroy(libxl__egc *egc, libxl__devices_remove_state *drs) { @@ -545,12 +545,12 @@ void libxl__devices_destroy(libxl__egc *egc, libxl__devices_remove_state *drs) char **kinds = NULL, **devs = NULL; int i, j, rc = 0; libxl__device *dev; - libxl__ao_devices *aodevs = &drs->aodevs; + libxl__multidev *multidev = &drs->multidev; libxl__ao_device *aodev; libxl__device_kind kind; - libxl__multidev_begin(ao, aodevs); - aodevs->callback = devices_remove_callback; + libxl__multidev_begin(ao, multidev); + multidev->callback = devices_remove_callback; path = libxl__sprintf(gc, "/local/domain/%d/device", domid); kinds = libxl__xs_directory(gc, XBT_NULL, path, &num_kinds); @@ -587,7 +587,7 @@ void libxl__devices_destroy(libxl__egc *egc, libxl__devices_remove_state *drs) libxl__device_destroy(gc, dev); continue; } - aodev = libxl__multidev_prepare(aodevs); + aodev = libxl__multidev_prepare(multidev); aodev->action = DEVICE_DISCONNECT; aodev->dev = dev; aodev->force = drs->force; @@ -613,7 +613,7 @@ void libxl__devices_destroy(libxl__egc *egc, libxl__devices_remove_state *drs) } out: - libxl__multidev_prepared(egc, aodevs, rc); + libxl__multidev_prepared(egc, multidev, rc); } /* Callbacks for device related operations */ @@ -1003,10 +1003,10 @@ static void device_hotplug_clean(libxl__gc *gc, libxl__ao_device *aodev) assert(!libxl__ev_child_inuse(&aodev->child)); } -static void devices_remove_callback(libxl__egc *egc, libxl__ao_devices *aodevs, - int rc) +static void devices_remove_callback(libxl__egc *egc, + libxl__multidev *multidev, int rc) { - libxl__devices_remove_state *drs = CONTAINER_OF(aodevs, *drs, aodevs); + libxl__devices_remove_state *drs = CONTAINER_OF(multidev, *drs, multidev); STATE_AO_GC(drs->ao); drs->callback(egc, drs, rc); diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c index 66aa45e..0c0084f 100644 --- a/tools/libxl/libxl_dm.c +++ b/tools/libxl/libxl_dm.c @@ -714,10 +714,10 @@ static void spawn_stubdom_pvqemu_cb(libxl__egc *egc, int rc); static void spawn_stub_launch_dm(libxl__egc *egc, - libxl__ao_devices *aodevs, int ret); + libxl__multidev *aodevs, int ret); static void stubdom_pvqemu_cb(libxl__egc *egc, - libxl__ao_devices *aodevs, + libxl__multidev *aodevs, int rc); static void spaw_stubdom_pvqemu_destroy_cb(libxl__egc *egc, @@ -856,10 +856,10 @@ retry_transaction: if (errno == EAGAIN) goto retry_transaction; - libxl__multidev_begin(ao, &sdss->aodevs); - sdss->aodevs.callback = spawn_stub_launch_dm; - libxl__add_disks(egc, ao, dm_domid, dm_config, &sdss->aodevs); - libxl__multidev_prepared(egc, &sdss->aodevs, 0); + libxl__multidev_begin(ao, &sdss->multidev); + sdss->multidev.callback = spawn_stub_launch_dm; + libxl__add_disks(egc, ao, dm_domid, dm_config, &sdss->multidev); + libxl__multidev_prepared(egc, &sdss->multidev, 0); free(args); return; @@ -872,9 +872,9 @@ out: } static void spawn_stub_launch_dm(libxl__egc *egc, - libxl__ao_devices *aodevs, int ret) + libxl__multidev *multidev, int ret) { - libxl__stub_dm_spawn_state *sdss = CONTAINER_OF(aodevs, *sdss, aodevs); + libxl__stub_dm_spawn_state *sdss = CONTAINER_OF(multidev, *sdss, multidev); STATE_AO_GC(sdss->dm.spawn.ao); libxl_ctx *ctx = libxl__gc_owner(gc); int i, num_console = STUBDOM_SPECIAL_CONSOLES; @@ -982,22 +982,22 @@ static void spawn_stubdom_pvqemu_cb(libxl__egc *egc, if (rc) goto out; if (d_config->num_nics > 0) { - libxl__multidev_begin(ao, &sdss->aodevs); - sdss->aodevs.callback = stubdom_pvqemu_cb; - libxl__add_nics(egc, ao, dm_domid, d_config, &sdss->aodevs); - libxl__multidev_prepared(egc, &sdss->aodevs, 0); + libxl__multidev_begin(ao, &sdss->multidev); + sdss->multidev.callback = stubdom_pvqemu_cb; + libxl__add_nics(egc, ao, dm_domid, d_config, &sdss->multidev); + libxl__multidev_prepared(egc, &sdss->multidev, 0); return; } out: - stubdom_pvqemu_cb(egc, &sdss->aodevs, rc); + stubdom_pvqemu_cb(egc, &sdss->multidev, rc); } static void stubdom_pvqemu_cb(libxl__egc *egc, - libxl__ao_devices *aodevs, + libxl__multidev *multidev, int rc) { - libxl__stub_dm_spawn_state *sdss = CONTAINER_OF(aodevs, *sdss, aodevs); + libxl__stub_dm_spawn_state *sdss = CONTAINER_OF(multidev, *sdss, multidev); STATE_AO_GC(sdss->dm.spawn.ao); uint32_t dm_domid = sdss->pvqemu.guest_domid; diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index bb3eb5f..6528694 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -1797,7 +1797,7 @@ typedef enum { } libxl__device_action; typedef struct libxl__ao_device libxl__ao_device; -typedef struct libxl__ao_devices libxl__ao_devices; +typedef struct libxl__multidev libxl__multidev; typedef void libxl__device_callback(libxl__egc*, libxl__ao_device*); /* This functions sets the necessary libxl__ao_device struct values to use @@ -1827,7 +1827,7 @@ struct libxl__ao_device { int rc; /* private for multidev */ int active; - libxl__ao_devices *aodevs; /* reference to the containing multidev */ + libxl__multidev *multidev; /* reference to the containing multidev */ /* private for add/remove implementation */ libxl__ev_devstate backend_ds; /* Bodge for Qemu devices, also used for timeout of hotplug execution */ @@ -1853,12 +1853,12 @@ struct libxl__ao_device { */ /* Starts preparing to add/remove a bunch of devices. */ -_hidden void libxl__multidev_begin(libxl__ao *ao, libxl__ao_devices*); +_hidden void libxl__multidev_begin(libxl__ao *ao, libxl__multidev*); /* Prepares to add/remove one of many devices. Returns a libxl__ao_device * which has had libxl__prepare_ao_device called, and which has also * had ->callback set. The user should not mess with aodev->callback. */ -_hidden libxl__ao_device *libxl__multidev_prepare(libxl__ao_devices*); +_hidden libxl__ao_device *libxl__multidev_prepare(libxl__multidev*); /* Notifies the multidev machinery that we have now finished preparing * and initiating devices. multidev->callback may then be called as @@ -1866,10 +1866,10 @@ _hidden libxl__ao_device *libxl__multidev_prepare(libxl__ao_devices*); * outstanding, perhaps reentrantly. If rc!=0 (error should have been * logged) multidev->callback will get a non-zero rc. * callback may be set by the user at any point before prepared. */ -_hidden void libxl__multidev_prepared(libxl__egc*, libxl__ao_devices*, int rc); +_hidden void libxl__multidev_prepared(libxl__egc*, libxl__multidev*, int rc); -typedef void libxl__devices_callback(libxl__egc*, libxl__ao_devices*, int rc); -struct libxl__ao_devices { +typedef void libxl__devices_callback(libxl__egc*, libxl__multidev*, int rc); +struct libxl__multidev { /* set by user: */ libxl__devices_callback *callback; /* for private use by libxl__...ao_devices... machinery: */ @@ -2342,7 +2342,7 @@ struct libxl__devices_remove_state { libxl__devices_remove_callback *callback; int force; /* libxl_device_TYPE_destroy rather than _remove */ /* private */ - libxl__ao_devices aodevs; + libxl__multidev multidev; int num_devices; }; @@ -2386,7 +2386,7 @@ _hidden void libxl__devices_destroy(libxl__egc *egc, libxl__devices_remove_state *drs); /* Helper function to add a bunch of disks. This should be used when - * the caller is inside an async op. "devices" will NOT be prepared by + * the caller is inside an async op. "multidev" will NOT be prepared by * this function, so the caller must make sure to call * libxl__multidev_begin before calling this function. * @@ -2395,11 +2395,11 @@ _hidden void libxl__devices_destroy(libxl__egc *egc, */ _hidden void libxl__add_disks(libxl__egc *egc, libxl__ao *ao, uint32_t domid, libxl_domain_config *d_config, - libxl__ao_devices *aodevs); + libxl__multidev *multidev); _hidden void libxl__add_nics(libxl__egc *egc, libxl__ao *ao, uint32_t domid, libxl_domain_config *d_config, - libxl__ao_devices *aodevs); + libxl__multidev *multidev); /*----- device model creation -----*/ @@ -2435,7 +2435,7 @@ typedef struct { libxl__domain_build_state dm_state; libxl__dm_spawn_state pvqemu; libxl__destroy_domid_state dis; - libxl__ao_devices aodevs; + libxl__multidev multidev; } libxl__stub_dm_spawn_state; _hidden void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state*); @@ -2467,7 +2467,7 @@ struct libxl__domain_create_state { libxl__save_helper_state shs; /* necessary if the domain creation failed and we have to destroy it */ libxl__domain_destroy_state dds; - libxl__ao_devices aodevs; + libxl__multidev multidev; }; /*----- Domain suspend (save) functions -----*/ -- 1.7.2.5 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |