File: io_base_register_datarep.c

package info (click to toggle)
openmpi 5.0.9-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 201,956 kB
  • sloc: ansic: 614,602; makefile: 42,354; sh: 11,194; javascript: 9,244; f90: 7,052; java: 6,404; perl: 5,192; python: 1,862; lex: 740; fortran: 61; cpp: 20; tcl: 12
file content (64 lines) | stat: -rw-r--r-- 2,453 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
 * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
 *                         University Research and Technology
 *                         Corporation.  All rights reserved.
 * Copyright (c) 2004-2005 The University of Tennessee and The University
 *                         of Tennessee Research Foundation.  All rights
 *                         reserved.
 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
 *                         University of Stuttgart.  All rights reserved.
 * Copyright (c) 2004-2005 The Regents of the University of California.
 *                         All rights reserved.
 * Copyright (c) 2008      Sun Microsystems, Inc.  All rights reserved.
 * Copyright (c) 2015      Research Organization for Information Science
 *                         and Technology (RIST). All rights reserved.
 * $COPYRIGHT$
 *
 * Additional copyrights may follow
 *
 * $HEADER$
 */

#include "ompi_config.h"

#include "opal/mca/base/base.h"
#include "opal/class/opal_list.h"
#include "ompi/constants.h"
#include "ompi/mca/io/io.h"
#include "ompi/mca/io/base/base.h"


int
mca_io_base_register_datarep(const char *datarep,
                             MPI_Datarep_conversion_function* read_fn,
                             MPI_Datarep_conversion_function* write_fn,
                             MPI_Datarep_extent_function* extent_fn,
                             void* state)
{
    mca_base_component_list_item_t *cli;
    const mca_base_component_t *component;
    const mca_io_base_component_2_0_0_t *v200;
    int tmp, ret = OMPI_SUCCESS;

    /* Find the maximum additional number of bytes required by all io
       components for requests and make that the request size */

    OPAL_LIST_FOREACH(cli, &ompi_io_base_framework.framework_components, mca_base_component_list_item_t) {
        component = cli->cli_component;

        /* Only know how to handle v2.0.0 components for now */
        if (component->mca_type_major_version == 2 &&
            component->mca_type_minor_version == 0 &&
            component->mca_type_release_version == 0) {
            v200 = (mca_io_base_component_2_0_0_t *) component;

            /* return first non-good error-code */
            tmp = v200->io_register_datarep(datarep, read_fn, write_fn,
                                            extent_fn, state);
            ret = (ret == OMPI_SUCCESS) ? tmp : ret;
        }
    }

    return ret;
}