diff options
author | Andy Grover <agrover@redhat.com> | 2011-06-16 18:57:09 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2011-07-25 03:47:59 -0400 |
commit | 55bdabdf41b6ee99e22e9d78a895b001fb1d852e (patch) | |
tree | a66c6d6480a2bddc7cbd534be6411cdda27a4898 /drivers/scsi/libiscsi.c | |
parent | 123521830c0ea35055b900d2ff0b73bb129e08cb (diff) |
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/libiscsi.c')
-rw-r--r-- | drivers/scsi/libiscsi.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index c552cd7850ac..57175a7d2ef0 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 | ||