5
5
* Copyright (c) 2004-2005 The University of Tennessee and The University
6
6
* of Tennessee Research Foundation. All rights
7
7
* reserved.
8
- * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
8
+ * Copyright (c) 2004-2015 High Performance Computing Center Stuttgart,
9
9
* University of Stuttgart. All rights reserved.
10
10
* Copyright (c) 2004-2005 The Regents of the University of California.
11
11
* All rights reserved.
41
41
42
42
int
43
43
mca_fs_gpfs_file_open (struct ompi_communicator_t * comm ,
44
- char * filename ,
44
+ char * filename ,
45
45
int access_mode ,
46
46
struct ompi_info_t * info ,
47
47
mca_io_ompio_file_t * fh )
@@ -60,35 +60,30 @@ mca_fs_gpfs_file_open (struct ompi_communicator_t *comm,
60
60
61
61
amode = 0 ;
62
62
63
- if (access_mode & MPI_MODE_CREATE )
63
+ if (access_mode & MPI_MODE_CREATE ) {
64
64
amode = amode | O_CREAT ;
65
- if (access_mode & MPI_MODE_RDONLY )
65
+ }
66
+ if (access_mode & MPI_MODE_RDONLY ) {
66
67
amode = amode | O_RDONLY ;
67
- if (access_mode & MPI_MODE_WRONLY )
68
+ }
69
+ if (access_mode & MPI_MODE_WRONLY ) {
68
70
amode = amode | O_WRONLY ;
69
- if (access_mode & MPI_MODE_RDWR )
71
+ }
72
+ if (access_mode & MPI_MODE_RDWR ) {
70
73
amode = amode | O_RDWR ;
71
- if (access_mode & MPI_MODE_EXCL )
74
+ }
75
+ if (access_mode & MPI_MODE_EXCL ) {
72
76
amode = amode | O_EXCL ;
77
+ }
78
+
79
+ //DEBUG: fprintf(stderr, "Opening a file using Linux open() within fs_gpfs_file_open\n");
73
80
74
- printf ("Opening a file using Linux open() within fs_gpfs_file_open\n" );
75
-
76
- // for DEBUG
77
- //int gdb = 0;
78
- //char hostname[256];
79
- //gethostname(hostname, sizeof(hostname));
80
- //printf("PID %d on %s ready for attach\n", getpid(), hostname);
81
- //fflush(stdout);
82
- //while (0 == gdb)
83
- //sleep(5);
84
-
85
81
fh -> fd = open (filename , amode , perm );
86
82
if (-1 == fh -> fd ) {
87
83
return OMPI_ERROR ;
88
84
}
89
85
90
86
fh -> f_amode = access_mode ;
91
- //Setting GPFS Hints
92
87
mca_fs_gpfs_file_set_info (fh , info );
93
88
94
89
return OMPI_SUCCESS ;
@@ -107,53 +102,55 @@ mca_fs_gpfs_file_get_amode (ompi_file_t *fh,
107
102
return OMPI_SUCCESS ;
108
103
}
109
104
110
- int mca_fs_gpfs_file_seek (ompi_file_t * fh , OMPI_MPI_OFFSET_TYPE off , int whence ) {
111
- printf ("GPFS FILE SEEK!" );
112
- int ret = OMPI_SUCCESS ;
113
- mca_io_ompio_data_t * data ;
114
- OMPI_MPI_OFFSET_TYPE offset , temp_offset ;
115
-
116
- data = (mca_io_ompio_data_t * ) fh -> f_io_selected_data ;
117
-
118
- offset = off * data -> ompio_fh .f_etype_size ;
119
-
120
- switch (whence ) {
121
- case MPI_SEEK_SET :
122
- if (offset < 0 ) {
123
- return OMPI_ERROR ;
124
- }
125
- break ;
126
- case MPI_SEEK_CUR :
127
- offset += data -> ompio_fh .f_position_in_file_view ;
128
- offset += data -> ompio_fh .f_disp ;
129
- if (offset < 0 ) {
130
- return OMPI_ERROR ;
131
- }
132
- break ;
133
- case MPI_SEEK_END :
134
- ret = data -> ompio_fh .f_fs -> fs_file_get_size (& data -> ompio_fh ,
135
- & temp_offset );
136
- offset += temp_offset ;
137
- if (offset < 0 || OMPI_SUCCESS != ret ) {
138
- return OMPI_ERROR ;
139
- }
140
- break ;
141
- default :
142
- return OMPI_ERROR ;
143
- }
144
-
145
- ret = ompi_io_ompio_set_explicit_offset (& data -> ompio_fh , offset
146
- / data -> ompio_fh .f_etype_size );
147
- return ret ;
105
+ //CN: Is mca_fs_gpfs_file_seek needed at all. Not used anywhere!
106
+ int
107
+ mca_fs_gpfs_file_seek (ompi_file_t * fh , OMPI_MPI_OFFSET_TYPE off , int whence ) {
108
+ //DEBUG: fprintf(stderr, "GPFS FILE SEEK!");
109
+ int ret = OMPI_SUCCESS ;
110
+ mca_io_ompio_data_t * data ;
111
+ OMPI_MPI_OFFSET_TYPE offset , temp_offset ;
112
+
113
+ data = (mca_io_ompio_data_t * ) fh -> f_io_selected_data ;
114
+
115
+ offset = off * data -> ompio_fh .f_etype_size ;
116
+
117
+ switch (whence ) {
118
+ case MPI_SEEK_SET :
119
+ if (offset < 0 ) {
120
+ return OMPI_ERROR ;
121
+ }
122
+ break ;
123
+ case MPI_SEEK_CUR :
124
+ offset += data -> ompio_fh .f_position_in_file_view ;
125
+ offset += data -> ompio_fh .f_disp ;
126
+ if (offset < 0 ) {
127
+ return OMPI_ERROR ;
128
+ }
129
+ break ;
130
+ case MPI_SEEK_END :
131
+ ret = data -> ompio_fh .f_fs -> fs_file_get_size (& data -> ompio_fh ,
132
+ & temp_offset );
133
+ offset += temp_offset ;
134
+ if (offset < 0 || OMPI_SUCCESS != ret ) {
135
+ return OMPI_ERROR ;
136
+ }
137
+ break ;
138
+ default :
139
+ return OMPI_ERROR ;
140
+ }
141
+
142
+ ret = ompi_io_ompio_set_explicit_offset (& data -> ompio_fh , offset
143
+ / data -> ompio_fh .f_etype_size );
144
+ return ret ;
148
145
}
149
146
150
147
int mca_fs_gpfs_file_get_position (ompi_file_t * fh , OMPI_MPI_OFFSET_TYPE * offset ) {
151
- mca_io_ompio_data_t * data ;
148
+ mca_io_ompio_data_t * data ;
152
149
153
- data = (mca_io_ompio_data_t * ) fh -> f_io_selected_data ;
150
+ data = (mca_io_ompio_data_t * ) fh -> f_io_selected_data ;
154
151
155
- * offset = data -> ompio_fh .f_position_in_file_view
156
- / data -> ompio_fh .f_etype_size ;
152
+ * offset = data -> ompio_fh .f_position_in_file_view
153
+ / data -> ompio_fh .f_etype_size ;
157
154
158
- return OMPI_SUCCESS ;
155
+ return OMPI_SUCCESS ;
159
156
}
0 commit comments