This source file includes following definitions.
- ADIOI_HFS_WriteContig
1
2
3
4
5
6
7
8 #include "ad_hfs.h"
9
10 #ifndef HAVE_LSEEK64
11 #define lseek64 lseek
12 #endif
13
14 void ADIOI_HFS_WriteContig(ADIO_File fd, void *buf, int count,
15 MPI_Datatype datatype, int file_ptr_type,
16 ADIO_Offset offset, ADIO_Status *status, int *error_code)
17 {
18 MPI_Count err=-1, datatype_size, len;
19 #ifndef PRINT_ERR_MSG
20 static char myname[] = "ADIOI_HFS_WRITECONTIG";
21 #endif
22
23 MPI_Type_size_x(datatype, &datatype_size);
24 len = datatype_size * count;
25
26 #ifdef SPPUX
27 fd->fp_sys_posn = -1;
28 if (file_ptr_type == ADIO_EXPLICIT_OFFSET)
29 err = pwrite64(fd->fd_sys, buf, len, offset);
30 else {
31 err = pwrite64(fd->fd_sys, buf, len, fd->fp_ind);
32 fd->fp_ind += err;
33 }
34 #endif
35
36 #ifdef HPUX
37 if (file_ptr_type == ADIO_EXPLICIT_OFFSET) {
38 if (fd->fp_sys_posn != offset)
39 lseek64(fd->fd_sys, offset, SEEK_SET);
40 err = write(fd->fd_sys, buf, len);
41 fd->fp_sys_posn = offset + err;
42
43 }
44 else {
45 if (fd->fp_sys_posn != fd->fp_ind)
46 lseek64(fd->fd_sys, fd->fp_ind, SEEK_SET);
47 err = write(fd->fd_sys, buf, len);
48 fd->fp_ind += err;
49 fd->fp_sys_posn = fd->fp_ind;
50 }
51 #endif
52
53 #ifdef HAVE_STATUS_SET_BYTES
54 if (err != -1) MPIR_Status_set_bytes(status, datatype, err);
55 #endif
56
57 if (err == -1) {
58 #ifdef MPICH
59 *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io",
60 "**io %s", strerror(errno));
61 #elif defined(PRINT_ERR_MSG)
62 *error_code = MPI_SUCCESS;
63 #else
64 *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
65 myname, "I/O Error", "%s", strerror(errno));
66 ADIOI_Error(fd, *error_code, myname);
67 #endif
68 }
69 else *error_code = MPI_SUCCESS;
70 }