[PATCH v2 28/49] libmultipath: reimplement dm_get_opencount() with new API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Martin Wilck <mwilck@xxxxxxxx>
Reviewed-by: Benjamin Marzinski <bmarzins@xxxxxxxxxx>
---
 libmultipath/devmapper.c | 28 ++++------------------------
 1 file changed, 4 insertions(+), 24 deletions(-)

diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c
index 5cada4c..47ff827 100644
--- a/libmultipath/devmapper.c
+++ b/libmultipath/devmapper.c
@@ -1048,34 +1048,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) != DMP_OK)
+		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





[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux