root/ompi/mca/fs/ime/fs_ime_file_get_size.c

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

DEFINITIONS

This source file includes following definitions.
  1. mca_fs_ime_file_get_size

   1 /*
   2  * Copyright (c) 2018      DataDirect Networks. All rights reserved.
   3  * $COPYRIGHT$
   4  *
   5  * Additional copyrights may follow
   6  *
   7  * $HEADER$
   8  */
   9 
  10 #include "ime_native.h"
  11 
  12 #include "ompi_config.h"
  13 #include "fs_ime.h"
  14 
  15 #include "mpi.h"
  16 #include "ompi/constants.h"
  17 #include "ompi/mca/fs/fs.h"
  18 
  19 /*
  20  *      file_get_size_ime
  21  *
  22  *      Function:       - get_size of a file
  23  *      Accepts:        - same arguments as MPI_File_get_size()
  24  *      Returns:        - Success if size is get
  25  */
  26 int mca_fs_ime_file_get_size (ompio_file_t *fh,
  27                               OMPI_MPI_OFFSET_TYPE *size)
  28 {
  29     /* reset errno */
  30     errno = 0;
  31 
  32     *size = ime_native_lseek(fh->fd, 0, SEEK_END);
  33     if (*size < 0) {
  34         return mca_fs_ime_get_mpi_err(errno);
  35     }
  36 
  37     errno = 0;
  38     if ((ime_native_lseek(fh->fd, fh->f_offset, SEEK_SET)) < 0) {
  39         return mca_fs_ime_get_mpi_err(errno);
  40     }
  41 
  42     return OMPI_SUCCESS;
  43 }

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