1 /* 2 * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana 3 * University Research and Technology 4 * Corporation. All rights reserved. 5 * Copyright (c) 2004-2011 The University of Tennessee and The University 6 * of Tennessee Research Foundation. All rights 7 * reserved. 8 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, 9 * University of Stuttgart. All rights reserved. 10 * Copyright (c) 2004-2005 The Regents of the University of California. 11 * All rights reserved. 12 * Copyright (c) 2008-2011 University of Houston. All rights reserved. 13 * Copyright (c) 2018 Research Organization for Information Science 14 * and Technology (RIST). All rights reserved. 15 * $COPYRIGHT$ 16 * 17 * Additional copyrights may follow 18 * 19 * $HEADER$ 20 */ 21 22 /* This code is based on the PVFS2 ADIO module in ROMIO 23 * Copyright (C) 1997 University of Chicago. 24 * See COPYRIGHT notice in top-level directory. 25 */ 26 27 #include "ompi_config.h" 28 #include "fs_pvfs2.h" 29 30 #include "mpi.h" 31 #include "ompi/constants.h" 32 #include "ompi/mca/fs/fs.h" 33 34 /* 35 * file_get_size_pvfs2 36 * 37 * Function: - get_size of a file 38 * Accepts: - same arguments as MPI_File_get_size() 39 * Returns: - Success if size is get 40 */ 41 int 42 mca_fs_pvfs2_file_get_size (ompio_file_t *fh, 43 OMPI_MPI_OFFSET_TYPE *size) 44 { 45 int ret; 46 mca_fs_pvfs2 *pvfs2_fs; 47 PVFS_sysresp_getattr resp_getattr; 48 49 pvfs2_fs = (mca_fs_pvfs2 *)fh->f_fs_ptr; 50 51 ret = PVFS_sys_getattr (pvfs2_fs->object_ref, PVFS_ATTR_SYS_SIZE, 52 &(pvfs2_fs->credentials), &resp_getattr); 53 if (ret != 0 ) { 54 return OMPI_ERROR; 55 } 56 57 *size = resp_getattr.attr.size; 58 59 return OMPI_SUCCESS; 60 }