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

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


Same logic as posted previously for libibverbs.

--

Don't pull 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/libibcm/include/infiniband/cm_abi.h
===================================================================
--- openib/src/userspace/libibcm/include/infiniband/cm_abi.h	(revision 7516)
+++ openib/src/userspace/libibcm/include/infiniband/cm_abi.h	(working copy)
@@ -36,7 +36,7 @@
 #ifndef CM_ABI_H
 #define CM_ABI_H
 
-#include <linux/types.h>
+#include <stdint.h>
 #include <infiniband/sa.h>
 #include <infiniband/marshall.h>
 
@@ -74,211 +74,211 @@
  * command ABI structures.
  */
 struct cm_abi_cmd_hdr {
-	__u32 cmd;
-	__u16 in;
-	__u16 out;
+	uint32_t cmd;
+	uint16_t in;
+	uint16_t out;
 };
 
 struct cm_abi_create_id {
-	__u64 uid;
-	__u64 response;
+	uint64_t uid;
+	uint64_t response;
 };
 
 struct cm_abi_create_id_resp {
-	__u32 id;
+	uint32_t id;
 };
 
 struct cm_abi_destroy_id {
-	__u64 response;
-	__u32 id;
-	__u32 reserved;
+	uint64_t response;
+	uint32_t id;
+	uint32_t reserved;
 };
 
 struct cm_abi_destroy_id_resp {
-	__u32 events_reported;
+	uint32_t events_reported;
 };
 
 struct cm_abi_attr_id {
-	__u64 response;
-	__u32 id;
-	__u32 reserved;
+	uint64_t response;
+	uint32_t id;
+	uint32_t reserved;
 };
 
 struct cm_abi_attr_id_resp {
-	__u64 service_id;
-	__u64 service_mask;
-	__u32 local_id;
-	__u32 remote_id;
+	uint64_t service_id;
+	uint64_t service_mask;
+	uint32_t local_id;
+	uint32_t remote_id;
 };
 
 struct cm_abi_init_qp_attr {
-	__u64 response;
-	__u32 id;
-	__u32 qp_state;
+	uint64_t response;
+	uint32_t id;
+	uint32_t qp_state;
 };
 
 struct cm_abi_listen {
-	__u64 service_id;
-	__u64 service_mask;
-	__u32 id;
-	__u32 reserved;
+	uint64_t service_id;
+	uint64_t service_mask;
+	uint32_t id;
+	uint32_t reserved;
 };
 
 struct cm_abi_establish {
-	__u32 id;
+	uint32_t id;
 };
 
 struct cm_abi_private_data {
-	__u64 data;
-	__u32 id;
-	__u8  len;
-	__u8  reserved[3];
+	uint64_t data;
+	uint32_t id;
+	uint8_t  len;
+	uint8_t  reserved[3];
 };
 
 struct cm_abi_req {
-	__u32 id;
-	__u32 qpn;
-	__u32 qp_type;
-	__u32 psn;
-	__u64 sid;
-	__u64 data;
-	__u64 primary_path;
-	__u64 alternate_path;
-	__u8  len;
-	__u8  peer_to_peer;
-	__u8  responder_resources;
-	__u8  initiator_depth;
-	__u8  remote_cm_response_timeout;
-	__u8  flow_control;
-	__u8  local_cm_response_timeout;
-	__u8  retry_count;
-	__u8  rnr_retry_count;
-	__u8  max_cm_retries;
-	__u8  srq;
-	__u8  reserved[5];
+	uint32_t id;
+	uint32_t qpn;
+	uint32_t qp_type;
+	uint32_t psn;
+	uint64_t sid;
+	uint64_t data;
+	uint64_t primary_path;
+	uint64_t alternate_path;
+	uint8_t  len;
+	uint8_t  peer_to_peer;
+	uint8_t  responder_resources;
+	uint8_t  initiator_depth;
+	uint8_t  remote_cm_response_timeout;
+	uint8_t  flow_control;
+	uint8_t  local_cm_response_timeout;
+	uint8_t  retry_count;
+	uint8_t  rnr_retry_count;
+	uint8_t  max_cm_retries;
+	uint8_t  srq;
+	uint8_t  reserved[5];
 };
 
 struct cm_abi_rep {
-	__u64 uid;
-	__u64 data;
-	__u32 id;
-	__u32 qpn;
-	__u32 psn;
-	__u8  len;
-	__u8  responder_resources;
-	__u8  initiator_depth;
-	__u8  target_ack_delay;
-	__u8  failover_accepted;
-	__u8  flow_control;
-	__u8  rnr_retry_count;
-	__u8  srq;
-	__u8  reserved[4];
+	uint64_t uid;
+	uint64_t data;
+	uint32_t id;
+	uint32_t qpn;
+	uint32_t psn;
+	uint8_t  len;
+	uint8_t  responder_resources;
+	uint8_t  initiator_depth;
+	uint8_t  target_ack_delay;
+	uint8_t  failover_accepted;
+	uint8_t  flow_control;
+	uint8_t  rnr_retry_count;
+	uint8_t  srq;
+	uint8_t  reserved[4];
 };
 
 struct cm_abi_info {
-	__u32 id;
-	__u32 status;
-	__u64 info;
-	__u64 data;
-	__u8  info_len;
-	__u8  data_len;
-	__u8  reserved[6];
+	uint32_t id;
+	uint32_t status;
+	uint64_t info;
+	uint64_t data;
+	uint8_t  info_len;
+	uint8_t  data_len;
+	uint8_t  reserved[6];
 };
 
 struct cm_abi_mra {
-	__u64 data;
-	__u32 id;
-	__u8  len;
-	__u8  timeout;
-	__u8  reserved[2];
+	uint64_t data;
+	uint32_t id;
+	uint8_t  len;
+	uint8_t  timeout;
+	uint8_t  reserved[2];
 };
 
 struct cm_abi_lap {
-	__u64 path;
-	__u64 data;
-	__u32 id;
-	__u8  len;
-	__u8  reserved[3];
+	uint64_t path;
+	uint64_t data;
+	uint32_t id;
+	uint8_t  len;
+	uint8_t  reserved[3];
 };
 
 struct cm_abi_sidr_req {
-	__u32 id;
-	__u32 timeout;
-	__u64 sid;
-	__u64 data;
-	__u64 path;
-	__u16 pkey;
-	__u8  len;
-	__u8  max_cm_retries;
-	__u8  reserved[4];
+	uint32_t id;
+	uint32_t timeout;
+	uint64_t sid;
+	uint64_t data;
+	uint64_t path;
+	uint16_t pkey;
+	uint8_t  len;
+	uint8_t  max_cm_retries;
+	uint8_t  reserved[4];
 };
 
 struct cm_abi_sidr_rep {
-	__u32 id;
-	__u32 qpn;
-	__u32 qkey;
-	__u32 status;
-	__u64 info;
-	__u64 data;
-	__u8  info_len;
-	__u8  data_len;
-	__u8  reserved[6];
+	uint32_t id;
+	uint32_t qpn;
+	uint32_t qkey;
+	uint32_t status;
+	uint64_t info;
+	uint64_t data;
+	uint8_t  info_len;
+	uint8_t  data_len;
+	uint8_t  reserved[6];
 };
 /*
  * event notification ABI structures.
  */
 struct cm_abi_event_get {
-	__u64 response;
-	__u64 data;
-	__u64 info;
-	__u8  data_len;
-	__u8  info_len;
-	__u8  reserved[6];
+	uint64_t response;
+	uint64_t data;
+	uint64_t info;
+	uint8_t  data_len;
+	uint8_t  info_len;
+	uint8_t  reserved[6];
 };
 
 struct cm_abi_req_event_resp {
 	struct ibv_kern_path_rec primary_path;
 	struct ibv_kern_path_rec alternate_path;
-	__u64                  remote_ca_guid;
-	__u32                  remote_qkey;
-	__u32                  remote_qpn;
-	__u32                  qp_type;
-	__u32                  starting_psn;
-	__u8  responder_resources;
-	__u8  initiator_depth;
-	__u8  local_cm_response_timeout;
-	__u8  flow_control;
-	__u8  remote_cm_response_timeout;
-	__u8  retry_count;
-	__u8  rnr_retry_count;
-	__u8  srq;
-	__u8  port;
-	__u8  reserved[7];
+	uint64_t                  remote_ca_guid;
+	uint32_t                  remote_qkey;
+	uint32_t                  remote_qpn;
+	uint32_t                  qp_type;
+	uint32_t                  starting_psn;
+	uint8_t  responder_resources;
+	uint8_t  initiator_depth;
+	uint8_t  local_cm_response_timeout;
+	uint8_t  flow_control;
+	uint8_t  remote_cm_response_timeout;
+	uint8_t  retry_count;
+	uint8_t  rnr_retry_count;
+	uint8_t  srq;
+	uint8_t  port;
+	uint8_t  reserved[7];
 };
 
 struct cm_abi_rep_event_resp {
-	__u64 remote_ca_guid;
-	__u32 remote_qkey;
-	__u32 remote_qpn;
-	__u32 starting_psn;
-	__u8  responder_resources;
-	__u8  initiator_depth;
-	__u8  target_ack_delay;
-	__u8  failover_accepted;
-	__u8  flow_control;
-	__u8  rnr_retry_count;
-	__u8  srq;
-	__u8  reserved[5];
+	uint64_t remote_ca_guid;
+	uint32_t remote_qkey;
+	uint32_t remote_qpn;
+	uint32_t starting_psn;
+	uint8_t  responder_resources;
+	uint8_t  initiator_depth;
+	uint8_t  target_ack_delay;
+	uint8_t  failover_accepted;
+	uint8_t  flow_control;
+	uint8_t  rnr_retry_count;
+	uint8_t  srq;
+	uint8_t  reserved[5];
 };
 
 struct cm_abi_rej_event_resp {
-	__u32 reason;
+	uint32_t reason;
 	/* ari in cm_abi_event_get info field. */
 };
 
 struct cm_abi_mra_event_resp {
-	__u8  timeout;
-	__u8  reserved[3];
+	uint8_t  timeout;
+	uint8_t  reserved[3];
 };
 
 struct cm_abi_lap_event_resp {
@@ -286,20 +286,20 @@
 };
 
 struct cm_abi_apr_event_resp {
-	__u32 status;
+	uint32_t status;
 	/* apr info in cm_abi_event_get info field. */
 };
 
 struct cm_abi_sidr_req_event_resp {
-	__u16 pkey;
-	__u8  port;
-	__u8  reserved;
+	uint16_t pkey;
+	uint8_t  port;
+	uint8_t  reserved;
 };
 
 struct cm_abi_sidr_rep_event_resp {
-	__u32 status;
-	__u32 qkey;
-	__u32 qpn;
+	uint32_t status;
+	uint32_t qkey;
+	uint32_t qpn;
 	/* info in cm_abi_event_get info field. */
 };
 
@@ -309,11 +309,11 @@
 #define CM_ABI_PRES_ALTERNATE 0x08
 
 struct cm_abi_event_resp {
-	__u64 uid;
-	__u32 id;
-	__u32 event;
-	__u32 present;
-	__u32 reserved;
+	uint64_t uid;
+	uint32_t id;
+	uint32_t event;
+	uint32_t present;
+	uint32_t reserved;
 	union {
 		struct cm_abi_req_event_resp req_resp;
 		struct cm_abi_rep_event_resp rep_resp;
@@ -325,7 +325,7 @@
 		struct cm_abi_sidr_req_event_resp sidr_req_resp;
 		struct cm_abi_sidr_rep_event_resp sidr_rep_resp;
 
-		__u32                             send_status;
+		uint32_t                     send_status;
 	} u;
 };
 

-- 
MST



More information about the general mailing list