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-2005 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-2013 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
23 #include "ompi_config.h"
24 #include "sharedfp_lockedfile.h"
25
26 #include "mpi.h"
27 #include "ompi/constants.h"
28 #include "ompi/mca/sharedfp/sharedfp.h"
29 #include "ompi/mca/sharedfp/base/base.h"
30
31 int
32 mca_sharedfp_lockedfile_get_position(ompio_file_t *fh,
33 OMPI_MPI_OFFSET_TYPE * offset)
34 {
35 int ret = OMPI_SUCCESS;
36 mca_sharedfp_base_module_t * shared_fp_base_module;
37 struct mca_sharedfp_base_data_t *sh = NULL;
38
39 if(fh->f_sharedfp_data==NULL){
40 opal_output(ompi_sharedfp_base_framework.framework_output,
41 "sharedfp_lockedfile_get_position - opening the shared file pointer\n");
42 shared_fp_base_module = fh->f_sharedfp;
43
44 ret = shared_fp_base_module->sharedfp_file_open(fh->f_comm,
45 fh->f_filename,
46 fh->f_amode,
47 fh->f_info,
48 fh);
49 if (ret != OMPI_SUCCESS) {
50 opal_output(0,"sharedfp_lockedfile_write - error opening the shared file pointer\n");
51 return ret;
52 }
53 }
54 /*Retrieve the shared file data struct*/
55 sh = fh->f_sharedfp_data;
56
57 /*Requesting the offset to write 0 bytes,
58 *returns the current offset w/o updating it
59 */
60 ret = mca_sharedfp_lockedfile_request_position(sh,0,offset);
61
62 return ret;
63 }