This source file includes following definitions.
- ADIO_Get_shared_fp
   1 
   2 
   3 
   4 
   5 
   6 
   7 #include "adio.h"
   8 
   9 
  10 
  11 
  12 
  13 
  14 void ADIOI_NFS_Get_shared_fp(ADIO_File fd, ADIO_Offset incr, ADIO_Offset *shared_fp,
  15                              int *error_code);
  16 
  17 void ADIO_Get_shared_fp(ADIO_File fd, ADIO_Offset incr, ADIO_Offset *shared_fp,
  18                          int *error_code)
  19 {
  20     ADIO_Status status;
  21     ADIO_Offset new_fp;
  22     MPI_Comm dupcommself;
  23 
  24     
  25 
  26 
  27 
  28 
  29     *shared_fp = 0;
  30 
  31 #ifdef ROMIO_NFS
  32     if (fd->file_system == ADIO_NFS) {
  33         ADIOI_NFS_Get_shared_fp(fd, incr, shared_fp, error_code);
  34         return;
  35     }
  36 #endif
  37 
  38     if (fd->shared_fp_fd == ADIO_FILE_NULL) {
  39         MPI_Comm_dup(MPI_COMM_SELF, &dupcommself);
  40         fd->shared_fp_fd = ADIO_Open(MPI_COMM_SELF, dupcommself, 
  41                                      fd->shared_fp_fname, 
  42                                      fd->file_system,
  43                                      fd->fns,
  44                                      ADIO_CREATE | ADIO_RDWR | ADIO_DELETE_ON_CLOSE, 
  45                                      0, MPI_BYTE, MPI_BYTE,
  46                                      MPI_INFO_NULL, 
  47                                      ADIO_PERM_NULL, error_code);
  48         if (*error_code != MPI_SUCCESS) return;
  49         ADIOI_WRITE_LOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset));
  50         ADIO_ReadContig(fd->shared_fp_fd, shared_fp, sizeof(ADIO_Offset), 
  51                        MPI_BYTE, ADIO_EXPLICIT_OFFSET, 0, &status, error_code);
  52         
  53 
  54 
  55     }
  56     else {
  57         ADIOI_WRITE_LOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset));
  58         ADIO_ReadContig(fd->shared_fp_fd, shared_fp, sizeof(ADIO_Offset), 
  59                        MPI_BYTE, ADIO_EXPLICIT_OFFSET, 0, &status, error_code);
  60         if (*error_code != MPI_SUCCESS) {
  61             ADIOI_UNLOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset));
  62             return;
  63         }
  64     }
  65 
  66     if (incr == 0) {goto done;}
  67 
  68     new_fp = *shared_fp + incr;
  69 
  70     ADIO_WriteContig(fd->shared_fp_fd, &new_fp, sizeof(ADIO_Offset), 
  71                     MPI_BYTE, ADIO_EXPLICIT_OFFSET, 0, &status, error_code);
  72 done:
  73     ADIOI_UNLOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset));
  74 }