diff --git a/ompi/mca/fs/base/Makefile.am b/ompi/mca/fs/base/Makefile.am index e578dd7308..215c8cdc28 100644 --- a/ompi/mca/fs/base/Makefile.am +++ b/ompi/mca/fs/base/Makefile.am @@ -25,4 +25,9 @@ libmca_fs_la_SOURCES += \ base/fs_base_file_select.c \ base/fs_base_file_unselect.c \ base/fs_base_find_available.c \ - base/fs_base_get_parent_dir.c + base/fs_base_get_parent_dir.c \ + base/fs_base_file_close.c \ + base/fs_base_file_sync.c \ + base/fs_base_file_delete.c \ + base/fs_base_file_set_size.c \ + base/fs_base_file_get_size.c diff --git a/ompi/mca/fs/base/base.h b/ompi/mca/fs/base/base.h index 9d9969fa1f..5d2a919ec2 100644 --- a/ompi/mca/fs/base/base.h +++ b/ompi/mca/fs/base/base.h @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2008 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2008-2011 University of Houston. All rights reserved. + * Copyright (c) 2008-2018 University of Houston. All rights reserved. * Copyright (c) 2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -52,6 +52,13 @@ OMPI_DECLSPEC int mca_fs_base_init_file (struct ompio_file_t *file); OMPI_DECLSPEC int mca_fs_base_get_param (struct ompio_file_t *file, int keyval); OMPI_DECLSPEC void mca_fs_base_get_parent_dir (char *filename, char **dirnamep); OMPI_DECLSPEC int mca_fs_base_get_fstype(char *fname); + +OMPI_DECLSPEC int mca_fs_base_file_delete (char* file_name, struct opal_info_t *info); +OMPI_DECLSPEC int mca_fs_base_file_sync (ompio_file_t *fh); +OMPI_DECLSPEC int mca_fs_base_file_get_size (ompio_file_t *fh, OMPI_MPI_OFFSET_TYPE *size); +OMPI_DECLSPEC int mca_fs_base_file_set_size (ompio_file_t *fh, OMPI_MPI_OFFSET_TYPE size); +OMPI_DECLSPEC int mca_fs_base_file_close (ompio_file_t *fh); + /* * Globals */ diff --git a/ompi/mca/fs/ufs/fs_ufs_file_close.c b/ompi/mca/fs/base/fs_base_file_close.c similarity index 91% rename from ompi/mca/fs/ufs/fs_ufs_file_close.c rename to ompi/mca/fs/base/fs_base_file_close.c index 678aa67430..49617f93f1 100644 --- a/ompi/mca/fs/ufs/fs_ufs_file_close.c +++ b/ompi/mca/fs/base/fs_base_file_close.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2008-2011 University of Houston. All rights reserved. + * Copyright (c) 2008-2018 University of Houston. All rights reserved. * Copyright (c) 2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -21,7 +21,7 @@ #include "ompi_config.h" -#include "fs_ufs.h" +#include "base.h" #include #include @@ -36,8 +36,7 @@ * Accepts: - file handle * Returns: - Success if file closed */ -int -mca_fs_ufs_file_close (ompio_file_t *fh) +int mca_fs_base_file_close (ompio_file_t *fh) { fh->f_comm->c_coll->coll_barrier (fh->f_comm, fh->f_comm->c_coll->coll_barrier_module); diff --git a/ompi/mca/fs/ufs/fs_ufs_file_delete.c b/ompi/mca/fs/base/fs_base_file_delete.c similarity index 86% rename from ompi/mca/fs/ufs/fs_ufs_file_delete.c rename to ompi/mca/fs/base/fs_base_file_delete.c index d6be6c3224..ddd1923cfb 100644 --- a/ompi/mca/fs/ufs/fs_ufs_file_delete.c +++ b/ompi/mca/fs/base/fs_base_file_delete.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2008-2011 University of Houston. All rights reserved. + * Copyright (c) 2008-2018 University of Houston. All rights reserved. * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * @@ -20,7 +20,8 @@ #include "ompi_config.h" -#include "fs_ufs.h" +#include "base.h" + #include #include "mpi.h" @@ -34,9 +35,8 @@ * Accepts: - file name & info * Returns: - Success if file closed */ -int -mca_fs_ufs_file_delete (char* file_name, - struct opal_info_t *info) +int mca_fs_base_file_delete (char* file_name, + struct opal_info_t *info) { int ret; diff --git a/ompi/mca/fs/ufs/fs_ufs_file_get_size.c b/ompi/mca/fs/base/fs_base_file_get_size.c similarity index 85% rename from ompi/mca/fs/ufs/fs_ufs_file_get_size.c rename to ompi/mca/fs/base/fs_base_file_get_size.c index 037c4fa56d..95438b2a2d 100644 --- a/ompi/mca/fs/ufs/fs_ufs_file_get_size.c +++ b/ompi/mca/fs/base/fs_base_file_get_size.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2008-2011 University of Houston. All rights reserved. + * Copyright (c) 2008-2018 University of Houston. All rights reserved. * Copyright (c) 2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -21,8 +21,7 @@ #include "ompi_config.h" -#include "fs_ufs.h" - +#include "base.h" #include "mpi.h" #include "ompi/constants.h" #include "ompi/mca/fs/fs.h" @@ -34,11 +33,10 @@ * * Function: - get_size of a file * Accepts: - same arguments as MPI_File_get_size() - * Returns: - Success if size is get + * Returns: - Success if size is retrieved */ -int -mca_fs_ufs_file_get_size (ompio_file_t *fh, - OMPI_MPI_OFFSET_TYPE *size) +int mca_fs_base_file_get_size (ompio_file_t *fh, + OMPI_MPI_OFFSET_TYPE *size) { *size = lseek(fh->fd, 0, SEEK_END); if (-1 == *size) { diff --git a/ompi/mca/fs/ufs/fs_ufs_file_set_size.c b/ompi/mca/fs/base/fs_base_file_set_size.c similarity index 92% rename from ompi/mca/fs/ufs/fs_ufs_file_set_size.c rename to ompi/mca/fs/base/fs_base_file_set_size.c index 708029c179..e20c1b5f1e 100644 --- a/ompi/mca/fs/ufs/fs_ufs_file_set_size.c +++ b/ompi/mca/fs/base/fs_base_file_set_size.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2008-2011 University of Houston. All rights reserved. + * Copyright (c) 2008-2018 University of Houston. All rights reserved. * Copyright (c) 2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -21,7 +21,7 @@ #include "ompi_config.h" -#include "fs_ufs.h" +#include "base.h" #include "mpi.h" #include "ompi/constants.h" @@ -36,8 +36,7 @@ * Accepts: - same arguments as MPI_File_set_size() * Returns: - Success if size is set */ -int -mca_fs_ufs_file_set_size (ompio_file_t *fh, +int mca_fs_base_file_set_size (ompio_file_t *fh, OMPI_MPI_OFFSET_TYPE size) { int err = 0; diff --git a/ompi/mca/fs/ufs/fs_ufs_file_sync.c b/ompi/mca/fs/base/fs_base_file_sync.c similarity index 89% rename from ompi/mca/fs/ufs/fs_ufs_file_sync.c rename to ompi/mca/fs/base/fs_base_file_sync.c index 9418a02e54..fd9137d280 100644 --- a/ompi/mca/fs/ufs/fs_ufs_file_sync.c +++ b/ompi/mca/fs/base/fs_base_file_sync.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2008-2011 University of Houston. All rights reserved. + * Copyright (c) 2008-2018 University of Houston. All rights reserved. * Copyright (c) 2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -21,15 +21,15 @@ #include "ompi_config.h" -#include "fs_ufs.h" +#include "base.h" + #include #include "mpi.h" #include "ompi/constants.h" #include "ompi/mca/fs/fs.h" -int -mca_fs_ufs_file_sync (ompio_file_t *fh) +int mca_fs_base_file_sync (ompio_file_t *fh) { int err; diff --git a/ompi/mca/fs/lustre/Makefile.am b/ompi/mca/fs/lustre/Makefile.am index 210d4102c5..bf4f487de7 100644 --- a/ompi/mca/fs/lustre/Makefile.am +++ b/ompi/mca/fs/lustre/Makefile.am @@ -9,7 +9,7 @@ # University of Stuttgart. All rights reserved. # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. -# Copyright (c) 2008-2011 University of Houston. All rights reserved. +# Copyright (c) 2008-2018 University of Houston. All rights reserved. # Copyright (c) 2017 IBM Corporation. All rights reserved. # $COPYRIGHT$ # @@ -36,12 +36,7 @@ fs_lustre_sources = \ fs_lustre.h \ fs_lustre.c \ fs_lustre_component.c \ - fs_lustre_file_open.c \ - fs_lustre_file_close.c \ - fs_lustre_file_delete.c \ - fs_lustre_file_sync.c \ - fs_lustre_file_set_size.c \ - fs_lustre_file_get_size.c + fs_lustre_file_open.c AM_CPPFLAGS = $(fs_lustre_CPPFLAGS) diff --git a/ompi/mca/fs/lustre/fs_lustre.c b/ompi/mca/fs/lustre/fs_lustre.c index 31fca26c25..e372904d92 100644 --- a/ompi/mca/fs/lustre/fs_lustre.c +++ b/ompi/mca/fs/lustre/fs_lustre.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2008-2017 University of Houston. All rights reserved. + * Copyright (c) 2008-2018 University of Houston. All rights reserved. * Copyright (c) 2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -55,11 +55,11 @@ static mca_fs_base_module_1_0_0_t lustre = { mca_fs_lustre_module_init, /* initalise after being selected */ mca_fs_lustre_module_finalize, /* close a module on a communicator */ mca_fs_lustre_file_open, - mca_fs_lustre_file_close, - mca_fs_lustre_file_delete, - mca_fs_lustre_file_set_size, - mca_fs_lustre_file_get_size, - mca_fs_lustre_file_sync + mca_fs_base_file_close, + mca_fs_base_file_delete, + mca_fs_base_file_set_size, + mca_fs_base_file_get_size, + mca_fs_base_file_sync }; /* * ******************************************************************* diff --git a/ompi/mca/fs/lustre/fs_lustre_file_close.c b/ompi/mca/fs/lustre/fs_lustre_file_close.c deleted file mode 100644 index ebe5c807b4..0000000000 --- a/ompi/mca/fs/lustre/fs_lustre_file_close.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2017 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2008-2011 University of Houston. All rights reserved. - * Copyright (c) 2018 Research Organization for Information Science - * and Technology (RIST). All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - - -#include "ompi_config.h" -#include "fs_lustre.h" - -#include -#include -#include "mpi.h" -#include "ompi/constants.h" -#include "ompi/mca/fs/fs.h" - -/* - * file_close_lustre - * - * Function: - closes a new file - * Accepts: - file handle - * Returns: - Success if file closed - */ -int -mca_fs_lustre_file_close (ompio_file_t *fh) -{ - fh->f_comm->c_coll->coll_barrier (fh->f_comm, - fh->f_comm->c_coll->coll_barrier_module); - close (fh->fd); - return OMPI_SUCCESS; -} diff --git a/ompi/mca/fs/lustre/fs_lustre_file_delete.c b/ompi/mca/fs/lustre/fs_lustre_file_delete.c deleted file mode 100644 index eb293b2021..0000000000 --- a/ompi/mca/fs/lustre/fs_lustre_file_delete.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2011 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2008-2011 University of Houston. All rights reserved. - * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - - -#include "ompi_config.h" -#include "fs_lustre.h" -#include - -#include "mpi.h" -#include "ompi/constants.h" -#include "ompi/mca/fs/fs.h" - -/* - * file_delete_lustre - * - * Function: - deletes a file - * Accepts: - file name & info - * Returns: - Success if file closed - */ -int -mca_fs_lustre_file_delete (char* file_name, - struct opal_info_t *info) -{ - int ret; - - ret = unlink(file_name); - if (0 > ret) { - return OMPI_ERROR; - } - - return OMPI_SUCCESS; -} diff --git a/ompi/mca/fs/lustre/fs_lustre_file_get_size.c b/ompi/mca/fs/lustre/fs_lustre_file_get_size.c deleted file mode 100644 index 057c67e111..0000000000 --- a/ompi/mca/fs/lustre/fs_lustre_file_get_size.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2011 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2008-2011 University of Houston. All rights reserved. - * Copyright (c) 2018 Research Organization for Information Science - * and Technology (RIST). All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - - -#include "ompi_config.h" -#include "fs_lustre.h" - -#include "mpi.h" -#include "ompi/constants.h" -#include "ompi/mca/fs/fs.h" - -/* - * file_get_size_lustre - * - * Function: - get_size of a file - * Accepts: - same arguments as MPI_File_get_size() - * Returns: - Success if size is get - */ -int -mca_fs_lustre_file_get_size (ompio_file_t *fh, - OMPI_MPI_OFFSET_TYPE *size) -{ - *size = lseek(fh->fd, 0, SEEK_END); - if (-1 == *size) { - perror ("lseek"); - return OMPI_ERROR; - } - - if (-1 == (lseek(fh->fd, fh->f_offset, SEEK_SET))) { - perror ("lseek"); - return OMPI_ERROR; - } - return OMPI_SUCCESS; -} diff --git a/ompi/mca/fs/lustre/fs_lustre_file_set_size.c b/ompi/mca/fs/lustre/fs_lustre_file_set_size.c deleted file mode 100644 index 8720a69a12..0000000000 --- a/ompi/mca/fs/lustre/fs_lustre_file_set_size.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2017 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2008-2011 University of Houston. All rights reserved. - * Copyright (c) 2018 Research Organization for Information Science - * and Technology (RIST). All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - - -#include "ompi_config.h" -#include "fs_lustre.h" - -#include "mpi.h" -#include "ompi/constants.h" -#include "ompi/mca/fs/fs.h" - -/* - * file_set_size_lustre - * - * Function: - set_size of a file - * Accepts: - same arguments as MPI_File_set_size() - * Returns: - Success if size is set - */ -int -mca_fs_lustre_file_set_size (ompio_file_t *fh, - OMPI_MPI_OFFSET_TYPE size) -{ - int err = 0; - - err = ftruncate(fh->fd, size); - - fh->f_comm->c_coll->coll_bcast (&err, - 1, - MPI_INT, - OMPIO_ROOT, - fh->f_comm, - fh->f_comm->c_coll->coll_bcast_module); - if (-1 == err) { - return OMPI_ERROR; - } - return OMPI_SUCCESS; -} diff --git a/ompi/mca/fs/lustre/fs_lustre_file_sync.c b/ompi/mca/fs/lustre/fs_lustre_file_sync.c deleted file mode 100644 index 896399d9b4..0000000000 --- a/ompi/mca/fs/lustre/fs_lustre_file_sync.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2011 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2008-2009 University of Houston. All rights reserved. - * Copyright (c) 2018 Research Organization for Information Science - * and Technology (RIST). All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - - -#include "ompi_config.h" -#include "fs_lustre.h" -#include - -#include "mpi.h" -#include "ompi/constants.h" -#include "ompi/mca/fs/fs.h" - -/* - * file_sync_lustre - * - * Function: - closes a new file - * Accepts: - file handle - * Returns: - Success if file closed - */ -int -mca_fs_lustre_file_sync (ompio_file_t *fh) -{ - int err; - - err = fsync(fh->fd); - - if (-1 == err) { - return OMPI_ERROR; - } - return OMPI_SUCCESS; -} diff --git a/ompi/mca/fs/ufs/Makefile.am b/ompi/mca/fs/ufs/Makefile.am index d9deca4c18..50201a80ca 100644 --- a/ompi/mca/fs/ufs/Makefile.am +++ b/ompi/mca/fs/ufs/Makefile.am @@ -9,7 +9,7 @@ # University of Stuttgart. All rights reserved. # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. -# Copyright (c) 2008-2011 University of Houston. All rights reserved. +# Copyright (c) 2008-2018 University of Houston. All rights reserved. # Copyright (c) 2017 IBM Corporation. All rights reserved. # $COPYRIGHT$ # @@ -46,9 +46,4 @@ sources = \ fs_ufs.h \ fs_ufs.c \ fs_ufs_component.c \ - fs_ufs_file_open.c \ - fs_ufs_file_close.c \ - fs_ufs_file_delete.c \ - fs_ufs_file_sync.c \ - fs_ufs_file_set_size.c \ - fs_ufs_file_get_size.c + fs_ufs_file_open.c diff --git a/ompi/mca/fs/ufs/fs_ufs.c b/ompi/mca/fs/ufs/fs_ufs.c index e423462dfc..eacfc74550 100644 --- a/ompi/mca/fs/ufs/fs_ufs.c +++ b/ompi/mca/fs/ufs/fs_ufs.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2008-2014 University of Houston. All rights reserved. + * Copyright (c) 2008-2018 University of Houston. All rights reserved. * Copyright (c) 2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -30,6 +30,7 @@ #include "mpi.h" #include "ompi/mca/fs/fs.h" #include "ompi/mca/fs/ufs/fs_ufs.h" +#include "ompi/mca/fs/base/base.h" /* * ******************************************************************* @@ -40,11 +41,11 @@ static mca_fs_base_module_1_0_0_t ufs = { mca_fs_ufs_module_init, /* initalise after being selected */ mca_fs_ufs_module_finalize, /* close a module on a communicator */ mca_fs_ufs_file_open, - mca_fs_ufs_file_close, - mca_fs_ufs_file_delete, - mca_fs_ufs_file_set_size, - mca_fs_ufs_file_get_size, - mca_fs_ufs_file_sync + mca_fs_base_file_close, + mca_fs_base_file_delete, + mca_fs_base_file_set_size, + mca_fs_base_file_get_size, + mca_fs_base_file_sync }; /* * *******************************************************************