summaryrefslogtreecommitdiff
path: root/extras/multipath/unused.c
diff options
context:
space:
mode:
authorchristophe.varoqui@free.fr <christophe.varoqui@free.fr>2003-12-22 20:49:48 -0800
committerGreg KH <gregkh@suse.de>2005-04-26 21:13:10 -0700
commit4081da7fe560f0ad173a9836589d6839d9dff9df (patch)
tree6fcf3f9acd25b1eabed328b6c7b2976e3e63dfc0 /extras/multipath/unused.c
parent176857119a77aad650412d9fedb568da4b543e07 (diff)
[PATCH] extras multipath update
incremental to 20031220, 2003-12-22 multipath-010 * don't print .sg_dev if equal to .dev (2.6) in print_path() * since the kernel code handles defective paths, remove all code to cope with them : * move do_tur() to unused.c * remove .state from path struct * remove .state settings & conditionals * add a cmdline switch to force maps to failover mode, ie 1 path per priority group * add default policies to the whitelist array (spread io == MULTIBUS / io forced to 1 path == FAILOVER) * move get_disk_size() call out of add_map() to coalesce() * comment tricky coalesce() fn * bogus unsused.c file renamed to unused.c
Diffstat (limited to 'extras/multipath/unused.c')
-rw-r--r--extras/multipath/unused.c78
1 files changed, 78 insertions, 0 deletions
diff --git a/extras/multipath/unused.c b/extras/multipath/unused.c
new file mode 100644
index 0000000000..33b3e859d1
--- /dev/null
+++ b/extras/multipath/unused.c
@@ -0,0 +1,78 @@
+static int
+do_tur(int fd)
+{
+ unsigned char turCmdBlk[TUR_CMD_LEN] = { 0x00, 0, 0, 0, 0, 0 };
+ struct sg_io_hdr io_hdr;
+ unsigned char sense_buffer[32];
+
+ memset(&io_hdr, 0, sizeof (struct sg_io_hdr));
+ io_hdr.interface_id = 'S';
+ io_hdr.cmd_len = sizeof (turCmdBlk);
+ io_hdr.mx_sb_len = sizeof (sense_buffer);
+ io_hdr.dxfer_direction = SG_DXFER_NONE;
+ io_hdr.cmdp = turCmdBlk;
+ io_hdr.sbp = sense_buffer;
+ io_hdr.timeout = 20000;
+ io_hdr.pack_id = 0;
+ if (ioctl(fd, SG_IO, &io_hdr) < 0) {
+ close(fd);
+ return 0;
+ }
+ if (io_hdr.info & SG_INFO_OK_MASK) {
+ return 0;
+ }
+ return 1;
+}
+
+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;
+
+}