[openib-general] Re: [PATCH] make private data pointers const

James Lentini jlentini at netapp.com
Mon May 16 10:29:46 PDT 2005


I don't see any obvious configuration error in my mail client, so I'm 
resending the patch as an attachment.

james

On Mon, 16 May 2005, James Lentini wrote:

>
> Sean,
>
> Sorry about that. The message was garbled on my end. I'm not sure if it was 
> my mail client or the mail server. I'll fix it and resend.
>
> james
>
> On Mon, 16 May 2005, Sean Hefty wrote:
>
>> James Lentini wrote:
>>> 
>>> This patch affects ib_cm.h and cm.c, which appear to be maintained by 
>>> Sean, and ucm.c, which appears to be maintained by Libor.
>>> 
>>> The patch adds the const qualifier to private data pointers passed into 
>>> the IB layer.
>> 
>> My system rejects all of the changes.  Has anyone else tried applying this 
>> patch?
>> 
>> - Sean
>> 
> _______________________________________________
> 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
>
-------------- next part --------------
Add the const qualifier to private data pointers passed into the IB layer.

Signed-off-by: James Lentini <jlentini at netapp.com>

Index: include/ib_cm.h
===================================================================
--- include/ib_cm.h	(revision 2357)
+++ include/ib_cm.h	(working copy)
@@ -333,7 +333,7 @@
 	u32			qp_num;
 	enum ib_qp_type		qp_type;
 	u32			starting_psn;
-	void			*private_data;
+	const void		*private_data;
 	u8			private_data_len;
 	u8			peer_to_peer;
 	u8			responder_resources;
