[openib-general] [PATCH] librdma: use stdint.h types

Michael S. Tsirkin mst at mellanox.co.il
Wed May 31 04:12:25 PDT 2006


Same patch as posted previously for libibverbs/libmthca.

---

librdma pulls in types from under linux/ directory which are
broken on some distros/compilers. There's no good reason for us to do so:
integer types of specific widths are specified in stdint.h in a portable way.

Signed-off-by: Michael S. Tsirkin <mst at mellanox.co.il>

Index: openib/src/userspace/librdmacm/include/rdma/rdma_cma_abi.h
===================================================================
--- openib/src/userspace/librdmacm/include/rdma/rdma_cma_abi.h	(revision 7599)
+++ openib/src/userspace/librdmacm/include/rdma/rdma_cma_abi.h	(working copy)
@@ -33,6 +33,7 @@
 #ifndef RDMA_CMA_ABI_H
 #define RDMA_CMA_ABI_H
 
+#include <stdint.h>
 #include <infiniband/sa-kern-abi.h>
 
 /*
@@ -63,146 +64,146 @@
 };
 
 struct ucma_abi_cmd_hdr {
-	__u32 cmd;
-	__u16 in;
-	__u16 out;
+	uint32_t cmd;
+	uint16_t in;
+	uint16_t out;
 };
 
 struct ucma_abi_create_id {
-	__u64 uid;
-	__u64 response;
+	uint64_t uid;
+	uint64_t response;
 };
 
 struct ucma_abi_create_id_resp {
-	__u32 id;
+	uint32_t id;
 };
 
 struct ucma_abi_destroy_id {
-	__u64 response;
-	__u32 id;
-	__u32 reserved;
+	uint64_t response;
+	uint32_t id;
+	uint32_t reserved;
 };
 
 struct ucma_abi_destroy_id_resp {
-	__u32 events_reported;
+	uint32_t events_reported;
 };
 
 struct ucma_abi_bind_addr {
-	__u64 response;
+	uint64_t response;
 	struct sockaddr_in6 addr;
-	__u32 id;
+	uint32_t id;
 };
 
 struct ucma_abi_resolve_addr {
 	struct sockaddr_in6 src_addr;
 	struct sockaddr_in6 dst_addr;
-	__u32 id;
-	__u32 timeout_ms;
+	uint32_t id;
+	uint32_t timeout_ms;
 };
 
 struct ucma_abi_resolve_route {
-	__u32 id;
-	__u32 timeout_ms;
+	uint32_t id;
+	uint32_t timeout_ms;
 };
 
 struct ucma_abi_query_route {
-	__u64 response;
-	__u32 id;
-	__u32 reserved;
+	uint64_t response;
+	uint32_t id;
+	uint32_t reserved;
 };
 
 struct ucma_abi_query_route_resp {
-	__u64 node_guid;
+	uint64_t node_guid;
 	struct ibv_kern_path_rec ib_route[2];
 	struct sockaddr_in6 src_addr;
 	struct sockaddr_in6 dst_addr;
-	__u32 num_paths;
-	__u8 port_num;
-	__u8 reserved[3];
+	uint32_t num_paths;
+	uint8_t port_num;
+	uint8_t reserved[3];
 };
 
 struct ucma_abi_conn_param {
-	__u32 qp_num;
-	__u32 qp_type;
-	__u8  private_data[RDMA_MAX_PRIVATE_DATA];
-	__u8  private_data_len;
-	__u8  srq;
-	__u8  responder_resources;
-	__u8  initiator_depth;
-	__u8  flow_control;
-	__u8  retry_count;
-	__u8  rnr_retry_count;
-	__u8  valid;
+	uint32_t qp_num;
+	uint32_t qp_type;
+	uint8_t  private_data[RDMA_MAX_PRIVATE_DATA];
+	uint8_t  private_data_len;
+	uint8_t  srq;
+	uint8_t  responder_resources;
+	uint8_t  initiator_depth;
+	uint8_t  flow_control;
+	uint8_t  retry_count;
+	uint8_t  rnr_retry_count;
+	uint8_t  valid;
 };
 
 struct ucma_abi_connect {
 	struct ucma_abi_conn_param conn_param;
-	__u32 id;
-	__u32 reserved;
+	uint32_t id;
+	uint32_t reserved;
 };
 
 struct ucma_abi_listen {
-	__u32 id;
-	__u32 backlog;
+	uint32_t id;
+	uint32_t backlog;
 };
 
 struct ucma_abi_accept {
-	__u64 uid;
+	uint64_t uid;
 	struct ucma_abi_conn_param conn_param;
-	__u32 id;
-	__u32 reserved;
+	uint32_t id;
+	uint32_t reserved;
 };
 
 struct ucma_abi_reject {
-	__u32 id;
-	__u8  private_data_len;
-	__u8  reserved[3];
-	__u8  private_data[RDMA_MAX_PRIVATE_DATA];
+	uint32_t id;
+	uint8_t  private_data_len;
+	uint8_t  reserved[3];
+	uint8_t  private_data[RDMA_MAX_PRIVATE_DATA];
 };
 
 struct ucma_abi_disconnect {
-	__u32 id;
+	uint32_t id;
 };
 
 struct ucma_abi_init_qp_attr {
-	__u64 response;
-	__u32 id;
-	__u32 qp_state;
+	uint64_t response;
+	uint32_t id;
+	uint32_t qp_state;
 };
 
 struct ucma_abi_get_event {
-	__u64 response;
+	uint64_t response;
 };
 
 struct ucma_abi_event_resp {
-	__u64 uid;
-	__u32 id;
-	__u32 event;
-	__u32 status;
-	__u8  private_data_len;
-	__u8  reserved[3];
-	__u8  private_data[RDMA_MAX_PRIVATE_DATA];
+	uint64_t uid;
+	uint32_t id;
+	uint32_t event;
+	uint32_t status;
+	uint8_t  private_data_len;
+	uint8_t  reserved[3];
+	uint8_t  private_data[RDMA_MAX_PRIVATE_DATA];
 };
 
 struct ucma_abi_get_option {
-	__u64 response;
-	__u64 optval;
-	__u32 id;
-	__u32 level;
-	__u32 optname;
-	__u32 optlen;
+	uint64_t response;
+	uint64_t optval;
+	uint32_t id;
+	uint32_t level;
+	uint32_t optname;
+	uint32_t optlen;
 };
 
 struct ucma_abi_get_option_resp {
-	__u32 optlen;
+	uint32_t optlen;
 };
 
 struct ucma_abi_set_option {
-	__u64 optval;
-	__u32 id;
-	__u32 level;
-	__u32 optname;
-	__u32 optlen;
+	uint64_t optval;
+	uint32_t id;
+	uint32_t level;
+	uint32_t optname;
+	uint32_t optlen;
 };
 
 #endif /* RDMA_CMA_ABI_H */
