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

James Lentini jlentini at netapp.com
Thu May 12 19:00:47 PDT 2005


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.

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

Index: include/ib_cm.h
===================================================================
--- include/ib_cm.h	(revision 2325)
+++ 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 2331)
+++ core/cm.c	(working copy)
@@ -1146,7 +1146,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_id_priv,
@@ -1177,7 +1177,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;
@@ -1418,7 +1418,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_id_priv,
@@ -1433,7 +1433,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;
@@ -1478,7 +1478,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)
  {
  	cm_format_mad_hdr(&drep_msg->hdr, cm_id_priv,
@@ -1509,7 +1509,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;
@@ -1640,7 +1640,7 @@
  			  enum ib_cm_rej_reason reason,
  			  void *ari,
  			  u8 ari_length,
-			  void *private_data,
+			  const void *private_data,
  			  u8 private_data_len)
  {
  	cm_format_mad_hdr(&rej_msg->hdr, cm_id_priv,
@@ -1677,7 +1677,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;
@@ -1836,7 +1836,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;
@@ -1876,7 +1876,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;
@@ -1944,7 +1944,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_id_priv,
@@ -1974,7 +1974,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;
@@ -2087,7 +2087,7 @@
  			  enum ib_cm_apr_status status,
  			  void *info,
  			  u8 info_length,
-			  void *private_data,
+			  const void *private_data,
  			  u8 private_data_len)
  {
  	cm_format_mad_hdr(&apr_msg->hdr, cm_id_priv,
@@ -2110,7 +2110,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 2331)
+++ 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