1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
2 /*
3 * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
4 * University Research and Technology
5 * Corporation. All rights reserved.
6 * Copyright (c) 2004-2005 The University of Tennessee and The University
7 * of Tennessee Research Foundation. All rights
8 * reserved.
9 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
10 * University of Stuttgart. All rights reserved.
11 * Copyright (c) 2004-2005 The Regents of the University of California.
12 * All rights reserved.
13 * Copyright (c) 2008-2015 University of Houston. All rights reserved.
14 * Copyright (c) 2015 Los Alamos National Security, LLC. All rights
15 * reserved.
16 * Copyright (c) 2015-2018 Research Organization for Information Science
17 * and Technology (RIST). All rights reserved.
18 * Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
19 * $COPYRIGHT$
20 *
21 * Additional copyrights may follow
22 *
23 * $HEADER$
24 */
25
26 #ifndef OMPI_MCA_FS_H
27 #define OMPI_MCA_FS_H
28
29 #include "ompi_config.h"
30 #include "mpi.h"
31 #include "ompi/mca/mca.h"
32 #include "opal/mca/base/base.h"
33 #include "ompi/info/info.h"
34
35 BEGIN_C_DECLS
36
37 struct ompio_file_t;
38
39 /*
40 * Macro for use in components that are of type coll
41 */
42 #define MCA_FS_BASE_VERSION_2_0_0 \
43 OMPI_MCA_BASE_VERSION_2_1_0("fs", 2, 0, 0)
44
45 /*
46 * This framework provides the abstraction for file management operations
47 * of the MPI I/O chapter in MPI-2. The operations defined by this
48 * framework are mostly collective in nature.
49 *
50 * These are the component function prototypes. These function pointers
51 * go into the component structure. These functions (query() and finalize()
52 * are called during fs_base_select(). Each component is query() ied
53 * and subsequently, all the unselected components are finalize() 'ed
54 * so that any *stuff* they did during query() can be undone. By
55 * similar logic, finalize() is also called on the component which
56 * was selected when the communicator is being destroyed.
57 *
58 * So, to sum it up, every component carries 4 functions:
59 * 1. open() - called during MPI_INIT
60 * 2. close() - called during MPI_FINALIZE
61 * 3. query() - called to select a particular component
62 * 4. finalize() - called when actions taken during query have
63 * to be undone
64 */
65
66 /*
67 * **************** component struct *******************************
68 * *********** These functions go in the component struct **********
69 * **************** component struct *******************************
70 */
71
72 typedef int (*mca_fs_base_component_init_query_1_0_0_fn_t)
73 (bool enable_progress_threads,
74 bool enable_mpi_threads);
75
76 typedef struct mca_fs_base_module_1_0_0_t *
77 (*mca_fs_base_component_file_query_1_0_0_fn_t) (struct ompio_file_t *file,
78 int *priority);
79
80 typedef int (*mca_fs_base_component_file_unquery_1_0_0_fn_t)
81 (struct ompio_file_t *file);
82
83 /*
84 * ****************** component struct ******************************
85 * Structure for fs v2.0.0 components.This is chained to MCA v2.0.0
86 * ****************** component struct ******************************
87 */
88 struct mca_fs_base_component_2_0_0_t {
89 mca_base_component_t fsm_version;
90 mca_base_component_data_t fsm_data;
91
92 mca_fs_base_component_init_query_1_0_0_fn_t fsm_init_query;
93 mca_fs_base_component_file_query_1_0_0_fn_t fsm_file_query;
94 mca_fs_base_component_file_unquery_1_0_0_fn_t fsm_file_unquery;
95 };
96 typedef struct mca_fs_base_component_2_0_0_t mca_fs_base_component_2_0_0_t;
97 typedef struct mca_fs_base_component_2_0_0_t mca_fs_base_component_t;
98
99 /*
100 * ***********************************************************************
101 * ************************ Interface function definitions **************
102 * These are the typedefs for the function pointers to various fs
103 * backend functions which will be used by the various fs components
104 * ***********************************************************************
105 */
106
107 typedef int (*mca_fs_base_module_init_1_0_0_fn_t)
108 (struct ompio_file_t *file);
109
110 typedef int (*mca_fs_base_module_finalize_1_0_0_fn_t)
111 (struct ompio_file_t *file);
112
113 typedef int (*mca_fs_base_module_file_open_fn_t)(
114 struct ompi_communicator_t *comm, const char *filename, int amode,
115 struct opal_info_t *info, struct ompio_file_t *fh);
116 typedef int (*mca_fs_base_module_file_close_fn_t)(struct ompio_file_t *fh);
117 typedef int (*mca_fs_base_module_file_delete_fn_t)(
118 char *filename, struct opal_info_t *info);
119 typedef int (*mca_fs_base_module_file_set_size_fn_t)
120 (struct ompio_file_t *fh, OMPI_MPI_OFFSET_TYPE size);
121 typedef int (*mca_fs_base_module_file_get_size_fn_t)
122 (struct ompio_file_t *fh, OMPI_MPI_OFFSET_TYPE *size);
123 typedef int (*mca_fs_base_module_file_sync_fn_t)
124 (struct ompio_file_t *fh);
125
126 /*
127 * ***********************************************************************
128 * *************************** module structure *************************
129 * ***********************************************************************
130 */
131 struct mca_fs_base_module_1_0_0_t {
132 /*
133 * Per-file initialization function. This is called only
134 * on the module which is selected. The finalize corresponding to
135 * this function is present on the component struct above
136 */
137 mca_fs_base_module_init_1_0_0_fn_t fs_module_init;
138 mca_fs_base_module_finalize_1_0_0_fn_t fs_module_finalize;
139
140 /* FS function pointers */
141 mca_fs_base_module_file_open_fn_t fs_file_open;
142 mca_fs_base_module_file_close_fn_t fs_file_close;
143 mca_fs_base_module_file_delete_fn_t fs_file_delete;
144 mca_fs_base_module_file_set_size_fn_t fs_file_set_size;
145 mca_fs_base_module_file_get_size_fn_t fs_file_get_size;
146 mca_fs_base_module_file_sync_fn_t fs_file_sync;
147 };
148 typedef struct mca_fs_base_module_1_0_0_t mca_fs_base_module_1_0_0_t;
149 typedef mca_fs_base_module_1_0_0_t mca_fs_base_module_t;
150
151 END_C_DECLS
152
153 #endif /* OMPI_MCA_FS_H */