]> sourceware.org Git - dm.git/commitdiff
dm_driver_version
authorAlasdair Kergon <agk@redhat.com>
Mon, 17 Oct 2005 18:05:39 +0000 (18:05 +0000)
committerAlasdair Kergon <agk@redhat.com>
Mon, 17 Oct 2005 18:05:39 +0000 (18:05 +0000)
WHATS_NEW
dmsetup/dmsetup.c
lib/.exported_symbols
lib/libdevmapper.h
lib/libdm-common.c

index 99283d61948afb299a77391c4ad5032ed6e4c005..60cb014e64d7f942f31449c731e3091321bb079f 100644 (file)
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
 Version 1.02.00 - 
 =============================
+  Add dm_driver_version().
   Added dependency tree functions to library.
   Added hash, bitset, pool, dbg_malloc to library.
   Added ls --tree to dmsetup.
index 4b2d7c01ce24114ca85a489df656c1fe690697dd..30b6c8b7cfcc4a83ec8c15fd3c2829fb3175ac3b 100644 (file)
@@ -497,32 +497,17 @@ static int _message(int argc, char **argv, void *data)
 
 static int _version(int argc, char **argv, void *data)
 {
-       int r = 0;
-       struct dm_task *dmt;
        char version[80];
 
        if (dm_get_library_version(version, sizeof(version)))
                printf("Library version:   %s\n", version);
 
-       if (!(dmt = dm_task_create(DM_DEVICE_VERSION)))
+       if (dm_driver_version(version, sizeof(version)))
                return 0;
 
-       if (!dm_task_run(dmt))
-               goto out;
-
-       if (!dm_task_get_driver_version(dmt, (char *) &version,
-                                       sizeof(version))) {
-               goto out;
-       }
-
        printf("Driver version:    %s\n", version);
 
-       r = 1;
-
-      out:
-       dm_task_destroy(dmt);
-
-       return r;
+       return 1;
 }
 
 static int _simple(int task, const char *name, uint32_t event_nr, int display)
index 85374dd46602f4752d6970766ce92e1c1a32db96..cb7eb0b3c2b1d3f1763e8321daeadbe0153eb4b1 100644 (file)
@@ -81,3 +81,4 @@ dm_hash_get_key
 dm_hash_get_data
 dm_hash_get_first
 dm_hash_get_next
+dm_driver_version
index a1fa6eee74e5e4c9ad024f53f67689bee9962e95..4df4a079867483b3ff549fe21492235a6fdfb6da 100644 (file)
@@ -188,6 +188,7 @@ void dm_lib_exit(void) __attribute((destructor));
  * Use NULL for all devices.
  */
 int dm_mknodes(const char *name);
+int dm_driver_version(char *version, size_t size);
 
 /*****************************
  * Dependency tree functions *
index 4c11856b7d1bae50b3c4f10033a9aac1d221560c..ed4392c80a107f630032a5d2d6570adb7f0408ab 100644 (file)
@@ -469,3 +469,24 @@ out:
        dm_task_destroy(dmt);
        return r;
 }
+
+int dm_driver_version(char *version, size_t size)
+{
+       struct dm_task *dmt;
+       int r = 0;
+
+       if (!(dmt = dm_task_create(DM_DEVICE_VERSION)))
+               return 0;
+
+       if (!dm_task_run(dmt))
+               log_error("Failed to get driver version");
+
+       if (!dm_task_get_driver_version(dmt, version, size))
+               goto out;
+
+       r = 1;
+
+out:
+       dm_task_destroy(dmt);
+       return r;
+}
This page took 0.034757 seconds and 5 git commands to generate.