@@ -360,7 +360,7 @@
 struct ib_cm_rep_param {
 	u32		qp_num;
 	u32		starting_psn;
-	void		*private_data;
+	const void	*private_data;
 	u8		private_data_len;
 	u8		responder_resources;
 	u8		initiator_depth;
@@ -391,7 +391,7 @@
  * @private_data_len: Size of the private data buffer, in bytes.
  */
 int ib_send_cm_rtu(struct ib_cm_id *cm_id,
-		   void *private_data,
+		   const void *private_data,
 		   u8 private_data_len);
 
 /**
@@ -404,7 +404,7 @@
  * @private_data_len: Size of the private data buffer, in bytes.
  */
 int ib_send_cm_dreq(struct ib_cm_id *cm_id,
-		    void *private_data,
+		    const void *private_data,
 		    u8 private_data_len);
 
 /**
@@ -416,7 +416,7 @@
  * @private_data_len: Size of the private data buffer, in bytes.
  */
 int ib_send_cm_drep(struct ib_cm_id *cm_id,
-		    void *private_data,
+		    const void *private_data,
 		    u8 private_data_len);
 
 /**
@@ -444,7 +444,7 @@
 		   enum ib_cm_rej_reason reason,
 		   void *ari,
 		   u8 ari_length,
-		   void *private_data,
+		   const void *private_data,
 		   u8 private_data_len);
 
 /**
@@ -459,7 +459,7 @@
  */
 int ib_send_cm_mra(struct ib_cm_id *cm_id,
 		   u8 service_timeout,
-		   void *private_data,
+		   const void *private_data,
 		   u8 private_data_len);
 
 /**
@@ -474,7 +474,7 @@
  */
 int ib_send_cm_lap(struct ib_cm_id *cm_id,
 		   struct ib_sa_path_rec *alternate_path,
-		   void *private_data,
+		   const void *private_data,
 		   u8 private_data_len);
 
 /**
@@ -513,14 +513,14 @@
 		   enum ib_cm_apr_status status,
 		   void *info,
 		   u8 info_length,
-		   void *private_data,
+		   const void *private_data,
 		   u8 private_data_len);
 
 struct ib_cm_sidr_req_param {
 	struct ib_sa_path_rec	*path;
 	u64			service_id;
 	int			timeout_ms;
-	void			*private_data;
+	const void		*private_data;
 	u8			private_data_len;
 	u8			max_cm_retries;
 	u16			pkey;
@@ -540,9 +540,9 @@
 	u32			qp_num;
 	u32			qkey;
 	enum ib_cm_sidr_status	status;
-	void			*info;
+	const void		*info;
 	u8			info_length;
-	void			*private_data;
+	const void		*private_data;
 	u8			private_data_len;
 };
 
Index: core/cm.c
===================================================================
--- core/cm.c	(revision 2357)
+++ core/cm.c	(working copy)
@@ -1205,7 +1205,7 @@
 
 static void cm_format_rtu(struct cm_rtu_msg *rtu_msg,
 			  struct cm_id_private *cm_id_priv,
-			  void *private_data,
+			  const void *private_data,
 			  u8 private_data_len)
 {
 	cm_format_mad_hdr(&rtu_msg->hdr, CM_RTU_ATTR_ID,
@@ -1236,7 +1236,7 @@
 }
 
 int ib_send_cm_rtu(struct ib_cm_id *cm_id,
-		   void *private_data,
+		   const void *private_data,
 		   u8 private_data_len)
 {
 	struct cm_id_private *cm_id_priv;
@@ -1471,7 +1471,7 @@
 
 static void cm_format_dreq(struct cm_dreq_msg *dreq_msg,
 			  struct cm_id_private *cm_id_priv,
-			  void *private_data,
+			  const void *private_data,
 			  u8 private_data_len)
 {
 	cm_format_mad_hdr(&dreq_msg->hdr, CM_DREQ_ATTR_ID,
@@ -1486,7 +1486,7 @@
 }
 
 int ib_send_cm_dreq(struct ib_cm_id *cm_id,
-		    void *private_data,
+		    const void *private_data,
 		    u8 private_data_len)
 {
 	struct cm_id_private *cm_id_priv;
@@ -1531,7 +1531,7 @@
 
 static void cm_format_drep(struct cm_drep_msg *drep_msg,
 			  struct cm_id_private *cm_id_priv,
-			  void *private_data,
+			  const void *private_data,
 			  u8 private_data_len)
 {
 	/* todo: TID should match received DREQ */
@@ -1563,7 +1563,7 @@
 }
 
 int ib_send_cm_drep(struct ib_cm_id *cm_id,
-		    void *private_data,
+		    const void *private_data,
 		    u8 private_data_len)
 {
 	struct cm_id_private *cm_id_priv;
@@ -1694,7 +1694,7 @@
 			  enum ib_cm_rej_reason reason,
 			  void *ari,
 			  u8 ari_length,
-			  void *private_data,
+			  const void *private_data,
 			  u8 private_data_len)
 {
 	/* todo: TID should match received REQ */
@@ -1732,7 +1732,7 @@
 		   enum ib_cm_rej_reason reason,
 		   void *ari,
 		   u8 ari_length,
-		   void *private_data,
+		   const void *private_data,
 		   u8 private_data_len)
 {
 	struct cm_id_private *cm_id_priv;
@@ -1891,7 +1891,7 @@
 static void cm_format_mra(struct cm_mra_msg *mra_msg,
 			  struct cm_id_private *cm_id_priv,
 			  u8 service_timeout,
-			  void *private_data,
+			  const void *private_data,
 			  u8 private_data_len)
 {
 	enum cm_msg_sequence msg_sequence;
@@ -1932,7 +1932,7 @@
 
 int ib_send_cm_mra(struct ib_cm_id *cm_id,
 		   u8 service_timeout,
-		   void *private_data,
+		   const void *private_data,
 		   u8 private_data_len)
 {
 	struct cm_id_private *cm_id_priv;
@@ -2000,7 +2000,7 @@
 static void cm_format_lap(struct cm_lap_msg *lap_msg,
 			  struct cm_id_private *cm_id_priv,
 			  struct ib_sa_path_rec *alternate_path,
-			  void *private_data,
+			  const void *private_data,
 			  u8 private_data_len)
 {
 	cm_format_mad_hdr(&lap_msg->hdr, CM_LAP_ATTR_ID,
@@ -2030,7 +2030,7 @@
 
 int ib_send_cm_lap(struct ib_cm_id *cm_id,
 		   struct ib_sa_path_rec *alternate_path,
-		   void *private_data,
+		   const void *private_data,
 		   u8 private_data_len)
 {
 	struct cm_id_private *cm_id_priv;
@@ -2143,7 +2143,7 @@
 			  enum ib_cm_apr_status status,
 			  void *info,
 			  u8 info_length,
-			  void *private_data,
+			  const void *private_data,
 			  u8 private_data_len)
 {
 	/* todo: TID should match received LAP */
@@ -2167,7 +2167,7 @@
 		   enum ib_cm_apr_status status,
 		   void *info,
 		   u8 info_length,
-		   void *private_data,
+		   const void *private_data,
 		   u8 private_data_len)
 {
 	struct cm_id_private *cm_id_priv;
Index: core/ucm.c
===================================================================
--- core/ucm.c	(revision 2357)
+++ core/ucm.c	(working copy)
@@ -721,7 +721,7 @@
 	return result;
 }
 
-static int ib_ucm_alloc_data(void **dest, u64 src, u32 len)
+static int ib_ucm_alloc_data(const void **dest, u64 src, u32 len)
 {
 	void *data;
 
@@ -913,12 +913,12 @@
 static ssize_t ib_ucm_send_private_data(struct ib_ucm_file *file,
 					const char __user *inbuf, int in_len,
 					int (*func)(struct ib_cm_id *cm_id,
-						    void *private_data,
+						    const void *private_data,
 						    u8 private_data_len))
 {
 	struct ib_ucm_private_data cmd;
 	struct ib_ucm_context *ctx;
-	void *private_data = NULL;
+	const void *private_data = NULL;
 	int result;
 
 	if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
@@ -974,15 +974,15 @@
 				const char __user *inbuf, int in_len,
 				int (*func)(struct ib_cm_id *cm_id,
 					    int status,
-					    void *info,
+					    const void *info,
 					    u8 info_len,
-					    void *data,
+					    const void *data,
 					    u8 data_len))
 {
 	struct ib_ucm_context *ctx;
 	struct ib_ucm_info cmd;
-	void *data = NULL;
-	void *info = NULL;
+	const void *data = NULL;
+	const void *info = NULL;
 	int result;
 
 	if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
@@ -1041,7 +1041,7 @@
 {
 	struct ib_ucm_context *ctx;
 	struct ib_ucm_mra cmd;
-	void *data = NULL;
+	const void *data = NULL;
 	int result;
 
 	if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
@@ -1080,7 +1080,7 @@
 	struct ib_ucm_context *ctx;
 	struct ib_sa_path_rec *path = NULL;
 	struct ib_ucm_lap cmd;
-	void *data = NULL;
+	const void *data = NULL;
 	int result;
 
 	if (copy_from_user(&cmd, inbuf, sizeof(cmd)))


More information about the general mailing list