⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ad_fstype.c

📁 MPICH是MPI的重要研究,提供了一系列的接口函数,为并行计算的实现提供了编程环境.
💻 C
📖 第 1 页 / 共 2 页
字号:
}/*  ADIO_FileSysType_prefix - determines file system type for a file using   a prefix on the file name.  upper layer should have already determined  that a prefix is present.Input Parameters:. filename - path to file, including prefix (xxx:)Output Parameters:. fstype - pointer to integer in which to store file system type (ADIO_XXX). error_code - pointer to integer in which to store error code  Returns MPI_SUCCESS in error_code on success.  Filename not having a prefix  is considered an error. Except for on Windows systems where the default is NTFS. */static void ADIO_FileSysType_prefix(char *filename, int *fstype, int *error_code){    *error_code = MPI_SUCCESS;    if (!strncmp(filename, "pfs:", 4) || !strncmp(filename, "PFS:", 4)) {	*fstype = ADIO_PFS;    }    else if (!strncmp(filename, "piofs:", 6) || !strncmp(filename, "PIOFS:", 6)) {	*fstype = ADIO_PIOFS;    }    else if (!strncmp(filename, "ufs:", 4) || !strncmp(filename, "UFS:", 4)) {	*fstype = ADIO_UFS;    }    else if (!strncmp(filename, "nfs:", 4) || !strncmp(filename, "NFS:", 4)) {	*fstype = ADIO_NFS;    }    else if (!strncmp(filename, "hfs:", 4) || !strncmp(filename, "HFS:", 4)) {	*fstype = ADIO_HFS;    }    else if (!strncmp(filename, "xfs:", 4) || !strncmp(filename, "XFS:", 4)) {	*fstype = ADIO_XFS;    }    else if (!strncmp(filename, "sfs:", 4) || !strncmp(filename, "SFS:", 4)) {	*fstype = ADIO_SFS;    }    else if (!strncmp(filename, "pvfs:", 5) || !strncmp(filename, "PVFS:", 5)) {	*fstype = ADIO_PVFS;    }    else if (!strncmp(filename, "testfs:", 7) 	     || !strncmp(filename, "TESTFS:", 7))    {	*fstype = ADIO_TESTFS;    }    else {#ifdef ROMIO_NTFS	*fstype = ADIO_NTFS;#else	*fstype = 0;	*error_code = MPI_ERR_UNKNOWN;#endif    }}/*@    ADIO_ResolveFileType - determines file system type and operations from                           file name string; this is a collective callInput Parameters:. comm - communicator across which collective open is performed. filename - name of file (string)Output Parameters:. fstype - (pointer to) int holding file system type. ops - (address of) pointer to table of valid file operations. error_code - (pointer to) int holding error codeNotes:This code used to be in MPI_File_open(), but it has been moved into here in order to clean things up.  The goal is to separate all this "did we compilefor this fs type" code from the MPI layer and also to introduce the ADIOI_Fnstables in a reasonable way. -- Rob, 06/06/2001@*/void ADIO_ResolveFileType(MPI_Comm comm, char *filename, int *fstype, 			  ADIOI_Fns **ops, int *error_code){#ifndef PRINT_ERR_MSG    static char myname[] = "ADIO_RESOLVEFILETYPE";#endif    int myerrcode, file_system, min_code;    char *tmp;    file_system = -1;    tmp = strchr(filename, ':');    if (!tmp) {	/* no prefix; use system-dependent function call to determine type */	ADIO_FileSysType_fncall(filename, &file_system, &myerrcode);	if (myerrcode != MPI_SUCCESS) {#ifdef PRINT_ERR_MSG	    FPRINTF(stderr, "ADIO_ResolveFileType: Can't determine the file-system type. Check the filename/path you provided and try again. Otherwise, prefix the filename with a string to indicate the type of file sytem (piofs:, pfs:, nfs:, ufs:, hfs:, xfs:, sfs:, pvfs:).\n");	    MPI_Abort(MPI_COMM_WORLD, 1);#else	    myerrcode = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_NO_FSTYPE,					myname, (char *) 0, (char *) 0);	    *error_code = ADIOI_Error(MPI_FILE_NULL, myerrcode, myname);	    return;#endif	}	/* ensure that everyone came up with the same file system type */	MPI_Allreduce(&file_system, &min_code, 1, MPI_INT, MPI_MIN, comm);	if (min_code == ADIO_NFS) file_system = ADIO_NFS;    }    else {	/* prefix specified; just match via prefix and assume everyone got 	 * the same thing.	 *	 * perhaps we should have this code go through the allreduce as well?	 */	ADIO_FileSysType_prefix(filename, &file_system, &myerrcode);	if (myerrcode != MPI_SUCCESS) {#ifdef PRINT_ERR_MSG	    FPRINTF(stderr, "ADIO_ResolveFileType: Can't determine the file-system type from the specified prefix. Check the filename/path and prefix you provided and try again.\n");	    MPI_Abort(MPI_COMM_WORLD, 1);#else	    myerrcode = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_NO_FSTYPE,					myname, (char *) 0, (char *) 0);	    *error_code = ADIOI_Error(MPI_FILE_NULL, myerrcode, myname);	    return;#endif	}    }    /* verify that we support this file system type and set ops pointer */    if (file_system == ADIO_PFS) {#ifndef PFS# ifdef PRINT_ERR_MSG	FPRINTF(stderr, "ADIO_ResolveFileType: ROMIO has not been configured to use the PFS file system\n");	MPI_Abort(MPI_COMM_WORLD, 1);# else	myerrcode = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_NO_PFS,				    myname, (char *) 0, (char *) 0);	*error_code = ADIOI_Error(MPI_FILE_NULL, myerrcode, myname);	return;# endif#else	*ops = &ADIO_PFS_operations;#endif    }    if (file_system == ADIO_PIOFS) {#ifndef PIOFS# ifdef PRINT_ERR_MSG	FPRINTF(stderr, "ADIO_ResolveFileType: ROMIO has not been configured to use the PIOFS file system\n");	MPI_Abort(MPI_COMM_WORLD, 1);# else	myerrcode = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_NO_PIOFS,				     myname, (char *) 0, (char *) 0);	*error_code = ADIOI_Error(MPI_FILE_NULL, myerrcode, myname);	return;# endif#else	*ops = &ADIO_PIOFS_operations;#endif    }    if (file_system == ADIO_UFS) {#ifndef UFS# ifdef PRINT_ERR_MSG	FPRINTF(stderr, "ADIO_ResolveFileType: ROMIO has not been configured to use the UFS file system\n");	MPI_Abort(MPI_COMM_WORLD, 1);# else	myerrcode = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_NO_UFS,				     myname, (char *) 0, (char *) 0);	*error_code = ADIOI_Error(MPI_FILE_NULL, myerrcode, myname);	return;# endif#else	*ops = &ADIO_UFS_operations;#endif    }    if (file_system == ADIO_NFS) {#ifndef NFS# ifdef PRINT_ERR_MSG	FPRINTF(stderr, "ADIO_ResolveFileType: ROMIO has not been configured to use the NFS file system\n");	MPI_Abort(MPI_COMM_WORLD, 1);# else	myerrcode = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_NO_NFS,				     myname, (char *) 0, (char *) 0);	*error_code =  ADIOI_Error(MPI_FILE_NULL, myerrcode, myname);	return;# endif#else	*ops = &ADIO_NFS_operations;#endif    }    if (file_system == ADIO_HFS) {#ifndef HFS# ifdef PRINT_ERR_MSG	FPRINTF(stderr, "ADIO_ResolveFileType: ROMIO has not been configured to use the HFS file system\n");	MPI_Abort(MPI_COMM_WORLD, 1);# else	myerrcode = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_NO_HFS,				     myname, (char *) 0, (char *) 0);	*error_code = ADIOI_Error(MPI_FILE_NULL, myerrcode, myname);	return;# endif#else	*ops = &ADIO_HFS_operations;#endif    }    if (file_system == ADIO_XFS) {#ifndef XFS# ifdef PRINT_ERR_MSG	FPRINTF(stderr, "ADIO_ResolveFileType: ROMIO has not been configured to use the XFS file system\n");	MPI_Abort(MPI_COMM_WORLD, 1);# else	myerrcode = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_NO_XFS,				     myname, (char *) 0, (char *) 0);	*error_code = ADIOI_Error(MPI_FILE_NULL, myerrcode, myname);	return;# endif#else	*ops = &ADIO_XFS_operations;#endif    }    if (file_system == ADIO_SFS) {#ifndef SFS# ifdef PRINT_ERR_MSG	FPRINTF(stderr, "ADIO_ResolveFileType: ROMIO has not been configured to use the SFS file system\n");	MPI_Abort(MPI_COMM_WORLD, 1);# else	myerrcode = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_NO_SFS,				     myname, (char *) 0, (char *) 0);	*error_code = ADIOI_Error(MPI_FILE_NULL, myerrcode, myname);	return;# endif#else	*ops = &ADIO_SFS_operations;#endif    }    if (file_system == ADIO_PVFS) {#ifndef ROMIO_PVFS# ifdef PRINT_ERR_MSG	FPRINTF(stderr, "ADIO_ResolveFileType: ROMIO has not been configured to use the PVFS file system\n");	MPI_Abort(MPI_COMM_WORLD, 1);# else	myerrcode = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_NO_PVFS,				     myname, (char *) 0, (char *) 0);	*error_code = ADIOI_Error(MPI_FILE_NULL, myerrcode, myname);	return;# endif#else	*ops = &ADIO_PVFS_operations;#endif    }    if (file_system == ADIO_NTFS) {#ifndef ROMIO_NTFS# ifdef PRINT_ERR_MSG	FPRINTF(stderr, "ADIO_ResolveFileType: ROMIO has not been configured to use the NTFS file system\n");	MPI_Abort(MPI_COMM_WORLD, 1);# else	myerrcode = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_NO_NTFS,				     myname, (char *) 0, (char *) 0);	*error_code = ADIOI_Error(MPI_FILE_NULL, myerrcode, myname);	return;# endif#else	*ops = &ADIO_NTFS_operations;#endif    }    if (file_system == ADIO_TESTFS) {#ifndef ROMIO_TESTFS# ifdef PRINT_ERR_MSG	FPRINTF(stderr, "ADIO_ResolveFileType: ROMIO has not been configured to use the TESTFS file system\n");	MPI_Abort(MPI_COMM_WORLD, 1);# else	myerrcode = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_NO_TESTFS,				     myname, (char *) 0, (char *) 0);	*error_code = ADIOI_Error(MPI_FILE_NULL, myerrcode, myname);	return;# endif#else	*ops = &ADIO_TESTFS_operations;#endif    }    *error_code = MPI_SUCCESS;    *fstype = file_system;    return;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -