OpenMPI  0.1.1
fs.h
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-2011 University of Houston. All rights reserved.
13  * $COPYRIGHT$
14  *
15  * Additional copyrights may follow
16  *
17  * $HEADER$
18  */
19 
20 #ifndef OMPI_MCA_FS_H
21 #define OMPI_MCA_FS_H
22 
23 #include "ompi_config.h"
24 #include "mpi.h"
25 #include "opal/mca/mca.h"
26 #include "opal/mca/base/base.h"
27 
28 BEGIN_C_DECLS
29 
30 struct mca_io_ompio_file_t;
31 
32 /*
33  * Macro for use in components that are of type coll
34  */
35 #define MCA_FS_BASE_VERSION_2_0_0 \
36  MCA_BASE_VERSION_2_0_0, \
37  "fs", 2, 0, 0
38 
39 /*
40  * This framework provides the abstraction for file management operations
41  * of the MPI I/O chapter in MPI-2. The operations defined by this
42  * framework are mostly collective in nature.
43  *
44  * These are the component function prototypes. These function pointers
45  * go into the component structure. These functions (query() and finalize()
46  * are called during fs_base_select(). Each component is query() ied
47  * and subsequently, all the unselected components are finalize() 'ed
48  * so that any *stuff* they did during query() can be undone. By
49  * similar logic, finalize() is also called on the component which
50  * was selected when the communicator is being destroyed.
51  *
52  * So, to sum it up, every component carries 4 functions:
53  * 1. open() - called during MPI_INIT
54  * 2. close() - called during MPI_FINALIZE
55  * 3. query() - called to select a particular component
56  * 4. finalize() - called when actions taken during query have
57  * to be undone
58  */
59 
60 /*
61  * **************** component struct *******************************
62  * *********** These functions go in the component struct **********
63  * **************** component struct *******************************
64  */
65 
66 typedef int (*mca_fs_base_component_init_query_1_0_0_fn_t)
67  (bool enable_progress_threads,
68  bool enable_mpi_threads);
69 
70 typedef struct mca_fs_base_module_1_0_0_t *
71 (*mca_fs_base_component_file_query_1_0_0_fn_t) (struct mca_io_ompio_file_t *file,
72  int *priority);
73 
74 typedef int (*mca_fs_base_component_file_unquery_1_0_0_fn_t)
75  (struct mca_io_ompio_file_t *file);
76 
77 /*
78  * ****************** component struct ******************************
79  * Structure for fs v2.0.0 components.This is chained to MCA v2.0.0
80  * ****************** component struct ******************************
81  */
83  mca_base_component_t fsm_version;
85 
86  mca_fs_base_component_init_query_1_0_0_fn_t fsm_init_query;
87  mca_fs_base_component_file_query_1_0_0_fn_t fsm_file_query;
88  mca_fs_base_component_file_unquery_1_0_0_fn_t fsm_file_unquery;
89 };
92 
93 /*
94  * ***********************************************************************
95  * ************************ Interface function definitions **************
96  * These are the typedefs for the function pointers to various fs
97  * backend functions which will be used by the various fs components
98  * ***********************************************************************
99  */
100 
101 typedef int (*mca_fs_base_module_init_1_0_0_fn_t)
102 (struct mca_io_ompio_file_t *file);
103 
104 typedef int (*mca_fs_base_module_finalize_1_0_0_fn_t)
105 (struct mca_io_ompio_file_t *file);
106 
107 typedef int (*mca_fs_base_module_file_open_fn_t)(
108  struct ompi_communicator_t *comm, char *filename, int amode,
109  struct ompi_info_t *info, struct mca_io_ompio_file_t *fh);
110 typedef int (*mca_fs_base_module_file_close_fn_t)(struct mca_io_ompio_file_t *fh);
111 typedef int (*mca_fs_base_module_file_delete_fn_t)(
112  char *filename, struct ompi_info_t *info);
113 typedef int (*mca_fs_base_module_file_set_size_fn_t)
114  (struct mca_io_ompio_file_t *fh, OMPI_MPI_OFFSET_TYPE size);
115 typedef int (*mca_fs_base_module_file_get_size_fn_t)
116  (struct mca_io_ompio_file_t *fh, OMPI_MPI_OFFSET_TYPE *size);
117 typedef int (*mca_fs_base_module_file_set_info_fn_t)
118  (struct mca_io_ompio_file_t *fh, struct ompi_info_t *info);
119 typedef int (*mca_fs_base_module_file_sync_fn_t)
120  (struct mca_io_ompio_file_t *fh);
121 
122 /*
123  * ***********************************************************************
124  * *************************** module structure *************************
125  * ***********************************************************************
126  */
128  /*
129  * Per-file initialization function. This is called only
130  * on the module which is selected. The finalize corresponding to
131  * this function is present on the component struct above
132  */
133  mca_fs_base_module_init_1_0_0_fn_t fs_module_init;
134  mca_fs_base_module_finalize_1_0_0_fn_t fs_module_finalize;
135 
136  /* FS function pointers */
137  mca_fs_base_module_file_open_fn_t fs_file_open;
138  mca_fs_base_module_file_close_fn_t fs_file_close;
139  mca_fs_base_module_file_delete_fn_t fs_file_delete;
140  mca_fs_base_module_file_set_size_fn_t fs_file_set_size;
141  mca_fs_base_module_file_get_size_fn_t fs_file_get_size;
142  mca_fs_base_module_file_set_info_fn_t fs_file_set_info;
143  mca_fs_base_module_file_sync_fn_t fs_file_sync;
144 };
147 
148 END_C_DECLS
149 
150 #endif /* OMPI_MCA_FS_H */
Common type for all MCA components.
Definition: mca.h:250
Top-level interface for all MCA components.
Definition: info.h:38
Definition: fs.h:127
Back-end structure for MPI_File.
Definition: io_ompio.h:121
Meta data for MCA v2.0.0 components.
Definition: mca.h:309
Definition: communicator.h:118