This source file includes following definitions.
- mca_fs_ime_component_init_query
- mca_fs_ime_component_file_query
- mca_fs_ime_component_file_unquery
- mca_fs_ime_module_init
- mca_fs_ime_module_finalize
- mca_fs_ime_get_mpi_err
- mca_fs_ime_native_fini
1
2
3
4
5
6
7
8
9
10 #include "ime_native.h"
11
12 #include "ompi_config.h"
13 #include "mpi.h"
14 #include "ompi/mca/fs/fs.h"
15 #include "ompi/mca/fs/base/base.h"
16 #include "ompi/mca/fs/ime/fs_ime.h"
17
18
19
20
21
22
23 static mca_fs_base_module_1_0_0_t ime = {
24 mca_fs_ime_module_init,
25 mca_fs_ime_module_finalize,
26 mca_fs_ime_file_open,
27 mca_fs_ime_file_close,
28 mca_fs_ime_file_delete,
29 mca_fs_ime_file_set_size,
30 mca_fs_ime_file_get_size,
31 mca_fs_ime_file_sync
32 };
33
34
35
36
37
38
39
40
41
42 static int mca_fs_ime_IS_INITIALIZED = 0;
43
44
45
46
47 int mca_fs_ime_component_init_query(bool enable_progress_threads,
48 bool enable_mpi_threads)
49 {
50
51
52 return OMPI_SUCCESS;
53 }
54
55 struct mca_fs_base_module_1_0_0_t *
56 mca_fs_ime_component_file_query (ompio_file_t *fh, int *priority)
57 {
58
59
60
61
62 char *tmp;
63
64 *priority = mca_fs_ime_priority;
65
66 tmp = strchr (fh->f_filename, ':');
67 if (!tmp) {
68
69 if (OMPIO_ROOT == fh->f_rank || MPI_COMM_NULL == fh->f_comm) {
70 fh->f_fstype = mca_fs_base_get_fstype ( fh->f_filename );
71 }
72 if (fh->f_comm != MPI_COMM_NULL) {
73 fh->f_comm->c_coll->coll_bcast (&(fh->f_fstype),
74 1,
75 MPI_INT,
76 OMPIO_ROOT,
77 fh->f_comm,
78 fh->f_comm->c_coll->coll_bcast_module);
79 }
80 }
81 else {
82 if (!strncmp(fh->f_filename, DEFAULT_IME_PREFIX_NO_FWD_SLASH,
83 IME_FILE_PREFIX_LEN_NO_FWD_SLASH)){
84 fh->f_fstype = IME;
85 }
86 }
87
88
89
90
91
92 if (IME == fh->f_fstype) {
93 if (*priority < FS_IME_INCREASED_PRIORITY) {
94 *priority = FS_IME_INCREASED_PRIORITY;
95 }
96 return &ime;
97 }
98
99 return NULL;
100 }
101
102 int mca_fs_ime_component_file_unquery (ompio_file_t *file)
103 {
104
105
106
107
108 return OMPI_SUCCESS;
109 }
110
111 int mca_fs_ime_module_init (ompio_file_t *file)
112 {
113
114
115 file->f_fstype = IME;
116
117 if (mca_fs_ime_IS_INITIALIZED == 0) {
118 mca_fs_ime_IS_INITIALIZED = 1;
119 ime_native_init();
120 }
121 return OMPI_SUCCESS;
122 }
123
124 int mca_fs_ime_module_finalize (ompio_file_t *file)
125 {
126
127
128
129
130
131
132
133 return OMPI_SUCCESS;
134 }
135
136 int mca_fs_ime_get_mpi_err(int errno_val)
137 {
138 switch (errno_val) {
139 case EACCES:
140 return MPI_ERR_ACCESS;
141
142 case ENAMETOOLONG:
143 return MPI_ERR_BAD_FILE;
144
145 case ENOENT:
146 return MPI_ERR_NO_SUCH_FILE;
147
148 case EISDIR:
149 return MPI_ERR_BAD_FILE;
150
151 case EROFS:
152 return MPI_ERR_READ_ONLY;
153
154 case EEXIST:
155 return MPI_ERR_FILE_EXISTS;
156
157 case ENOSPC:
158 return MPI_ERR_NO_SPACE;
159
160 case EDQUOT:
161 return MPI_ERR_QUOTA;
162
163 case ETXTBSY:
164 return MPI_ERR_FILE_IN_USE;
165
166 case EBADF:
167 return MPI_ERR_FILE;
168
169 default:
170 return MPI_ERR_OTHER;
171 }
172 }
173
174 int mca_fs_ime_native_fini()
175 {
176 int ret;
177 if (mca_fs_ime_IS_INITIALIZED == 0) {
178 return OMPI_SUCCESS;
179 }
180
181
182
183
184
185 mca_fs_ime_IS_INITIALIZED = 0;
186
187 ret = ime_native_finalize();
188 if (ret != 0) {
189 return OMPI_ERROR;
190 }
191
192 return OMPI_SUCCESS;