[openib-general] [PATCH] Fix some compile issues with libehca

Anton Blanchard anton at samba.org
Thu Jun 1 23:43:46 PDT 2006


Hi,

Heres a patch to fix some warnings about missing prototypes (memset
etc), and one compile error due to libsysfs not being included.

This was also giving a warning when built as 32bit:

       my_cq->ipz_queue.queue = (u8*)resp.ipz_queue.queue;

src/ehca_umain.c:239: warning: cast to pointer from integer of different size

So cast it to a long first. Is that code correct for 32bit?

Anton
---

Index: src/ehca_uinit.c
===================================================================
--- src/ehca_uinit.c	(revision 7621)
+++ src/ehca_uinit.c	(working copy)
@@ -44,6 +44,7 @@
 
 #include <infiniband/driver.h>
 #include <stdlib.h>
+#include <string.h>
 #include <unistd.h>
 #include <errno.h>
 #include <sys/mman.h>
@@ -51,6 +52,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#include <sysfs/libsysfs.h>
 
 #include "ehca_uclasses.h"
 
Index: src/ehca_umain.c
===================================================================
--- src/ehca_umain.c	(revision 7621)
+++ src/ehca_umain.c	(working copy)
@@ -53,6 +53,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
+#include <string.h>
 #include <sys/mman.h>
 #include <netinet/in.h>
 
@@ -234,8 +235,8 @@
 	/* copy data returned from kernel */
 	my_cq->cq_number = resp.cq_number;
 	my_cq->token = resp.token;
-	my_cq->ipz_queue.queue = (u8*)resp.ipz_queue.queue;
-	my_cq->ipz_queue.current_q_addr = (u8*)resp.ipz_queue.queue;
+	my_cq->ipz_queue.queue = (u8*)(long)resp.ipz_queue.queue;
+	my_cq->ipz_queue.current_q_addr = (u8*)(long)resp.ipz_queue.queue;
 	my_cq->ipz_queue.qe_size = resp.ipz_queue.qe_size;
 	my_cq->ipz_queue.act_nr_of_sg = resp.ipz_queue.act_nr_of_sg;
 	my_cq->ipz_queue.queue_length = resp.ipz_queue.queue_length;
@@ -321,16 +322,16 @@
 	my_qp->qkey = resp.qkey;
 	my_qp->real_qp_num = resp.real_qp_num;
 	/* rqueue properties */
-	my_qp->ipz_rqueue.queue = (u8*)resp.ipz_rqueue.queue;
-	my_qp->ipz_rqueue.current_q_addr = (u8*)resp.ipz_rqueue.queue;
+	my_qp->ipz_rqueue.queue = (u8*)(long)resp.ipz_rqueue.queue;
+	my_qp->ipz_rqueue.current_q_addr = (u8*)(long)resp.ipz_rqueue.queue;
 	my_qp->ipz_rqueue.qe_size = resp.ipz_rqueue.qe_size;
 	my_qp->ipz_rqueue.act_nr_of_sg = resp.ipz_rqueue.act_nr_of_sg;
 	my_qp->ipz_rqueue.queue_length = resp.ipz_rqueue.queue_length;
 	my_qp->ipz_rqueue.pagesize = resp.ipz_rqueue.pagesize;
 	my_qp->ipz_rqueue.toggle_state = resp.ipz_rqueue.toggle_state;
 	/* squeue properties */
-	my_qp->ipz_squeue.queue = (u8*)resp.ipz_squeue.queue;
-	my_qp->ipz_squeue.current_q_addr = (u8*)resp.ipz_squeue.queue;
+	my_qp->ipz_squeue.queue = (u8*)(long)resp.ipz_squeue.queue;
+	my_qp->ipz_squeue.current_q_addr = (u8*)(long)resp.ipz_squeue.queue;
 	my_qp->ipz_squeue.qe_size = resp.ipz_squeue.qe_size;
 	my_qp->ipz_squeue.act_nr_of_sg = resp.ipz_squeue.act_nr_of_sg;
 	my_qp->ipz_squeue.queue_length = resp.ipz_squeue.queue_length;



More information about the general mailing list