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

Hoang-Nam Nguyen HNGUYEN at de.ibm.com
Fri Jun 2 03:41:24 PDT 2006


Hi,
will incorporate those patches in our code. They should be correct for both
64/32 bit version of libehca.
Thanks!
Hoang-Nam Nguyen

openib-general-bounces at openib.org wrote on 02.06.2006 08:43:46:

>
> 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;
> _______________________________________________
> openib-general mailing list
> openib-general at openib.org
> http://openib.org/mailman/listinfo/openib-general
>
> To unsubscribe, please visit
http://openib.org/mailman/listinfo/openib-general
>




More information about the general mailing list