AMPI #952: update ROMIO to MPICH2-1.4.1p1
[charm.git] / src / libs / ck-libs / ampi / romio / adio / common / ad_fstype.c
blob5cd9ae2b26b1731410aa1864ba553468c9ed0efe
1 /* -*- Mode: C; c-basic-offset:4 ; -*- */
2 /*
3 * Copyright (C) 1997 University of Chicago.
4 * See COPYRIGHT notice in top-level directory.
5 */
7 /* This file is quickly becoming the single one, outside the ADIO
8 * implementations, which has "what ADIO components are built in" code in it.
9 */
11 #include "adio.h"
13 #ifdef HAVE_UNISTD_H
14 #include <unistd.h>
15 #endif
17 #ifdef HAVE_SYS_PARAM_H
18 #include <sys/param.h>
19 #endif
21 #ifdef HAVE_PVFS_H
22 #include "pvfs.h"
23 #endif
25 #ifdef HAVE_PVFS2_H
26 #include "pvfs2.h"
27 #endif
29 #ifdef HAVE_ZOIDFS_H
30 #include "zoidfs.h"
31 #endif
33 /* Notes on detection process:
35 * There are three more "general" mechanisms that we use for detecting
36 * file system type:
37 * - struct statfs's f_type field
38 * - struct statvfs's f_basetype field
39 * - struct stat's st_fstype field
41 * Otherwise we'll fall back on some OS-specific approach.
44 #ifdef HAVE_STRUCT_STATFS
45 # ifdef HAVE_SYS_VFS_H
46 # include <sys/vfs.h>
47 # endif
48 # ifdef HAVE_SYS_STATVFS_H
49 # include <sys/statvfs.h>
50 # endif
51 # ifdef HAVE_SYS_PARAM_H
52 # include <sys/param.h>
53 # endif
54 # ifdef HAVE_SYS_MOUNT_H
55 # include <sys/mount.h>
56 # endif
57 /* On Linux platforms, linux/nfs_fs.h is all messed up and cannot be
58 * reliably included.
60 # if defined(ROMIO_NFS) && !defined(NFS_SUPER_MAGIC)
61 # define NFS_SUPER_MAGIC 0x6969
62 # endif
64 # if defined(ROMIO_PANFS) && !defined(PAN_KERNEL_FS_CLIENT_SUPER_MAGIC)
65 # define PAN_KERNEL_FS_CLIENT_SUPER_MAGIC 0xAAD7AAEA
66 # endif
67 #endif
69 # if defined(ROMIO_XFS) && !defined(XFS_SUPER_MAGIC)
70 # define XFS_SUPER_MAGIC 0x58465342
71 # endif
73 #if !defined(PVFS2_SUPER_MAGIC)
74 #define PVFS2_SUPER_MAGIC (0x20030528)
75 #endif
77 #ifdef ROMIO_HAVE_STRUCT_STATVFS_WITH_F_BASETYPE
78 # ifdef HAVE_SYS_STATVFS_H
79 # include <sys/statvfs.h>
80 # endif
81 # ifdef HAVE_SYS_VFS_H
82 # include <sys/vfs.h>
83 # endif
84 # ifdef HAVE_SYS_PARAM_H
85 # include <sys/param.h>
86 # endif
87 # ifdef HAVE_SYS_MOUNT_H
88 # include <sys/mount.h>
89 # endif
90 #endif
92 #ifdef ROMIO_HAVE_STRUCT_STAT_WITH_ST_FSTYPE
93 # ifdef HAVE_SYS_TYPES_H
94 # include <sys/types.h>
95 # endif
96 # ifdef HAVE_SYS_STAT_H
97 # include <sys/stat.h>
98 # endif
99 #endif
101 /* ADIO_FileSysType_parentdir is only used if one of these is defined.
102 By including this test, we avoid warnings about unused static functions
103 from the compiler */
104 #if defined(ROMIO_HAVE_STRUCT_STATVFS_WITH_F_BASETYPE) || \
105 defined(HAVE_STRUCT_STATFS) || \
106 defined(ROMIO_HAVE_STRUCT_STAT_WITH_ST_FSTYPE)
107 #ifndef ROMIO_NTFS
108 #define ROMIO_NEEDS_ADIOPARENTDIR
109 static void ADIO_FileSysType_parentdir(char *filename, char **dirnamep);
110 #endif
111 #endif
112 static void ADIO_FileSysType_prefix(char *filename, int *fstype,
113 int *error_code);
114 static void ADIO_FileSysType_fncall(char *filename, int *fstype,
115 int *error_code);
118 ADIO_FileSysType_parentdir - determines a string pathname for the
119 parent directory of a given filename.
121 Input Parameters:
122 . filename - pointer to file name character array
124 Output Parameters:
125 . dirnamep - pointer to location in which to store a pointer to a string
127 Note that the caller should free the memory located at the pointer returned
128 after the string is no longer needed.
130 #ifdef ROMIO_NEEDS_ADIOPARENTDIR
132 #ifndef PATH_MAX
133 #define PATH_MAX 65535
134 #endif
136 /* In a strict ANSI environment, S_ISLNK may not be defined. Fix that
137 here. We assume that S_ISLNK is *always* defined as a macro. If
138 that is not universally true, then add a test to the romio
139 configure that trys to link a program that references S_ISLNK */
140 #if !defined(S_ISLNK)
141 # if defined(S_IFLNK)
142 /* Check for the link bit */
143 # define S_ISLNK(mode) ((mode) & S_IFLNK)
144 # else
145 /* no way to check if it is a link, so say false */
146 # define S_ISLNK(mode) 0
147 # endif
148 #endif /* !(S_ISLNK) */
150 /* ADIO_FileSysType_parentdir
152 * Returns pointer to string in dirnamep; that string is allocated with
153 * strdup and must be free()'d.
155 static void ADIO_FileSysType_parentdir(char *filename, char **dirnamep)
157 int err;
158 char *dir = NULL, *slash;
159 struct stat statbuf;
161 err = lstat(filename, &statbuf);
163 if (err || (!S_ISLNK(statbuf.st_mode))) {
164 /* no such file, or file is not a link; these are the "normal"
165 * cases where we can just return the parent directory.
167 dir = ADIOI_Strdup(filename);
169 else {
170 /* filename is a symlink. we've presumably already tried
171 * to stat it and found it to be missing (dangling link),
172 * but this code doesn't care if the target is really there
173 * or not.
175 int namelen;
176 char *linkbuf;
178 linkbuf = ADIOI_Malloc(PATH_MAX+1);
179 namelen = readlink(filename, linkbuf, PATH_MAX+1);
180 if (namelen == -1) {
181 /* something strange has happened between the time that
182 * we determined that this was a link and the time that
183 * we attempted to read it; punt and use the old name.
185 dir = ADIOI_Strdup(filename);
187 else {
188 /* successfully read the link */
189 linkbuf[namelen] = '\0'; /* readlink doesn't null terminate */
190 dir = ADIOI_Strdup(linkbuf);
191 ADIOI_Free(linkbuf);
195 slash = strrchr(dir, '/');
196 if (!slash) ADIOI_Strncpy(dir, ".", 2);
197 else {
198 if (slash == dir) *(dir + 1) = '\0';
199 else *slash = '\0';
202 *dirnamep = dir;
203 return;
205 #endif /* ROMIO_NTFS */
207 #ifdef ROMIO_BGL /* BlueGene support for lockless i/o (necessary for PVFS.
208 possibly beneficial for others, unless data sieving
209 writes desired) */
211 /* BlueGene environment variables can override lockless selection.*/
212 extern void ad_bgl_get_env_vars();
213 extern long bglocklessmpio_f_type;
215 static void check_for_lockless_exceptions(long stat_type, int *fstype)
217 /* exception for lockless file systems. (PVFS2 is the default in ad_bgl_tuning.)
218 * The BGLOCKLESS_F_TYPE environment variable will override it by specifying
219 * the appropriate file system magic number here.
221 if (stat_type == bglocklessmpio_f_type)
222 /* use lock-free driver on bluegene to support specified fs (defaults to pvfs2) */
223 *fstype = ADIO_BGLOCKLESS;
225 #endif
227 ADIO_FileSysType_fncall - determines the file system type for a given file
228 using a system-dependent function call
230 Input Parameters:
231 . filename - pointer to file name character array
233 Output Parameters:
234 . fstype - location in which to store file system type (ADIO_XXX)
235 . error_code - location in which to store error code
237 MPI_SUCCESS is stored in the location pointed to by error_code on success.
239 This function is used by MPI_File_open() and MPI_File_delete() to determine
240 file system type. Most other functions use the type which is stored when the
241 file is opened.
243 static void ADIO_FileSysType_fncall(char *filename, int *fstype, int *error_code)
245 #ifndef ROMIO_NTFS
246 char *dir;
247 int err;
248 #endif
250 #ifdef ROMIO_HAVE_STRUCT_STATVFS_WITH_F_BASETYPE
251 struct statvfs vfsbuf;
252 #endif
253 #ifdef HAVE_STRUCT_STATFS
254 struct statfs fsbuf;
255 #endif
256 #ifdef ROMIO_HAVE_STRUCT_STAT_WITH_ST_FSTYPE
257 struct stat sbuf;
258 #endif
259 static char myname[] = "ADIO_RESOLVEFILETYPE_FNCALL";
261 *error_code = MPI_SUCCESS;
263 #ifdef ROMIO_HAVE_STRUCT_STATVFS_WITH_F_BASETYPE
264 do {
265 err = statvfs(filename, &vfsbuf);
266 } while (err && (errno == ESTALE));
268 if (err && (errno == ENOENT)) {
269 /* ENOENT may be returned in two cases:
270 * 1) no directory entry for "filename"
271 * 2) "filename" is a dangling symbolic link
273 * ADIO_FileSysType_parentdir tries to deal with both cases.
275 ADIO_FileSysType_parentdir(filename, &dir);
276 err = statvfs(dir, &vfsbuf);
278 ADIOI_Free(dir);
281 /* --BEGIN ERROR HANDLING-- */
282 if (err) {
283 *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
284 myname, __LINE__, MPI_ERR_NO_SUCH_FILE,
285 "**filename", "**filename %s", filename);
286 return;
288 /* --END ERROR HANDLING-- */
290 /* FPRINTF(stderr, "%s\n", vfsbuf.f_basetype); */
291 if (!strncmp(vfsbuf.f_basetype, "nfs", 3)) {
292 *fstype = ADIO_NFS;
293 return;
295 if (!strncmp(vfsbuf.f_basetype, "xfs", 3)) {
296 *fstype = ADIO_XFS;
297 return;
300 # ifdef ROMIO_UFS
301 /* if UFS support is enabled, default to that */
302 *fstype = ADIO_UFS;
303 return;
304 # endif
306 /* --BEGIN ERROR HANDLING-- */
307 *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
308 myname, __LINE__, MPI_ERR_NO_SUCH_FILE,
309 "**filename", "**filename %s", filename);
310 /* --END ERROR HANDLING-- */
311 #endif /* STATVFS APPROACH */
313 #ifdef HAVE_STRUCT_STATFS
314 do {
315 err = statfs(filename, &fsbuf);
316 } while (err && (errno == ESTALE));
318 if (err && (errno == ENOENT)) {
319 ADIO_FileSysType_parentdir(filename, &dir);
320 err = statfs(dir, &fsbuf);
321 ADIOI_Free(dir);
324 /* --BEGIN ERROR HANDLING-- */
325 if (err) {
326 *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
327 myname, __LINE__, MPI_ERR_NO_SUCH_FILE,
328 "**filename", "**filename %s", filename);
329 return;
331 /* --END ERROR HANDLING-- */
333 # ifdef ROMIO_HAVE_STRUCT_STATFS_WITH_F_FSTYPENAME
334 if ( !strncmp("nfs",fsbuf.f_fstypename,3) ) {
335 *fstype = ADIO_NFS;
336 return;
338 # endif
340 # ifdef ROMIO_BGL
341 /* BlueGene is a special case: all file systems are AD_BGL, except for
342 * certain exceptions */
344 /* Bluegene needs to read enviroment variables before selecting the file system*/
345 ad_bgl_get_env_vars();
347 *fstype = ADIO_BGL;
348 check_for_lockless_exceptions(fsbuf.f_type, fstype);
349 *error_code = MPI_SUCCESS;
350 return;
351 # endif
353 /* FPRINTF(stderr, "%d\n", fsbuf.f_type);*/
354 # ifdef NFS_SUPER_MAGIC
355 if (fsbuf.f_type == NFS_SUPER_MAGIC) {
356 *fstype = ADIO_NFS;
357 return;
359 # endif
361 #ifdef ROMIO_LUSTRE
362 # ifndef LL_SUPER_MAGIC
363 # define LL_SUPER_MAGIC 0x0BD00BD0
364 # endif
365 if (fsbuf.f_type == LL_SUPER_MAGIC) {
366 *fstype = ADIO_LUSTRE;
367 return;
369 #endif
371 # ifdef PAN_KERNEL_FS_CLIENT_SUPER_MAGIC
372 if (fsbuf.f_type == PAN_KERNEL_FS_CLIENT_SUPER_MAGIC) {
373 *fstype = ADIO_PANFS;
374 return;
376 # endif
378 # ifdef MOUNT_NFS
379 if (fsbuf.f_type == MOUNT_NFS) {
380 *fstype = ADIO_NFS;
381 return;
383 # endif
385 # ifdef MOUNT_PFS
386 if (fsbuf.f_type == MOUNT_PFS) {
387 *fstype = ADIO_PFS;
388 return;
390 # endif
392 # ifdef PVFS_SUPER_MAGIC
393 if (fsbuf.f_type == PVFS_SUPER_MAGIC) {
394 *fstype = ADIO_PVFS;
395 return;
397 # endif
399 # ifdef PVFS2_SUPER_MAGIC
400 if (fsbuf.f_type == PVFS2_SUPER_MAGIC) {
401 *fstype = ADIO_PVFS2;
402 return;
404 # endif
406 # ifdef XFS_SUPER_MAGIC
407 if (fsbuf.f_type == XFS_SUPER_MAGIC) {
408 *fstype = ADIO_XFS;
409 return;
411 # endif
413 # ifdef ROMIO_UFS
414 /* if UFS support is enabled, default to that */
415 *fstype = ADIO_UFS;
416 return;
417 # endif
418 /* --BEGIN ERROR HANDLING-- */
419 *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
420 myname, __LINE__, MPI_ERR_NO_SUCH_FILE,
421 "**filename", "**filename %s", filename);
422 /* --END ERROR HANDLING-- */
423 #endif /* STATFS APPROACH */
425 #ifdef ROMIO_HAVE_STRUCT_STAT_WITH_ST_FSTYPE
426 do {
427 err = stat(filename, &sbuf);
428 } while (err && (errno == ESTALE));
430 if (err && (errno == ENOENT)) {
431 ADIO_FileSysType_parentdir(filename, &dir);
432 err = stat(dir, &sbuf);
433 ADIOI_Free(dir);
436 if (err) {
437 /* --BEGIN ERROR HANDLING-- */
438 *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
439 myname, __LINE__, MPI_ERR_NO_SUCH_FILE,
440 "**filename", "**filename %s", filename);
441 /* --END ERROR HANDLING-- */
442 return;
444 else {
445 if (!strcmp(sbuf.st_fstype, "nfs")) *fstype = ADIO_NFS;
446 else *fstype = ADIO_SFS; /* assuming SX4 for now */
448 #endif /* STAT APPROACH */
450 #ifdef ROMIO_NTFS
451 ADIOI_UNREFERENCED_ARG(filename);
452 ADIOI_UNREFERENCED_ARG(error_code);
453 *fstype = ADIO_NTFS; /* only supported FS on Windows */
454 #elif defined(ROMIO_NFS)
455 *fstype = ADIO_NFS;
456 #elif defined(ROMIO_UFS)
457 *fstype = ADIO_UFS;
458 #else
459 /* --BEGIN ERROR HANDLING-- */
460 *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
461 myname, __LINE__, MPI_ERR_NO_SUCH_FILE,
462 "**filename", "**filename %s", filename);
463 /* --END ERROR HANDLING-- */
464 #endif
467 /* all proceeses opening, creating, or deleting a file end up invoking several
468 * stat system calls (unless a fs prefix is given). Cary out this file system
469 * detection in a more scalable way by having rank 0 stat the file and broadcast the result (fs type and error code) to the other mpi processes */
471 static void ADIO_FileSysType_fncall_scalable(MPI_Comm comm, char *filename, int * file_system, int * error_code)
473 int rank;
474 int buf[2];
475 MPI_Comm_rank(comm, &rank);
477 if (rank == 0) {
478 ADIO_FileSysType_fncall(filename, file_system, error_code);
479 buf[0] = *file_system;
480 buf[1] = *error_code;
482 MPI_Bcast(buf, 2, MPI_INT, 0, comm);
483 *file_system = buf[0];
484 *error_code = buf[1];
490 ADIO_FileSysType_prefix - determines file system type for a file using
491 a prefix on the file name. upper layer should have already determined
492 that a prefix is present.
494 Input Parameters:
495 . filename - path to file, including prefix (xxx:)
497 Output Parameters:
498 . fstype - pointer to integer in which to store file system type (ADIO_XXX)
499 . error_code - pointer to integer in which to store error code
501 Returns MPI_SUCCESS in error_code on success. Filename not having a prefix
502 is considered an error. Except for on Windows systems where the default is NTFS.
505 static void ADIO_FileSysType_prefix(char *filename, int *fstype, int *error_code)
507 static char myname[] = "ADIO_RESOLVEFILETYPE_PREFIX";
508 *error_code = MPI_SUCCESS;
510 if (!strncmp(filename, "pfs:", 4) || !strncmp(filename, "PFS:", 4)) {
511 *fstype = ADIO_PFS;
513 else if (!strncmp(filename, "piofs:", 6) || !strncmp(filename, "PIOFS:", 6)) {
514 *fstype = ADIO_PIOFS;
516 else if (!strncmp(filename, "ufs:", 4) || !strncmp(filename, "UFS:", 4)) {
517 *fstype = ADIO_UFS;
519 else if (!strncmp(filename, "nfs:", 4) || !strncmp(filename, "NFS:", 4)) {
520 *fstype = ADIO_NFS;
522 else if (!strncmp(filename, "panfs:", 6) || !strncmp(filename, "PANFS:", 6)) {
523 *fstype = ADIO_PANFS;
525 else if (!strncmp(filename, "hfs:", 4) || !strncmp(filename, "HFS:", 4)) {
526 *fstype = ADIO_HFS;
528 else if (!strncmp(filename, "xfs:", 4) || !strncmp(filename, "XFS:", 4)) {
529 *fstype = ADIO_XFS;
531 else if (!strncmp(filename, "sfs:", 4) || !strncmp(filename, "SFS:", 4)) {
532 *fstype = ADIO_SFS;
534 else if (!strncmp(filename, "pvfs:", 5) || !strncmp(filename, "PVFS:", 5)) {
535 *fstype = ADIO_PVFS;
537 else if (!strncmp(filename, "pvfs2:", 6)||!strncmp(filename, "PVFS2:", 6)) {
538 *fstype = ADIO_PVFS2;
540 else if (!strncmp(filename, "zoidfs:", 7)||
541 !strncmp(filename, "ZOIDFS:", 7)) {
542 *fstype = ADIO_ZOIDFS;
544 else if (!strncmp(filename, "testfs:", 7)
545 || !strncmp(filename, "TESTFS:", 7))
547 *fstype = ADIO_TESTFS;
549 else if (!strncmp(filename, "ftp:", 4)
550 || !strncmp(filename, "gsiftp:", 7))
552 *fstype = ADIO_GRIDFTP;
554 else if (!strncmp(filename, "lustre:", 7)
555 || !strncmp(filename, "LUSTRE:", 7))
557 *fstype = ADIO_LUSTRE;
559 else if (!strncmp(filename, "bgl:", 4) || !strncmp(filename, "BGL:", 4)) {
560 *fstype = ADIO_BGL;
562 else if (!strncmp(filename, "bglockless:", 11) ||
563 !strncmp(filename, "BGLOCKLESS:", 11)) {
564 *fstype = ADIO_BGLOCKLESS;
566 else {
567 #ifdef ROMIO_NTFS
568 *fstype = ADIO_NTFS;
569 #else
570 *fstype = 0;
571 /* --BEGIN ERROR HANDLING-- */
572 *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
573 myname, __LINE__, MPI_ERR_NO_SUCH_FILE,
574 "**filename", "**filename %s", filename);
575 /* --END ERROR HANDLING-- */
576 #endif
581 ADIO_ResolveFileType - determines file system type and operations from
582 file name string; this is a collective call
584 Input Parameters:
585 . comm - communicator across which collective open is performed
586 . filename - name of file (string)
588 Output Parameters:
589 . fstype - (pointer to) int holding file system type
590 . ops - (address of) pointer to table of valid file operations
591 . error_code - (pointer to) int holding error code
593 Notes:
594 This code used to be in MPI_File_open(), but it has been moved into here in
595 order to clean things up. The goal is to separate all this "did we compile
596 for this fs type" code from the MPI layer and also to introduce the ADIOI_Fns
597 tables in a reasonable way. -- Rob, 06/06/2001
599 void ADIO_ResolveFileType(MPI_Comm comm, char *filename, int *fstype,
600 ADIOI_Fns **ops, int *error_code)
602 int myerrcode, file_system, min_code, max_code;
603 char *tmp;
604 static char myname[] = "ADIO_RESOLVEFILETYPE";
606 file_system = -1;
607 tmp = strchr(filename, ':');
608 if (!tmp) {
609 int have_nfs_enabled=0;
610 *error_code = MPI_SUCCESS;
611 /* no prefix; use system-dependent function call to determine type */
612 /* Optimization: we can reduce the 'storm of stats' that result from
613 * thousands of mpi processes determinig file type this way. Let us
614 * have just one process stat the file and broadcast the result to
615 * everyone else.
616 * - Note that we will not catch cases like
617 * http://www.mcs.anl.gov/web-mail-archive/lists/mpich-discuss/2007/08/msg00042.html
618 * (edit: now http://lists.mcs.anl.gov/pipermail/mpich-discuss/2007-August/002648.html)
620 * where file systems are not mounted or available on other processes,
621 * but we'll catch those a few functions later in ADIO_Open
622 * - Note that if we have NFS enabled, we might have a situation where,
623 * for example, /home/user/data.out is UFS on one process but NFS on
624 * others, so we won't perform this optimization if NFS is enabled.
625 * - Another point: error codes and file system types are broadcast to
626 * all members of the communicator, so we get to skip the allreduce
627 * steps*/
629 #ifdef ROMIO_NFS
630 have_nfs_enabled=1;
631 #endif
632 if (!have_nfs_enabled) {
633 ADIO_FileSysType_fncall_scalable(comm, filename, &file_system, &myerrcode);
634 if (myerrcode != MPI_SUCCESS) {
635 *error_code = myerrcode;
636 return;
638 } else {
639 ADIO_FileSysType_fncall(filename, &file_system, &myerrcode);
640 if (myerrcode != MPI_SUCCESS) {
641 *error_code = myerrcode;
643 /* the check for file system type will hang if any process got
644 * an error in ADIO_FileSysType_fncall. Processes encountering
645 * an error will return early, before the collective file
646 * system type check below. This case could happen if a full
647 * path exists on one node but not on others, and no prefix
648 * like ufs: was provided. see discussion at
649 * http://www.mcs.anl.gov/web-mail-archive/lists/mpich-discuss/2007/08/msg00042.html
650 * (edit: now
651 * http://lists.mcs.anl.gov/pipermail/mpich-discuss/2007-August/002648.html)
654 MPI_Allreduce(error_code, &max_code, 1, MPI_INT, MPI_MAX, comm);
655 if (max_code != MPI_SUCCESS) {
656 *error_code = max_code;
657 return;
659 /* ensure everyone came up with the same file system type */
660 MPI_Allreduce(&file_system, &min_code, 1, MPI_INT,
661 MPI_MIN, comm);
662 if (min_code == ADIO_NFS) file_system = ADIO_NFS;
667 else {
668 /* prefix specified; just match via prefix and assume everyone got
669 * the same thing.
671 * perhaps we should have this code go through the allreduce as well?
673 ADIO_FileSysType_prefix(filename, &file_system, &myerrcode);
674 if (myerrcode != MPI_SUCCESS) {
675 *error_code = myerrcode;
676 return;
680 /* verify that we support this file system type and set ops pointer */
681 if (file_system == ADIO_PFS) {
682 #ifndef ROMIO_PFS
683 *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
684 myname, __LINE__, MPI_ERR_IO,
685 "**iofstypeunsupported", 0);
686 return;
687 #else
688 *ops = &ADIO_PFS_operations;
689 #endif
691 if (file_system == ADIO_PIOFS) {
692 #ifndef ROMIO_PIOFS
693 *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
694 myname, __LINE__, MPI_ERR_IO,
695 "**iofstypeunsupported", 0);
696 return;
697 #else
698 *ops = &ADIO_PIOFS_operations;
699 #endif
701 if (file_system == ADIO_UFS) {
702 #ifndef ROMIO_UFS
703 *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
704 myname, __LINE__, MPI_ERR_IO,
705 "**iofstypeunsupported", 0);
706 return;
707 #else
708 *ops = &ADIO_UFS_operations;
709 #endif
711 if (file_system == ADIO_NFS) {
712 #ifndef ROMIO_NFS
713 *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
714 myname, __LINE__, MPI_ERR_IO,
715 "**iofstypeunsupported", 0);
716 return;
717 #else
718 *ops = &ADIO_NFS_operations;
719 #endif
721 if (file_system == ADIO_PANFS) {
722 #ifndef ROMIO_PANFS
723 *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
724 myname, __LINE__, MPI_ERR_IO,
725 "**iofstypeunsupported", 0);
726 return;
727 #else
728 *ops = &ADIO_PANFS_operations;
729 #endif
731 if (file_system == ADIO_HFS) {
732 #ifndef ROMIO_HFS
733 *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
734 myname, __LINE__, MPI_ERR_IO,
735 "**iofstypeunsupported", 0);
736 return;
737 #else
738 *ops = &ADIO_HFS_operations;
739 #endif
741 if (file_system == ADIO_XFS) {
742 #ifndef ROMIO_XFS
743 *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
744 myname, __LINE__, MPI_ERR_IO,
745 "**iofstypeunsupported", 0);
746 return;
747 #else
748 *ops = &ADIO_XFS_operations;
749 #endif
751 if (file_system == ADIO_SFS) {
752 #ifndef ROMIO_SFS
753 *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
754 myname, __LINE__, MPI_ERR_IO,
755 "**iofstypeunsupported", 0);
756 return;
757 #else
758 *ops = &ADIO_SFS_operations;
759 #endif
761 if (file_system == ADIO_PVFS) {
762 #ifndef ROMIO_PVFS
763 *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
764 myname, __LINE__, MPI_ERR_IO,
765 "**iofstypeunsupported", 0);
766 return;
767 #else
768 *ops = &ADIO_PVFS_operations;
769 #endif
771 if (file_system == ADIO_PVFS2) {
772 #ifndef ROMIO_PVFS2
773 *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
774 myname, __LINE__, MPI_ERR_IO,
775 "**iofstypeunsupported", 0);
776 return;
777 #else
778 *ops = &ADIO_PVFS2_operations;
779 #endif
781 if (file_system == ADIO_NTFS) {
782 #ifndef ROMIO_NTFS
783 *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
784 myname, __LINE__, MPI_ERR_IO,
785 "**iofstypeunsupported", 0);
786 return;
787 #else
788 *ops = &ADIO_NTFS_operations;
789 #endif
791 if (file_system == ADIO_TESTFS) {
792 #ifndef ROMIO_TESTFS
793 *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
794 myname, __LINE__, MPI_ERR_IO,
795 "**iofstypeunsupported", 0);
796 return;
797 #else
798 *ops = &ADIO_TESTFS_operations;
799 #endif
801 if (file_system == ADIO_BGL) {
802 #ifndef ROMIO_BGL
803 *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
804 myname, __LINE__, MPI_ERR_IO,
805 "**iofstypeunsupported", 0);
806 return;
807 #else
808 *ops = &ADIO_BGL_operations;
809 #endif
811 if (file_system == ADIO_BGLOCKLESS) {
812 #ifndef ROMIO_BGLOCKLESS
813 *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
814 myname, __LINE__, MPI_ERR_IO,
815 "**iofstypeunsupported", 0);
816 return;
817 #else
818 *ops = &ADIO_BGLOCKLESS_operations;
819 #endif
822 if (file_system == ADIO_GRIDFTP) {
823 #ifndef ROMIO_GRIDFTP
824 *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
825 myname, __LINE__, MPI_ERR_IO,
826 "**iofstypeunsupported", 0);
827 return;
828 #else
829 *ops = &ADIO_GRIDFTP_operations;
830 #endif
832 if (file_system == ADIO_LUSTRE) {
833 #ifndef ROMIO_LUSTRE
834 *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**iofstypeunsupported", 0);
835 return;
836 #else
837 *ops = &ADIO_LUSTRE_operations;
838 #endif
840 if (file_system == ADIO_ZOIDFS) {
841 #ifndef ROMIO_ZOIDFS
842 *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
843 myname, __LINE__, MPI_ERR_IO,
844 "**iofstypeunsupported", 0);
845 return;
846 #else
847 *ops = &ADIO_ZOIDFS_operations;
848 #endif
850 *error_code = MPI_SUCCESS;
851 *fstype = file_system;
852 return;
855 * vim: ts=8 sts=4 sw=4 noexpandtab