Signed-off-by: Martin Wilck <mwilck@xxxxxxxx> --- libmultipath/devmapper.c | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c index 8a0578e..859a861 100644 --- a/libmultipath/devmapper.c +++ b/libmultipath/devmapper.c @@ -1038,34 +1038,14 @@ static int dm_dev_t (const char *mapname, char *dev_t, int len) return 0; } -int -dm_get_opencount (const char * mapname) +int dm_get_opencount (const char *mapname) { - int r = -1; - struct dm_task *dmt; struct dm_info info; - if (!(dmt = libmp_dm_task_create(DM_DEVICE_INFO))) - return 0; + if (dm_get_info(mapname, &info) != 0) + return -1; - if (!dm_task_set_name(dmt, mapname)) - goto out; - - if (!libmp_dm_task_run(dmt)) { - dm_log_error(3, DM_DEVICE_INFO, dmt); - goto out; - } - - if (!dm_task_get_info(dmt, &info)) - goto out; - - if (!info.exists) - goto out; - - r = info.open_count; -out: - dm_task_destroy(dmt); - return r; + return info.open_count; } int -- 2.45.2