root/ompi/mca/io/romio321/romio/adio/ad_panfs/ad_panfs_write.c

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

DEFINITIONS

This source file includes following definitions.
  1. ADIOI_PANFS_WriteContig

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
   2 /* 
   3  *
   4  *   Copyright (C) 2004 University of Chicago. 
   5  *   See COPYRIGHT notice in top-level directory.
   6  */
   7 
   8 #include "ad_panfs.h"
   9 
  10 #ifdef HAVE_UNISTD_H
  11 #include <unistd.h>
  12 #endif
  13 
  14 void ADIOI_PANFS_WriteContig(ADIO_File fd, const void *buf, int count,
  15                            MPI_Datatype datatype, int file_ptr_type,
  16                            ADIO_Offset offset, ADIO_Status *status,
  17                            int *error_code)
  18 {
  19     MPI_Count err = -1, datatype_size, len;
  20     static char myname[] = "ADIOI_PANFS_WRITECONTIG";
  21 
  22     MPI_Type_size_x(datatype, &datatype_size);
  23     len = datatype_size * count;
  24 
  25     if (file_ptr_type == ADIO_INDIVIDUAL) {
  26         offset = fd->fp_ind;
  27     }
  28 
  29     if (fd->fp_sys_posn != offset) {
  30         err = lseek(fd->fd_sys, offset, SEEK_SET);
  31         /* --BEGIN ERROR HANDLING-- */
  32         if (err == -1) {
  33             *error_code = MPIO_Err_create_code(MPI_SUCCESS,
  34                                                MPIR_ERR_RECOVERABLE,
  35                                                myname, __LINE__,
  36                                                MPI_ERR_IO, "**io",
  37                                                "**io %s", strerror(errno));
  38             fd->fp_sys_posn = -1;
  39             return;
  40         }
  41         /* --END ERROR HANDLING-- */
  42     }
  43     
  44     AD_PANFS_RETRY(write(fd->fd_sys, buf, len),err)
  45     /* --BEGIN ERROR HANDLING-- */
  46     if (err == -1) {
  47         *error_code = MPIO_Err_create_code(MPI_SUCCESS,
  48                                            MPIR_ERR_RECOVERABLE,
  49                                            myname, __LINE__,
  50                                            MPI_ERR_IO, "**io",
  51                                            "**io %s", strerror(errno));
  52         fd->fp_sys_posn = -1;
  53         return;
  54     }
  55     /* --END ERROR HANDLING-- */
  56 
  57     fd->fp_sys_posn = offset + err;
  58 
  59     if (file_ptr_type == ADIO_INDIVIDUAL) {
  60         fd->fp_ind += err; 
  61     }
  62 
  63 #ifdef HAVE_STATUS_SET_BYTES
  64     if (err != -1 && status) MPIR_Status_set_bytes(status, datatype, err);
  65 #endif
  66 
  67     *error_code = MPI_SUCCESS;
  68 }

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