diff options
author | Nicholas Bellinger <nab@linux-iscsi.org> | 2011-05-19 23:19:13 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2011-05-27 07:49:43 -0400 |
commit | 1078da163fd2c1d3cba76cd4018e897a4f98efc5 (patch) | |
tree | 74ab10b4fb4ddc6120f8b2f1079088b77980c538 /drivers/target/target_core_device.c | |
parent | ccf4d680f80941f0073a9bc6a5e0ed41496b46e7 (diff) |
[SCSI] target: Convert REPORT_LUNs to use int_to_scsilun
This patch converts transport_core_report_lun_response() to use
drivers/scsi/scsi_scan.c:int_to_scsilun instead of using the
struct target_core_fabric_ops->pack_lun() fabric provided API vector.
It also removes the tfo->pack_lun check from target_fabric_tf_ops_check()
and removes from struct target_core_fabric_ops->pack_lun() from
target_core_fabric_ops.h, and the following mainline scsi-misc fabric
modules:
*) tcm_loop: Drop tcm_loop_pack_lun() usage
*) tcm_fc: Drop ft_pack_lun() usage
Reported-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <jbottomley@parallels.com>
Diffstat (limited to 'drivers/target/target_core_device.c')
-rw-r--r-- | drivers/target/target_core_device.c | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index fc10ed4ac49..8407f9ca2b3 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <net/sock.h> | 38 | #include <net/sock.h> |
39 | #include <net/tcp.h> | 39 | #include <net/tcp.h> |
40 | #include <scsi/scsi.h> | 40 | #include <scsi/scsi.h> |
41 | #include <scsi/scsi_device.h> | ||
41 | 42 | ||
42 | #include <target/target_core_base.h> | 43 | #include <target/target_core_base.h> |
43 | #include <target/target_core_device.h> | 44 | #include <target/target_core_device.h> |
@@ -658,8 +659,7 @@ int transport_core_report_lun_response(struct se_cmd *se_cmd) | |||
658 | struct se_session *se_sess = SE_SESS(se_cmd); | 659 | struct se_session *se_sess = SE_SESS(se_cmd); |
659 | struct se_task *se_task; | 660 | struct se_task *se_task; |
660 | unsigned char *buf = (unsigned char *)T_TASK(se_cmd)->t_task_buf; | 661 | unsigned char *buf = (unsigned char *)T_TASK(se_cmd)->t_task_buf; |
661 | u32 cdb_offset = 0, lun_count = 0, offset = 8; | 662 | u32 cdb_offset = 0, lun_count = 0, offset = 8, i; |
662 | u64 i, lun; | ||
663 | 663 | ||
664 | list_for_each_entry(se_task, &T_TASK(se_cmd)->t_task_list, t_list) | 664 | list_for_each_entry(se_task, &T_TASK(se_cmd)->t_task_list, t_list) |
665 | break; | 665 | break; |
@@ -675,15 +675,7 @@ int transport_core_report_lun_response(struct se_cmd *se_cmd) | |||
675 | * a $FABRIC_MOD. In that case, report LUN=0 only. | 675 | * a $FABRIC_MOD. In that case, report LUN=0 only. |
676 | */ | 676 | */ |
677 | if (!(se_sess)) { | 677 | if (!(se_sess)) { |
678 | lun = 0; | 678 | int_to_scsilun(0, (struct scsi_lun *)&buf[offset]); |
679 | buf[offset++] = ((lun >> 56) & 0xff); | ||
680 | buf[offset++] = ((lun >> 48) & 0xff); | ||
681 | buf[offset++] = ((lun >> 40) & 0xff); | ||
682 | buf[offset++] = ((lun >> 32) & 0xff); | ||
683 | buf[offset++] = ((lun >> 24) & 0xff); | ||
684 | buf[offset++] = ((lun >> 16) & 0xff); | ||
685 | buf[offset++] = ((lun >> 8) & 0xff); | ||
686 | buf[offset++] = (lun & 0xff); | ||
687 | lun_count = 1; | 679 | lun_count = 1; |
688 | goto done; | 680 | goto done; |
689 | } | 681 | } |
@@ -703,15 +695,8 @@ int transport_core_report_lun_response(struct se_cmd *se_cmd) | |||
703 | if ((cdb_offset + 8) >= se_cmd->data_length) | 695 | if ((cdb_offset + 8) >= se_cmd->data_length) |
704 | continue; | 696 | continue; |
705 | 697 | ||
706 | lun = cpu_to_be64(CMD_TFO(se_cmd)->pack_lun(deve->mapped_lun)); | 698 | int_to_scsilun(deve->mapped_lun, (struct scsi_lun *)&buf[offset]); |
707 | buf[offset++] = ((lun >> 56) & 0xff); | 699 | offset += 8; |
708 | buf[offset++] = ((lun >> 48) & 0xff); | ||
709 | buf[offset++] = ((lun >> 40) & 0xff); | ||
710 | buf[offset++] = ((lun >> 32) & 0xff); | ||
711 | buf[offset++] = ((lun >> 24) & 0xff); | ||
712 | buf[offset++] = ((lun >> 16) & 0xff); | ||
713 | buf[offset++] = ((lun >> 8) & 0xff); | ||
714 | buf[offset++] = (lun & 0xff); | ||
715 | cdb_offset += 8; | 700 | cdb_offset += 8; |
716 | } | 701 | } |
717 | spin_unlock_irq(&SE_NODE_ACL(se_sess)->device_list_lock); | 702 | spin_unlock_irq(&SE_NODE_ACL(se_sess)->device_list_lock); |