diff options
author | Chandra Seetharaman <sekharan@us.ibm.com> | 2009-08-03 15:42:39 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2009-08-22 18:52:14 -0400 |
commit | 14d9cb5f760c86b3a8f686909465982231c06627 (patch) | |
tree | 5846e1152a7b00343ed3bf894b84376ae4421d3c | |
parent | 18ee70c9d7b2dcd312a1f8c6536841e7c0fea5ca (diff) |
[SCSI] scsi_dh: Provide set_params interface in emc device handler
Handle the parameters provided by user thru multipath.
This handler expects only 2 parameters and their value can either be 0 or 1.
This code originates from the old dm-emc.c file. Appropriate changes have
been made to make it work in the new design.
Reported-by: Eddie Williams <Eddie.Williams@steeleye.com>
Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com>
Tested-by: Eddie Williams <Eddie.Williams@steeleye.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
-rw-r--r-- | drivers/scsi/device_handler/scsi_dh_emc.c | 59 |
1 files changed, 56 insertions, 3 deletions
diff --git a/drivers/scsi/device_handler/scsi_dh_emc.c b/drivers/scsi/device_handler/scsi_dh_emc.c index 0e572d2c5b0a..0cffe84976fe 100644 --- a/drivers/scsi/device_handler/scsi_dh_emc.c +++ b/drivers/scsi/device_handler/scsi_dh_emc.c | |||
@@ -561,6 +561,61 @@ done: | |||
561 | 561 | ||
562 | return result; | 562 | return result; |
563 | } | 563 | } |
564 | /* | ||
565 | * params - parameters in the following format | ||
566 | * "no_of_params\0param1\0param2\0param3\0...\0" | ||
567 | * for example, string for 2 parameters with value 10 and 21 | ||
568 | * is specified as "2\010\021\0". | ||
569 | */ | ||
570 | static int clariion_set_params(struct scsi_device *sdev, const char *params) | ||
571 | { | ||
572 | struct clariion_dh_data *csdev = get_clariion_data(sdev); | ||
573 | unsigned int hr = 0, st = 0, argc; | ||
574 | const char *p = params; | ||
575 | int result = SCSI_DH_OK; | ||
576 | |||
577 | if ((sscanf(params, "%u", &argc) != 1) || (argc != 2)) | ||
578 | return -EINVAL; | ||
579 | |||
580 | while (*p++) | ||
581 | ; | ||
582 | if ((sscanf(p, "%u", &st) != 1) || (st > 1)) | ||
583 | return -EINVAL; | ||
584 | |||
585 | while (*p++) | ||
586 | ; | ||
587 | if ((sscanf(p, "%u", &hr) != 1) || (hr > 1)) | ||
588 | return -EINVAL; | ||
589 | |||
590 | if (st) | ||
591 | csdev->flags |= CLARIION_SHORT_TRESPASS; | ||
592 | else | ||
593 | csdev->flags &= ~CLARIION_SHORT_TRESPASS; | ||
594 | |||
595 | if (hr) | ||
596 | csdev->flags |= CLARIION_HONOR_RESERVATIONS; | ||
597 | else | ||
598 | csdev->flags &= ~CLARIION_HONOR_RESERVATIONS; | ||
599 | |||
600 | /* | ||
601 | * If this path is owned, we have to send a trespass command | ||
602 | * with the new parameters. If not, simply return. Next trespass | ||
603 | * command would use the parameters. | ||
604 | */ | ||
605 | if (csdev->lun_state != CLARIION_LUN_OWNED) | ||
606 | goto done; | ||
607 | |||
608 | csdev->lun_state = CLARIION_LUN_UNINITIALIZED; | ||
609 | result = send_trespass_cmd(sdev, csdev); | ||
610 | if (result != SCSI_DH_OK) | ||
611 | goto done; | ||
612 | |||
613 | /* Update status */ | ||
614 | result = clariion_send_inquiry(sdev, csdev); | ||
615 | |||
616 | done: | ||
617 | return result; | ||
618 | } | ||
564 | 619 | ||
565 | static const struct scsi_dh_devlist clariion_dev_list[] = { | 620 | static const struct scsi_dh_devlist clariion_dev_list[] = { |
566 | {"DGC", "RAID"}, | 621 | {"DGC", "RAID"}, |
@@ -581,11 +636,9 @@ static struct scsi_device_handler clariion_dh = { | |||
581 | .check_sense = clariion_check_sense, | 636 | .check_sense = clariion_check_sense, |
582 | .activate = clariion_activate, | 637 | .activate = clariion_activate, |
583 | .prep_fn = clariion_prep_fn, | 638 | .prep_fn = clariion_prep_fn, |
639 | .set_params = clariion_set_params, | ||
584 | }; | 640 | }; |
585 | 641 | ||
586 | /* | ||
587 | * TODO: need some interface so we can set trespass values | ||
588 | */ | ||
589 | static int clariion_bus_attach(struct scsi_device *sdev) | 642 | static int clariion_bus_attach(struct scsi_device *sdev) |
590 | { | 643 | { |
591 | struct scsi_dh_data *scsi_dh_data; | 644 | struct scsi_dh_data *scsi_dh_data; |