From 2c76a4f11bbe8a38c685ae79f4bd384284f47db9 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Wed, 28 Sep 2011 16:42:11 +0100 Subject: libxl: attempt to cleanup tapdisk processes on disk backend destroy. Signed-off-by: Ian Campbell Committed-by: Ian Jackson --- tools/blktap2/control/tap-ctl-list.c | 12 ++++++------ tools/blktap2/control/tap-ctl.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'tools/blktap2') diff --git a/tools/blktap2/control/tap-ctl-list.c b/tools/blktap2/control/tap-ctl-list.c index 1497270874..c91f6f48d3 100644 --- a/tools/blktap2/control/tap-ctl-list.c +++ b/tools/blktap2/control/tap-ctl-list.c @@ -506,17 +506,15 @@ out: } int -tap_ctl_find_minor(const char *type, const char *path) +tap_ctl_find(const char *type, const char *path, tap_list_t *tap) { tap_list_t **list, **_entry; - int minor, err; + int ret = -ENOENT, err; err = tap_ctl_list(&list); if (err) return err; - minor = -1; - for (_entry = list; *_entry != NULL; ++_entry) { tap_list_t *entry = *_entry; @@ -526,11 +524,13 @@ tap_ctl_find_minor(const char *type, const char *path) if (path && (!entry->path || strcmp(entry->path, path))) continue; - minor = entry->minor; + *tap = *entry; + tap->type = tap->path = NULL; + ret = 0; break; } tap_ctl_free_list(list); - return minor >= 0 ? minor : -ENOENT; + return ret; } diff --git a/tools/blktap2/control/tap-ctl.h b/tools/blktap2/control/tap-ctl.h index d951e774cb..de0bc29a48 100644 --- a/tools/blktap2/control/tap-ctl.h +++ b/tools/blktap2/control/tap-ctl.h @@ -76,7 +76,7 @@ int tap_ctl_get_driver_id(const char *handle); int tap_ctl_list(tap_list_t ***list); void tap_ctl_free_list(tap_list_t **list); -int tap_ctl_find_minor(const char *type, const char *path); +int tap_ctl_find(const char *type, const char *path, tap_list_t *tap); int tap_ctl_allocate(int *minor, char **devname); int tap_ctl_free(const int minor); -- cgit v1.2.3