| 1 | /* |
| 2 | * Copyright (C) by Argonne National Laboratory |
| 3 | * See COPYRIGHT in top-level directory |
| 4 | */ |
| 5 | |
| 6 | #include "ad_nfs.h"cxx . . $ `<file>/src/mpi/romio/adio/ad_nfs/ad_nfs.h`/ |
| 7 | |
| 8 | /* set the shared file pointer to "offset" etypes relative to the current |
| 9 | view */ |
| 10 | |
| 11 | /* |
| 12 | This looks very similar to ADIOI_GEN_Set_shared_fp, except this |
| 13 | function avoids locking the file twice. The generic version does |
| 14 | |
| 15 | Write lock |
| 16 | ADIO_WriteContig |
| 17 | Unlock |
| 18 | |
| 19 | For NFS, ADIOI_NFS_WriteContig does a lock before writing to disable |
| 20 | caching. To avoid the lock being called twice, this version for NFS does |
| 21 | |
| 22 | Write lock |
| 23 | Lseek |
| 24 | Write |
| 25 | Unlock |
| 26 | |
| 27 | */ |
| 28 | |
| 29 | void ADIOI_NFS_Set_shared_fpcxx . . $ ADIOI_NFS_Set_shared_fp(bbde957b0f498fe2).(ADIO_Filecxx . . $ ADIO_File# fd, ADIO_Offsetcxx . . $ ADIO_Offset# offset, int *error_code) |
| 30 | { |
| 31 | ssize_tcxx . . $ ssize_t# err; |
| 32 | MPI_Commcxx . . $ MPI_Comm# dupcommself; |
| 33 | static char myname[] = "ADIOI_NFS_SET_SHARED_FP"; |
| 34 | |
| 35 | if (fd->shared_fp_fdcxx . . $ ADIOI_FileD#shared_fp_fd. == ADIO_FILE_NULLcxx . . $ `src/mpi/romio/adio/include/adio.h:299:9`!) { |
| 36 | MPI_Comm_dupcxx . . $ `src/mpi/romio/adio/include/mpipr.h:89:9`!(MPI_COMM_SELFcxx . . $ `src/include/mpi.h:268:9`!, &dupcommself); |
| 37 | fd->shared_fp_fdcxx . . $ ADIOI_FileD#shared_fp_fd. = ADIO_Opencxx . . $ ADIO_Open(fc350024cc5155b6).(MPI_COMM_SELFcxx . . $ `src/include/mpi.h:268:9`!, dupcommself, |
| 38 | fd->shared_fp_fnamecxx . . $ ADIOI_FileD#shared_fp_fname., |
| 39 | fd->file_systemcxx . . $ ADIOI_FileD#file_system., fd->fnscxx . . $ ADIOI_FileD#fns., |
| 40 | ADIO_CREATEcxx . . $ `src/mpi/romio/adio/include/adio.h:268:9`! | ADIO_RDWRcxx . . $ `src/mpi/romio/adio/include/adio.h:271:9`! | ADIO_DELETE_ON_CLOSEcxx . . $ `src/mpi/romio/adio/include/adio.h:272:9`!, |
| 41 | 0, MPI_BYTEcxx . . $ `src/include/mpi.h:177:9`!, MPI_BYTEcxx . . $ `src/include/mpi.h:177:9`!, MPI_INFO_NULLcxx . . $ `src/include/mpi.h:340:9`!, |
| 42 | ADIO_PERM_NULLcxx . . $ `src/mpi/romio/adio/include/adio.h:345:9`!, error_code); |
| 43 | } |
| 44 | |
| 45 | if (*error_code != MPI_SUCCESScxx . . $ `src/include/mpi.h:655:9`!) |
| 46 | return; |
| 47 | |
| 48 | ADIOI_WRITE_LOCKcxx . . $ `src/mpi/romio/adio/include/adioi.h:826:9`!(fd->shared_fp_fd, 0, SEEK_SETcxx . . $ `<external>/232824719582829767/stdio.h:110:9`!, sizeof(ADIO_Offset)); |
| 49 | #ifdef ADIOI_MPE_LOGGING |
| 50 | MPE_Log_event(ADIOI_MPE_lseek_a, 0, NULL); |
| 51 | #endif |
| 52 | lseekcxx . . $ lseek(f1afe674ac17c82e).(fd->shared_fp_fdcxx . . $ ADIOI_FileD#shared_fp_fd.->fd_syscxx . . $ ADIOI_FileD#fd_sys., 0, SEEK_SETcxx . . $ `<external>/232824719582829767/stdio.h:110:9`!); |
| 53 | #ifdef ADIOI_MPE_LOGGING |
| 54 | MPE_Log_event(ADIOI_MPE_lseek_b, 0, NULL); |
| 55 | #endif |
| 56 | #ifdef ADIOI_MPE_LOGGING |
| 57 | MPE_Log_event(ADIOI_MPE_write_a, 0, NULL); |
| 58 | #endif |
| 59 | err = writecxx . . $ write(41184a59d38b4f65).(fd->shared_fp_fdcxx . . $ ADIOI_FileD#shared_fp_fd.->fd_syscxx . . $ ADIOI_FileD#fd_sys., &offset, sizeof(ADIO_Offsetcxx . . $ ADIO_Offset#)); |
| 60 | #ifdef ADIOI_MPE_LOGGING |
| 61 | MPE_Log_event(ADIOI_MPE_write_b, 0, NULL); |
| 62 | #endif |
| 63 | ADIOI_UNLOCKcxx . . $ `src/mpi/romio/adio/include/adioi.h:830:9`!(fd->shared_fp_fd, 0, SEEK_SETcxx . . $ `<external>/232824719582829767/stdio.h:110:9`!, sizeof(ADIO_Offset)); |
| 64 | |
| 65 | if (err == -1) { |
| 66 | *error_code = MPIO_Err_create_codecxx . . $ MPIO_Err_create_code(730e79217e15f80f).(MPI_SUCCESScxx . . $ `src/include/mpi.h:655:9`!, MPIR_ERR_RECOVERABLEcxx . . $ `src/mpi/romio/adio/include/adio.h:475:9`!, |
| 67 | myname, __LINE__, MPI_ERR_IOcxx . . $ `src/include/mpi.h:697:9`!, |
| 68 | "**io", "**io %s", strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 69 | } else |
| 70 | *error_code = MPI_SUCCESScxx . . $ `src/include/mpi.h:655:9`!; |
| 71 | } |