root/ompi/mca/io/romio321/romio/adio/ad_pfs/ad_pfs_write.c

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

DEFINITIONS

This source file includes following definitions.
  1. ADIOI_PFS_WriteContig

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
   2 /* 
   3  *
   4  *   Copyright (C) 1997 University of Chicago. 
   5  *   See COPYRIGHT notice in top-level directory.
   6  */
   7 
   8 #include "ad_pfs.h"
   9 
  10 void ADIOI_PFS_WriteContig(ADIO_File fd, void *buf, int count, 
  11                            MPI_Datatype datatype, int file_ptr_type,
  12                            ADIO_Offset offset, ADIO_Status *status,
  13                            int *error_code)
  14 {
  15     MPI_Count err=-1, datatype_size, len;
  16     static char myname[] = "ADIOI_PFS_WRITECONTIG";
  17 
  18     MPI_Type_size_x(datatype, &datatype_size);
  19     len = datatype_size * count;
  20 
  21     if (file_ptr_type == ADIO_EXPLICIT_OFFSET) {
  22         if (fd->fp_sys_posn != offset) {
  23             lseek(fd->fd_sys, offset, SEEK_SET);
  24         }
  25         err = _cwrite(fd->fd_sys, buf, len);
  26         fd->fp_sys_posn = offset + err;
  27          /* individual file pointer not updated */        
  28     }
  29     else { /* write from curr. location of ind. file pointer */
  30         if (fd->fp_sys_posn != fd->fp_ind) {
  31             lseek(fd->fd_sys, fd->fp_ind, SEEK_SET);
  32         }
  33         err = _cwrite(fd->fd_sys, buf, len);
  34         fd->fp_ind += err;
  35         fd->fp_sys_posn = fd->fp_ind;
  36     }
  37 
  38 #ifdef HAVE_STATUS_SET_BYTES
  39     if (err != -1) MPIR_Status_set_bytes(status, datatype, err);
  40 #endif
  41 
  42     if (err == -1) {
  43         *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
  44                                            myname, __LINE__, MPI_ERR_IO,
  45                                            "**io",
  46                                            "**io %s", strerror(errno));
  47     }
  48     else *error_code = MPI_SUCCESS;
  49 }

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