Fix some compiler warnings

This commit is contained in:
Ronnie Sahlberg
2012-11-11 10:12:39 -08:00
parent 9eb26a368d
commit 5a95010b59
2 changed files with 9 additions and 3 deletions

View File

@@ -26,6 +26,8 @@ static int clamp_datasn;
static int my_iscsi_queue_pdu(struct iscsi_context *iscsi _U_, struct iscsi_pdu *pdu) static int my_iscsi_queue_pdu(struct iscsi_context *iscsi _U_, struct iscsi_pdu *pdu)
{ {
uint32_t datasn;
if (pdu->outdata.data[0] != ISCSI_PDU_DATA_OUT) { if (pdu->outdata.data[0] != ISCSI_PDU_DATA_OUT) {
return 0; return 0;
} }
@@ -44,7 +46,8 @@ static int my_iscsi_queue_pdu(struct iscsi_context *iscsi _U_, struct iscsi_pdu
break; break;
case 4: case 4:
/* change datasn from (0,1) to (1,0) */ /* change datasn from (0,1) to (1,0) */
*(uint32_t *)&pdu->outdata.data[36] = htonl(1 - ntohl(*(uint32_t *)&pdu->outdata.data[36])); datasn = ntohl(*(uint32_t *)&pdu->outdata.data[36]);
*(uint32_t *)&pdu->outdata.data[36] = htonl(1 - datasn);
break; break;
} }
return 0; return 0;

View File

@@ -28,17 +28,20 @@ uint32_t block_size;
static int my_iscsi_queue_pdu(struct iscsi_context *iscsi _U_, struct iscsi_pdu *pdu) static int my_iscsi_queue_pdu(struct iscsi_context *iscsi _U_, struct iscsi_pdu *pdu)
{ {
uint32_t buffer_offset;
if (pdu->outdata.data[0] != ISCSI_PDU_DATA_OUT) { if (pdu->outdata.data[0] != ISCSI_PDU_DATA_OUT) {
return 0; return 0;
} }
buffer_offset = ntohl(*(uint32_t *)&pdu->outdata.data[40]);
switch (change_bufferoffset) { switch (change_bufferoffset) {
case 1: case 1:
/* Add 1M to the buffer offset */ /* Add 1M to the buffer offset */
*(uint32_t *)&pdu->outdata.data[40] = htonl(ntohl(*(uint32_t *)&pdu->outdata.data[40]) + 1024*1024); *(uint32_t *)&pdu->outdata.data[40] = htonl(buffer_offset + 1024*1024);
break; break;
case 2: case 2:
/* Add -'block_size' to the buffer offset */ /* Add -'block_size' to the buffer offset */
*(uint32_t *)&pdu->outdata.data[40] = htonl(ntohl(*(uint32_t *)&pdu->outdata.data[40]) - block_size); *(uint32_t *)&pdu->outdata.data[40] = htonl(buffer_offset - block_size);
break; break;
} }
return 0; return 0;