Index: openib/src/userspace/librdmacm/configure.in
===================================================================
--- openib/src/userspace/librdmacm/configure.in	(revision 7599)
+++ openib/src/userspace/librdmacm/configure.in	(working copy)
@@ -23,19 +23,21 @@
 AC_CHECK_SIZEOF(long)
 
 dnl Checks for libraries
+AC_CHECK_LIB(sysfs, sysfs_open_class, [],
+    AC_MSG_ERROR([sysfs_open_class() not found.  librdmacm requires libsysfs.]))
+
 if test "$disable_libcheck" != "yes"
 then
-AC_CHECK_LIB(sysfs, sysfs_open_class, [],
-    AC_MSG_ERROR([sysfs_open_class() not found.  librdmacm requires libsysfs.]))
 AC_CHECK_LIB(ibverbs, ibv_get_device_list, [],
     AC_MSG_ERROR([ibv_get_device_list() not found.  librdmacm requires libibverbs.]))
 fi
 
 dnl Checks for header files.
+AC_CHECK_HEADER(sysfs/libsysfs.h, [],
+    AC_MSG_ERROR([<sysfs/libsysfs.h> not found.  librdmacm requires libsysfs.]))
+
 if test "$disable_libcheck" != "yes"
 then
-AC_CHECK_HEADER(sysfs/libsysfs.h, [],
-    AC_MSG_ERROR([<sysfs/libsysfs.h> not found.  librdmacm requires libsysfs.]))
 AC_CHECK_HEADER(infiniband/verbs.h, [],
     AC_MSG_ERROR([<infiniband/verbs.h> not found.  Is libibverbs installed?]))
 fi

-- 
MST



More information about the general mailing list