Skip to content

Commit af9ac6c

Browse files
committed
pml: do not cast way the const modifier when this is not necessary
update the pml framework and mpi c bindings (cherry picked from commit open-mpi/ompi@6e6a3e9)
1 parent 331650c commit af9ac6c

32 files changed

+129
-80
lines changed

ompi/mca/pml/base/pml_base_request.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
1414
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
1515
* reserved.
16+
* Copyright (c) 2015 Research Organization for Information Science
17+
* and Technology (RIST). All rights reserved.
1618
* $COPYRIGHT$
1719
*
1820
* Additional copyrights may follow
@@ -68,7 +70,7 @@ struct mca_pml_base_request_t {
6870
opal_convertor_t req_convertor; /**< always need the convertor */
6971
/* END: These field have to match the definition of the mca_pml_cm_request_t */
7072

71-
void *req_addr; /**< pointer to application buffer */
73+
const void *req_addr; /**< pointer to application buffer */
7274
size_t req_count; /**< count of user datatype elements */
7375
int32_t req_peer; /**< peer process - rank w/in this communicator */
7476
int32_t req_tag; /**< user defined tag */

ompi/mca/pml/base/pml_base_sendreq.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
* Copyright (c) 2004-2005 The Regents of the University of California.
1111
* All rights reserved.
1212
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
13+
* Copyright (c) 2015 Research Organization for Information Science
14+
* and Technology (RIST). All rights reserved.
1315
* $COPYRIGHT$
1416
*
1517
* Additional copyrights may follow
@@ -35,7 +37,7 @@ BEGIN_C_DECLS
3537
*/
3638
struct mca_pml_base_send_request_t {
3739
mca_pml_base_request_t req_base; /**< base request type - common data structure for use by wait/test */
38-
void *req_addr; /**< pointer to send buffer - may not be application buffer */
40+
const void *req_addr; /**< pointer to send buffer - may not be application buffer */
3941
size_t req_bytes_packed; /**< packed size of a message given the datatype and count */
4042
mca_pml_base_send_mode_t req_send_mode; /**< type of send */
4143
};

ompi/mca/pml/cm/pml_cm.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
* Copyright (c) 2004-2007 The University of Tennessee and The University
55
* of Tennessee Research Foundation. All rights
66
* reserved.
7+
* Copyright (c) 2015 Research Organization for Information Science
8+
* and Technology (RIST). All rights reserved.
79
* $COPYRIGHT$
810
*
911
* Additional copyrights may follow
@@ -65,7 +67,7 @@ OMPI_DECLSPEC extern int mca_pml_cm_del_comm(struct ompi_communicator_t* comm);
6567

6668

6769
__opal_attribute_always_inline__ static inline int
68-
mca_pml_cm_irecv_init(void *addr,
70+
mca_pml_cm_irecv_init(const void *addr,
6971
size_t count,
7072
ompi_datatype_t * datatype,
7173
int src,
@@ -90,7 +92,7 @@ mca_pml_cm_irecv_init(void *addr,
9092
}
9193

9294
__opal_attribute_always_inline__ static inline int
93-
mca_pml_cm_irecv(void *addr,
95+
mca_pml_cm_irecv(const void *addr,
9496
size_t count,
9597
ompi_datatype_t * datatype,
9698
int src,
@@ -131,7 +133,7 @@ mca_pml_cm_recv_fast_completion(struct mca_mtl_request_t *mtl_request)
131133
}
132134

133135
__opal_attribute_always_inline__ static inline int
134-
mca_pml_cm_recv(void *addr,
136+
mca_pml_cm_recv(const void *addr,
135137
size_t count,
136138
ompi_datatype_t * datatype,
137139
int src,
@@ -207,7 +209,7 @@ mca_pml_cm_recv(void *addr,
207209
}
208210

209211
__opal_attribute_always_inline__ static inline int
210-
mca_pml_cm_isend_init(void* buf,
212+
mca_pml_cm_isend_init(const void* buf,
211213
size_t count,
212214
ompi_datatype_t* datatype,
213215
int dst,
@@ -233,7 +235,7 @@ mca_pml_cm_isend_init(void* buf,
233235
}
234236

235237
__opal_attribute_always_inline__ static inline int
236-
mca_pml_cm_isend(void* buf,
238+
mca_pml_cm_isend(const void* buf,
237239
size_t count,
238240
ompi_datatype_t* datatype,
239241
int dst,
@@ -304,7 +306,7 @@ mca_pml_cm_isend(void* buf,
304306
}
305307

306308
__opal_attribute_always_inline__ static inline int
307-
mca_pml_cm_send(void *buf,
309+
mca_pml_cm_send(const void *buf,
308310
size_t count,
309311
ompi_datatype_t* datatype,
310312
int dst,

ompi/mca/pml/cm/pml_cm_recvreq.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
* Copyright (c) 2012 Sandia National Laboratories. All rights reserved.
1414
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
1515
* reserved.
16+
* Copyright (c) 2015 Research Organization for Information Science
17+
* and Technology (RIST). All rights reserved.
1618
* $COPYRIGHT$
1719
*
1820
* Additional copyrights may follow
@@ -36,7 +38,7 @@ OBJ_CLASS_DECLARATION(mca_pml_cm_thin_recv_request_t);
3638

3739
struct mca_pml_cm_hvy_recv_request_t {
3840
mca_pml_cm_request_t req_base;
39-
void *req_addr; /**< pointer to application buffer */
41+
const void *req_addr; /**< pointer to application buffer */
4042
size_t req_count; /**< count of user datatype elements */
4143
int32_t req_peer; /**< peer process - rank w/in this communicator */
4244
int32_t req_tag; /**< user defined tag */

ompi/mca/pml/cm/pml_cm_sendreq.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
* All rights reserved.
1313
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
1414
* reserved.
15+
* Copyright (c) 2015 Research Organization for Information Science
16+
* and Technology (RIST). All rights reserved.
1517
* $COPYRIGHT$
1618
*
1719
* Additional copyrights may follow
@@ -47,7 +49,7 @@ OBJ_CLASS_DECLARATION(mca_pml_cm_thin_send_request_t);
4749

4850
struct mca_pml_cm_hvy_send_request_t {
4951
mca_pml_cm_send_request_t req_send;
50-
void *req_addr; /**< pointer to application buffer */
52+
const void *req_addr; /**< pointer to application buffer */
5153
size_t req_count; /**< count of user datatype elements */
5254
int32_t req_peer; /**< peer process - rank w/in this communicator */
5355
int32_t req_tag; /**< user defined tag */

ompi/mca/pml/ob1/pml_ob1.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* Copyright (c) 2011 Sandia National Laboratories. All rights reserved.
1515
* Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights
1616
* reserved.
17+
* Copyright (c) 2015 Research Organization for Information Science
18+
* and Technology (RIST). All rights reserved.
1719
* $COPYRIGHT$
1820
*
1921
* Additional copyrights may follow
@@ -138,7 +140,7 @@ extern int mca_pml_ob1_mprobe( int dst,
138140
struct ompi_message_t **message,
139141
ompi_status_public_t* status );
140142

141-
extern int mca_pml_ob1_isend_init( void *buf,
143+
extern int mca_pml_ob1_isend_init( const void *buf,
142144
size_t count,
143145
ompi_datatype_t *datatype,
144146
int dst,
@@ -147,7 +149,7 @@ extern int mca_pml_ob1_isend_init( void *buf,
147149
struct ompi_communicator_t* comm,
148150
struct ompi_request_t **request );
149151

150-
extern int mca_pml_ob1_isend( void *buf,
152+
extern int mca_pml_ob1_isend( const void *buf,
151153
size_t count,
152154
ompi_datatype_t *datatype,
153155
int dst,
@@ -156,31 +158,31 @@ extern int mca_pml_ob1_isend( void *buf,
156158
struct ompi_communicator_t* comm,
157159
struct ompi_request_t **request );
158160

159-
extern int mca_pml_ob1_send( void *buf,
161+
extern int mca_pml_ob1_send( const void *buf,
160162
size_t count,
161163
ompi_datatype_t *datatype,
162164
int dst,
163165
int tag,
164166
mca_pml_base_send_mode_t mode,
165167
struct ompi_communicator_t* comm );
166168

167-
extern int mca_pml_ob1_irecv_init( void *buf,
169+
extern int mca_pml_ob1_irecv_init( const void *buf,
168170
size_t count,
169171
ompi_datatype_t *datatype,
170172
int src,
171173
int tag,
172174
struct ompi_communicator_t* comm,
173175
struct ompi_request_t **request );
174176

175-
extern int mca_pml_ob1_irecv( void *buf,
177+
extern int mca_pml_ob1_irecv( const void *buf,
176178
size_t count,
177179
ompi_datatype_t *datatype,
178180
int src,
179181
int tag,
180182
struct ompi_communicator_t* comm,
181183
struct ompi_request_t **request );
182184

183-
extern int mca_pml_ob1_recv( void *buf,
185+
extern int mca_pml_ob1_recv( const void *buf,
184186
size_t count,
185187
ompi_datatype_t *datatype,
186188
int src,

ompi/mca/pml/ob1/pml_ob1_irecv.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
* Copyright (c) 2010-2012 Oracle and/or its affiliates. All rights reserved.
1616
* Copyright (c) 2011 Sandia National Laboratories. All rights reserved.
1717
* Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
18+
* Copyright (c) 2015 Research Organization for Information Science
19+
* and Technology (RIST). All rights reserved.
1820
* $COPYRIGHT$
1921
*
2022
* Additional copyrights may follow
@@ -34,7 +36,7 @@
3436

3537
mca_pml_ob1_recv_request_t *mca_pml_ob1_recvreq = NULL;
3638

37-
int mca_pml_ob1_irecv_init(void *addr,
39+
int mca_pml_ob1_irecv_init(const void *addr,
3840
size_t count,
3941
ompi_datatype_t * datatype,
4042
int src,
@@ -59,7 +61,7 @@ int mca_pml_ob1_irecv_init(void *addr,
5961
return OMPI_SUCCESS;
6062
}
6163

62-
int mca_pml_ob1_irecv(void *addr,
64+
int mca_pml_ob1_irecv(const void *addr,
6365
size_t count,
6466
ompi_datatype_t * datatype,
6567
int src,
@@ -86,7 +88,7 @@ int mca_pml_ob1_irecv(void *addr,
8688
}
8789

8890

89-
int mca_pml_ob1_recv(void *addr,
91+
int mca_pml_ob1_recv(const void *addr,
9092
size_t count,
9193
ompi_datatype_t * datatype,
9294
int src,

ompi/mca/pml/ob1/pml_ob1_isend.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
mca_pml_ob1_send_request_t *mca_pml_ob1_sendreq = NULL;
3636

37-
int mca_pml_ob1_isend_init(void *buf,
37+
int mca_pml_ob1_isend_init(const void *buf,
3838
size_t count,
3939
ompi_datatype_t * datatype,
4040
int dst,
@@ -64,7 +64,7 @@ int mca_pml_ob1_isend_init(void *buf,
6464
}
6565

6666
/* try to get a small message out on to the wire quickly */
67-
static inline int mca_pml_ob1_send_inline (void *buf, size_t count,
67+
static inline int mca_pml_ob1_send_inline (const void *buf, size_t count,
6868
ompi_datatype_t * datatype,
6969
int dst, int tag, int16_t seqn,
7070
ompi_proc_t *dst_proc, mca_bml_base_endpoint_t* endpoint,
@@ -120,7 +120,7 @@ static inline int mca_pml_ob1_send_inline (void *buf, size_t count,
120120
return (int) size;
121121
}
122122

123-
int mca_pml_ob1_isend(void *buf,
123+
int mca_pml_ob1_isend(const void *buf,
124124
size_t count,
125125
ompi_datatype_t * datatype,
126126
int dst,
@@ -171,7 +171,7 @@ int mca_pml_ob1_isend(void *buf,
171171
return rc;
172172
}
173173

174-
int mca_pml_ob1_send(void *buf,
174+
int mca_pml_ob1_send(const void *buf,
175175
size_t count,
176176
ompi_datatype_t * datatype,
177177
int dst,

ompi/mca/pml/pml.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
* Copyright (c) 2006-2015 Los Alamos National Security, LLC. All rights
1414
* reserved.
1515
* Copyright (c) 2011 Sandia National Laboratories. All rights reserved.
16+
* Copyright (c) 2015 Research Organization for Information Science
17+
* and Technology (RIST). All rights reserved.
1618
* $COPYRIGHT$
1719
*
1820
* Additional copyrights may follow
@@ -206,7 +208,7 @@ typedef int (*mca_pml_base_module_del_comm_fn_t)(struct ompi_communicator_t* com
206208
* @return OMPI_SUCCESS or failure status.
207209
*/
208210
typedef int (*mca_pml_base_module_irecv_init_fn_t)(
209-
void *buf,
211+
const void *buf,
210212
size_t count,
211213
struct ompi_datatype_t *datatype,
212214
int src,
@@ -228,7 +230,7 @@ typedef int (*mca_pml_base_module_irecv_init_fn_t)(
228230
* @return OMPI_SUCCESS or failure status.
229231
*/
230232
typedef int (*mca_pml_base_module_irecv_fn_t)(
231-
void *buf,
233+
const void *buf,
232234
size_t count,
233235
struct ompi_datatype_t *datatype,
234236
int src,
@@ -257,7 +259,7 @@ typedef int (*mca_pml_base_module_imrecv_fn_t)(
257259
* @return OMPI_SUCCESS or failure status.
258260
*/
259261
typedef int (*mca_pml_base_module_recv_fn_t)(
260-
void *buf,
262+
const void *buf,
261263
size_t count,
262264
struct ompi_datatype_t *datatype,
263265
int src,
@@ -287,7 +289,7 @@ typedef int (*mca_pml_base_module_mrecv_fn_t)(
287289
* @return OMPI_SUCCESS or failure status.
288290
*/
289291
typedef int (*mca_pml_base_module_isend_init_fn_t)(
290-
void *buf,
292+
const void *buf,
291293
size_t count,
292294
struct ompi_datatype_t *datatype,
293295
int dst,
@@ -312,7 +314,7 @@ typedef int (*mca_pml_base_module_isend_init_fn_t)(
312314
* @return OMPI_SUCCESS or failure status.
313315
*/
314316
typedef int (*mca_pml_base_module_isend_fn_t)(
315-
void *buf,
317+
const void *buf,
316318
size_t count,
317319
struct ompi_datatype_t *datatype,
318320
int dst,
@@ -336,7 +338,7 @@ typedef int (*mca_pml_base_module_isend_fn_t)(
336338
* @return OMPI_SUCCESS or failure status.
337339
*/
338340
typedef int (*mca_pml_base_module_send_fn_t)(
339-
void *buf,
341+
const void *buf,
340342
size_t count,
341343
struct ompi_datatype_t *datatype,
342344
int dst,

ompi/mca/pml/yalla/pml_yalla.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
/*
22
* Copyright (C) Mellanox Technologies Ltd. 2001-2011. ALL RIGHTS RESERVED.
3+
* Copyright (c) 2015 Research Organization for Information Science
4+
* and Technology (RIST). All rights reserved.
35
* $COPYRIGHT$
46
*
57
* Additional copyrights may follow
@@ -311,7 +313,7 @@ int mca_pml_yalla_del_comm(struct ompi_communicator_t* comm)
311313
return OMPI_SUCCESS;
312314
}
313315

314-
int mca_pml_yalla_irecv_init(void *buf, size_t count, ompi_datatype_t *datatype,
316+
int mca_pml_yalla_irecv_init(const void *buf, size_t count, ompi_datatype_t *datatype,
315317
int src, int tag, struct ompi_communicator_t* comm,
316318
struct ompi_request_t **request)
317319
{
@@ -327,7 +329,7 @@ int mca_pml_yalla_irecv_init(void *buf, size_t count, ompi_datatype_t *datatype,
327329
return OMPI_SUCCESS;
328330
}
329331

330-
int mca_pml_yalla_irecv(void *buf, size_t count, ompi_datatype_t *datatype,
332+
int mca_pml_yalla_irecv(const void *buf, size_t count, ompi_datatype_t *datatype,
331333
int src, int tag, struct ompi_communicator_t* comm,
332334
struct ompi_request_t **request)
333335
{
@@ -351,7 +353,7 @@ int mca_pml_yalla_irecv(void *buf, size_t count, ompi_datatype_t *datatype,
351353
return OMPI_SUCCESS;
352354
}
353355

354-
int mca_pml_yalla_recv(void *buf, size_t count, ompi_datatype_t *datatype, int src,
356+
int mca_pml_yalla_recv(const void *buf, size_t count, ompi_datatype_t *datatype, int src,
355357
int tag, struct ompi_communicator_t* comm,
356358
ompi_status_public_t* status)
357359
{
@@ -381,7 +383,7 @@ int mca_pml_yalla_recv(void *buf, size_t count, ompi_datatype_t *datatype, int s
381383
return OMPI_SUCCESS;
382384
}
383385

384-
int mca_pml_yalla_isend_init(void *buf, size_t count, ompi_datatype_t *datatype,
386+
int mca_pml_yalla_isend_init(const void *buf, size_t count, ompi_datatype_t *datatype,
385387
int dst, int tag, mca_pml_base_send_mode_t mode,
386388
struct ompi_communicator_t* comm,
387389
struct ompi_request_t **request)
@@ -448,7 +450,7 @@ static int mca_pml_yalla_bsend(mxm_send_req_t *mxm_sreq)
448450
return OMPI_SUCCESS;
449451
}
450452

451-
int mca_pml_yalla_isend(void *buf, size_t count, ompi_datatype_t *datatype,
453+
int mca_pml_yalla_isend(const void *buf, size_t count, ompi_datatype_t *datatype,
452454
int dst, int tag, mca_pml_base_send_mode_t mode,
453455
struct ompi_communicator_t* comm,
454456
struct ompi_request_t **request)
@@ -484,7 +486,7 @@ int mca_pml_yalla_isend(void *buf, size_t count, ompi_datatype_t *datatype,
484486
return OMPI_SUCCESS;
485487
}
486488

487-
int mca_pml_yalla_send(void *buf, size_t count, ompi_datatype_t *datatype, int dst,
489+
int mca_pml_yalla_send(const void *buf, size_t count, ompi_datatype_t *datatype, int dst,
488490
int tag, mca_pml_base_send_mode_t mode,
489491
struct ompi_communicator_t* comm)
490492
{

0 commit comments

Comments
 (0)