aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorAndy Grover <agrover@redhat.com>2011-06-16 18:57:09 -0400
committerJames Bottomley <JBottomley@Parallels.com>2011-06-29 17:22:13 -0400
commit516f43a2a555000e77c1d59b8298cb46aad9ecc1 (patch)
tree1e9fe8742e1c70cdf65e9f3f926ea30075e09131 /drivers/scsi
parent2e00d24e7ebae3183aeab0f958ea1142d1af3a02 (diff)
[SCSI] iscsi: Use struct scsi_lun in iscsi structs instead of u8[8]
struct scsi_lun is also just a struct with an array of 8 octets (64 bits) but using it instead in iscsi structs lets us call scsilun_to_int without a cast, and also lets us copy it using assignment, instead of memcpy(). Signed-off-by: Andy Grover <agrover@redhat.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/be2iscsi/be_main.c5
-rw-r--r--drivers/scsi/bnx2i/bnx2i_hwi.c8
-rw-r--r--drivers/scsi/libiscsi.c14
3 files changed, 13 insertions, 14 deletions
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 94b9a07845d..7b967ed4896 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -3963,11 +3963,10 @@ static int beiscsi_iotask(struct iscsi_task *task, struct scatterlist *sg,
3963 } 3963 }
3964 memcpy(&io_task->cmd_bhs->iscsi_data_pdu. 3964 memcpy(&io_task->cmd_bhs->iscsi_data_pdu.
3965 dw[offsetof(struct amap_pdu_data_out, lun) / 32], 3965 dw[offsetof(struct amap_pdu_data_out, lun) / 32],
3966 io_task->cmd_bhs->iscsi_hdr.lun, sizeof(struct scsi_lun)); 3966 &io_task->cmd_bhs->iscsi_hdr.lun, sizeof(struct scsi_lun));
3967 3967
3968 AMAP_SET_BITS(struct amap_iscsi_wrb, lun, pwrb, 3968 AMAP_SET_BITS(struct amap_iscsi_wrb, lun, pwrb,
3969 cpu_to_be16((unsigned short)io_task->cmd_bhs->iscsi_hdr. 3969 cpu_to_be16(*(unsigned short *)&io_task->cmd_bhs->iscsi_hdr.lun));
3970 lun[0]));
3971 AMAP_SET_BITS(struct amap_iscsi_wrb, r2t_exp_dtl, pwrb, xferlen); 3970 AMAP_SET_BITS(struct amap_iscsi_wrb, r2t_exp_dtl, pwrb, xferlen);
3972 AMAP_SET_BITS(struct amap_iscsi_wrb, wrb_idx, pwrb, 3971 AMAP_SET_BITS(struct amap_iscsi_wrb, wrb_idx, pwrb,
3973 io_task->pwrb_handle->wrb_index); 3972 io_task->pwrb_handle->wrb_index);
diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c
index 5c54a2d9b83..550e6c4ea8b 100644
--- a/drivers/scsi/bnx2i/bnx2i_hwi.c
+++ b/drivers/scsi/bnx2i/bnx2i_hwi.c
@@ -430,7 +430,7 @@ int bnx2i_send_iscsi_tmf(struct bnx2i_conn *bnx2i_conn,
430 default: 430 default:
431 tmfabort_wqe->ref_itt = RESERVED_ITT; 431 tmfabort_wqe->ref_itt = RESERVED_ITT;
432 } 432 }
433 memcpy(scsi_lun, tmfabort_hdr->lun, sizeof(struct scsi_lun)); 433 memcpy(scsi_lun, &tmfabort_hdr->lun, sizeof(struct scsi_lun));
434 tmfabort_wqe->lun[0] = be32_to_cpu(scsi_lun[0]); 434 tmfabort_wqe->lun[0] = be32_to_cpu(scsi_lun[0]);
435 tmfabort_wqe->lun[1] = be32_to_cpu(scsi_lun[1]); 435 tmfabort_wqe->lun[1] = be32_to_cpu(scsi_lun[1]);
436 436
@@ -547,7 +547,7 @@ int bnx2i_send_iscsi_nopout(struct bnx2i_conn *bnx2i_conn,
547 547
548 nopout_wqe->op_code = nopout_hdr->opcode; 548 nopout_wqe->op_code = nopout_hdr->opcode;
549 nopout_wqe->op_attr = ISCSI_FLAG_CMD_FINAL; 549 nopout_wqe->op_attr = ISCSI_FLAG_CMD_FINAL;
550 memcpy(nopout_wqe->lun, nopout_hdr->lun, 8); 550 memcpy(nopout_wqe->lun, &nopout_hdr->lun, 8);
551 551
552 if (test_bit(BNX2I_NX2_DEV_57710, &ep->hba->cnic_dev_type)) { 552 if (test_bit(BNX2I_NX2_DEV_57710, &ep->hba->cnic_dev_type)) {
553 u32 tmp = nopout_wqe->lun[0]; 553 u32 tmp = nopout_wqe->lun[0];
@@ -1711,7 +1711,7 @@ static int bnx2i_process_nopin_mesg(struct iscsi_session *session,
1711 hdr->flags = ISCSI_FLAG_CMD_FINAL; 1711 hdr->flags = ISCSI_FLAG_CMD_FINAL;
1712 hdr->itt = task->hdr->itt; 1712 hdr->itt = task->hdr->itt;
1713 hdr->ttt = cpu_to_be32(nop_in->ttt); 1713 hdr->ttt = cpu_to_be32(nop_in->ttt);
1714 memcpy(hdr->lun, nop_in->lun, 8); 1714 memcpy(&hdr->lun, nop_in->lun, 8);
1715 } 1715 }
1716done: 1716done:
1717 __iscsi_complete_pdu(conn, (struct iscsi_hdr *)hdr, NULL, 0); 1717 __iscsi_complete_pdu(conn, (struct iscsi_hdr *)hdr, NULL, 0);
@@ -1754,7 +1754,7 @@ static void bnx2i_process_async_mesg(struct iscsi_session *session,
1754 resp_hdr->opcode = async_cqe->op_code; 1754 resp_hdr->opcode = async_cqe->op_code;
1755 resp_hdr->flags = 0x80; 1755 resp_hdr->flags = 0x80;
1756 1756
1757 memcpy(resp_hdr->lun, async_cqe->lun, 8); 1757 memcpy(&resp_hdr->lun, async_cqe->lun, 8);
1758 resp_hdr->exp_cmdsn = cpu_to_be32(async_cqe->exp_cmd_sn); 1758 resp_hdr->exp_cmdsn = cpu_to_be32(async_cqe->exp_cmd_sn);
1759 resp_hdr->max_cmdsn = cpu_to_be32(async_cqe->max_cmd_sn); 1759 resp_hdr->max_cmdsn = cpu_to_be32(async_cqe->max_cmd_sn);
1760 1760
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 0c550d5b913..d7a4120034a 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -169,7 +169,7 @@ void iscsi_prep_data_out_pdu(struct iscsi_task *task, struct iscsi_r2t_info *r2t
169 hdr->datasn = cpu_to_be32(r2t->datasn); 169 hdr->datasn = cpu_to_be32(r2t->datasn);
170 r2t->datasn++; 170 r2t->datasn++;
171 hdr->opcode = ISCSI_OP_SCSI_DATA_OUT; 171 hdr->opcode = ISCSI_OP_SCSI_DATA_OUT;
172 memcpy(hdr->lun, task->lun, sizeof(hdr->lun)); 172 hdr->lun = task->lun;
173 hdr->itt = task->hdr_itt; 173 hdr->itt = task->hdr_itt;
174 hdr->exp_statsn = r2t->exp_statsn; 174 hdr->exp_statsn = r2t->exp_statsn;
175 hdr->offset = cpu_to_be32(r2t->data_offset + r2t->sent); 175 hdr->offset = cpu_to_be32(r2t->data_offset + r2t->sent);
@@ -296,7 +296,7 @@ static int iscsi_check_tmf_restrictions(struct iscsi_task *task, int opcode)
296 /* 296 /*
297 * Allow PDUs for unrelated LUNs 297 * Allow PDUs for unrelated LUNs
298 */ 298 */
299 hdr_lun = scsilun_to_int((struct scsi_lun *)tmf->lun); 299 hdr_lun = scsilun_to_int(&tmf->lun);
300 if (hdr_lun != task->sc->device->lun) 300 if (hdr_lun != task->sc->device->lun)
301 return 0; 301 return 0;
302 /* fall through */ 302 /* fall through */
@@ -389,8 +389,8 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_task *task)
389 return rc; 389 return rc;
390 hdr->opcode = ISCSI_OP_SCSI_CMD; 390 hdr->opcode = ISCSI_OP_SCSI_CMD;
391 hdr->flags = ISCSI_ATTR_SIMPLE; 391 hdr->flags = ISCSI_ATTR_SIMPLE;
392 int_to_scsilun(sc->device->lun, (struct scsi_lun *)hdr->lun); 392 int_to_scsilun(sc->device->lun, &hdr->lun);
393 memcpy(task->lun, hdr->lun, sizeof(task->lun)); 393 task->lun = hdr->lun;
394 hdr->exp_statsn = cpu_to_be32(conn->exp_statsn); 394 hdr->exp_statsn = cpu_to_be32(conn->exp_statsn);
395 cmd_len = sc->cmd_len; 395 cmd_len = sc->cmd_len;
396 if (cmd_len < ISCSI_CDB_SIZE) 396 if (cmd_len < ISCSI_CDB_SIZE)
@@ -968,7 +968,7 @@ static void iscsi_send_nopout(struct iscsi_conn *conn, struct iscsi_nopin *rhdr)
968 hdr.flags = ISCSI_FLAG_CMD_FINAL; 968 hdr.flags = ISCSI_FLAG_CMD_FINAL;
969 969
970 if (rhdr) { 970 if (rhdr) {
971 memcpy(hdr.lun, rhdr->lun, 8); 971 hdr.lun = rhdr->lun;
972 hdr.ttt = rhdr->ttt; 972 hdr.ttt = rhdr->ttt;
973 hdr.itt = RESERVED_ITT; 973 hdr.itt = RESERVED_ITT;
974 } else 974 } else
@@ -2092,7 +2092,7 @@ static void iscsi_prep_abort_task_pdu(struct iscsi_task *task,
2092 hdr->opcode = ISCSI_OP_SCSI_TMFUNC | ISCSI_OP_IMMEDIATE; 2092 hdr->opcode = ISCSI_OP_SCSI_TMFUNC | ISCSI_OP_IMMEDIATE;
2093 hdr->flags = ISCSI_TM_FUNC_ABORT_TASK & ISCSI_FLAG_TM_FUNC_MASK; 2093 hdr->flags = ISCSI_TM_FUNC_ABORT_TASK & ISCSI_FLAG_TM_FUNC_MASK;
2094 hdr->flags |= ISCSI_FLAG_CMD_FINAL; 2094 hdr->flags |= ISCSI_FLAG_CMD_FINAL;
2095 memcpy(hdr->lun, task->lun, sizeof(hdr->lun)); 2095 hdr->lun = task->lun;
2096 hdr->rtt = task->hdr_itt; 2096 hdr->rtt = task->hdr_itt;
2097 hdr->refcmdsn = task->cmdsn; 2097 hdr->refcmdsn = task->cmdsn;
2098} 2098}
@@ -2233,7 +2233,7 @@ static void iscsi_prep_lun_reset_pdu(struct scsi_cmnd *sc, struct iscsi_tm *hdr)
2233 hdr->opcode = ISCSI_OP_SCSI_TMFUNC | ISCSI_OP_IMMEDIATE; 2233 hdr->opcode = ISCSI_OP_SCSI_TMFUNC | ISCSI_OP_IMMEDIATE;
2234 hdr->flags = ISCSI_TM_FUNC_LOGICAL_UNIT_RESET & ISCSI_FLAG_TM_FUNC_MASK; 2234 hdr->flags = ISCSI_TM_FUNC_LOGICAL_UNIT_RESET & ISCSI_FLAG_TM_FUNC_MASK;
2235 hdr->flags |= ISCSI_FLAG_CMD_FINAL; 2235 hdr->flags |= ISCSI_FLAG_CMD_FINAL;
2236 int_to_scsilun(sc->device->lun, (struct scsi_lun *)hdr->lun); 2236 int_to_scsilun(sc->device->lun, &hdr->lun);
2237 hdr->rtt = RESERVED_ITT; 2237 hdr->rtt = RESERVED_ITT;
2238} 2238}
2239 2239