root/ompi/mca/io/romio321/romio/adio/ad_pvfs/ad_pvfs_fcntl.c

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

DEFINITIONS

This source file includes following definitions.
  1. ADIOI_PVFS_Fcntl

   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_pvfs.h"
   9 #include "adio_extern.h"
  10 
  11 void ADIOI_PVFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct,
  12                       int *error_code)
  13 {
  14     static char myname[] = "ADIOI_PVFS_FCNTL";
  15 
  16     switch(flag) {
  17     case ADIO_FCNTL_GET_FSIZE:
  18 #ifdef ADIOI_MPE_LOGGING
  19         MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL );
  20 #endif
  21         fcntl_struct->fsize = pvfs_lseek64(fd->fd_sys, 0, SEEK_END);
  22 #ifdef ADIOI_MPE_LOGGING
  23         MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL );
  24 #endif
  25         if (fd->fp_sys_posn != -1) {
  26 #ifdef ADIOI_MPE_LOGGING
  27              MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL );
  28 #endif
  29              pvfs_lseek64(fd->fd_sys, fd->fp_sys_posn, SEEK_SET);
  30 #ifdef ADIOI_MPE_LOGGING
  31              MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL );
  32 #endif
  33         }
  34         if (fcntl_struct->fsize == -1) {
  35             *error_code = MPIO_Err_create_code(MPI_SUCCESS,
  36                                                MPIR_ERR_RECOVERABLE, myname,
  37                                                __LINE__, MPI_ERR_IO, "**io",
  38                                                "**io %s", strerror(errno));
  39         }
  40         else *error_code = MPI_SUCCESS;
  41         break;
  42 
  43     case ADIO_FCNTL_SET_DISKSPACE:
  44         ADIOI_GEN_Prealloc(fd, fcntl_struct->diskspace, error_code);
  45         break;
  46 
  47     case ADIO_FCNTL_SET_ATOMICITY:
  48         fd->atomicity = 0;
  49         /* --BEGIN ERROR HANDLING-- */
  50         if (fcntl_struct->atomicity != 0) {
  51             *error_code = MPIO_Err_create_code(MPI_SUCCESS,
  52                                                MPIR_ERR_RECOVERABLE,
  53                                                myname, __LINE__,
  54                                                MPI_ERR_UNSUPPORTED_OPERATION,
  55                                                "PVFS does not support atomic mode",
  56                                                0);
  57             return;
  58         }
  59         /* --END ERROR HANDLING-- */
  60         break;
  61 
  62     default:
  63         /* --BEGIN ERROR HANDLING-- */
  64         *error_code = MPIO_Err_create_code(MPI_SUCCESS,
  65                                            MPIR_ERR_RECOVERABLE,
  66                                            myname, __LINE__,
  67                                            MPI_ERR_ARG,
  68                                            "**flag", "**flag %d", flag);
  69         return;  
  70         /* --END ERROR HANDLING-- */
  71     }
  72 }

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