Skip to content

Commit c4a6196

Browse files
committed
oshmem: use C99 subobject naming for component initialization
This commit helps future-proof oshmem components by initializing each component member by name. Signed-off-by: Nathan Hjelm <[email protected]>
1 parent df75d03 commit c4a6196

File tree

12 files changed

+165
-174
lines changed

12 files changed

+165
-174
lines changed

oshmem/mca/atomic/basic/atomic_basic_component.c

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
12
/*
23
* Copyright (c) 2013 Mellanox Technologies, Inc.
34
* All rights reserved.
5+
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
6+
* reserved.
47
* $COPYRIGHT$
58
*
69
* Additional copyrights may follow
@@ -41,34 +44,27 @@ mca_atomic_base_component_t mca_atomic_basic_component = {
4144
/* First, the mca_component_t struct containing meta information
4245
about the component itself */
4346

44-
{
47+
.atomic_version = {
4548
MCA_ATOMIC_BASE_VERSION_2_0_0,
4649

4750
/* Component name and version */
48-
"basic",
49-
OSHMEM_MAJOR_VERSION,
50-
OSHMEM_MINOR_VERSION,
51-
OSHMEM_RELEASE_VERSION,
52-
53-
/* component open */
54-
_basic_open,
55-
/* component close */
56-
NULL,
57-
/* component query */
58-
NULL,
59-
/* component register */
60-
_basic_register
51+
.mca_component_name = "basic",
52+
MCA_BASE_MAKE_VERSION(component, OSHMEM_MAJOR_VERSION, OSHMEM_MINOR_VERSION,
53+
OSHMEM_RELEASE_VERSION),
54+
55+
.mca_open_component = _basic_open,
56+
.mca_register_component_params = _basic_register,
6157
},
62-
{
58+
.atomic_data = {
6359
/* The component is checkpoint ready */
6460
MCA_BASE_METADATA_PARAM_CHECKPOINT
6561
},
6662

6763
/* Initialization / querying functions */
6864

69-
mca_atomic_basic_init,
70-
mca_atomic_basic_finalize,
71-
mca_atomic_basic_query
65+
.atomic_init = mca_atomic_basic_init,
66+
.atomic_finalize = mca_atomic_basic_finalize,
67+
.atomic_query = mca_atomic_basic_query,
7268
};
7369

7470
static int _basic_register(void)

oshmem/mca/atomic/mxm/atomic_mxm_component.c

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
12
/*
23
* Copyright (c) 2013 Mellanox Technologies, Inc.
34
* All rights reserved.
5+
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
6+
* reserved.
47
* $COPYRIGHT$
58
*
69
* Additional copyrights may follow
@@ -45,34 +48,27 @@ mca_atomic_base_component_t mca_atomic_mxm_component = {
4548
/* First, the mca_component_t struct containing meta information
4649
about the component itself */
4750

48-
{
51+
.atomic_version = {
4952
MCA_ATOMIC_BASE_VERSION_2_0_0,
5053

5154
/* Component name and version */
52-
"mxm",
53-
OSHMEM_MAJOR_VERSION,
54-
OSHMEM_MINOR_VERSION,
55-
OSHMEM_RELEASE_VERSION,
56-
57-
/* component open */
58-
_mxm_open,
59-
/* component close */
60-
NULL,
61-
/* component query */
62-
NULL,
63-
/* component register */
64-
_mxm_register
55+
.mca_component_name = "mxm",
56+
MCA_BASE_MAKE_VERSION(component, OSHMEM_MAJOR_VERSION, OSHMEM_MINOR_VERSION,
57+
OSHMEM_RELEASE_VERSION),
58+
59+
.mca_open_component = _mxm_open,
60+
.mca_register_component_params = _mxm_register,
6561
},
66-
{
62+
.atomic_data = {
6763
/* The component is checkpoint ready */
6864
MCA_BASE_METADATA_PARAM_CHECKPOINT
6965
},
7066

7167
/* Initialization / querying functions */
7268

73-
mca_atomic_mxm_init,
74-
mca_atomic_mxm_finalize,
75-
mca_atomic_mxm_query
69+
.atomic_init = mca_atomic_mxm_init,
70+
.atomic_finalize = mca_atomic_mxm_finalize,
71+
.atomic_query = mca_atomic_mxm_query,
7672
};
7773

7874
static int _mxm_register(void)

oshmem/mca/memheap/buddy/memheap_buddy_component.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
12
/*
23
* Copyright (c) 2013 Mellanox Technologies, Inc.
34
* All rights reserved.
5+
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
6+
* reserved.
47
* $COPYRIGHT$
58
*
69
* Additional copyrights may follow
@@ -21,23 +24,21 @@ static mca_memheap_base_module_t* mca_memheap_buddy_component_init(memheap_conte
2124
static int _basic_open(void);
2225

2326
mca_memheap_base_component_t mca_memheap_buddy_component = {
24-
{
27+
.memheap_version = {
2528
MCA_MEMHEAP_BASE_VERSION_2_0_0,
2629

27-
"buddy", /* MCA component name */
28-
OSHMEM_MAJOR_VERSION, /* MCA component major version */
29-
OSHMEM_MINOR_VERSION, /* MCA component minor version */
30-
OSHMEM_RELEASE_VERSION, /* MCA component release version */
30+
.mca_component_name = "buddy",
31+
MCA_BASE_MAKE_VERSION(component, OSHMEM_MAJOR_VERSION, OSHMEM_MINOR_VERSION,
32+
OSHMEM_RELEASE_VERSION),
3133

32-
_basic_open,
33-
mca_memheap_buddy_component_close,
34-
NULL
34+
.mca_open_component = _basic_open,
35+
.mca_close_component = mca_memheap_buddy_component_close,
3536
},
36-
{
37+
.memheap_data = {
3738
/* The component is checkpoint ready */
3839
MCA_BASE_METADATA_PARAM_CHECKPOINT
3940
},
40-
mca_memheap_buddy_component_init
41+
.memheap_init = mca_memheap_buddy_component_init,
4142
};
4243

4344
/* Open component */

oshmem/mca/memheap/ptmalloc/memheap_ptmalloc_component.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
12
/*
23
* Copyright (c) 2013 Mellanox Technologies, Inc.
34
* All rights reserved.
5+
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
6+
* reserved.
47
* $COPYRIGHT$
58
*
69
* Additional copyrights may follow
@@ -21,23 +24,21 @@ static mca_memheap_base_module_t* mca_memheap_ptmalloc_component_init(memheap_co
2124
static int _basic_open(void);
2225

2326
mca_memheap_base_component_t mca_memheap_ptmalloc_component = {
24-
{
27+
.memheap_version = {
2528
MCA_MEMHEAP_BASE_VERSION_2_0_0,
2629

27-
"ptmalloc", /* MCA component name */
28-
OSHMEM_MAJOR_VERSION, /* MCA component major version */
29-
OSHMEM_MINOR_VERSION, /* MCA component minor version */
30-
OSHMEM_RELEASE_VERSION, /* MCA component release version */
31-
32-
_basic_open,
33-
mca_memheap_ptmalloc_component_close,
34-
NULL
30+
.mca_component_name= "ptmalloc",
31+
MCA_BASE_MAKE_VERSION(component, OSHMEM_MAJOR_VERSION, OSHMEM_MINOR_VERSION,
32+
OSHMEM_RELEASE_VERSION),
33+
34+
.mca_open_component = _basic_open,
35+
.mca_close_component = mca_memheap_ptmalloc_component_close,
3536
},
36-
{
37+
.memheap_data = {
3738
/* The component is checkpoint ready */
3839
MCA_BASE_METADATA_PARAM_CHECKPOINT
3940
},
40-
mca_memheap_ptmalloc_component_init
41+
.memheap_init = mca_memheap_ptmalloc_component_init,
4142
};
4243

