@@ -44,9 +44,9 @@ int mca_fs_gpfs_file_set_info(ompio_file_t *fh, struct ompi_info_t *info)
44
44
{
45
45
int rc = 0 ;
46
46
int flag ;
47
- int valueLen = MPI_MAX_INFO_VAL ;
48
- char value [MPI_MAX_INFO_VAL + 1 ];
47
+ opal_cstring_t * info_str ;
49
48
char gpfsHintsKey [50 ];
49
+ bool info_bool ;
50
50
const char * split = "," ;
51
51
char * token ;
52
52
int ret = OMPI_SUCCESS ;
@@ -163,9 +163,9 @@ int mca_fs_gpfs_file_set_info(ompio_file_t *fh, struct ompi_info_t *info)
163
163
*/
164
164
165
165
strcpy (gpfsHintsKey , "useSIOXLib" );
166
- ompi_info_get (info_selected , gpfsHintsKey , valueLen , value , & flag );
166
+ ompi_info_get_bool (info_selected , gpfsHintsKey , & info_bool , & flag );
167
167
if (flag ) {
168
- if (strcmp ( value , "true" ) == 0 ) {
168
+ if (info_bool ) {
169
169
//using the SIOX lib and the I/O pattern selection
170
170
ret = mca_fs_gpfs_io_selection (fh , info , info_selected );
171
171
if (ret != OMPI_SUCCESS )
@@ -179,23 +179,26 @@ int mca_fs_gpfs_file_set_info(ompio_file_t *fh, struct ompi_info_t *info)
179
179
180
180
//Setting GPFS Hint - gpfsAccessRange
181
181
strcpy (gpfsHintsKey , "gpfsAccessRange" );
182
- ompi_info_get (info_selected , gpfsHintsKey , valueLen , value , & flag );
182
+ ompi_info_get (info_selected , gpfsHintsKey , & info_str , & flag );
183
183
if (flag ) {
184
184
opal_output (ompi_fs_base_framework .framework_output ,
185
- "GPFS Access Range is set: %s: %s\n" , gpfsHintsKey , value );
185
+ "GPFS Access Range is set: %s: %s\n" , gpfsHintsKey , info_str -> string );
186
186
gpfs_hint_AccessRange .gpfsFcntlHeader .totalLength = sizeof (gpfs_hint_AccessRange );
187
187
gpfs_hint_AccessRange .gpfsFcntlHeader .fcntlVersion = GPFS_FCNTL_CURRENT_VERSION ;
188
188
gpfs_hint_AccessRange .gpfsFcntlHeader .fcntlReserved = 0 ;
189
189
190
190
gpfs_hint_AccessRange .gpfsAccessRange .structLen =
191
191
sizeof (gpfs_hint_AccessRange .gpfsAccessRange );
192
192
gpfs_hint_AccessRange .gpfsAccessRange .structType = GPFS_ACCESS_RANGE ;
193
- token = strtok (value , split );
193
+ char * info_str_dup = strdup (info_str -> string );
194
+ OBJ_RELEASE (info_str );
195
+ token = strtok (info_str_dup , split );
194
196
gpfs_hint_AccessRange .gpfsAccessRange .start = atol (token );
195
197
token = strtok (NULL , split );
196
198
gpfs_hint_AccessRange .gpfsAccessRange .length = atol (token );
197
199
token = strtok (NULL , split );
198
200
gpfs_hint_AccessRange .gpfsAccessRange .isWrite = atoi (token );
201
+ free (info_str_dup );
199
202
200
203
rc = gpfs_fcntl (gpfs_file_handle , & gpfs_hint_AccessRange );
201
204
if (rc != 0 ) {
@@ -209,21 +212,24 @@ int mca_fs_gpfs_file_set_info(ompio_file_t *fh, struct ompi_info_t *info)
209
212
210
213
//Setting GPFS Hint - gpfsFreeRange
211
214
strcpy (gpfsHintsKey , "gpfsFreeRange" );
212
- ompi_info_get (info_selected , gpfsHintsKey , valueLen , value , & flag );
215
+ ompi_info_get (info_selected , gpfsHintsKey , & info_str , & flag );
213
216
if (flag ) {
214
217
opal_output (ompi_fs_base_framework .framework_output ,
215
- "GPFS Free Range is set: %s: %s\n" , gpfsHintsKey , value );
218
+ "GPFS Free Range is set: %s: %s\n" , gpfsHintsKey , info_str -> string );
216
219
gpfs_hint_FreeRange .gpfsFcntlHeader .totalLength = sizeof (gpfs_hint_FreeRange );
217
220
gpfs_hint_FreeRange .gpfsFcntlHeader .fcntlVersion = GPFS_FCNTL_CURRENT_VERSION ;
218
221
gpfs_hint_FreeRange .gpfsFcntlHeader .fcntlReserved = 0 ;
219
222
220
223
gpfs_hint_FreeRange .gpfsFreeRange .structLen =
221
224
sizeof (gpfs_hint_FreeRange .gpfsFreeRange );
222
225
gpfs_hint_FreeRange .gpfsFreeRange .structType = GPFS_FREE_RANGE ;
223
- token = strtok (value , split );
226
+ char * info_str_dup = strdup (info_str -> string );
227
+ OBJ_RELEASE (info_str );
228
+ token = strtok (info_str_dup , split );
224
229
gpfs_hint_FreeRange .gpfsFreeRange .start = atol (token );
225
230
token = strtok (NULL , split );
226
231
gpfs_hint_FreeRange .gpfsFreeRange .length = atol (token );
232
+ free (info_str_dup );
227
233
228
234
rc = gpfs_fcntl (gpfs_file_handle , & gpfs_hint_FreeRange );
229
235
if (rc != 0 ) {
@@ -241,10 +247,10 @@ int mca_fs_gpfs_file_set_info(ompio_file_t *fh, struct ompi_info_t *info)
241
247
242
248
//Setting GPFS Hint - gpfsClearFileCache
243
249
strcpy (gpfsHintsKey , "gpfsClearFileCache" );
244
- ompi_info_get (info_selected , gpfsHintsKey , valueLen , value , & flag );
245
- if (flag & ( strcmp ( value , "true" ) == 0 ) ) {
250
+ ompi_info_get_bool (info_selected , gpfsHintsKey , & info_bool , & flag );
251
+ if (flag && info_bool ) {
246
252
opal_output (ompi_fs_base_framework .framework_output ,
247
- "GPFS Clear File Cache is set: %s: %s \n" , gpfsHintsKey , value );
253
+ "GPFS Clear File Cache is set: %s\n" , gpfsHintsKey );
248
254
gpfs_hint_ClearFileCache .gpfsFcntlHeader .totalLength = sizeof (gpfs_hint_ClearFileCache );
249
255
gpfs_hint_ClearFileCache .gpfsFcntlHeader .fcntlVersion = GPFS_FCNTL_CURRENT_VERSION ;
250
256
gpfs_hint_ClearFileCache .gpfsFcntlHeader .fcntlReserved = 0 ;
@@ -265,10 +271,10 @@ int mca_fs_gpfs_file_set_info(ompio_file_t *fh, struct ompi_info_t *info)
265
271
266
272
//Setting GPFS Hint - gpfsCancelHints
267
273
strcpy (gpfsHintsKey , "gpfsCancelHints" );
268
- ompi_info_get (info_selected , gpfsHintsKey , valueLen , value , & flag );
269
- if (flag & ( strcmp ( value , "true" ) == 0 ) ) {
274
+ ompi_info_get_bool (info_selected , gpfsHintsKey , & info_bool , & flag );
275
+ if (flag && info_bool ) {
270
276
opal_output (ompi_fs_base_framework .framework_output ,
271
- "GPFS Cancel Hints is set: %s: %s \n" , gpfsHintsKey , value );
277
+ "GPFS Cancel Hints is set: %s\n" , gpfsHintsKey );
272
278
gpfs_hint_CancelHints .gpfsFcntlHeader .totalLength = sizeof (gpfs_hint_CancelHints );
273
279
gpfs_hint_CancelHints .gpfsFcntlHeader .fcntlVersion = GPFS_FCNTL_CURRENT_VERSION ;
274
280
gpfs_hint_CancelHints .gpfsFcntlHeader .fcntlReserved = 0 ;
@@ -289,23 +295,26 @@ int mca_fs_gpfs_file_set_info(ompio_file_t *fh, struct ompi_info_t *info)
289
295
290
296
//Setting GPFS Hint - gpfsSetReplication
291
297
strcpy (gpfsHintsKey , "gpfsSetReplication" );
292
- ompi_info_get (info_selected , gpfsHintsKey , valueLen , value , & flag );
298
+ ompi_info_get (info_selected , gpfsHintsKey , & info_str , & flag );
293
299
if (flag ) {
294
300
opal_output (ompi_fs_base_framework .framework_output ,
295
- "GPFS Set Replication is set: %s: %s\n" , gpfsHintsKey , value );
301
+ "GPFS Set Replication is set: %s: %s\n" , gpfsHintsKey , info_str -> string );
296
302
gpfs_hint_SetReplication .gpfsFcntlHeader .totalLength = sizeof (gpfs_hint_SetReplication );
297
303
gpfs_hint_SetReplication .gpfsFcntlHeader .fcntlVersion = GPFS_FCNTL_CURRENT_VERSION ;
298
304
gpfs_hint_SetReplication .gpfsFcntlHeader .fcntlReserved = 0 ;
299
305
300
306
gpfs_hint_SetReplication .gpfsSetReplication .structLen =
301
307
sizeof (gpfs_hint_SetReplication .gpfsSetReplication );
302
308
gpfs_hint_SetReplication .gpfsSetReplication .structType = GPFS_FCNTL_SET_REPLICATION ;
303
- token = strtok (value , split );
309
+ char * info_str_dup = strdup (info_str -> string );
310
+ OBJ_RELEASE (info_str );
311
+ token = strtok (info_str_dup , split );
304
312
gpfs_hint_SetReplication .gpfsSetReplication .metadataReplicas = atoi (token );
305
313
gpfs_hint_SetReplication .gpfsSetReplication .maxMetadataReplicas = atoi (token );
306
314
gpfs_hint_SetReplication .gpfsSetReplication .dataReplicas = atoi (token );
307
315
gpfs_hint_SetReplication .gpfsSetReplication .maxDataReplicas = atoi (token );
308
316
gpfs_hint_SetReplication .gpfsSetReplication .reserved = 0 ;
317
+ free (info_str_dup );
309
318
310
319
rc = gpfs_fcntl (gpfs_file_handle , & gpfs_hint_SetReplication );
311
320
if (rc != 0 ) {
@@ -322,18 +331,21 @@ int mca_fs_gpfs_file_set_info(ompio_file_t *fh, struct ompi_info_t *info)
322
331
323
332
//Setting GPFS Hint - gpfsByteRange
324
333
strcpy (gpfsHintsKey , "gpfsByteRange" );
325
- ompi_info_get (info_selected , gpfsHintsKey , valueLen , value , & flag );
334
+ ompi_info_get (info_selected , gpfsHintsKey , & info_str , & flag );
326
335
if (flag ) {
327
336
opal_output (ompi_fs_base_framework .framework_output ,
328
- "GPFS Byte Range is set: %s: %s\n" , gpfsHintsKey , value );
337
+ "GPFS Byte Range is set: %s: %s\n" , gpfsHintsKey , info_str -> string );
329
338
gpfs_hint_ByteRange .gpfsFcntlHeader .totalLength = sizeof (gpfs_hint_ByteRange );
330
339
gpfs_hint_ByteRange .gpfsFcntlHeader .fcntlVersion = GPFS_FCNTL_CURRENT_VERSION ;
331
340
gpfs_hint_ByteRange .gpfsFcntlHeader .fcntlReserved = 0 ;
332
341
333
- token = strtok (value , split );
342
+ char * info_str_dup = strdup (info_str -> string );
343
+ OBJ_RELEASE (info_str );
344
+ token = strtok (info_str_dup , split );
334
345
gpfs_hint_ByteRange .gpfsByteRange .startOffset = atol (token );
335
- token = strtok (value , split );
346
+ token = strtok (NULL , split );
336
347
gpfs_hint_ByteRange .gpfsByteRange .numOfBlks = atol (token );
348
+ free (info_str_dup );
337
349
338
350
rc = gpfs_fcntl (gpfs_file_handle , & gpfs_hint_ByteRange );
339
351
if (rc != 0 ) {
@@ -347,21 +359,24 @@ int mca_fs_gpfs_file_set_info(ompio_file_t *fh, struct ompi_info_t *info)
347
359
348
360
//Setting GPFS Hint - gpfsRestripeData
349
361
strcpy (gpfsHintsKey , "gpfsRestripeData" );
350
- ompi_info_get (info_selected , gpfsHintsKey , valueLen , value , & flag );
362
+ ompi_info_get (info_selected , gpfsHintsKey , & info_str , & flag );
351
363
if (flag ) {
352
364
opal_output (ompi_fs_base_framework .framework_output ,
353
- "GPFS Restripe Data is set: %s: %s\n" , gpfsHintsKey , value );
365
+ "GPFS Restripe Data is set: %s: %s\n" , gpfsHintsKey , info_str -> string );
354
366
gpfs_hint_RestripeData .gpfsFcntlHeader .totalLength = sizeof (gpfs_hint_RestripeData );
355
367
gpfs_hint_RestripeData .gpfsFcntlHeader .fcntlVersion = GPFS_FCNTL_CURRENT_VERSION ;
356
368
gpfs_hint_RestripeData .gpfsFcntlHeader .fcntlReserved = 0 ;
357
369
358
370
gpfs_hint_RestripeData .gpfsRestripeData .structLen =
359
371
sizeof (gpfs_hint_RestripeData .gpfsRestripeData );
360
372
gpfs_hint_RestripeData .gpfsRestripeData .structType = GPFS_FCNTL_RESTRIPE_DATA ;
361
- token = strtok (value , split );
373
+ char * info_str_dup = strdup (info_str -> string );
374
+ OBJ_RELEASE (info_str );
375
+ token = strtok (info_str_dup , split );
362
376
gpfs_hint_RestripeData .gpfsRestripeData .options = atoi (token );
363
377
gpfs_hint_RestripeData .gpfsRestripeData .reserved1 = 0 ;
364
378
gpfs_hint_RestripeData .gpfsRestripeData .reserved2 = 0 ;
379
+ free (info_str_dup );
365
380
366
381
rc = gpfs_fcntl (gpfs_file_handle , & gpfs_hint_RestripeData );
367
382
if (rc != 0 ) {
0 commit comments