summaryrefslogtreecommitdiff
path: root/extras/multipath/unsused.c
diff options
context:
space:
mode:
authorchristophe.varoqui@free.fr <christophe.varoqui@free.fr>2003-12-22 20:49:22 -0800
committerGreg KH <gregkh@suse.de>2005-04-26 21:13:10 -0700
commit176857119a77aad650412d9fedb568da4b543e07 (patch)
tree1845bcc17c88391bc58d5304ec3cdd8ea19ff28b /extras/multipath/unsused.c
parent4af58c70571c5c63edaff20d2032c8eeb59678b6 (diff)
[PATCH] extras multipath update
An important one, against stock udev-009 : 2003-12-20 multipath-010 * big ChangeLog update * start to give a little control over target params : introduce cmdline arg -i to control polling interval * cope with hotplug-style calling convention : ie "multipath scsi $DEVPATH" ... to avoid messing with online maps not concerned by an event * example hotplug agent to drop in /etc/hotplug.d/scsi * revert the run & resched patch : unless someone proves me wrong, this was overdesigned * move commented out functions in unused.c * update multipath target params to "udm[23] style" * mp target now supports nr_path == 1, so do we * add gratuitous free() * push version forward
Diffstat (limited to 'extras/multipath/unsused.c')
-rw-r--r--extras/multipath/unsused.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/extras/multipath/unsused.c b/extras/multipath/unsused.c
new file mode 100644
index 0000000000..ecdd695ac8
--- /dev/null
+++ b/extras/multipath/unsused.c
@@ -0,0 +1,52 @@
+static int
+del_map(char * str) {
+ struct dm_task *dmt;
+
+ if (!(dmt = dm_task_create(DM_DEVICE_REMOVE)))
+ return 0;
+ if (!dm_task_set_name(dmt, str))
+ goto delout;
+ if (!dm_task_run(dmt))
+ goto delout;
+
+ printf("Deleted device map : %s\n", str);
+
+ delout:
+ dm_task_destroy(dmt);
+ return 1;
+}
+
+get_table(const char * str)
+{
+ int r = 0;
+ struct dm_task *dmt;
+ void *next = NULL;
+ uint64_t start, length;
+ char *target_type = NULL;
+ char *params;
+
+ if (!(dmt = dm_task_create(DM_DEVICE_TABLE)))
+ return 0;
+
+ if (!dm_task_set_name(dmt, str))
+ goto out;
+
+ if (!dm_task_run(dmt))
+ goto out;
+
+ do {
+ next = dm_get_next_target(dmt, next, &start, &length,
+ &target_type, &params);
+ if (target_type) {
+ printf("%" PRIu64 " %" PRIu64 " %s %s\n",
+ start, length, target_type, params);
+ }
+ } while (next);
+
+ r = 1;
+
+ out:
+ dm_task_destroy(dmt);
+ return r;
+
+}