root/ompi/mca/io/romio321/romio/adio/common/ad_set_sh_fp.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. ADIO_Set_shared_fp

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
   2 /* 
   3  *   Copyright (C) 1997 University of Chicago. 
   4  *   See COPYRIGHT notice in top-level directory.
   5  */
   6 
   7 #include "adio.h"
   8 
   9 /* set the shared file pointer to "offset" etypes relative to the current 
  10    view */
  11 
  12 void ADIOI_NFS_Set_shared_fp(ADIO_File fd, ADIO_Offset offset, int *error_code);
  13 
  14 void ADIO_Set_shared_fp(ADIO_File fd, ADIO_Offset offset, int *error_code)
  15 {
  16     ADIO_Status status;
  17     MPI_Comm dupcommself;
  18 
  19 #ifdef ROMIO_NFS
  20     if (fd->file_system == ADIO_NFS) {
  21         ADIOI_NFS_Set_shared_fp(fd, offset, error_code);
  22         return;
  23     }
  24 #endif
  25 
  26     if (fd->shared_fp_fd == ADIO_FILE_NULL) {
  27         MPI_Comm_dup(MPI_COMM_SELF, &dupcommself);
  28         fd->shared_fp_fd = ADIO_Open(MPI_COMM_SELF, dupcommself, 
  29                                      fd->shared_fp_fname, 
  30                                      fd->file_system,
  31                                      fd->fns,
  32                                      ADIO_CREATE | ADIO_RDWR | ADIO_DELETE_ON_CLOSE, 
  33                                      0, MPI_BYTE, MPI_BYTE,
  34                                      MPI_INFO_NULL, 
  35                                      ADIO_PERM_NULL, error_code);
  36     }
  37 
  38     if (*error_code != MPI_SUCCESS) return;
  39 
  40     ADIOI_WRITE_LOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset));
  41     ADIO_WriteContig(fd->shared_fp_fd, &offset, sizeof(ADIO_Offset), 
  42                      MPI_BYTE, ADIO_EXPLICIT_OFFSET, 0, &status, error_code);
  43     ADIOI_UNLOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset));
  44 }
  45 

/* [<][>][^][v][top][bottom][index][help] */