This source file includes following definitions.
- ADIOI_PFS_IwriteContig
1
2
3
4
5
6
7
8 #include "ad_pfs.h"
9
10 void ADIOI_PFS_IwriteContig(ADIO_File fd, void *buf, int count,
11 MPI_Datatype datatype, int file_ptr_type,
12 ADIO_Offset offset, ADIO_Request *request, int *error_code)
13 {
14 long *id_sys;
15 ADIO_Offset off;
16 int err;
17 MPI_Count len, typesize;
18 static char myname[] = "ADIOI_PFS_IWRITECONTIG";
19
20 *request = ADIOI_Malloc_request();
21 (*request)->optype = ADIOI_WRITE;
22 (*request)->fd = fd;
23 (*request)->datatype = datatype;
24
25 MPI_Type_size_x(datatype, &typesize);
26 len = count * typesize;
27
28 id_sys = (long *) ADIOI_Malloc(sizeof(long));
29 (*request)->handle = (void *) id_sys;
30
31 off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind : offset;
32
33 lseek(fd->fd_sys, off, SEEK_SET);
34 *id_sys = _iwrite(fd->fd_sys, buf, len);
35
36 if ((*id_sys == -1) && (errno == EQNOMID)) {
37
38
39
40
41
42 ADIOI_Complete_async(error_code);
43 if (error_code != MPI_SUCCESS) return;
44
45
46 *id_sys = _iwrite(fd->fd_sys, buf, len);
47
48 if ((*id_sys == -1) && (errno == EQNOMID)) {
49 *error_code = MPIO_Err_create_code(MPI_SUCCESS,
50 MPIR_ERR_RECOVERABLE, myname,
51 __LINE__, MPI_ERR_IO, "**io",
52 "**io %s", strerror(errno));
53 return;
54 }
55 }
56 else if (*id_sys == -1) {
57 *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
58 myname, __LINE__, MPI_ERR_IO,
59 "**io",
60 "**io %s", strerror(errno));
61 return;
62 }
63
64 if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind += len;
65
66 (*request)->queued = 1;
67 (*request)->nbytes = len;
68 ADIOI_Add_req_to_list(request);
69 fd->async_count++;
70
71 fd->fp_sys_posn = -1;
72
73 if (*id_sys == -1) {
74 *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
75 myname, __LINE__, MPI_ERR_IO,
76 "**io",
77 "**io %s", strerror(errno));
78 }
79 else *error_code = MPI_SUCCESS;
80 }