4344
/* Open component */

oshmem/mca/scoll/basic/scoll_basic_component.c

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
12
/*
23
* Copyright (c) 2013 Mellanox Technologies, Inc.
34
* All rights reserved.
5+
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
6+
* reserved.
47
* $COPYRIGHT$
58
*
69
* Additional copyrights may follow
@@ -48,30 +51,28 @@ mca_scoll_base_component_t mca_scoll_basic_component = {
4851
/* First, the mca_component_t struct containing meta information
4952
about the component itself */
5053

51-
{
54+
.scoll_version = {
5255
MCA_SCOLL_BASE_VERSION_2_0_0,
5356

5457
/* Component name and version */
55-
"basic",
56-
OSHMEM_MAJOR_VERSION,
57-
OSHMEM_MINOR_VERSION,
58-
OSHMEM_RELEASE_VERSION,
58+
.mca_component_name = "basic",
59+
MCA_BASE_MAKE_VERSION(component, OSHMEM_MAJOR_VERSION, OSHMEM_MINOR_VERSION,
60+
OSHMEM_RELEASE_VERSION),
5961

6062
/* Component open and close functions */
61-
basic_open,
62-
basic_close,
63-
NULL,
64-
basic_register
63+
.mca_open_component = basic_open,
64+
.mca_close_component = basic_close,
65+
.mca_register_component_params = basic_register,
6566
},
66-
{
67+
.scoll_data = {
6768
/* The component is checkpoint ready */
6869
MCA_BASE_METADATA_PARAM_CHECKPOINT
6970
},
7071

7172
/* Initialization / querying functions */
7273

73-
mca_scoll_basic_init,
74-
mca_scoll_basic_query
74+
.scoll_init = mca_scoll_basic_init,
75+
.scoll_query = mca_scoll_basic_query,
7576
};
7677

7778
static int basic_register(void)

oshmem/mca/scoll/fca/scoll_fca_component.c

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
12
/*
23
* Copyright (c) 2013 Mellanox Technologies, Inc.
34
* All rights reserved.
45
* Copyright (c) 2014 Research Organization for Information Science
56
* and Technology (RIST). All rights reserved.
7+
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
8+
* reserved.
69
* $COPYRIGHT$
710
*
811
* Additional copyrights may follow
@@ -58,30 +61,28 @@ mca_scoll_fca_component_t mca_scoll_fca_component = {
5861
/* First, the mca_component_t struct containing meta information
5962
* about the component itfca */
6063
{
61-
{
64+
.scoll_version = {
6265
MCA_SCOLL_BASE_VERSION_2_0_0,
6366

6467
/* Component name and version */
65-
"fca",
66-
OSHMEM_MAJOR_VERSION,
67-
OSHMEM_MINOR_VERSION,
68-
OSHMEM_RELEASE_VERSION,
68+
.mca_component_name = "fca",
69+
MCA_BASE_MAKE_VERSION(component, OSHMEM_MAJOR_VERSION, OSHMEM_MINOR_VERSION,
70+
OSHMEM_RELEASE_VERSION),
6971

7072
/* Component open and close functions */
71-
fca_open,
72-
fca_close,
73-
NULL,
74-
fca_register
73+
.mca_open_component = fca_open,
74+
.mca_close_component = fca_close,
75+
.mca_register_component_params = fca_register,
7576
},
76-
{
77+
.scoll_data = {
7778
/* The component is not checkpoint ready */
7879
MCA_BASE_METADATA_PARAM_NONE
7980
},
8081

8182
/* Initialization / querying functions */
8283

83-
mca_scoll_fca_init_query,
84-
mca_scoll_fca_comm_query,
84+
.scoll_init = mca_scoll_fca_init_query,
85+
.scoll_query = mca_scoll_fca_comm_query,
8586
}
8687
};
8788

oshmem/mca/scoll/mpi/scoll_mpi_component.c

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
/**
2-
Copyright (c) 2011 Mellanox Technologies. All rights reserved.
3-
$COPYRIGHT$
4-
5-
Additional copyrights may follow
6-
7-
$HEADER$
1+
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
2+
/*
3+
* Copyright (c) 2011 Mellanox Technologies. All rights reserved.
4+
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
5+
* reserved.
6+
* $COPYRIGHT$
7+
*
8+
* Additional copyrights may follow
9+
*
10+
* $HEADER$
811
*/
912
#include <stdio.h>
1013

@@ -29,30 +32,28 @@ mca_scoll_mpi_component_t mca_scoll_mpi_component = {
2932
/* First, the mca_component_t struct containing meta information
3033
about the component itfca */
3134
{
32-
{
35+
.scoll_version = {
3336
MCA_SCOLL_BASE_VERSION_2_0_0,
3437

3538
/* Component name and version */
36-
"mpi",
37-
OSHMEM_MAJOR_VERSION,
38-
OSHMEM_MINOR_VERSION,
39-
OSHMEM_RELEASE_VERSION,
39+
.mca_component_name = "mpi",
40+
MCA_BASE_MAKE_VERSION(component, OSHMEM_MAJOR_VERSION, OSHMEM_MINOR_VERSION,
41+
OSHMEM_RELEASE_VERSION),
4042

4143
/* Component open and close functions */
42-
mpi_open,
43-
mpi_close,
44-
NULL,
45-
mpi_register
44+
.mca_open_component = mpi_open,
45+
.mca_close_component = mpi_close,
46+
.mca_register_component_params = mpi_register,
4647
},
47-
{
48+
.scoll_data = {
4849
/* The component is not checkpoint ready */
4950
MCA_BASE_METADATA_PARAM_NONE
5051
},
5152

5253
/* Initialization / querying functions */
5354

54-
mca_scoll_mpi_init_query,
55-
mca_scoll_mpi_comm_query,
55+
.scoll_init = mca_scoll_mpi_init_query,
56+
.scoll_query = mca_scoll_mpi_comm_query,
5657
},
5758
77, /* priority */
5859
0, /* verbose level */

0 commit comments

Comments
 (0)