@@ -44,9 +44,9 @@ int mca_fs_gpfs_file_set_info(ompio_file_t *fh, struct ompi_info_t *info)
4444{
4545 int rc = 0 ;
4646 int flag ;
47- int valueLen = MPI_MAX_INFO_VAL ;
48- char value [MPI_MAX_INFO_VAL + 1 ];
47+ opal_cstring_t * info_str ;
4948 char gpfsHintsKey [50 ];
49+ bool info_bool ;
5050 const char * split = "," ;
5151 char * token ;
5252 int ret = OMPI_SUCCESS ;
@@ -163,9 +163,9 @@ int mca_fs_gpfs_file_set_info(ompio_file_t *fh, struct ompi_info_t *info)
163163 */
164164
165165 strcpy (gpfsHintsKey , "useSIOXLib" );
166- ompi_info_get (info_selected , gpfsHintsKey , valueLen , value , & flag );
166+ ompi_info_get_bool (info_selected , gpfsHintsKey , & info_bool , & flag );
167167 if (flag ) {
168- if (strcmp ( value , "true" ) == 0 ) {
168+ if (info_bool ) {
169169 //using the SIOX lib and the I/O pattern selection
170170 ret = mca_fs_gpfs_io_selection (fh , info , info_selected );
171171 if (ret != OMPI_SUCCESS )
@@ -179,23 +179,26 @@ int mca_fs_gpfs_file_set_info(ompio_file_t *fh, struct ompi_info_t *info)
179179
180180 //Setting GPFS Hint - gpfsAccessRange
181181 strcpy (gpfsHintsKey , "gpfsAccessRange" );
182- ompi_info_get (info_selected , gpfsHintsKey , valueLen , value , & flag );
182+ ompi_info_get (info_selected , gpfsHintsKey , & info_str , & flag );
183183 if (flag ) {
184184 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 );
186186 gpfs_hint_AccessRange .gpfsFcntlHeader .totalLength = sizeof (gpfs_hint_AccessRange );
187187 gpfs_hint_AccessRange .gpfsFcntlHeader .fcntlVersion = GPFS_FCNTL_CURRENT_VERSION ;
188188 gpfs_hint_AccessRange .gpfsFcntlHeader .fcntlReserved = 0 ;
189189
190190 gpfs_hint_AccessRange .gpfsAccessRange .structLen =
191191 sizeof (gpfs_hint_AccessRange .gpfsAccessRange );
192192 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 );
194196 gpfs_hint_AccessRange .gpfsAccessRange .start = atol (token );
195197 token = strtok (NULL , split );
196198 gpfs_hint_AccessRange .gpfsAccessRange .length = atol (token );
197199 token = strtok (NULL , split );
198200 gpfs_hint_AccessRange .gpfsAccessRange .isWrite = atoi (token );
201+ free (info_str_dup );
199202
200203 rc = gpfs_fcntl (gpfs_file_handle , & gpfs_hint_AccessRange );
201204 if (rc != 0 ) {
@@ -209,21 +212,24 @@ int mca_fs_gpfs_file_set_info(ompio_file_t *fh, struct ompi_info_t *info)
209212
210213 //Setting GPFS Hint - gpfsFreeRange
211214 strcpy (gpfsHintsKey , "gpfsFreeRange" );
212- ompi_info_get (info_selected , gpfsHintsKey , valueLen , value , & flag );
215+ ompi_info_get (info_selected , gpfsHintsKey , & info_str , & flag );
213216 if (flag ) {
214217 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 );
216219 gpfs_hint_FreeRange .gpfsFcntlHeader .totalLength = sizeof (gpfs_hint_FreeRange );
217220 gpfs_hint_FreeRange .gpfsFcntlHeader .fcntlVersion = GPFS_FCNTL_CURRENT_VERSION ;
218221 gpfs_hint_FreeRange .gpfsFcntlHeader .fcntlReserved = 0 ;
219222
220223 gpfs_hint_FreeRange .gpfsFreeRange .structLen =
221224 sizeof (gpfs_hint_FreeRange .gpfsFreeRange );
222225 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 );
224229 gpfs_hint_FreeRange .gpfsFreeRange .start = atol (token );
225230 token = strtok (NULL , split );
226231 gpfs_hint_FreeRange .gpfsFreeRange .length = atol (token );
232+ free (info_str_dup );
227233
228234 rc = gpfs_fcntl (gpfs_file_handle , & gpfs_hint_FreeRange );
229235 if (rc != 0 ) {
@@ -241,10 +247,10 @@ int mca_fs_gpfs_file_set_info(ompio_file_t *fh, struct ompi_info_t *info)
241247
242248 //Setting GPFS Hint - gpfsClearFileCache
243249 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 ) {
246252 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 );
248254 gpfs_hint_ClearFileCache .gpfsFcntlHeader .totalLength = sizeof (gpfs_hint_ClearFileCache );
249255 gpfs_hint_ClearFileCache .gpfsFcntlHeader .fcntlVersion = GPFS_FCNTL_CURRENT_VERSION ;
250256 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)
265271
266272 //Setting GPFS Hint - gpfsCancelHints
267273 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 ) {
270276 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 );
272278 gpfs_hint_CancelHints .gpfsFcntlHeader .totalLength = sizeof (gpfs_hint_CancelHints );
273279 gpfs_hint_CancelHints .gpfsFcntlHeader .fcntlVersion = GPFS_FCNTL_CURRENT_VERSION ;
274280 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)
289295
290296 //Setting GPFS Hint - gpfsSetReplication
291297 strcpy (gpfsHintsKey , "gpfsSetReplication" );
292- ompi_info_get (info_selected , gpfsHintsKey , valueLen , value , & flag );
298+ ompi_info_get (info_selected , gpfsHintsKey , & info_str , & flag );
293299 if (flag ) {
294300 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 );
296302 gpfs_hint_SetReplication .gpfsFcntlHeader .totalLength = sizeof (gpfs_hint_SetReplication );
297303 gpfs_hint_SetReplication .gpfsFcntlHeader .fcntlVersion = GPFS_FCNTL_CURRENT_VERSION ;
298304 gpfs_hint_SetReplication .gpfsFcntlHeader .fcntlReserved = 0 ;
299305
300306 gpfs_hint_SetReplication .gpfsSetReplication .structLen =
301307 sizeof (gpfs_hint_SetReplication .gpfsSetReplication );
302308 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 );
304312 gpfs_hint_SetReplication .gpfsSetReplication .metadataReplicas = atoi (token );
305313 gpfs_hint_SetReplication .gpfsSetReplication .maxMetadataReplicas = atoi (token );
306314 gpfs_hint_SetReplication .gpfsSetReplication .dataReplicas = atoi (token );
307315 gpfs_hint_SetReplication .gpfsSetReplication .maxDataReplicas = atoi (token );
308316 gpfs_hint_SetReplication .gpfsSetReplication .reserved = 0 ;
317+ free (info_str_dup );
309318
310319 rc = gpfs_fcntl (gpfs_file_handle , & gpfs_hint_SetReplication );
311320 if (rc != 0 ) {
@@ -322,18 +331,21 @@ int mca_fs_gpfs_file_set_info(ompio_file_t *fh, struct ompi_info_t *info)
322331
323332 //Setting GPFS Hint - gpfsByteRange
324333 strcpy (gpfsHintsKey , "gpfsByteRange" );
325- ompi_info_get (info_selected , gpfsHintsKey , valueLen , value , & flag );
334+ ompi_info_get (info_selected , gpfsHintsKey , & info_str , & flag );
326335 if (flag ) {
327336 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 );
329338 gpfs_hint_ByteRange .gpfsFcntlHeader .totalLength = sizeof (gpfs_hint_ByteRange );
330339 gpfs_hint_ByteRange .gpfsFcntlHeader .fcntlVersion = GPFS_FCNTL_CURRENT_VERSION ;
331340 gpfs_hint_ByteRange .gpfsFcntlHeader .fcntlReserved = 0 ;
332341
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 );
334345 gpfs_hint_ByteRange .gpfsByteRange .startOffset = atol (token );
335- token = strtok (value , split );
346+ token = strtok (NULL , split );
336347 gpfs_hint_ByteRange .gpfsByteRange .numOfBlks = atol (token );
348+ free (info_str_dup );
337349
338350 rc = gpfs_fcntl (gpfs_file_handle , & gpfs_hint_ByteRange );
339351 if (rc != 0 ) {
@@ -347,21 +359,24 @@ int mca_fs_gpfs_file_set_info(ompio_file_t *fh, struct ompi_info_t *info)
347359
348360 //Setting GPFS Hint - gpfsRestripeData
349361 strcpy (gpfsHintsKey , "gpfsRestripeData" );
350- ompi_info_get (info_selected , gpfsHintsKey , valueLen , value , & flag );
362+ ompi_info_get (info_selected , gpfsHintsKey , & info_str , & flag );
351363 if (flag ) {
352364 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 );
354366 gpfs_hint_RestripeData .gpfsFcntlHeader .totalLength = sizeof (gpfs_hint_RestripeData );
355367 gpfs_hint_RestripeData .gpfsFcntlHeader .fcntlVersion = GPFS_FCNTL_CURRENT_VERSION ;
356368 gpfs_hint_RestripeData .gpfsFcntlHeader .fcntlReserved = 0 ;
357369
358370 gpfs_hint_RestripeData .gpfsRestripeData .structLen =
359371 sizeof (gpfs_hint_RestripeData .gpfsRestripeData );
360372 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 );
362376 gpfs_hint_RestripeData .gpfsRestripeData .options = atoi (token );
363377 gpfs_hint_RestripeData .gpfsRestripeData .reserved1 = 0 ;
364378 gpfs_hint_RestripeData .gpfsRestripeData .reserved2 = 0 ;
379+ free (info_str_dup );
365380
366381 rc = gpfs_fcntl (gpfs_file_handle , & gpfs_hint_RestripeData );
367382 if (rc != 0 ) {
0 commit comments