Blob Blame History Raw
From a239423a0f9250dad9998152fa4b4b46accdf641 Mon Sep 17 00:00:00 2001
From: Michal Suchanek <msuchanek@suse.de>
Date: Mon, 14 Nov 2016 17:28:31 +0100
Subject: [PATCH] Fix 32bit build.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
 lib/iser.c                                            | 7 ++++---
 test-tool/test_compareandwrite_invalid_dataout_size.c | 4 ++--
 test-tool/test_writesame10_invalid_dataout_size.c     | 4 ++--
 test-tool/test_writesame16_invalid_dataout_size.c     | 4 ++--
 4 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/lib/iser.c b/lib/iser.c
index ad3adb3..17832c3 100644
--- a/lib/iser.c
+++ b/lib/iser.c
@@ -23,6 +23,7 @@
 #include <string.h>
 #include <stdbool.h>
 #include <unistd.h>
+#include <inttypes.h>
 #include "iscsi.h"
 #include "iser-private.h"
 #include "iscsi-private.h"
@@ -524,7 +525,7 @@ iser_prepare_read_cmd(struct iser_conn *iser_conn,struct iser_pdu *iser_pdu)
 		}
 
 		tx_desc->data_dir = DATA_READ;
-		hdr->read_va = htobe64((uint64_t)tx_desc->data_buff);
+		hdr->read_va = htobe64((intptr_t)tx_desc->data_buff);
 		hdr->read_stag = htobe32((uint32_t)tx_desc->data_mr->rkey);
 		hdr->flags |= ISER_RSV;
 
@@ -565,7 +566,7 @@ iser_prepare_write_cmd(struct iser_conn *iser_conn, struct iser_pdu *iser_pdu)
 
 	hdr->flags     |= ISER_WSV;
 	hdr->write_stag = htobe32((uint32_t)(tx_desc->data_mr->rkey));
-	hdr->write_va   = htobe64((uint64_t)(tx_desc->data_buff));
+	hdr->write_va   = htobe64((intptr_t)(tx_desc->data_buff));
 
 	return 0;
 }
@@ -1146,7 +1147,7 @@ static int iser_handle_wc(struct ibv_wc *wc,struct iser_conn *iser_conn)
 					wc->wr_id, wc->status, wc->vendor_err);
 			return iscsi_service_reconnect_if_loggedin(iscsi);
 		} else {
-			iscsi_set_error(iscsi, "flush error: wr id %lx\n", wc->wr_id);
+			iscsi_set_error(iscsi, "flush error: wr id %" PRIx64 "\n", wc->wr_id);
 
 			return 0;
 		}
diff --git a/test-tool/test_compareandwrite_invalid_dataout_size.c b/test-tool/test_compareandwrite_invalid_dataout_size.c
index b27b4f8..76da1e0 100644
--- a/test-tool/test_compareandwrite_invalid_dataout_size.c
+++ b/test-tool/test_compareandwrite_invalid_dataout_size.c
@@ -64,7 +64,7 @@ test_compareandwrite_invalid_dataout_size(void)
 
 
         logging(LOG_VERBOSE, "Check too small DataOut");
-        logging(LOG_VERBOSE, "COMPAREANDWRITE with DataOut==%ld (4 blocks) "
+        logging(LOG_VERBOSE, "COMPAREANDWRITE with DataOut==%zd (4 blocks) "
                 "and TL == 1 ", 4 * block_size);
 
         new_tl = 1;
@@ -74,7 +74,7 @@ test_compareandwrite_invalid_dataout_size(void)
                         EXPECT_STATUS_GENERIC_BAD);
 
         logging(LOG_VERBOSE, "Check too large DataOut");
-        logging(LOG_VERBOSE, "COMPAREANDWRITE with DataOut==%ld (4 blocks) "
+        logging(LOG_VERBOSE, "COMPAREANDWRITE with DataOut==%zd (4 blocks) "
                 "and TL == 3 ", 4 * block_size);
 
         new_tl = 2;
diff --git a/test-tool/test_writesame10_invalid_dataout_size.c b/test-tool/test_writesame10_invalid_dataout_size.c
index f521908..119d786 100644
--- a/test-tool/test_writesame10_invalid_dataout_size.c
+++ b/test-tool/test_writesame10_invalid_dataout_size.c
@@ -41,13 +41,13 @@ test_writesame10_invalid_dataout_size(void)
         memset(scratch, 0xa6, block_size);
 
         logging(LOG_VERBOSE, "Check too small DataOut");
-        logging(LOG_VERBOSE, "Unmap with DataOut==%ld (block_size==%ld)",
+        logging(LOG_VERBOSE, "Unmap with DataOut==%zd (block_size==%zd)",
                 block_size / 2, block_size);
         WRITESAME10(sd, 0, block_size / 2, 1, 0, 1, 0, 0, scratch,
                     EXPECT_STATUS_GENERIC_BAD);
 
         logging(LOG_VERBOSE, "Check too large DataOut");
-        logging(LOG_VERBOSE, "Unmap with DataOut==%ld (block_size==%ld)",
+        logging(LOG_VERBOSE, "Unmap with DataOut==%zd (block_size==%zd)",
                 block_size * 2, block_size);
         WRITESAME10(sd, 0, block_size * 2, 1, 0, 1, 0, 0, scratch,
                     EXPECT_STATUS_GENERIC_BAD);
diff --git a/test-tool/test_writesame16_invalid_dataout_size.c b/test-tool/test_writesame16_invalid_dataout_size.c
index 128673f..a2e22bb 100644
--- a/test-tool/test_writesame16_invalid_dataout_size.c
+++ b/test-tool/test_writesame16_invalid_dataout_size.c
@@ -41,13 +41,13 @@ test_writesame16_invalid_dataout_size(void)
         memset(scratch, 0xa6, block_size);
 
         logging(LOG_VERBOSE, "Check too small DataOut");
-        logging(LOG_VERBOSE, "Unmap with DataOut==%ld (block_size==%ld)",
+        logging(LOG_VERBOSE, "Unmap with DataOut==%zd (block_size==%zd)",
                 block_size / 2, block_size);
         WRITESAME16(sd, 0, block_size / 2, 1, 0, 1, 0, 0, scratch,
                     EXPECT_STATUS_GENERIC_BAD);
 
         logging(LOG_VERBOSE, "Check too large DataOut");
-        logging(LOG_VERBOSE, "Unmap with DataOut==%ld (block_size==%ld)",
+        logging(LOG_VERBOSE, "Unmap with DataOut==%zd (block_size==%zd)",
                 block_size * 2, block_size);
         WRITESAME16(sd, 0, block_size * 2, 1, 0, 1, 0, 0, scratch,
                     EXPECT_STATUS_GENERIC_BAD);
-- 
2.13.6