aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxl/libxl_device.c
diff options
context:
space:
mode:
authorRoger Pau Monne <roger.pau@entel.upc.edu>2011-12-15 18:55:46 +0100
committerRoger Pau Monne <roger.pau@entel.upc.edu>2011-12-15 18:55:46 +0100
commit5b4f1759a0a78efe70f349e15b1d4ce876ec1e1b (patch)
tree452064e7b58477a9cd11b922b683228e04fed956 /tools/libxl/libxl_device.c
parent0b5c5ae1bdc2152016f72a7c00706fefc95e5b39 (diff)
downloadxen-5b4f1759a0a78efe70f349e15b1d4ce876ec1e1b.tar.gz
xen-5b4f1759a0a78efe70f349e15b1d4ce876ec1e1b.tar.bz2
xen-5b4f1759a0a78efe70f349e15b1d4ce876ec1e1b.zip
libxl: remove force parameter from libxl__devices_destroy
Remove the force flag, and always use forced destruction. Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu> Acked-by: Ian Jackson <ian.jackson.citrix.com> Committed-by: Ian Jackson <ian.jackson.citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/libxl/libxl_device.c')
-rw-r--r--tools/libxl/libxl_device.c45
1 files changed, 4 insertions, 41 deletions
diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c
index 1ff812d4cb..9b1fc5789c 100644
--- a/tools/libxl/libxl_device.c
+++ b/tools/libxl/libxl_device.c
@@ -500,13 +500,13 @@ int libxl__device_destroy(libxl__gc *gc, libxl__device *dev)
return 0;
}
-int libxl__devices_destroy(libxl__gc *gc, uint32_t domid, int force)
+int libxl__devices_destroy(libxl__gc *gc, uint32_t domid)
{
libxl_ctx *ctx = libxl__gc_owner(gc);
char *path;
unsigned int num_kinds, num_devs;
char **kinds = NULL, **devs = NULL;
- int i, j, n_watches = 0;
+ int i, j;
libxl__device dev;
libxl__device_kind kind;
@@ -537,16 +537,7 @@ int libxl__devices_destroy(libxl__gc *gc, uint32_t domid, int force)
dev.kind = kind;
dev.devid = atoi(devs[j]);
- if (force) {
- libxl__device_destroy(gc, &dev);
- } else {
- int rc = libxl__device_remove(gc, &dev, 0);
- if (rc < 0)
- LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
- "cannot remove device %s\n", path);
- else
- n_watches += rc;
- }
+ libxl__device_destroy(gc, &dev);
}
}
}
@@ -560,37 +551,9 @@ int libxl__devices_destroy(libxl__gc *gc, uint32_t domid, int force)
dev.kind = LIBXL__DEVICE_KIND_CONSOLE;
dev.devid = 0;
- if (force) {
- libxl__device_destroy(gc, &dev);
- } else {
- int rc = libxl__device_remove(gc, &dev, 0);
- if (rc < 0)
- LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
- "cannot remove device %s\n", path);
- else
- n_watches += rc;
- }
+ libxl__device_destroy(gc, &dev);
}
- if (!force) {
- /* Linux-ism. Most implementations leave the timeout
- * untouched after select. Linux, however, will chip
- * away the elapsed time from it, which is what we
- * need to enforce a single time span waiting for
- * device destruction. */
- struct timeval tv;
- tv.tv_sec = LIBXL_DESTROY_TIMEOUT;
- tv.tv_usec = 0;
- while (n_watches > 0) {
- if (libxl__wait_for_device_state(gc, &tv, XenbusStateClosed,
- destroy_device) < 0) {
- /* function returned ERROR_* */
- break;
- } else {
- n_watches--;
- }
- }
- }
out:
return 0;
}