1 /*
2 * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3 * University Research and Technology
4 * Corporation. All rights reserved.
5 * Copyright (c) 2004-2005 The University of Tennessee and The University
6 * of Tennessee Research Foundation. All rights
7 * reserved.
8 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9 * University of Stuttgart. All rights reserved.
10 * Copyright (c) 2004-2005 The Regents of the University of California.
11 * All rights reserved.
12 * Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
13 * Copyright (c) 2015 Research Organization for Information Science
14 * and Technology (RIST). All rights reserved.
15 * $COPYRIGHT$
16 *
17 * Additional copyrights may follow
18 *
19 * $HEADER$
20 */
21
22 #include "ompi_config.h"
23
24 #include "opal/mca/base/base.h"
25 #include "opal/class/opal_list.h"
26 #include "ompi/constants.h"
27 #include "ompi/mca/io/io.h"
28 #include "ompi/mca/io/base/base.h"
29
30
31 int
32 mca_io_base_register_datarep(const char *datarep,
33 MPI_Datarep_conversion_function* read_fn,
34 MPI_Datarep_conversion_function* write_fn,
35 MPI_Datarep_extent_function* extent_fn,
36 void* state)
37 {
38 mca_base_component_list_item_t *cli;
39 const mca_base_component_t *component;
40 const mca_io_base_component_2_0_0_t *v200;
41 int tmp, ret = OMPI_SUCCESS;
42
43 /* Find the maximum additional number of bytes required by all io
44 components for requests and make that the request size */
45
46 OPAL_LIST_FOREACH(cli, &ompi_io_base_framework.framework_components, mca_base_component_list_item_t) {
47 component = cli->cli_component;
48
49 /* Only know how to handle v2.0.0 components for now */
50 if (component->mca_type_major_version == 2 &&
51 component->mca_type_minor_version == 0 &&
52 component->mca_type_release_version == 0) {
53 v200 = (mca_io_base_component_2_0_0_t *) component;
54
55 /* return first non-good error-code */
56 tmp = v200->io_register_datarep(datarep, read_fn, write_fn,
57 extent_fn, state);
58 ret = (ret == OMPI_SUCCESS) ? tmp : ret;
59 }
60 }
61
62 return ret;
63 }
64